Files
fast_response/admin/application/api/controller/Wxaiconfig.php
meimei 24c924dddb fixed
2025-04-12 17:26:45 +08:00

55 lines
2.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\api\controller;
use think\Db;
use wanghua\general_utility_tools_php\tool\Tools;
class Wxaiconfig extends BaseHttpApi
{
/**
* @return void 获取微信AI回复客户的配置
* * 【请求地址】:
* api/WxAiConfig/getRepayContent
*
* * 【请求参数】:(如果有“必须”标识则表示该字段是必填项)
* wxid AI微信ID【必须】
*
* * 【返回参数】
* delay_secs 回复时间秒
* status yes-在线 no-离线
*/
function getRepayContent(){
Tools::log_to_write_txt(['获取某群的责任人wxid 入参:'=>input()]);
try {
$wxid = input('wxid');
if(empty($wxid)){
return json(Tools::set_fail('参数错误.0',['error_msg'=>'错误信息wxid错误']));
}
$item = Db::table('fa_aicustomerservice')
->alias('aicustomerservice')
->join('fa_aicustomerservicefirmstorelist aicustomerservicefirmstorelist',' aicustomerservicefirmstorelist.aicustomerservice_id = aicustomerservice.id')
->field('aicustomerservicefirmstorelist.reply_times,aicustomerservicefirmstorelist.status')
->where('aicustomerservice.wxid',$wxid)
->order('aicustomerservicefirmstorelist.id','desc')
->find();
if(empty($item)){
return json(Tools::set_fail('参数错误.1',['error_msg'=>'错误信息该群id未匹配到配置信息']));
}
return json(Tools::set_ok('ok',[
'delay_secs'=>$item['reply_times'],
'status'=>$item['status']
]));
}catch(\Exception $e){
Tools::log_to_write_txt([
'error'=>'获取某群的责任人wxid.异常.'.$e->getMessage(),
'参数'=>input(),
'error_info'=>$e->getTraceAsString()
]);
return json(Tools::set_res(500,'操作异常',[]));
}
}
}