Files
fast_response/digital_doctor/application/api/controller/Guliangquestion.php
2025-03-17 10:56:09 +08:00

81 lines
2.3 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 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 Guliangquestion extends BaseHttpApi
{
protected $controller_comments = '估量-问答配置';
/**
* desc获取估量-问答配置
*
* api/Guliangquestion/getGuliangquestionList
*
* 参数:
* 带分页
* current_page 当前页码
* list_rows 每页显示条数 默认15
* name 问题
* answer 答案
*
* 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span>
* id ID
* name 问题
* answer 答案
* authorwh
*/
function getGuliangquestionList(){
Tools::log_to_write_txt(['获取估量-问答配置 入参:'=>input()]);
$api_desc = '获取估量-问答配置';
try {
$name = input('name');
$answer = input('answer');
$model_obj = Db::table(TabConf::$fa_guliangquestion);
if(input('name')){
$model_obj->where('name',input('name'));
}
if(input('answer')){
$model_obj->where('answer',input('answer'));
}
$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,'操作异常',[]));
}
}
}