代码优化
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\common\controller;
|
||||
|
||||
use library\ResponseHelper;
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
use think\facade\Config;
|
||||
@@ -132,20 +133,19 @@ class Api extends Controller
|
||||
{
|
||||
$type = $this->request->param('type', '');
|
||||
if (empty($type)){
|
||||
return json_encode(['code' => 500,'msg' => '参数缺失']);
|
||||
return ResponseHelper::error('参数缺失');
|
||||
}
|
||||
|
||||
if (!in_array($type,['ckb','ai_store'])){
|
||||
return json_encode(['code' => 500,'msg' => '参数错误']);
|
||||
return ResponseHelper::error('参数错误');
|
||||
}
|
||||
|
||||
|
||||
$data = Db::name('app_version')
|
||||
->field('version,downloadUrl,updateContent')
|
||||
->where(['type'=>$type])
|
||||
->order('id DESC')
|
||||
->find();
|
||||
|
||||
return json_encode(['code' => 200,'msg' => '获取成功','data' => $data]);
|
||||
return ResponseHelper::success($data, '获取成功');
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user