request->isAjax()){ $lists = KefuLangLogic::lists($this->shop_id,$this->page_size,$this->page_no); 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('删除失败'); } }