test_service d3170b4d1c 1
2023-12-01 15:43:29 +08:00

41 lines
1.0 KiB
PHP
Executable File

<?php
namespace app\applet\controller\wechat;
use app\applet\controller\Controller;
use app\applet\model\Setting as SettingModel;
use app\applet\model\Wechat as WechatModel;
use think\facade\View;
/**
* 公众号模板消息
*/
class Tplmsg extends Controller
{
private $wechat;
/**
* 构造方法
*/
public function initialize()
{
parent::initialize();
$this->wechat = WechatModel::detail($this->applet_id);
View::assign('wechat', $this->wechat);
}
/**
* 更新设置事件
*/
public function setting()
{
if (!$this->request->isAjax()) {
$model = SettingModel::getItem('webtplmsg',$this->applet_id);
return View::fetch('setting', compact('model'));
}
$model = new SettingModel;
if ($model->edit('webtplmsg',$this->postData('data'),$this->applet_id)) {
return $this->renderSuccess('更新成功');
}
return $this->renderError('更新失败');
}
}