|
|
@ -4,6 +4,7 @@ declare (strict_types=1); |
|
|
|
namespace app\common\library\wxserver; |
|
|
|
namespace app\common\library\wxserver; |
|
|
|
|
|
|
|
|
|
|
|
use app\common\model\WxserverAccount; |
|
|
|
use app\common\model\WxserverAccount; |
|
|
|
|
|
|
|
use cores\exception\BaseException; |
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
use think\db\exception\DbException; |
|
|
|
use think\db\exception\DbException; |
|
|
|
use think\db\exception\ModelNotFoundException; |
|
|
|
use think\db\exception\ModelNotFoundException; |
|
|
@ -115,21 +116,35 @@ class Server |
|
|
|
* @notes:发布版本 |
|
|
|
* @notes:发布版本 |
|
|
|
* @param $appid |
|
|
|
* @param $appid |
|
|
|
* @param $template_id |
|
|
|
* @param $template_id |
|
|
|
* @param $version |
|
|
|
|
|
|
|
* @param $desc |
|
|
|
|
|
|
|
* @return true|void |
|
|
|
* @return true|void |
|
|
|
* @throws DataNotFoundException |
|
|
|
* @throws DataNotFoundException |
|
|
|
* @throws DbException |
|
|
|
* @throws DbException |
|
|
|
* @throws ModelNotFoundException |
|
|
|
* @throws ModelNotFoundException|BaseException |
|
|
|
* @author: wanghousheng |
|
|
|
* @author: wanghousheng |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function commit($appid, $template_id, $version, $desc) |
|
|
|
public function commit($appid, $template_id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
$version = ''; |
|
|
|
|
|
|
|
$desc = ''; |
|
|
|
$model = new WxserverAccount(); |
|
|
|
$model = new WxserverAccount(); |
|
|
|
$info = $model->where(['appid' => $appid])->find(); |
|
|
|
$info = $model->where(['appid' => $appid])->find(); |
|
|
|
if (!empty($info)) { |
|
|
|
if (!empty($info)) { |
|
|
|
$info = $info->toArray(); |
|
|
|
$info = $info->toArray(); |
|
|
|
$access_token = $this->authorizerAccessToken($appid, $info['refresh_token']); |
|
|
|
$access_token = $this->authorizerAccessToken($appid, $info['refresh_token']); |
|
|
|
|
|
|
|
//获取模板 |
|
|
|
|
|
|
|
$templatelist = $this->getTemplatelist(); |
|
|
|
|
|
|
|
if ($templatelist) { |
|
|
|
|
|
|
|
foreach ($templatelist as $value) { |
|
|
|
|
|
|
|
if (!empty($value['user_version']) && !empty($value['user_desc']) && $value['template_id'] == $template_id) { |
|
|
|
|
|
|
|
$version = $value['user_version']; |
|
|
|
|
|
|
|
$desc = $value['user_desc']; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($version == '' || $desc == '') { |
|
|
|
|
|
|
|
throwError('模板不存在'); |
|
|
|
|
|
|
|
} |
|
|
|
$data['template_id'] = $template_id; |
|
|
|
$data['template_id'] = $template_id; |
|
|
|
$data['user_version'] = $version; |
|
|
|
$data['user_version'] = $version; |
|
|
|
$data['user_desc'] = $desc; |
|
|
|
$data['user_desc'] = $desc; |
|
|
|