TimestampBehavior::class, 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'], ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'], ] ] ]; } public static function saveErr($store_id, $order_id, $order_no, $err) { $model = new self(); $model->store_id = $store_id; $model->order_id = $order_id; $model->order_no = $order_no; $model->err_res = is_array($err) ? json_encode($err, JSON_UNESCAPED_UNICODE) : $err; if($model->save()){ return [ 'code' => 0, ]; } return [ 'code' => 1, 'msg' => array_shift($model->getFirstErrors()), ]; } }