chore(addon/aikefu): 更新配置UI
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user