This commit is contained in:
2025-03-30 14:27:08 +08:00
parent eabcdebd41
commit 76b1ee3889
3 changed files with 10 additions and 6 deletions

View File

@@ -33,12 +33,16 @@ class Feedback extends BaseHttpApi
return Mmodel::catchJson(function (){
$content = input('content');
$wx_groupid = input('chatroom_id');//客户所在微信群id
$followup_record_id = input('followup_record_id');//回访记录id
if(empty($content)){
return Tools::set_fail('反馈内容不能为空');
}
if(empty($wx_groupid)){
return Tools::set_fail('群id不能为空');
}
if(empty($followup_record_id)){
return Tools::set_fail('回访记录id不能为空');
}
//得到3条反馈消息AI去总结
$str = $this->aiResult($content);
@@ -50,10 +54,10 @@ class Feedback extends BaseHttpApi
//查询是否有回访记录
$ret = Db::table('fa_firmcustomerfollowuprecord')
->where('rel_group',$wx_groupid)
->order('id desc')
->where('id',$followup_record_id)
->find();
if(empty($ret)){
return Tools::set_fail('该客户无回访记录');
return Tools::set_fail('本次反馈未找到对应回访记录请确认回访记录和群id是否真实存在');
}
Db::table('fa_firmcustomerfeedback')
->data([

View File

@@ -26,15 +26,15 @@ class PyappLofic
* authorwh
* @throws \Exception
*/
function setFollowupModel($chatroom_id,$follow_up_content){
function setFollowupModel($chatroom_id,$return_record){
$base_url = SundryConfig::val('py_app_base_url');
$url = $base_url.'/vip_groups/follow-up';
$post_data = [
'chatroom_id' => $chatroom_id,
'is_follow_up' => true,
'follow_up_content'=>$follow_up_content
'follow_up_content'=>$return_record['visit_msg'],
'followup_record_id'=>$return_record['id'],
];
$res = Curl::curl_post_json($url, $post_data);
if(empty($res['data'])){

View File

@@ -138,7 +138,7 @@ class Tasktimer extends Controller
//设置AI客服回访模式
$py_logic = new PyappLofic();
Tools::log_to_write_txt(['回访微信群客户结束设置AI客服回访模式开始rel_group'=>$cust['rel_group'],'visit_msg'=>$return_record['visit_msg']]);
$set_res = $py_logic->setFollowupModel($cust['rel_group'],$return_record['visit_msg']);
$set_res = $py_logic->setFollowupModel($cust['rel_group'],$return_record);
Tools::log_to_write_txt(['回访微信群客户结束设置AI客服回访模式结束$set_res'=>$set_res]);
return Tools::set_ok('发送成功');