'ID', 'change_pos_id' => 'qimall_addons_double_copy_change_pos.id', 'mall_id' => '商城ID', 'user_id' => '用户ID', 'old_topid' => '原topid', 'now_topid' => '现topid', 'status' => '状态[-1:删除;0:禁用;1启用]', 'created_at' => '创建时间', 'updated_at' => '更新时间', ]; } /** * 关联用户 * @Author: lun * @DateTime: 2023/6/3 0003 15:51 * @Copyright: copyright (c) 2021 广东七件事集团 * @return \yii\db\ActiveQuery */ public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id'])->select('id,nickname,mobile,avatar_url,parent_id'); } /** * 换位前用户 * @Author: lun * @DateTime: 2023/6/3 0003 15:51 * @Copyright: copyright (c) 2021 广东七件事集团 * @return \yii\db\ActiveQuery */ public function getOldTop() { return $this->hasOne(User::class, ['id' => 'old_topid'])->select('id,nickname,mobile,avatar_url,parent_id'); } /** * 换位后用户 * @Author: lun * @DateTime: 2023/6/3 0003 15:52 * @Copyright: copyright (c) 2021 广东七件事集团 * @return \yii\db\ActiveQuery */ public function getNowTop() { return $this->hasOne(User::class, ['id' => 'now_topid'])->select('id,nickname,mobile,avatar_url,parent_id'); } /** * 保存数据 * @Author: lun * @DateTime: 2023/6/2 0002 15:53 * @Copyright: copyright (c) 2021 广东七件事集团 * @param $params * @return bool */ public static function setData($params) { try { $model = new self(); $model->loadDefaultValues(); if (!$model->load($params, '') || !$model->save()) throw new Exception($model->getErrorMessage()); return true; } catch (\Exception $e) { self::setStaticError($e->getMessage()); return false; } } }