diff --git a/app/admin/controller/Wxwholesaler.php b/app/admin/controller/Wxwholesaler.php index 7ba5dd0b..2058fa0a 100644 --- a/app/admin/controller/Wxwholesaler.php +++ b/app/admin/controller/Wxwholesaler.php @@ -188,6 +188,20 @@ class Wxwholesaler extends Controller return $this->renderError('操作失败'); } + public function commitOne(): Json + { + $appid = $this->request->get('appid'); + $obj = new Wholesaler(); + $msg = $obj->privacyInfo($appid); + if ($msg == 'ok') { + $msg = $obj->submitAudit($appid); + if ($msg == 'ok') { + return $this->renderSuccess('success'); + } + } + return $this->renderError($msg); + } + /** * @notes:获取版本信息 * @return Json diff --git a/app/common/library/wxserver/Server.php b/app/common/library/wxserver/Server.php index d7773552..595bfdef 100644 --- a/app/common/library/wxserver/Server.php +++ b/app/common/library/wxserver/Server.php @@ -660,6 +660,7 @@ class Server { $token = $this->authorizerAccessToken($appid); if ($token) { + $url = "https://api.weixin.qq.com/wxa/setwebviewdomain?access_token=$token"; $data['action'] = 'set'; $data['webviewdomain'] = $domain; diff --git a/app/common/library/wxserver/Wholesaler.php b/app/common/library/wxserver/Wholesaler.php index 7568d1b6..3a4136b1 100644 --- a/app/common/library/wxserver/Wholesaler.php +++ b/app/common/library/wxserver/Wholesaler.php @@ -508,9 +508,9 @@ class Wholesaler if ($token) { $url = "https://api.weixin.qq.com/wxa/modify_domain_directly?access_token=$token"; $data['action'] = 'set'; - $data['requestdomain'] = [$domain, 'https://apis.map.gg.com','https://qiniu.shop.royaum.com.cn']; - $data['uploaddomain'] = [$domain,'https://qiniu.shop.royaum.com.cn']; - $data['downloaddomain'] = [$domain,'https://qiniu.shop.royaum.com.cn']; + $data['requestdomain'] = [$domain, 'https://apis.map.gg.com', 'https://qiniu.shop.royaum.com.cn']; + $data['uploaddomain'] = [$domain, 'https://qiniu.shop.royaum.com.cn']; + $data['downloaddomain'] = [$domain, 'https://qiniu.shop.royaum.com.cn']; $result = $this->curlPost($url, json_encode($data)); Db::table('yoshop_wx_server')->insertGetId(['content' => "设置域名信息", 'created_at' => date('Y-m-d H:i:s')]); Db::table('yoshop_wx_server')->insertGetId(['content' => $result, 'created_at' => date('Y-m-d H:i:s')]); @@ -546,8 +546,6 @@ class Wholesaler $data['owner_setting']['contact_qq'] = '527264601'; $data['owner_setting']['notice_method'] = '公告'; $result = $this->curlPost($url, json_encode($data)); - Db::table('yoshop_wx_server')->insertGetId(['content' => "设置隐私信息", 'created_at' => date('Y-m-d H:i:s')]); - Db::table('yoshop_wx_server')->insertGetId(['content' => $result, 'created_at' => date('Y-m-d H:i:s')]); $result = json_decode($result, true); if ($result && !empty($result['errmsg']) && $result['errmsg'] == 'ok') { return true; @@ -659,8 +657,6 @@ class Wholesaler $data['action'] = 'set'; $data['webviewdomain'] = $domain; $result = $this->curlPost($url, json_encode($data)); - Db::table('yoshop_wx_server')->insertGetId(['content' => "业务域名", 'created_at' => date('Y-m-d H:i:s')]); - Db::table('yoshop_wx_server')->insertGetId(['content' => $result, 'created_at' => date('Y-m-d H:i:s')]); $result = json_decode($result, true); if ($result && !empty($result['errmsg']) && $result['errmsg'] == 'ok') { return true; @@ -698,8 +694,9 @@ class Wholesaler return 0; } - public function submitAudit($appid): bool + public function submitAudit($appid) { + $msg = 'ok'; $access_token = $this->authorizerAccessToken($appid); if ($access_token) { $url = 'https://api.weixin.qq.com/wxa/submit_audit?access_token=' . $access_token; @@ -718,11 +715,12 @@ class Wholesaler $up['audit_time'] = date('Y-m-d H:i:s'); $up['auditid'] = $result['auditid']; $model->update($up, ['appid' => $appid]); - return true; + } else { + $msg = !empty($result['errmsg']) ? $result['errmsg'] : '提交失败(未知错误)'; } } - return false; + return $msg; } /**