新增接口小版本更新支持
This commit is contained in:
parent
51ce1314c9
commit
68dc4af69d
@ -56,7 +56,7 @@ class Plugs extends Controller
|
||||
}
|
||||
}
|
||||
$this->field = $this->app->request->get('field', 'icon');
|
||||
$this->fetch(realpath(__DIR__ . '/../../view/api/icon.html'));
|
||||
$this->fetch(dirname(__DIR__, 2) . '/view/api/icon.html');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,10 +52,9 @@ class Upload extends Controller
|
||||
$allows = str2arr(sysconf('storage.allow_exts|raw'));
|
||||
if (empty($uuid) && $unid > 0) $allows = array_intersect($exts, $allows);
|
||||
foreach ($allows as $ext) $data['exts'][$ext] = Storage::mime($ext);
|
||||
$template = realpath(__DIR__ . '/../../view/api/upload.js');
|
||||
$data['exts'] = json_encode($data['exts'], JSON_UNESCAPED_UNICODE);
|
||||
$data['nameType'] = sysconf('storage.name_type|raw') ?: 'xmd5';
|
||||
return view($template, $data)->contentType('application/x-javascript');
|
||||
return view(dirname(__DIR__, 2) . '/view/api/upload.js', $data)->contentType('application/x-javascript');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,6 +73,7 @@ class Core extends Controller
|
||||
|
||||
-801 => 'ip: 请求错误,不在白名单',
|
||||
-802 => '方法不存在',
|
||||
-803 => '版本号不正确',
|
||||
|
||||
-1000 => '系统维护中',
|
||||
|
||||
@ -98,7 +99,6 @@ class Core extends Controller
|
||||
# 获取输入的信息
|
||||
public function input(): void
|
||||
{
|
||||
// var_dump(8888);exit;
|
||||
$this->input = input();
|
||||
if (!$this->input) {
|
||||
$this->no(-100);
|
||||
|
@ -1,18 +1,5 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2020 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 ( https://mit-license.org )
|
||||
// +----------------------------------------------------------------------
|
||||
// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
|
||||
// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
use think\exception\HttpResponseException;
|
||||
|
||||
|
||||
@ -28,6 +15,8 @@ if(!$version){
|
||||
//默认跳转到v1版本
|
||||
if ($version == null) $version = "api";#api.notify,url
|
||||
|
||||
|
||||
|
||||
$pathInfo = request()->pathinfo();
|
||||
if ($pathInfo == null) {
|
||||
$json = [
|
||||
@ -35,7 +24,6 @@ if ($pathInfo == null) {
|
||||
'data'=>'',
|
||||
'msg' =>'请求错误'
|
||||
];
|
||||
// var_dump($json);
|
||||
throw new HttpResponseException(json($json));
|
||||
}
|
||||
|
||||
@ -44,7 +32,14 @@ if ($pathInfo == null) {
|
||||
|
||||
if($version!='api'){
|
||||
if(!str_contains($pathInfo, 'api.')){
|
||||
if(str_contains($version, '.')){
|
||||
$versions = str_replace(".", "", $version);
|
||||
#支持小版本的更新
|
||||
app()->route->rule(':controller/:function', $versions . '.:controller/:function');
|
||||
}else{
|
||||
app()->route->rule(':controller/:function', $version . '.:controller/:function');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -30,10 +30,10 @@ define(function () {
|
||||
this.patterns = {
|
||||
qq: '^[1-9][0-9]{4,11}$',
|
||||
ip: '^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$',
|
||||
url: '^https?://([a-zA-Z0-9]+\\.)+[a-zA-Z0-9]+',
|
||||
url: '^https?://([a-zA-Z0-9-]+\\.)+[-_a-zA-Z0-9-]+',
|
||||
phone: '^1[3-9][0-9]{9}$',
|
||||
mobile: '^1[3-9][0-9]{9}$',
|
||||
email: '^([a-zA-Z0-9_\\.\\-])+@(([a-zA-Z0-9\-])+\\.)+([a-zA-Z0-9]{2,4})+$',
|
||||
email: '^([a-zA-Z0-9_\\.-])+@(([a-zA-Z0-9-])+\\.)+([a-zA-Z0-9]{2,4})+$',
|
||||
wechat: '^[a-zA-Z]([-_a-zA-Z0-9]{5,19})+$',
|
||||
cardid: '^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$',
|
||||
userame: '^[a-zA-Z0-9_-]{4,16}$',
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user