50], [['content', 'setting'], 'string'], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'r_id' => 'R ID', 'user_id' => 'User ID', 'reward_title' => '奖励名称', 'content' => 'Content', 'setting' => 'Setting', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'is_frozen' => 'Is Frozen', ]; } /*** * 关联用户 */ public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id']); } /** * 保存数据 * @Author: lun * @DateTime: 2022/1/15 0015 9:36 * @Copyright: copyright (c) 2021 广东七件事集团 * @param $mall_id * @param array $params * @return array|bool */ public static function setData($mall_id, array $params){ try{ $model = new self(); $model->loadDefaultValues(); $model->mall_id = $mall_id; if(!$model->load($params, '') || !$model->save()) throw new Exception($model->getErrorMessage()); return $model->toArray(); }catch(\Exception $e){ self::setStaticError($e->getMessage()); return false; } } }