|
|
|
@ -4,8 +4,11 @@ declare (strict_types=1); |
|
|
|
|
namespace app\admin\controller; |
|
|
|
|
|
|
|
|
|
use app\common\library\wxserver\Server; |
|
|
|
|
use cores\exception\BaseException; |
|
|
|
|
use PHPQRCode\QRcode; |
|
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
|
use think\db\exception\DbException; |
|
|
|
|
use think\db\exception\ModelNotFoundException; |
|
|
|
|
use think\facade\Db; |
|
|
|
|
use think\response\Json; |
|
|
|
|
|
|
|
|
@ -70,4 +73,87 @@ class Wxserve extends Controller |
|
|
|
|
} |
|
|
|
|
return $this->renderSuccess(['list' => $list, 'total' => $total]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @notes:草稿箱列表 |
|
|
|
|
* @return Json |
|
|
|
|
* @author: wanghousheng |
|
|
|
|
*/ |
|
|
|
|
public function templatedraftlist(): Json |
|
|
|
|
{ |
|
|
|
|
$obj = new Server(); |
|
|
|
|
$list = $obj->getTemplateDraftList(); |
|
|
|
|
return $this->renderSuccess($list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @notes:添加草稿到模板中 |
|
|
|
|
* @return Json |
|
|
|
|
* @author: wanghousheng |
|
|
|
|
*/ |
|
|
|
|
public function addTotemplate(): Json |
|
|
|
|
{ |
|
|
|
|
$draft_id = $this->request->get('draft_id'); |
|
|
|
|
if ($draft_id) { |
|
|
|
|
$obj = new Server(); |
|
|
|
|
$res = $obj->addTotemplate($draft_id); |
|
|
|
|
if ($res) { |
|
|
|
|
return $this->renderSuccess('success'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return $this->renderError('操作失败'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @notes:获取模板列表 |
|
|
|
|
* @return Json |
|
|
|
|
* @author: wanghousheng |
|
|
|
|
*/ |
|
|
|
|
public function templatelist(): Json |
|
|
|
|
{ |
|
|
|
|
$obj = new Server(); |
|
|
|
|
$list = $obj->getTemplatelist(); |
|
|
|
|
return $this->renderSuccess($list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @notes:删除模板 |
|
|
|
|
* @return Json |
|
|
|
|
* @author: wanghousheng |
|
|
|
|
*/ |
|
|
|
|
public function delTemplatelist(): Json |
|
|
|
|
{ |
|
|
|
|
$template_id = $this->request->get('template_id'); |
|
|
|
|
if ($template_id) { |
|
|
|
|
$obj = new Server(); |
|
|
|
|
$res = $obj->deleTetemplate($template_id); |
|
|
|
|
if ($res) { |
|
|
|
|
return $this->renderSuccess('success'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return $this->renderError('操作失败'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @notes:提交版本审核 |
|
|
|
|
* @return Json |
|
|
|
|
* @throws DbException |
|
|
|
|
* @throws BaseException |
|
|
|
|
* @throws DataNotFoundException |
|
|
|
|
* @throws ModelNotFoundException |
|
|
|
|
* @author: wanghousheng |
|
|
|
|
*/ |
|
|
|
|
public function commit(): Json |
|
|
|
|
{ |
|
|
|
|
$appid = $this->request->get('appid'); |
|
|
|
|
$template_id = $this->request->get('template_id'); |
|
|
|
|
if ($template_id && $appid) { |
|
|
|
|
$obj = new Server(); |
|
|
|
|
$res = $obj->commit($appid, $template_id); |
|
|
|
|
if ($res) { |
|
|
|
|
return $this->renderSuccess('success'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return $this->renderError('操作失败'); |
|
|
|
|
} |
|
|
|
|
} |