Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
数据应用
ThinkLibrary
提交
c3c7e198
T
ThinkLibrary
项目概览
数据应用
/
ThinkLibrary
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
代码片段
项目成员
Pages
T
ThinkLibrary
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c3c7e198
编写于
4月 23, 2020
作者:
李光春
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- 增加请求门面
上级
59987bcf
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
168 addition
and
3 deletion
+168
-3
src/facade/Dates.php
src/facade/Dates.php
+1
-0
src/facade/Files.php
src/facade/Files.php
+1
-0
src/facade/Ints.php
src/facade/Ints.php
+1
-0
src/facade/Pregs.php
src/facade/Pregs.php
+1
-0
src/facade/Randoms.php
src/facade/Randoms.php
+2
-1
src/facade/Requests.php
src/facade/Requests.php
+50
-0
src/facade/Returns.php
src/facade/Returns.php
+1
-0
src/facade/Strings.php
src/facade/Strings.php
+2
-1
src/facade/Times.php
src/facade/Times.php
+1
-0
src/facade/UnIqIds.php
src/facade/UnIqIds.php
+2
-1
src/facade/Urls.php
src/facade/Urls.php
+1
-0
src/facade/Xmls.php
src/facade/Xmls.php
+1
-0
src/helper/Requests.php
src/helper/Requests.php
+104
-0
未找到文件。
src/facade/Dates.php
浏览文件 @
c3c7e198
...
...
@@ -23,6 +23,7 @@ use think\Facade;
* 日期门面
* Class Dates
* @see \DtApp\ThinkLibrary\Date
* @package DtApp\ThinkLibrary\facade
* @package think\facade
* @mixin helper
*/
...
...
src/facade/Files.php
浏览文件 @
c3c7e198
...
...
@@ -23,6 +23,7 @@ use think\Facade;
* 文件门面
* Class Files
* @see \DtApp\ThinkLibrary\helper\Files
* @package DtApp\ThinkLibrary\facade
* @package think\facade
* @mixin helper
*
...
...
src/facade/Ints.php
浏览文件 @
c3c7e198
...
...
@@ -23,6 +23,7 @@ use think\Facade;
* 数字门面
* Class Ints
* @see \DtApp\ThinkLibrary\helper\Ints
* @package DtApp\ThinkLibrary\Ints
* @package think\facade
* @mixin helper
*
...
...
src/facade/Pregs.php
浏览文件 @
c3c7e198
...
...
@@ -23,6 +23,7 @@ use think\facade;
* 验证门面
* Class Pregs
* @see \DtApp\ThinkLibrary\helper\Pregs
* @package DtApp\ThinkLibrary\Pregs
* @package think\facade
* @mixin helper
*
...
...
src/facade/Randoms.php
浏览文件 @
c3c7e198
...
...
@@ -22,7 +22,8 @@ use think\facade;
/**
* 随机门面
* Class Randoms
* @see \DtApp\ThinkLibrary\Random
* @see \DtApp\ThinkLibrary\Randoms
* @package DtApp\ThinkLibrary\Randoms
* @package think\facade
* @mixin helper
*
...
...
src/facade/Requests.php
0 → 100644
浏览文件 @
c3c7e198
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 6.0 for ThinkPhP 6.0
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 :https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 :https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace
DtApp\ThinkLibrary\facade
;
use
DtApp\ThinkLibrary\helper\Requests
as
helper
;
use
think\Facade
;
/**
* 请求门面
* Class Requests
* @see \DtApp\ThinkLibrary\helper\Requests
* @package DtApp\ThinkLibrary\facade
* @package think\facade
* @mixin helper
*
* @method helper isEmpty(array $data, array $arr) array|bool 判断输入的参数
* @method helper isEmptyRet(array $data, array $arr) array 判断输入的参数为空就返回Json错误
* @method helper isGet() bool 判断是否为GET方式
* @method helper isPost() bool 判断是否为POST方式
* @method helper isPut() bool 判断是否为PUT方式
* @method helper isDelete() bool 判断是否为DELETE方式
* @method helper isAjax() bool 判断是否为Ajax方式
* @method helper getWebsiteAddress() bool 获取域名地址
*/
class
Requests
extends
Facade
{
/**
* 获取当前Facade对应类名(或者已经绑定的容器对象标识)
* @access protected
* @return string
*/
public
static
function
getFacadeClass
()
{
return
helper
::
class
;
}
}
src/facade/Returns.php
浏览文件 @
c3c7e198
...
...
@@ -23,6 +23,7 @@ use think\Facade;
* 返回门面
* Class Returns
* @see \DtApp\ThinkLibrary\helper\Returns
* @package DtApp\ThinkLibrary\Returns
* @package think\facade
* @mixin helper
*
...
...
src/facade/Strings.php
浏览文件 @
c3c7e198
...
...
@@ -22,7 +22,8 @@ use think\facade;
/**
* 字符串门面
* Class Strings
* @see \DtApp\ThinkLibrary\Str
* @see \DtApp\ThinkLibrary\Strings
* @package DtApp\ThinkLibrary\Strings
* @package think\facade
* @mixin helper
*
...
...
src/facade/Times.php
浏览文件 @
c3c7e198
...
...
@@ -23,6 +23,7 @@ use think\Facade;
* 时间门面
* Class Times
* @see \DtApp\ThinkLibrary\helper\Times
* @package DtApp\ThinkLibrary\Times
* @package think\facade
* @mixin helper
*
...
...
src/facade/UnIqIds.php
浏览文件 @
c3c7e198
...
...
@@ -22,7 +22,8 @@ use think\Facade;
/**
* 唯一ID门面
* Class UnIqIds
* @see \DtApp\ThinkLibrary\UnIqId
* @see \DtApp\ThinkLibrary\UnIqIds
* @package DtApp\ThinkLibrary\UnIqIds
* @package think\facade
* @mixin helper
*
...
...
src/facade/Urls.php
浏览文件 @
c3c7e198
...
...
@@ -23,6 +23,7 @@ use think\Facade;
* 网址门面
* Class Urls
* @see \DtApp\ThinkLibrary\Urls
* @package DtApp\ThinkLibrary\Urls
* @package think\facade
* @mixin helper
*
...
...
src/facade/Xmls.php
浏览文件 @
c3c7e198
...
...
@@ -23,6 +23,7 @@ use think\Facade;
* XML门面
* Class Xmls
* @see \DtApp\ThinkLibrary\helper\Xmls
* @package DtApp\ThinkLibrary\Xmls
* @package think\facade
* @mixin helper
*
...
...
src/helper/Requests.php
0 → 100644
浏览文件 @
c3c7e198
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 6.0 for ThinkPhP 6.0
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 :https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 :https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace
DtApp\ThinkLibrary\helper
;
/**
* 请求管理类
* Class Requests
* @package DtApp\ThinkLibrary\helper
*/
class
Requests
{
/**
* 判断输入的参数
* @param array $data
* @param array $arr
* @return array|bool
*/
public
function
isEmpty
(
array
$data
,
array
$arr
)
{
foreach
(
$arr
as
$k
=>
$v
)
if
(
empty
(
isset
(
$data
[
"
$v
"
])
?
$data
[
"
$v
"
]
:
''
))
return
false
;
return
$data
;
}
/**
* 判断输入的参数为空就返回Json错误
* @param array $data
* @param array $arr
* @return array
*/
public
function
isEmptyRet
(
array
$data
,
array
$arr
)
{
foreach
(
$arr
as
$k
=>
$v
)
if
(
empty
(
isset
(
$data
[
"
$v
"
])
?
$data
[
"
$v
"
]
:
''
))
\
DtApp\ThinkLibrary\facade\Returns
::
jsonError
(
'请检查参数'
,
102
);
return
$data
;
}
/**
* 判断是否为GET方式
* @return bool
*/
public
function
isGet
()
{
return
request
()
->
isGet
();
}
/**
* 判断是否为POST方式
* @return bool
*/
public
function
isPost
()
{
return
request
()
->
isPost
();
}
/**
* 判断是否为PUT方式
* @return boolean
*/
public
function
isPut
()
{
return
request
()
->
isPut
();
}
/**
* 判断是否为DELETE方式
* @return boolean
*/
public
function
isDelete
()
{
return
request
()
->
isDelete
();
}
/**
* 判断是否为Ajax方式
* @return bool
*/
public
function
isAjax
()
{
return
request
()
->
isAjax
();
}
/**
* 获取域名地址
* @return string
*/
public
function
getWebsiteAddress
()
{
$http_type
=
((
isset
(
$_SERVER
[
'HTTPS'
])
&&
$_SERVER
[
'HTTPS'
]
==
'on'
)
||
(
isset
(
$_SERVER
[
'HTTP_X_FORWARDED_PROTO'
])
&&
$_SERVER
[
'HTTP_X_FORWARDED_PROTO'
]
==
'https'
))
?
'https://'
:
'http://'
;
return
$http_type
.
$_SERVER
[
'HTTP_HOST'
]
.
"/"
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录