diff --git a/digital_doctor/application/api/controller/Users.php b/digital_doctor/application/api/controller/Users.php index 666cca9..a138f85 100644 --- a/digital_doctor/application/api/controller/Users.php +++ b/digital_doctor/application/api/controller/Users.php @@ -9,6 +9,7 @@ namespace app\api\controller; +use app\api\logic\TychatLogic; use app\api\logic\UserOfflinePrizeLogic; use app\common\model\TabConf; use GatewayWorker\Lib\Gateway; @@ -170,4 +171,22 @@ class Users extends BaseHttpApi }); } + /** + * desc:保存听译聊天记录 + * + * api/Users/saveChatHistory + * + * author:wh + */ + function saveChatHistory(){ + return Mmodel::catchJson(function (){ + $obj = new TychatLogic(); + $chat_content = input('chat_content'); + if(empty($chat_content)){ + return Tools::set_fail('参数错误'); + } + $res = $obj->saveChatHistory($chat_content); + return Tools::set_ok('ok',$res); + }); + } } \ No newline at end of file diff --git a/digital_doctor/application/api/logic/TychatLogic.php b/digital_doctor/application/api/logic/TychatLogic.php index fa63885..08050c3 100644 --- a/digital_doctor/application/api/logic/TychatLogic.php +++ b/digital_doctor/application/api/logic/TychatLogic.php @@ -38,23 +38,23 @@ class TychatLogic extends BaseLogic ] ]; */ - function saveChatHistory($client_id,$res){ - $items = $res['items']; + function saveChatHistory($chat_content){ $data = [ - 'username'=>$items['username'], - 'chat_msg'=>$items['content'], + 'chat_msg'=>$chat_content, ]; Db::table('fa_ty_chathistory')->insert($data); //这里做健康小洞察 //$this->getHealthInsight(); - $json = BaseWssApi::json_wss('ok','保存成功'); - Gateway::sendToClient($client_id, $json); + return Tools::set_ok(); } /** * desc:健康洞察 + * + * api/HealthInsights/getHealthInsight + * * author:wh */ function getHealthInsight(){