model = new \app\api\model\Config(); } /** * @OA\Get ( * path="config/index",tags={"系统配置"},summary="获取系统配置",description="获取系统配置", * @OA\Parameter(ref="#/components/parameters/token"), * @OA\Parameter(name="name",in="query",description="配置名称",@OA\Schema (type="string")), * @OA\Parameter(name="type",in="query",description="配置标识",@OA\Schema (type="string")), * @OA\Parameter(name="value",in="query",description="配置值",@OA\Schema (type="string")), * @OA\Response( * response=200, * description="返回所有配置信息", * ), * ) */ public function index() { //接受参数 $_get = $this->request->param(); //验证参数 validate(\app\api\validate\Config::class)->scene('lists')->check($_get); //指定搜索参数 $this->model->search_arr = ['name', 'type', 'value']; //数据处理 $_data = $this->model->index(); //返回数据 return send_http_status($_data); } /** * @OA\Post (path="config/save",tags={"系统配置"},summary="系统配置",description="系统配置", * @OA\Parameter(ref="#/components/parameters/token"), * @OA\RequestBody( * @OA\MediaType(mediaType="application/json", * @OA\Schema ( * @OA\Property(property="name",type="string",description="此那么可自行定义 比如 seo_title"), * @OA\Property(property="value",type="string",description="此那么可自行定义 比如 合肥网站优化"), * ), * ), * ), * @OA\Response( * response=200, * description="添加成功", * @OA\JsonContent(type="object", * @OA\Property(property="code", type="integer",format="int32",description="状态码"), * @OA\Property(property="msg", type="string",description="提示信息"), * @OA\Property(property="count", type="integer",format="int32",description="记录总数"), * @OA\Property(property="data", type="integer",format="int32",description="添加成功的的数据ID"), * ), * ), * ) * @Log [sys_name] 在 [sys_time] 更新了配置信息 */ public function save() { //接收参数 $_post = $this->request->post(); //处理并返回参数 $insertId = $this->model->edit($_post); return send_http_status($insertId, $insertId ? 209 : 210); } }