其余文件
This commit is contained in:
160
app/shop/controller/kefu/Kefu.php
Normal file
160
app/shop/controller/kefu/Kefu.php
Normal file
@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
namespace app\shop\controller\kefu;
|
||||
|
||||
|
||||
use app\common\basics\ShopBase;
|
||||
use app\common\model\shop\ShopRole;
|
||||
use app\shop\logic\kefu\KefuLogic;
|
||||
use app\shop\validate\kefu\KefuValidate;
|
||||
use app\common\server\JsonServer;
|
||||
use app\shop\validate\kefu\LoginValidate;
|
||||
|
||||
/**
|
||||
* 客服管理控制器
|
||||
* Class Kefu
|
||||
* @package app\admin\controller\kefu
|
||||
*/
|
||||
class Kefu extends ShopBase
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 客服列表
|
||||
* @return \think\response\Json|\think\response\View
|
||||
* @author 段誉
|
||||
* @date 2021/11/26 18:40
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$get = $this->request->get();
|
||||
$lists = KefuLogic::getLists($get, $this->shop_id);
|
||||
return JsonServer::success('获取成功', $lists);
|
||||
}
|
||||
return view();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 添加客服
|
||||
* @return \think\response\Json|\think\response\View
|
||||
* @author 段誉
|
||||
* @date 2021/11/26 18:04
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$post = $this->request->post();
|
||||
$post['disable'] = isset($post['disable']) && $post['disable'] == 'on' ? 0 : 1;
|
||||
$post['shop_id'] = $this->shop_id;
|
||||
(new KefuValidate())->goCheck('add', $post);
|
||||
$res = KefuLogic::add($post, $this->shop_id);
|
||||
if (false === $res) {
|
||||
$error = KefuLogic::getError() ?: '操作失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('操作成功');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑客服
|
||||
* @return \think\response\Json|\think\response\View
|
||||
* @author 段誉
|
||||
* @date 2021/11/27 10:45
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$post = $this->request->post();
|
||||
$post['disable'] = isset($post['disable']) && $post['disable'] == 'on' ? 0 : 1;
|
||||
(new KefuValidate())->goCheck('edit', $post);
|
||||
$res = KefuLogic::edit($post, $this->shop_id);
|
||||
if (false === $res) {
|
||||
$error = KefuLogic::getError() ?: '操作失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('操作成功');
|
||||
}
|
||||
|
||||
$id = $this->request->get('id');
|
||||
return view('', [
|
||||
'detail' => KefuLogic::detail($id, $this->shop_id),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除客服
|
||||
* @return \think\response\Json|void
|
||||
* @author 段誉
|
||||
* @date 2021/11/26 18:53
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$post = $this->request->post();
|
||||
(new KefuValidate())->goCheck('del');
|
||||
KefuLogic::del($post, $this->shop_id);
|
||||
return JsonServer::success('操作成功');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 管理员列表
|
||||
* @return \think\response\Json|\think\response\View
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2021/11/26 18:01
|
||||
*/
|
||||
public function adminLists()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$get = $this->request->get();
|
||||
return JsonServer::success('', KefuLogic::getAdminLists($get, $this->shop_id));
|
||||
}
|
||||
return view('', ['role_lists' => (new ShopRole())->getRoleLists(['shop_id' => $this->shop_id])]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置状态
|
||||
* @return \think\response\Json|void
|
||||
* @author 段誉
|
||||
* @date 2021/11/26 18:40
|
||||
*/
|
||||
public function status()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$post = $this->request->post();
|
||||
KefuLogic::setStatus($post, $this->shop_id);
|
||||
return JsonServer::success('操作成功');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 登录工作台
|
||||
* @return \think\response\Json|void
|
||||
* @author 段誉
|
||||
* @date 2021/12/20 10:46
|
||||
*/
|
||||
public function login()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$id = $this->request->post('id/d');
|
||||
(new LoginValidate())->goCheck('', ['shop_id' =>$this->shop_id]);
|
||||
$res = KefuLogic::login($id, $this->shop_id);
|
||||
if (false === $res) {
|
||||
return JsonServer::error(KefuLogic::getError() ?: '系统错误');
|
||||
}
|
||||
return JsonServer::success('', ['url' => $res]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
109
app/shop/controller/kefu/KefuLang.php
Normal file
109
app/shop/controller/kefu/KefuLang.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\shop\controller\kefu;
|
||||
use app\shop\logic\kefu\KefuLangLogic;
|
||||
use app\shop\validate\kefu\KefuLangValidate;
|
||||
use app\common\basics\ShopBase;
|
||||
use app\common\server\JsonServer;
|
||||
|
||||
/**
|
||||
* 客服术语
|
||||
* Class KefuLang
|
||||
* @package app\admin\controller\kefu
|
||||
*/
|
||||
class KefuLang extends ShopBase
|
||||
{
|
||||
/**
|
||||
* @notes 列表
|
||||
* @return \think\response\Json|\think\response\View
|
||||
* @throws \think\db\exception\DbException
|
||||
* @author cjhao
|
||||
* @date 2021/11/29 15:20
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
if($this->request->isAjax()){
|
||||
$page = $this->request->get('page', 1);
|
||||
$limit = $this->request->get('limit', 10);
|
||||
$lists = KefuLangLogic::lists($this->shop_id,$limit,$page);
|
||||
return JsonServer::success('获取成功', $lists);
|
||||
}
|
||||
return view();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加话术
|
||||
* @return \think\response\Json|\think\response\View
|
||||
* @author cjhao
|
||||
* @date 2021/11/29 15:59
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if($this->request->isAjax()){
|
||||
$post= (new KefuLangValidate())->goCheck('add',['shop_id'=>$this->shop_id]);
|
||||
$result = KefuLangLogic::add($this->shop_id,$post);
|
||||
if($result){
|
||||
return JsonServer::success('新增成功', []);
|
||||
}
|
||||
return JsonServer::error('新增失败');
|
||||
}
|
||||
return view();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 编辑话术
|
||||
* @return \think\response\Json|\think\response\View
|
||||
* @author cjhao
|
||||
* @date 2021/11/29 15:59
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
if($this->request->isAjax()){
|
||||
$post= (new KefuLangValidate())->goCheck(null,['shop_id'=>$this->shop_id]);
|
||||
$result = KefuLangLogic::edit($post);
|
||||
if($result){
|
||||
return JsonServer::success('修改成功', []);
|
||||
}
|
||||
return JsonServer::error('修改失败');
|
||||
}
|
||||
$id = $this->request->get('id');
|
||||
return view('', [
|
||||
'detail' => KefuLangLogic::detail($this->shop_id,$id),
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除话术
|
||||
* @return \think\response\Json
|
||||
* @author cjhao
|
||||
* @date 2021/11/29 16:46
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$post= (new KefuLangValidate())->goCheck('del',['shop_id'=>$this->shop_id]);
|
||||
$result = KefuLangLogic::del($this->shop_id,$post['id']);
|
||||
if($result){
|
||||
return JsonServer::success('删除成功', []);
|
||||
}
|
||||
return JsonServer::error('删除失败');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user