切换导航条
此项目
正在载入...
登录
周海龙
/
globalso-v6-c-customer
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
李小龙
3 months ago
提交
6f86e343c59e2575e37f824a667f87bcda05592a
2 个父辈
5965213a
52325964
Merge branch 'master' of
http://47.244.231.31:8099/zhl/globalso-v6-c-customer
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
15 行增加
和
17 行删除
app/Http/Controllers/Api/NoticeController.php
app/Http/Controllers/Api/NoticeController.php
查看文件 @
6f86e34
...
...
@@ -63,14 +63,14 @@ protected function error($message = 'error', $status = 400, $data = [])
/**
* 响应
* @param
null
$msg
* @param
string
$msg
* @param int $code
* @param array $data
* @param int $result_code
* @param string $type
* @return void
*/
public
function
response
(
$msg
=
null
,
$code
=
self
::
SUCCESS
,
$data
=
[],
$result_code
=
200
,
$type
=
'application/json'
)
public
function
response
(
$msg
=
'success'
,
$code
=
self
::
SUCCESS
,
$data
=
[],
$result_code
=
200
,
$type
=
'application/json'
)
{
$result
=
[
'msg'
=>
$msg
,
...
...
@@ -256,7 +256,8 @@ public function websiteHtml(Request $request)
* 文案
* @param Request $request
*/
public
function
getRandInquiryText
(
Request
$request
){
public
function
getRandInquiryText
(
Request
$request
)
{
//IP限流+验证参数
$this
->
limitIp
(
$request
);
...
...
@@ -266,7 +267,7 @@ public function getRandInquiryText(Request $request){
}
catch
(
\Exception
$e
)
{
$resStr
=
$e
->
getMessage
();
}
$this
->
response
(
"ok"
,
self
::
SUCCESS
,
$resStr
);
$this
->
response
(
"ok"
,
self
::
SUCCESS
,
$resStr
);
return
;
}
...
...
@@ -275,7 +276,8 @@ public function getRandInquiryText(Request $request){
* @param Request $request
* @return string
*/
public
function
pullCode
(
Request
$request
){
public
function
pullCode
(
Request
$request
)
{
$command
=
"cd /www/wwwroot/self_site && ./pull_custom_code.sh"
;
shell_exec
(
$command
);
return
$this
->
success
();
...
...
@@ -285,8 +287,9 @@ public function pullCode(Request $request){
* @param $url
* @return bool|string
*/
public
function
httpGet
(
$url
){
$ch1
=
curl_init
();
public
function
httpGet
(
$url
)
{
$ch1
=
curl_init
();
$timeout
=
0
;
curl_setopt
(
$ch1
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch1
,
CURLOPT_RETURNTRANSFER
,
true
);
...
...
@@ -461,17 +464,17 @@ public function deleteDirectory($path)
public
function
transmit
(
$request
,
$type
=
self
::
TYPEVISIT
,
$traffic
=
self
::
TRAFFICZERO
)
{
if
(
$request
->
getClientIp
()
==
"127.0.0.1"
)
{
return
$this
->
success
();
$this
->
response
();
}
//判断是否是爬虫
$isReptile
=
$this
->
isReptile
(
$request
);
if
(
$isReptile
)
{
return
$this
->
success
();
$this
->
response
();
}
$data
=
$request
->
all
();
if
(
empty
(
$data
))
{
return
$this
->
success
();
$this
->
response
();
}
$data
[
"device_port"
]
=
$this
->
userAgentHandle
(
$request
->
userAgent
(),
$data
[
"device_port"
]
??
self
::
DEVICE_PORT_ONE
);
$req
[
"data"
]
=
$data
;
...
...
@@ -491,19 +494,14 @@ public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRA
//转发接口
$transmitUrl
=
env
(
"TRANSMIT_URL"
);
$resp
=
$this
->
httpPost
(
$transmitUrl
.
"api/selfSiteApi/"
,
json_encode
(
$req
));
if
(
$resp
[
"status"
]
!=
self
::
SUCCESS
)
{
if
(
(
$resp
[
"status"
]
??
0
)
!=
self
::
SUCCESS
)
{
$dataJson
=
json_encode
(
$req
);
if
(
!
file_exists
(
storage_path
(
'logs/fail_req'
)))
{
mkdir
(
storage_path
(
'logs/fail_req'
,
0777
,
true
));
}
@
file_put_contents
(
storage_path
(
'logs/fail_req/'
.
date
(
'Y-m-d'
)
.
'.log'
),
var_export
(
$dataJson
,
true
)
.
PHP_EOL
,
FILE_APPEND
);
}
if
(
isset
(
$resp
[
"data"
])){
$this
->
response
(
"success"
,
self
::
SUCCESS
,
$resp
[
"data"
]);
}
else
{
$this
->
success
();
}
return
;
$this
->
response
(
"success"
,
self
::
SUCCESS
,
$resp
[
"data"
]
??
[]);
}
/**
...
...
请
注册
或
登录
后发表评论