This commit is contained in:
2025-03-28 21:49:14 +08:00
parent dbfc2b5265
commit fc120b02c1
4 changed files with 74 additions and 4 deletions

View File

@@ -0,0 +1,65 @@
<?php
/*
* description
* authorwh
* email
* createTime{2025/3/28} {21:41}
*/
namespace app\api\logic;
use wanghua\general_utility_tools_php\http\Curl;
/**
* python项目逻辑
* Class PyappLofic
* @package app\api\logic
*/
class PyappLofic
{
/**
* desc设置回访模式
* authorwh
* @throws \Exception
*/
function setFollowupModel($chatroom_id,$follow_up_content){
$base_url = config('py_app_base_url.base_url');
$url = $base_url.'/vip_groups/follow-up';
$post_data = [
'chatroom_id' => $chatroom_id,
'followup_model' => true,
'follow_up_content'=>$follow_up_content
];
$res = Curl::curl_post($url, $post_data);
if(empty($res['data'])){
throw new \Exception('设置回访模式失败');
}
$res_data = json_decode($res['data'], true);
return $res_data;
}
/**
* desc关闭回访模式
* authorwh
* @throws \Exception
*/
function closeFollowupModel($chatroom_id){
$base_url = config('py_app_base_url.base_url');
$url = $base_url.'/vip_groups/follow-up';
$post_data = [
'chatroom_id' => $chatroom_id,
'followup_model' => false,
];
$res = Curl::curl_post($url, $post_data);
if(empty($res['data'])){
throw new \Exception('关闭回访模式失败');
}
$res_data = json_decode($res['data'], true);
return $res_data;
}
}

View File

@@ -27,7 +27,8 @@ class TokenLogic extends BaseLogic
*/ */
function getToken() function getToken()
{ {
$url = 'https://wechat-api-test.excn.vip/vip_groups/auth_info'; $base_url = config('py_app_base_url.base_url');
$url = $base_url.'/vip_groups/auth_info';
$res = \wanghua\general_utility_tools_php\http\Curl::curl_post($url, []); $res = \wanghua\general_utility_tools_php\http\Curl::curl_post($url, []);
if(empty($res['data'])){ if(empty($res['data'])){
throw new \Exception('获取token失败'); throw new \Exception('获取token失败');

View File

@@ -337,9 +337,10 @@ return [
//API接口地址 //API接口地址
'api_url' => 'https://api.fastadmin.net', 'api_url' => 'https://api.fastadmin.net',
], ],
//'gewechat'=>[ //python应用url
// 'base_url'=>'https://wechat-api-test.excn.vip/v2/api' 'py_app_base_url'=>[
//], 'base_url'=>'https://wechat-api-test.excn.vip/v2/api'
],
'ai_config'=>[ 'ai_config'=>[
//AI话术/话术示例 //AI话术/话术示例
'talk_skill'=>[ 'talk_skill'=>[

View File

@@ -10,6 +10,7 @@ namespace app\index\controller;
use app\api\logic\MessageLogic; use app\api\logic\MessageLogic;
use app\api\logic\PyappLofic;
use app\api\logic\TokenLogic; use app\api\logic\TokenLogic;
use think\Controller; use think\Controller;
use think\Db; use think\Db;
@@ -134,6 +135,8 @@ class Tasktimer extends Controller
'send_time'=>Tools::get_now_date(), 'send_time'=>Tools::get_now_date(),
]); ]);
//设置AI客服回访模式
(new PyappLofic())->setFollowupModel($cust['rel_group'],$return_record['visit_msg']);
return Tools::set_ok('发送成功'); return Tools::set_ok('发送成功');
} }