Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
47b41a12
Commit
47b41a12
authored
Jun 27, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
f275a0ab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
21 deletions
+21
-21
AppointmentTime.php
application/api/controller/AppointmentTime.php
+1
-1
Response.php
thinkphp/library/think/Response.php
+20
-20
No files found.
application/api/controller/AppointmentTime.php
View file @
47b41a12
...
@@ -71,7 +71,7 @@ class AppointmentTime extends Basic
...
@@ -71,7 +71,7 @@ class AppointmentTime extends Basic
return
$this
->
response
(
"101"
,
"楼盘信息不能为空"
);
return
$this
->
response
(
"101"
,
"楼盘信息不能为空"
);
}
}
//todo 参数校验
//todo 参数校验
if
(
!
isset
(
$params
[
"phone"
])
||
!
preg_match
(
'/^1[345678]\d{9}$/'
,
$params
[
"phone"
]))
{
if
(
!
isset
(
$params
[
"phone"
])
||
!
preg_match
(
'/^1[345678
9
]\d{9}$/'
,
$params
[
"phone"
]))
{
return
$this
->
response
(
"101"
,
"手机号为空或手机号无效"
);
return
$this
->
response
(
"101"
,
"手机号为空或手机号无效"
);
}
}
...
...
thinkphp/library/think/Response.php
View file @
47b41a12
...
@@ -41,8 +41,8 @@ class Response
...
@@ -41,8 +41,8 @@ class Response
/**
/**
* 构造函数
* 构造函数
* @access public
* @access public
* @param mixed $data
输出数据
* @param mixed $data 输出数据
* @param int
$code
* @param int $code
* @param array $header
* @param array $header
* @param array $options 输出参数
* @param array $options 输出参数
*/
*/
...
@@ -60,11 +60,11 @@ class Response
...
@@ -60,11 +60,11 @@ class Response
/**
/**
* 创建Response对象
* 创建Response对象
* @access public
* @access public
* @param mixed
$data
输出数据
* @param mixed
$data
输出数据
* @param string $type
输出类型
* @param string $type 输出类型
* @param int
$code
* @param int $code
* @param array
$header
* @param array $header
* @param array
$options 输出参数
* @param array $options 输出参数
* @return Response|JsonResponse|ViewResponse|XmlResponse|RedirectResponse|JsonpResponse
* @return Response|JsonResponse|ViewResponse|XmlResponse|RedirectResponse|JsonpResponse
*/
*/
public
static
function
create
(
$data
=
''
,
$type
=
''
,
$code
=
200
,
array
$header
=
[],
$options
=
[])
public
static
function
create
(
$data
=
''
,
$type
=
''
,
$code
=
200
,
array
$header
=
[],
$options
=
[])
...
@@ -106,7 +106,7 @@ class Response
...
@@ -106,7 +106,7 @@ class Response
$this
->
header
[
'Cache-Control'
]
=
'max-age='
.
$cache
[
1
]
.
',must-revalidate'
;
$this
->
header
[
'Cache-Control'
]
=
'max-age='
.
$cache
[
1
]
.
',must-revalidate'
;
$this
->
header
[
'Last-Modified'
]
=
gmdate
(
'D, d M Y H:i:s'
)
.
' GMT'
;
$this
->
header
[
'Last-Modified'
]
=
gmdate
(
'D, d M Y H:i:s'
)
.
' GMT'
;
$this
->
header
[
'Expires'
]
=
gmdate
(
'D, d M Y H:i:s'
,
$_SERVER
[
'REQUEST_TIME'
]
+
$cache
[
1
])
.
' GMT'
;
$this
->
header
[
'Expires'
]
=
gmdate
(
'D, d M Y H:i:s'
,
$_SERVER
[
'REQUEST_TIME'
]
+
$cache
[
1
])
.
' GMT'
;
Cache
::
tag
(
$cache
[
2
])
->
set
(
$cache
[
0
],
[
$data
,
$this
->
header
],
$cache
[
1
]);
Cache
::
tag
(
$cache
[
2
])
->
set
(
$cache
[
0
],
[
$data
,
$this
->
header
],
$cache
[
1
]);
}
}
}
}
...
@@ -177,8 +177,8 @@ class Response
...
@@ -177,8 +177,8 @@ class Response
/**
/**
* 设置响应头
* 设置响应头
* @access public
* @access public
* @param string|array $name
参数名
* @param string|array $name 参数名
* @param string
$value 参数值
* @param string $value 参数值
* @return $this
* @return $this
*/
*/
public
function
header
(
$name
,
$value
=
null
)
public
function
header
(
$name
,
$value
=
null
)
...
@@ -199,14 +199,14 @@ class Response
...
@@ -199,14 +199,14 @@ class Response
public
function
content
(
$content
)
public
function
content
(
$content
)
{
{
if
(
null
!==
$content
&&
!
is_string
(
$content
)
&&
!
is_numeric
(
$content
)
&&
!
is_callable
([
if
(
null
!==
$content
&&
!
is_string
(
$content
)
&&
!
is_numeric
(
$content
)
&&
!
is_callable
([
$content
,
$content
,
'__toString'
,
'__toString'
,
])
])
)
{
)
{
throw
new
\InvalidArgumentException
(
sprintf
(
'variable type error: %s'
,
gettype
(
$content
)));
throw
new
\InvalidArgumentException
(
sprintf
(
'variable type error: %s'
,
gettype
(
$content
)));
}
}
$this
->
content
=
(
string
)
$content
;
$this
->
content
=
(
string
)
$content
;
return
$this
;
return
$this
;
}
}
...
@@ -269,7 +269,7 @@ class Response
...
@@ -269,7 +269,7 @@ class Response
/**
/**
* 页面输出类型
* 页面输出类型
* @param string $contentType 输出类型
* @param string $contentType 输出类型
* @param string $charset
输出编码
* @param string $charset 输出编码
* @return $this
* @return $this
*/
*/
public
function
contentType
(
$contentType
,
$charset
=
'utf-8'
)
public
function
contentType
(
$contentType
,
$charset
=
'utf-8'
)
...
@@ -309,16 +309,16 @@ class Response
...
@@ -309,16 +309,16 @@ class Response
{
{
if
(
null
==
$this
->
content
)
{
if
(
null
==
$this
->
content
)
{
$content
=
$this
->
output
(
$this
->
data
);
$content
=
$this
->
output
(
$this
->
data
);
Log
::
record
(
"response msg:"
.
$content
);
if
(
null
!==
$content
&&
!
is_string
(
$content
)
&&
!
is_numeric
(
$content
)
&&
!
is_callable
([
if
(
null
!==
$content
&&
!
is_string
(
$content
)
&&
!
is_numeric
(
$content
)
&&
!
is_callable
([
$content
,
$content
,
'__toString'
,
'__toString'
,
])
])
)
{
)
{
throw
new
\InvalidArgumentException
(
sprintf
(
'variable type error: %s'
,
gettype
(
$content
)));
throw
new
\InvalidArgumentException
(
sprintf
(
'variable type error: %s'
,
gettype
(
$content
)));
}
}
$this
->
content
=
(
string
)
$content
;
$this
->
content
=
(
string
)
$content
;
}
}
return
$this
->
content
;
return
$this
->
content
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment