137 lines
3.5 KiB
PHP
137 lines
3.5 KiB
PHP
<?php
|
|
|
|
namespace app\adminapi\controller\channel;
|
|
|
|
use app\adminapi\controller\BaseAdminController;
|
|
use app\adminapi\lists\channel\OfficialAccountReplyLists;
|
|
use app\adminapi\logic\channel\OfficialAccountReplyLogic;
|
|
use app\adminapi\validate\channel\OfficialAccountReplyValidate;
|
|
|
|
/**
|
|
* 微信公众号回复控制器
|
|
* Class OfficialAccountReplyController
|
|
* @package app\adminapi\controller\channel
|
|
*/
|
|
class OfficialAccountReplyController extends BaseAdminController
|
|
{
|
|
|
|
public array $notNeedLogin = ['index'];
|
|
|
|
|
|
/**
|
|
* @notes 查看回复列表(关注/关键词/默认)
|
|
* @return \think\response\Json
|
|
* @author 段誉
|
|
* @date 2022/3/29 10:58
|
|
*/
|
|
public function lists()
|
|
{
|
|
return $this->dataLists(new OfficialAccountReplyLists());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 添加回复(关注/关键词/默认)
|
|
* @return \think\response\Json
|
|
* @author 段誉
|
|
* @date 2022/3/29 10:58
|
|
*/
|
|
public function add()
|
|
{
|
|
$params = (new OfficialAccountReplyValidate())->post()->goCheck('add');
|
|
$result = OfficialAccountReplyLogic::add($params);
|
|
if ($result) {
|
|
return $this->success('操作成功', [], 1, 1);
|
|
}
|
|
return $this->fail(OfficialAccountReplyLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 查看回复详情
|
|
* @return \think\response\Json
|
|
* @author 段誉
|
|
* @date 2022/3/29 10:58
|
|
*/
|
|
public function detail()
|
|
{
|
|
$params = (new OfficialAccountReplyValidate())->goCheck('detail');
|
|
$result = OfficialAccountReplyLogic::detail($params);
|
|
return $this->data($result);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑回复(关注/关键词/默认)
|
|
* @return \think\response\Json
|
|
* @author 段誉
|
|
* @date 2022/3/29 10:58
|
|
*/
|
|
public function edit()
|
|
{
|
|
$params = (new OfficialAccountReplyValidate())->post()->goCheck('edit');
|
|
$result = OfficialAccountReplyLogic::edit($params);
|
|
if ($result) {
|
|
return $this->success('操作成功', [], 1, 1);
|
|
}
|
|
return $this->fail(OfficialAccountReplyLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除回复(关注/关键词/默认)
|
|
* @return \think\response\Json
|
|
* @author 段誉
|
|
* @date 2022/3/29 10:59
|
|
*/
|
|
public function delete()
|
|
{
|
|
$params = (new OfficialAccountReplyValidate())->post()->goCheck('delete');
|
|
OfficialAccountReplyLogic::delete($params);
|
|
return $this->success('操作成功', [], 1, 1);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 更新排序
|
|
* @return \think\response\Json
|
|
* @author 段誉
|
|
* @date 2022/3/29 10:59
|
|
*/
|
|
public function sort()
|
|
{
|
|
$params = (new OfficialAccountReplyValidate())->post()->goCheck('sort');
|
|
OfficialAccountReplyLogic::sort($params);
|
|
return $this->success('操作成功', [], 1, 1);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 更新状态
|
|
* @return \think\response\Json
|
|
* @author 段誉
|
|
* @date 2022/3/29 10:59
|
|
*/
|
|
public function status()
|
|
{
|
|
$params = (new OfficialAccountReplyValidate())->post()->goCheck('status');
|
|
OfficialAccountReplyLogic::status($params);
|
|
return $this->success('操作成功', [], 1, 1);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 微信公众号回调
|
|
* @throws \ReflectionException
|
|
* @author 段誉
|
|
* @date 2022/3/29 10:59
|
|
*/
|
|
public function index()
|
|
{
|
|
$result = OfficialAccountReplyLogic::index();
|
|
return response($result->getBody())->header([
|
|
'Content-Type' => 'text/plain;charset=utf-8'
|
|
]);
|
|
}
|
|
}
|