| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace common\models\order;
- use Yii;
- /**
- * This is the model class for table "{{%order_user_handle}}".
- *
- * @property int $id ID
- * @property int $mall_id 商城ID
- * @property int $user_id 用户ID
- * @property int $order_id 订单ID
- * @property int $order_status 订单状态
- * @property int $status 状态[-1删除;0禁用;1正常]
- * @property int $created_at 创建时间
- * @property int $updated_at 更新时间
- */
- class OrderUserHandle extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%order_user_handle}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'user_id', 'order_id', 'order_status', 'status', 'created_at', 'updated_at'], 'integer'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => '商城ID',
- 'user_id' => '用户ID',
- 'order_id' => '订单ID',
- 'order_status' => '订单状态',
- 'status' => '状态[-1删除;0禁用;1正常]',
- 'created_at' => '创建时间',
- 'updated_at' => '更新时间',
- ];
- }
- public static function setData(array $params)
- {
- try {
- $model = self::findOne([
- 'mall_id' => $params['mall_id'],
- 'user_id' => $params['user_id'],
- 'order_id' => $params['order_id']
- ]);
- if (empty($modle)) {
- $model = new self();
- $model->loadDefaultValues();
- }
- if (!$model->load($params, '') || !$model->save()) {
- throw new \Exception($model->getErrorMessage());
- }
- return $model;
- } catch (\Exception $e) {
- self::setStaticError($e->getMessage());
- return false;
- }
- }
- }
|