84 lines
2.5 KiB
PHP
84 lines
2.5 KiB
PHP
<?php
|
||
|
||
namespace app\api\controller;
|
||
|
||
use think\Db;
|
||
use app\common\model\TabConf;
|
||
use wanghua\general_utility_tools_php\file\upload\FileUpload;
|
||
use wanghua\general_utility_tools_php\tool\Tools;
|
||
use wanghua\general_utility_tools_php\Validate;
|
||
use think\Controller;
|
||
|
||
class Tychathistory extends BaseHttpApi
|
||
{
|
||
protected $controller_comments = '听译-聊天历史';
|
||
|
||
/**
|
||
* desc:获取听译-聊天历史
|
||
*
|
||
* api/Tychathistory/getTychathistoryList
|
||
*
|
||
* 参数:
|
||
* 带分页
|
||
* current_page 当前页码
|
||
* list_rows 每页显示条数 默认15
|
||
* hdruserbaseinfo_id 统一基本信息 统一基本信息 必须
|
||
*
|
||
* 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span>:
|
||
* id ID
|
||
* username 用户
|
||
* type 聊天角色
|
||
* chat_msg 问诊内容
|
||
* ticket 对话票据(数据隔离)
|
||
* create_time 创建时间
|
||
* hdruserbaseinfo_id 统一基本信息
|
||
|
||
* author:wh
|
||
*/
|
||
function getTychathistoryList(){
|
||
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参数错误'));
|
||
}
|
||
|
||
|
||
|
||
$model_obj = Db::table(TabConf::$fa_ty_chathistory);
|
||
|
||
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,'操作异常',[]));
|
||
}
|
||
}
|
||
|
||
} |