'ID', 'rule_id' => '规则ID', 'user_id' => '会员ID', 'mall_id' => '商城id', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'status' => '状态[-1:删除;0:禁用;1启用]', 'number' => '金额', 'grant_object' => '发放对象:1:全部会员 2:会员等级 3:会员标签 4:会员id 5:指定区域', 'grant_object_content' => '对象内容', ]; } /** * 保存数据 * @Author: ltm * @DateTime: 2022/6/28 0015 9:26 * @Copyright: copyright (c) 2021 广东七件事集团 * @param $mall_id * @param array $params * @return Rebate|bool */ public static function setData(array $params){ try{ $mall_id = $params['mall_id']; $model = new self(); $model->loadDefaultValues(); $model->mall_id = $mall_id; //var_dump($params); // 将内容转为json字符串 if(!$model->load($params,'') || !$model->save()) throw new Exception($model->getErrorMessage()); return $model; }catch(\Exception $e){ self::setStaticError($e->getMessage()); return false; } } /** * 关联用户信息 * @Author:ltm * @DateTime: 2022/5/6 0022 17:13 * @Copyright: copyright (c) 2021 广东七件事集团 * @return \yii\db\ActiveQuery */ public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id'])->select('id,nickname,username,mobile,avatar_url'); } public function getRule() { return $this->hasOne(IssueCouponsRule::class, ['id' => 'rule_id']); } }