From f42b4a1036817fe38311f1836341f35115b56ec4 Mon Sep 17 00:00:00 2001 From: ZF sun <34314687@qq.com> Date: Sat, 6 Dec 2025 17:14:17 +0800 Subject: [PATCH] =?UTF-8?q?chore(addon/aikefu):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AEUI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/addon/aikefu/shop/controller/Kefu.php | 25 ++++++++++---- src/addon/aikefu/shop/view/kefu/index.html | 38 ++++++++++++++++++++++ 2 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 src/addon/aikefu/shop/view/kefu/index.html diff --git a/src/addon/aikefu/shop/controller/Kefu.php b/src/addon/aikefu/shop/controller/Kefu.php index 377c2d7cd..1ad85769e 100644 --- a/src/addon/aikefu/shop/controller/Kefu.php +++ b/src/addon/aikefu/shop/controller/Kefu.php @@ -9,13 +9,26 @@ use addon\aikefu\model\Config as KefuConfigModel; use addon\aikefu\model\Conversation as KefuConversationModel; use addon\aikefu\model\Message as KefuMessageModel; use app\shop\controller\BaseShop; -use think\facade\View; + +use think\facade\Db as Db; /** * 智能客服 控制器 */ class Kefu extends BaseShop { + /** + * 智能客服默认页面 + * @return \think\response\View + */ + public function index() + { + $kefu_config_model = new KefuConfigModel(); + $config_info = $kefu_config_model->getConfig($this->site_id, $this->app_module)['data']['value'] ?? []; + $this->assign("config_info", $config_info); + return $this->fetch("kefu/index"); + } + /** * 智能客服配置页 * @return \think\response\View|\think\response\Json @@ -51,7 +64,7 @@ class Kefu extends BaseShop */ public function conversation() { - return View::fetch("kefu/conversation"); + return $this->fetch("kefu/conversation"); } /** @@ -146,7 +159,7 @@ class Kefu extends BaseShop $kefu_message_model = new KefuMessageModel(); // 开启事务 - \think\facade\Db::startTrans(); + Db::startTrans(); try { // 删除会话关联的消息 @@ -169,12 +182,12 @@ class Kefu extends BaseShop ]); // 提交事务 - \think\facade\Db::commit(); + Db::commit(); return $this->success($result); } catch (\Exception $e) { // 回滚事务 - \think\facade\Db::rollback(); + Db::rollback(); return $this->error($e->getMessage()); } } @@ -187,7 +200,7 @@ class Kefu extends BaseShop { $conversation_id = input("conversation_id", ""); View::assign("conversation_id", $conversation_id); - return View::fetch("kefu/message"); + return $this->fetch("kefu/message"); } /** diff --git a/src/addon/aikefu/shop/view/kefu/index.html b/src/addon/aikefu/shop/view/kefu/index.html new file mode 100644 index 000000000..9d02d1800 --- /dev/null +++ b/src/addon/aikefu/shop/view/kefu/index.html @@ -0,0 +1,38 @@ +