| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- use Yii;
- use yii\behaviors\TimestampBehavior;
- use yii\db\ActiveRecord;
- class DeliveryKeloopErr extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%delivery_keloop_err}}';
- }
- public function behaviors()
- {
- return [
- [
- 'class' => 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()),
- ];
- }
- }
|