diff --git a/docker-compose.yml b/docker-compose.yml index c66f65151..7eb5cf572 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -140,4 +140,5 @@ volumes: networks: sass-platform-net: name: ${PROJECT_NAME}_${APP_ENV}_net - driver: bridge \ No newline at end of file + driver: bridge + external: true \ No newline at end of file diff --git a/src/app/model/web/Config.php b/src/app/model/web/Config.php index a65cbaab9..bed6c07bc 100644 --- a/src/app/model/web/Config.php +++ b/src/app/model/web/Config.php @@ -847,6 +847,45 @@ class Config extends BaseModel // return $data; // } + /** + * 设置企业微信配置 + * @param $data + * @param int $site_id + * @param string $app_module + * @return array + */ + public function setWxworkConfig($data, $site_id = 1, $app_module = 'shop') + { + $config = new ConfigModel(); + $res = $config->setConfig($data, '企业微信配置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'WXWORK_CONFIG' ] ]); + return $res; + } + + /** + * 获取企业微信配置 + * @param int $site_id + * @param string $app_module + * @return array + */ + public function getWxworkConfig($site_id = 1, $app_module = 'shop') + { + $config = new ConfigModel(); + $res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'WXWORK_CONFIG' ] ]); + if (empty($res[ 'data' ][ 'value' ])) { + $res[ 'data' ][ 'value' ] = [ + 'corp_id' => '', + 'agent_id' => '', + 'contact_id' => '', + 'contact_url' => '', + 'timestamp' => '', + 'nonceStr' => '', + 'signature' => '', + 'enabled' => false + ]; + } + return $res; + } + /** * 设置商品编码设置 * @param $data diff --git a/src/app/shop/controller/Config.php b/src/app/shop/controller/Config.php index a8316c045..da961574f 100644 --- a/src/app/shop/controller/Config.php +++ b/src/app/shop/controller/Config.php @@ -210,6 +210,32 @@ class Config extends BaseShop } + /** + * 企业微信配置 + */ + public function wxwork() + { + $config_model = new ConfigModel(); + if (request()->isJson()) { + $data = [ + 'corp_id' => input('corp_id', ''), + 'agent_id' => input('agent_id', ''), + 'contact_id' => input('contact_id', ''), + 'contact_url' => input('contact_url', ''), + 'timestamp' => input('timestamp', ''), + 'nonceStr' => input('nonceStr', ''), + 'signature' => input('signature', ''), + 'enabled' => input('enabled', 0) + ]; + $this->addLog('修改企业微信配置'); + return $config_model->setWxworkConfig($data, $this->site_id, $this->app_module); + } else { + $config_result = $config_model->getWxworkConfig($this->site_id, $this->app_module); + $this->assign('wxwork_config', $config_result[ 'data' ][ 'value' ]); + return $this->fetch('config/wxwork'); + } + } + /** * 域名跳转配置 */ diff --git a/src/app/shop/view/config/wxwork.html b/src/app/shop/view/config/wxwork.html new file mode 100644 index 000000000..157f19602 --- /dev/null +++ b/src/app/shop/view/config/wxwork.html @@ -0,0 +1,146 @@ + + +
企业微信的企业ID,可在企业微信管理后台获取
+企业微信应用的AgentId,创建应用后获取
+企业微信客服的ID,用于客服功能
+企业微信活码的链接地址
+用于验证的时间戳,通常由系统自动生成
+用于验证的随机字符串
+用于验证的签名,通常由系统自动生成
+