(可能有部分额外字段未在此体现): * id ID * username 用户 * type 聊天角色 * chat_msg 问诊内容 * ticket 对话票据(用于隔离用户聊天历史记录) * userbaseinfo_id 基本信息ID * create_time 创建时间 * hdruserbaseinfo_id 统一基本信息 * author:wh */ function getTtchathistoryList(){ Tools::log_to_write_txt(['获取疼痛科聊天历史 入参:'=>input()]); $api_desc = '获取疼痛科聊天历史'; try { //$hdruserbaseinfo_id = input('hdruserbaseinfo_id'); //if(empty($hdruserbaseinfo_id)){ // return json(Tools::set_fail('hdruserbaseinfo_id参数错误')); //} $reportid = input('reportid'); if(empty($reportid)){ return json(Tools::set_fail('reportid参数错误')); } //查询最新的ticket //$last_ticket = Db::table(TabConf::$fa_tt_chathistory) // ->where('hdruserbaseinfo_id',$hdruserbaseinfo_id) // ->order('id desc') // ->value('ticket'); $model_obj = Db::table(TabConf::$fa_tt_chathistory); //if(!empty($last_ticket)){ // $model_obj->where('ticket',$last_ticket); //} //【对话记录跟着报告走】 $model_obj->where('reportid',$reportid); //if(input('hdruserbaseinfo_id')){ // $model_obj->where('hdruserbaseinfo_id',input('hdruserbaseinfo_id')); //} $data = $model_obj->paginate(['page'=>input('current_page',1),'list_rows'=>input('list_rows',15)]) ->each(function($item, $key){ return $item; }); // ['total'] => int(30) // ['per_page'] => int(15) // ['current_page'] => int(1) // ['last_page''] => int(2) $data = $data->toArray();//包含 data列表 return json(Tools::set_ok('ok',$data)); }catch(\Exception $e){ Tools::log_to_write_txt([ 'error'=>'获取疼痛科聊天历史.异常.'.$e->getMessage(), '参数'=>input(), 'error_info'=>$e->getTraceAsString() ]); return json(Tools::set_res(500,'操作异常',[])); } } }