pull/5/head
wanghousheng 4 months ago
parent 97d19c6539
commit 2367bedd1a
  1. 23
      app/admin/controller/Wxwholesaler.php
  2. 9
      app/common/library/wxserver/Wholesaler.php

@ -5,6 +5,7 @@ namespace app\admin\controller;
use app\common\library\wxserver\Wholesaler; use app\common\library\wxserver\Wholesaler;
use app\job\controller\Wxholesaler as WxserverJob; use app\job\controller\Wxholesaler as WxserverJob;
use cores\exception\BaseException;
use PHPQRCode\QRcode; use PHPQRCode\QRcode;
use think\db\exception\DbException; use think\db\exception\DbException;
use think\facade\Db; use think\facade\Db;
@ -188,13 +189,17 @@ class Wxwholesaler extends Controller
return $this->renderError('操作失败'); return $this->renderError('操作失败');
} }
/** 单个操作发布体验版
* @throws BaseException
*/
public function commitOne(): Json public function commitOne(): Json
{ {
$appid = $this->request->get('appid'); $appid = $this->request->get('appid');
$template_id = $this->request->get('template_id');
$obj = new Wholesaler(); $obj = new Wholesaler();
$msg = $obj->privacyInfo($appid); $msg = $obj->privacyInfo($appid);
if ($msg == 'ok') { if ($msg == 'ok') {
$msg = $obj->submitAudit($appid); $msg = $obj->commit($appid, $template_id);
if ($msg == 'ok') { if ($msg == 'ok') {
return $this->renderSuccess('success'); return $this->renderSuccess('success');
} }
@ -239,6 +244,22 @@ class Wxwholesaler extends Controller
return $this->renderError('操作失败'); return $this->renderError('操作失败');
} }
/**
* @notes:单个提交正式版审核
* @return Json
* @author: wanghousheng
*/
public function auditOne(): Json
{
$appid = $this->request->get('appid');
$obj = new Wholesaler();
$msg = $obj->submitAudit($appid);
if ($msg == 'ok') {
return $this->renderSuccess('success');
}
return $this->renderError($msg);
}
/** /**
* @notes:发布正式版前检查 * @notes:发布正式版前检查
* @return Json * @return Json

@ -211,12 +211,13 @@ class Wholesaler
* @notes:发布体验版 * @notes:发布体验版
* @param $appid * @param $appid
* @param $template_id * @param $template_id
* @return bool * @return mixed|string
* @throws BaseException * @throws BaseException
* @author: wanghousheng * @author: wanghousheng
*/ */
public function commit($appid, $template_id): bool public function commit($appid, $template_id): string
{ {
$msg = '提交体验版失败';
$version = ''; $version = '';
$access_token = $this->authorizerAccessToken($appid); $access_token = $this->authorizerAccessToken($appid);
//获取模板 //获取模板
@ -244,14 +245,14 @@ class Wholesaler
$result = json_decode($result, true); $result = json_decode($result, true);
if ($result && !empty($result['errmsg']) && $result['errmsg'] == 'ok') { if ($result && !empty($result['errmsg']) && $result['errmsg'] == 'ok') {
//体验码 //体验码
$msg = $result['errmsg'];
$qr_code = $this->getQrcode($appid); $qr_code = $this->getQrcode($appid);
if ($qr_code) { if ($qr_code) {
$model = new WxwholesalerAccount(); $model = new WxwholesalerAccount();
$model->update(['experience_code' => $qr_code], ['appid' => $appid]); $model->update(['experience_code' => $qr_code], ['appid' => $appid]);
} }
return true;
} }
return false; return !empty($result['errmsg']) ? $result['errmsg'] : $msg;
} }
/** /**

Loading…
Cancel
Save