'ID', 'user_id' => 'User Id', 'mall_id' => 'Mall Id', 'user_parent_id' => 'User Parent Id', 'rebate_id' => 'Rebate Id', 'rebate_buy_id' => 'Rebate Buy Id', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } /*** * 关联用户 */ public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id']); } /*** * 关联上级用户 */ public function getParentUser() { return $this->hasOne(User::class, ['id' => 'user_parent_id']); } /*** * 关联推三返一活动 */ public function getRebate() { return $this->hasOne(Rebate::class, ['id' => 'rebate_id']); } /*** * 关联推三返一活动购买信息 */ public function getRebateBuy() { return $this->hasOne(RebateBuy::class, ['id' => 'rebate_buy_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; } } }