切换导航条
此项目
正在载入...
登录
郭盛
/
areial
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郭盛
5 years ago
提交
6983f7651af444e53c6d583dd281118ea3d11755
1 个父辈
f2265133
1 个管道 的构建
通过
耗费 1 秒
短信接口
变更
2
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
77 行增加
和
17 行删除
.idea/workspace.xml
application/nsms/nsms.php
.idea/workspace.xml
查看文件 @
6983f76
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"e93f11c2-a7d9-4d35-8b1c-8dd18e7f5fef"
name=
"Default"
comment=
""
>
<change
type=
"MODIFICATION"
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
/>
<change
type=
"MODIFICATION"
beforePath=
"$PROJECT_DIR$/application/api/controller/Pay.php"
afterPath=
"$PROJECT_DIR$/application/api/controller/Pay.php"
/>
<change
type=
"MODIFICATION"
beforePath=
"$PROJECT_DIR$/public/api.html"
afterPath=
"$PROJECT_DIR$/public/api.html"
/>
</list>
<list
default=
"true"
id=
"e93f11c2-a7d9-4d35-8b1c-8dd18e7f5fef"
name=
"Default"
comment=
""
/>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"TRACKING_ENABLED"
value=
"true"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
...
...
@@ -210,7 +206,7 @@
</component>
<component
name=
"PhpWorkspaceProjectConfiguration"
backward_compatibility_performed=
"true"
/>
<component
name=
"ProjectFrameBounds"
extendedState=
"1"
>
<option
name=
"x"
value=
"14
8
"
/>
<option
name=
"x"
value=
"14
1
"
/>
<option
name=
"y"
value=
"49"
/>
<option
name=
"width"
value=
"1776"
/>
<option
name=
"height"
value=
"1014"
/>
...
...
@@ -242,12 +238,6 @@
<item
name=
"areial"
type=
"2a2b976b:PhpTreeStructureProvider$1"
/>
<item
name=
"application"
type=
"2a2b976b:PhpTreeStructureProvider$1"
/>
</path>
<path>
<item
name=
"areial"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"areial"
type=
"2a2b976b:PhpTreeStructureProvider$1"
/>
<item
name=
"application"
type=
"2a2b976b:PhpTreeStructureProvider$1"
/>
<item
name=
"nsms"
type=
"2a2b976b:PhpTreeStructureProvider$1"
/>
</path>
</expand>
<select
/>
</subPane>
...
...
@@ -310,7 +300,7 @@
<workItem
from=
"1574469667436"
duration=
"25235000"
/>
<workItem
from=
"1574641631900"
duration=
"15479000"
/>
<workItem
from=
"1574669596135"
duration=
"11747000"
/>
<workItem
from=
"1574727687281"
duration=
"15
410
000"
/>
<workItem
from=
"1574727687281"
duration=
"15
711
000"
/>
</task>
<task
id=
"LOCAL-00001"
summary=
"调试"
>
<created>
1574145133364
</created>
...
...
@@ -323,7 +313,7 @@
<servers
/>
</component>
<component
name=
"TimeTrackingManager"
>
<option
name=
"totallyTimeSpent"
value=
"245
681
000"
/>
<option
name=
"totallyTimeSpent"
value=
"245
982
000"
/>
</component>
<component
name=
"TodoView"
>
<todo-panel
id=
"selected-file"
>
...
...
@@ -335,16 +325,16 @@
</todo-panel>
</component>
<component
name=
"ToolWindowManager"
>
<frame
x=
"14
8
"
y=
"49"
width=
"1776"
height=
"1014"
extended-state=
"1"
/>
<frame
x=
"14
1
"
y=
"49"
width=
"1776"
height=
"1014"
extended-state=
"1"
/>
<layout>
<window_info
id=
"Project"
active=
"
fals
e"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
show_stripe_button=
"true"
weight=
"0.14160839"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"combo"
/>
<window_info
id=
"Project"
active=
"
tru
e"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
show_stripe_button=
"true"
weight=
"0.14160839"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"combo"
/>
<window_info
id=
"TODO"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.32912987"
sideWeight=
"0.5"
order=
"9"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Event Log"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"0"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Database"
active=
"false"
anchor=
"right"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"0"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Run"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"5"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Version Control"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Structure"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.25"
sideWeight=
"0.5"
order=
"2"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Terminal"
active=
"
tru
e"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
show_stripe_button=
"true"
weight=
"0.12884834"
sideWeight=
"0.5"
order=
"2"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Terminal"
active=
"
fals
e"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
show_stripe_button=
"true"
weight=
"0.12884834"
sideWeight=
"0.5"
order=
"2"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Debug"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.4"
sideWeight=
"0.5"
order=
"6"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Favorites"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"0"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Cvs"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.25"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
...
...
application/nsms/nsms.php
0 → 100644
查看文件 @
6983f76
<?php
namespace
app\nsms
;
date_default_timezone_set
(
'PRC'
);
//设置时区
/**
* 发送API
* demo仅供参考,demo最低运行环境PHP5.3
* 请确认开启PHP CURL 扩展
*/
class
sendAPI
{
public
$data
;
//发送数据
public
$timeout
=
30
;
//超时
private
$apiUrl
;
//发送地址
private
$username
;
//用户名
private
$password
;
//密码
function
__construct
(
$url
,
$username
,
$password
)
{
$this
->
apiUrl
=
$url
;
$this
->
username
=
$username
;
$this
->
password
=
$password
;
}
private
function
httpGet
()
{
$url
=
$this
->
apiUrl
.
'?'
.
http_build_query
(
$this
->
data
);
$curl
=
curl_init
();
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
true
);
curl_setopt
(
$curl
,
CURLOPT_TIMEOUT
,
$this
->
timeout
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYPEER
,
false
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYHOST
,
false
);
curl_setopt
(
$curl
,
CURLOPT_URL
,
$url
);
$res
=
curl_exec
(
$curl
);
if
(
curl_errno
(
$curl
))
{
echo
'Error GET '
.
curl_error
(
$curl
);
}
curl_close
(
$curl
);
return
$res
;
}
private
function
httpPost
(){
// 模拟提交数据函数
$curl
=
curl_init
();
// 启动一个CURL会话
curl_setopt
(
$curl
,
CURLOPT_URL
,
$this
->
apiUrl
);
// 要访问的地址
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYPEER
,
false
);
// 对认证证书来源的检查
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYHOST
,
false
);
// 从证书中检查SSL加密算法是否存在
curl_setopt
(
$curl
,
CURLOPT_USERAGENT
,
$_SERVER
[
'HTTP_USER_AGENT'
]);
// 模拟用户使用的浏览器
curl_setopt
(
$curl
,
CURLOPT_POST
,
true
);
// 发送一个常规的Post请求
curl_setopt
(
$curl
,
CURLOPT_POSTFIELDS
,
http_build_query
(
$this
->
data
));
// Post提交的数据包
curl_setopt
(
$curl
,
CURLOPT_TIMEOUT
,
$this
->
timeout
);
// 设置超时限制防止死循环
curl_setopt
(
$curl
,
CURLOPT_HEADER
,
false
);
// 显示返回的Header区域内容
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
true
);
// 获取的信息以文件流的形式返回
$result
=
curl_exec
(
$curl
);
// 执行操作
if
(
curl_errno
(
$curl
))
{
echo
'Error POST'
.
curl_error
(
$curl
);
}
curl_close
(
$curl
);
// 关键CURL会话
return
$result
;
// 返回数据
}
/**
* @param $type|提交类型 POST/GET
* @param $isTranscoding|是否需要转 $isTranscoding 是否需要转utf-8 默认 false
* @return mixed
*/
public
function
sendSMS
(
$type
,
$isTranscoding
=
false
)
{
$this
->
data
[
'content'
]
=
$isTranscoding
===
true
?
mb_convert_encoding
(
$this
->
data
[
'content'
],
"UTF-8"
)
:
$this
->
data
[
'content'
];
$this
->
data
[
'username'
]
=
$this
->
username
;
$this
->
data
[
'tkey'
]
=
date
(
'YmdHis'
);
$this
->
data
[
'password'
]
=
md5
(
md5
(
$this
->
password
)
.
$this
->
data
[
'tkey'
]);
return
$type
==
"POST"
?
$this
->
httpPost
()
:
$this
->
httpGet
();
}
}
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论