| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
- namespace common\models\order;
- use Exception;
- use RuntimeException;
- use Yii;
- /**
- * This is the model class for table "qimall_order_behavior_logs".
- *
- * @property int $id
- * @property int $mall_id
- * @property int $operator_user_id 操作人用户id
- * @property int $operator_user_type 操作用户类型 1后台 2用户
- * @property int $behavior 1创建订单 2取消订单 3订单未付款自动关闭 4提醒发货 5订单发货 6确认收货 7已收货订单超时关闭 8订单完成 9评价 10申请售后 11已收到退货 12售后发货 13取消售后 14同意售后 15拒绝售后 16退款超限 17主动退款 18删除 19批量删除 20备注 21批量备注 22留言 23批量留言 24修改地址
- * @property string $desc
- * @property string|null $extra_info
- * @property int $ip
- * @property int $status
- * @property int $operation_time 实际操作时间
- * @property int $order_id 订单ID
- * @property int $created_at
- * @property int $updated_at
- */
- class OrderBehaviorLogs extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_order_behavior_logs';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'operator_user_id', 'operator_user_type', 'behavior', 'ip', 'status', 'operation_time', 'order_id', 'created_at', 'updated_at'], 'integer'],
- [['extra_info'], 'safe'],
- [['desc'], 'string', 'max' => 500],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => 'Mall ID',
- 'operator_user_id' => 'Operator User ID',
- 'operator_user_type' => 'Operator User Type',
- 'behavior' => 'Behavior',
- 'desc' => 'Desc',
- 'extra_info' => 'Extra Info',
- 'ip' => 'Ip',
- 'status' => 'Status',
- 'operation_time' => 'Operation Time',
- 'order_id' => 'Order Id',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- /**
- * @param $params
- *
- * @return false|self
- */
- public static function setData($params)
- {
- try {
- $model = new self();
- $model->loadDefaultValues();
- if (!empty($params['ip'])) {
- $params['ip'] = ip2long($params['ip']);
- }
- if (empty($params['operation_time'])) {
- $params['operation_time'] = time();
- }
- if (!$model->load($params, '')) {
- throw new RuntimeException($model->getErrorMessage());
- }
- if (!$model->save()) {
- throw new RuntimeException($model->getErrorMessage());
- }
- return $model;
- } catch (Exception $e) {
- self::$static_error = $e->getMessage();
- return false;
- }
- }
- /**
- * @return \yii\db\ActiveQuery
- */
- public function getOrder()
- {
- return $this->hasOne(Order::class, ['id' => 'order_id']);
- }
- }
|