64], [['province', 'city', 'district'], 'string', 'max' => 50], [['address', 'logo'], 'string', 'max' => 255], [['contact_person'], 'string', 'max' => 30], [['phone'], 'string', 'max' => 13], [['third_status'], 'string', 'max' => 20], [['wechat_appid', 'wechat_secret', 'wechat_token', 'wechat_aes_key'], 'string', 'max' => 128], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => '商城ID', 'name' => '店铺名称', 'wechat_appid' => '微信视频小店APPID', 'wechat_secret' => '微信视频小店密钥', 'wechat_token' => '微信视频小店消息推送令牌(Token)', 'wechat_aes_key' => '微信视频小店消息加密密钥', 'status' => '状态[-1删除;0禁用;1正常]', 'created_at' => '创建时间', 'updated_at' => '更新时间', ]; } public static function setData(array $params) { try { if (!empty($params['id'])) { $model = self::findOne(['and', ['id' => $params['id'], 'mall_id' => $params['mall_id'], 'status' => [StatusEnum::ENABLED, StatusEnum::DISABLED]]]); if (empty($model)) throw new \Exception('id参数错误'); } else { $model = new self(); $model->loadDefaultValues(); } if (!$model->load($params, '') || !$model->save()) throw new \Exception($model->getErrorMessage()); return $model; } catch (\Exception $e) { self::setStaticError($e->getMessage()); return false; } } public function getProvinceInfo() { return $this->hasOne(Region::class, ['id' => 'province_id']); } public function getCityInfo() { return $this->hasOne(Region::class, ['id' => 'city_id']); } public function getDistrictInfo() { return $this->hasOne(Region::class, ['id' => 'district_id']); } public function getAddress() { return $this->hasOne(WechatVideoShopAddress::class, ['shop_id' => 'id']); } }