0], [['storeId'], 'safe'], ]; } public function afterValidate() { if(!isset($this->storeId)){ $this->storeId = get_store_id(); } } public function attributes() { return [ 'secretId' => '腾讯云账号', 'secretKey' => '腾讯云密钥', 'region' => '区域', 'status' => '是否允许商城使用' ]; } public function save(){ if(!$this->validate()){ return [ 'code' => 1, "msg" => $this->getErrorSummary(false)[0] ]; } $setting = [ 'secretId' => $this->secretId, 'secretKey' => $this->secretKey, 'region' => $this->region ]; Option::set('tencent_image_setting',json_encode($setting), $this->storeId ,'saas'); Option::set('tencent_image_setting_status',$this->status, $this->storeId ,'saas'); return ['code'=>0,'msg'=>'保存成功', 'storeId' => $this->storeId]; } }