Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
数据应用
ThinkLibrary
提交
adca5657
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 搜索 >>
提交
adca5657
编写于
5月 06, 2020
作者:
李光春
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- 增加 微信小程序
- 增加 微信公众号
上级
8044a254
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
349 addition
and
62 deletion
+349
-62
src/helper/Files.php
src/helper/Files.php
+6
-5
src/helper/Ints.php
src/helper/Ints.php
+3
-2
src/helper/Pregs.php
src/helper/Pregs.php
+14
-13
src/helper/Requests.php
src/helper/Requests.php
+11
-10
src/helper/UnIqIds.php
src/helper/UnIqIds.php
+5
-4
src/helper/Urls.php
src/helper/Urls.php
+6
-5
src/service/WeChat/MessageManagementService.php
src/service/WeChat/MessageManagementService.php
+46
-0
src/service/WeMini/AccessTokenService.php
src/service/WeMini/AccessTokenService.php
+45
-0
src/service/WeMini/CustomerMessageService.php
src/service/WeMini/CustomerMessageService.php
+6
-9
src/service/WeMini/LoginService.php
src/service/WeMini/LoginService.php
+46
-0
src/service/WeMini/NewTmplService.php
src/service/WeMini/NewTmplService.php
+14
-14
src/service/WeMini/QrCodeService.php
src/service/WeMini/QrCodeService.php
+74
-0
src/service/WeMini/UserInfoService.php
src/service/WeMini/UserInfoService.php
+44
-0
src/service/ip/QqWryService.php
src/service/ip/QqWryService.php
+29
-0
未找到文件。
src/helper/Files.php
浏览文件 @
adca5657
...
...
@@ -13,6 +13,7 @@
// | github 仓库地址 :https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
declare
(
strict_types
=
1
);
namespace
DtApp\ThinkLibrary\helper
;
...
...
@@ -33,7 +34,7 @@ class Files
* @return bool
* @throws DtAppException
*/
public
function
delete
(
string
$name
)
public
function
delete
(
string
$name
)
:
bool
{
if
(
empty
(
$name
))
throw
new
DtAppException
(
'请检查需要删除文件夹的名称'
);
if
(
file_exists
(
$name
))
if
(
unlink
(
$name
))
return
true
;
...
...
@@ -46,7 +47,7 @@ class Files
* @return bool
* @throws DtAppException
*/
public
function
deletes
(
string
$name
)
public
function
deletes
(
string
$name
)
:
bool
{
if
(
empty
(
$name
))
throw
new
DtAppException
(
'请检查需要删除文件夹的名称'
);
//先删除目录下的文件:
...
...
@@ -78,7 +79,7 @@ class Files
* @return bool
* @throws DtAppException
*/
public
function
folderZip
(
string
$name
,
string
$suffix_name
=
'.png'
,
string
$file_name
=
'*'
)
public
function
folderZip
(
string
$name
,
string
$suffix_name
=
'.png'
,
string
$file_name
=
'*'
)
:
bool
{
if
(
empty
(
$name
))
throw
new
DtAppException
(
'请检查需要打包的路径名称'
);
try
{
...
...
@@ -103,7 +104,7 @@ class Files
* @param string $path
* @return array|string
*/
public
function
getFiles
(
string
$path
)
public
function
getFiles
(
string
$path
)
:
array
{
$files
=
[];
if
(
is_dir
(
$path
))
{
...
...
@@ -131,7 +132,7 @@ class Files
* @param string $path
* @return bool
*/
public
function
rmFiles
(
string
$path
)
public
function
rmFiles
(
string
$path
)
:
bool
{
$files
=
$this
->
getFiles
(
$path
);
if
(
!
is_array
(
$files
))
{
...
...
src/helper/Ints.php
浏览文件 @
adca5657
...
...
@@ -13,6 +13,7 @@
// | github 仓库地址 :https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
declare
(
strict_types
=
1
);
namespace
DtApp\ThinkLibrary\helper
;
...
...
@@ -29,7 +30,7 @@ class Ints
* @param int $num
* @return bool
*/
public
function
isEvenNumbers
(
int
$num
)
public
function
isEvenNumbers
(
int
$num
)
:
bool
{
if
(
$num
%
2
==
0
)
return
true
;
return
false
;
...
...
@@ -40,7 +41,7 @@ class Ints
* @param int $num
* @return bool
*/
public
function
isOddNumbers
(
int
$num
)
public
function
isOddNumbers
(
int
$num
)
:
bool
{
if
(
$num
%
2
==
0
)
return
false
;
return
true
;
...
...
src/helper/Pregs.php
浏览文件 @
adca5657
...
...
@@ -13,6 +13,7 @@
// | github 仓库地址 :https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
declare
(
strict_types
=
1
);
namespace
DtApp\ThinkLibrary\helper
;
...
...
@@ -30,7 +31,7 @@ class Pregs
* @param $mobile
* @return bool
*/
public
function
isIphone
(
$mobile
)
public
function
isIphone
(
$mobile
)
:
bool
{
if
(
preg_match
(
'/^[1]([3-9])[0-9]{9}$/'
,
$mobile
))
return
true
;
return
false
;
...
...
@@ -42,7 +43,7 @@ class Pregs
* @param $mobile
* @return bool
*/
public
function
isIphoneAll
(
$mobile
)
public
function
isIphoneAll
(
$mobile
)
:
bool
{
if
(
preg_match
(
'/^[1](([3][0-9])|([4][5-9])|([5][0-3,5-9])|([6][5,6])|([7][0-8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$/'
,
$mobile
))
return
true
;
return
false
;
...
...
@@ -54,7 +55,7 @@ class Pregs
* @param $tel
* @return bool
*/
public
function
isTel
(
$tel
)
public
function
isTel
(
$tel
)
:
bool
{
if
(
preg_match
(
"/^(\(\d
{
3,4}\)|\d{3,4}-)?\d{7,8
}
$/"
,
$tel
))
return
true
;
return
false
;
...
...
@@ -66,7 +67,7 @@ class Pregs
* @param int $id 身份证号码
* @return bool
*/
public
function
isIdCard
(
$id
)
public
function
isIdCard
(
$id
)
:
bool
{
if
(
preg_match
(
"/^\d
{
15}|\d{18
}
$/"
,
$id
))
return
true
;
return
false
;
...
...
@@ -78,7 +79,7 @@ class Pregs
* @param $digit
* @return bool
*/
public
function
isDigit
(
$digit
)
public
function
isDigit
(
$digit
)
:
bool
{
if
(
preg_match
(
"/^\d*$/"
,
$digit
))
return
true
;
return
false
;
...
...
@@ -90,7 +91,7 @@ class Pregs
* @param $num
* @return bool
*/
public
function
isNum
(
$num
)
public
function
isNum
(
$num
)
:
bool
{
if
(
is_numeric
(
$num
))
return
true
;
return
false
;
...
...
@@ -102,7 +103,7 @@ class Pregs
* @param $str
* @return bool
*/
public
function
isStr
(
$str
)
public
function
isStr
(
$str
)
:
bool
{
if
(
preg_match
(
"/^\w+$/"
,
$str
))
return
true
;
return
false
;
...
...
@@ -114,7 +115,7 @@ class Pregs
* @param $str
* @return bool
*/
public
function
isPassword
(
$str
)
public
function
isPassword
(
$str
)
:
bool
{
if
(
preg_match
(
"/^[a-zA-Z]\w
{
5,17
}
$/"
,
$str
))
return
true
;
return
false
;
...
...
@@ -126,7 +127,7 @@ class Pregs
* @param $str
* @return bool
*/
public
function
isChinese
(
$str
)
public
function
isChinese
(
$str
)
:
bool
{
if
(
preg_match
(
"/^[\u4e00-\u9fa5],
{
0,
}
$/"
,
$str
))
return
true
;
return
false
;
...
...
@@ -138,7 +139,7 @@ class Pregs
* @param $email
* @return bool
*/
public
function
isEmail
(
$email
)
public
function
isEmail
(
$email
)
:
bool
{
if
(
preg_match
(
"/^\w+[-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/"
,
$email
))
return
true
;
return
false
;
...
...
@@ -150,7 +151,7 @@ class Pregs
* @param $url
* @return bool
*/
public
function
isLink
(
$url
)
public
function
isLink
(
$url
)
:
bool
{
if
(
preg_match
(
"/http:\/\/[\w.]+[\w\/]*[\w.]*\??[\w=&\+\%]*/is"
,
$url
))
return
true
;
return
false
;
...
...
@@ -162,7 +163,7 @@ class Pregs
* @param $qq
* @return bool
*/
public
function
isQq
(
$qq
)
public
function
isQq
(
$qq
)
:
bool
{
if
(
preg_match
(
"/^[1-9][0-9]
{
4,
}
$/"
,
$qq
))
return
true
;
return
false
;
...
...
@@ -174,7 +175,7 @@ class Pregs
* @param $ip
* @return bool
*/
public
function
isIp
(
$ip
)
public
function
isIp
(
$ip
)
:
bool
{
if
(
preg_match
(
"/^[0-9]
{
1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3
}
$/"
,
$ip
))
return
true
;
return
false
;
...
...
src/helper/Requests.php
浏览文件 @
adca5657
...
...
@@ -13,6 +13,7 @@
// | github 仓库地址 :https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
declare
(
strict_types
=
1
);
namespace
DtApp\ThinkLibrary\helper
;
...
...
@@ -27,11 +28,11 @@ class Requests
* 判断输入的参数
* @param array $data
* @param array $arr
* @return array
|bool
* @return array
*/
public
function
isEmpty
(
array
$data
,
array
$arr
)
public
function
isEmpty
(
array
$data
,
array
$arr
)
:
array
{
foreach
(
$arr
as
$k
=>
$v
)
if
(
empty
(
isset
(
$data
[
"
$v
"
])
?
$data
[
"
$v
"
]
:
''
))
return
false
;
foreach
(
$arr
as
$k
=>
$v
)
if
(
empty
(
isset
(
$data
[
"
$v
"
])
?
$data
[
"
$v
"
]
:
''
))
return
''
;
return
$data
;
}
...
...
@@ -41,7 +42,7 @@ class Requests
* @param array $arr
* @return array
*/
public
function
isEmptyRet
(
array
$data
,
array
$arr
)
public
function
isEmptyRet
(
array
$data
,
array
$arr
)
:
array
{
foreach
(
$arr
as
$k
=>
$v
)
if
(
empty
(
isset
(
$data
[
"
$v
"
])
?
$data
[
"
$v
"
]
:
''
))
\
DtApp\ThinkLibrary\facade\Returns
::
jsonError
(
'请检查参数'
,
102
);
return
$data
;
...
...
@@ -51,7 +52,7 @@ class Requests
* 判断是否为GET方式
* @return bool
*/
public
function
isGet
()
public
function
isGet
()
:
bool
{
return
request
()
->
isGet
();
}
...
...
@@ -60,7 +61,7 @@ class Requests
* 判断是否为POST方式
* @return bool
*/
public
function
isPost
()
public
function
isPost
()
:
bool
{
return
request
()
->
isPost
();
}
...
...
@@ -69,7 +70,7 @@ class Requests
* 判断是否为PUT方式
* @return boolean
*/
public
function
isPut
()
public
function
isPut
()
:
bool
{
return
request
()
->
isPut
();
}
...
...
@@ -78,7 +79,7 @@ class Requests
* 判断是否为DELETE方式
* @return boolean
*/
public
function
isDelete
()
public
function
isDelete
()
:
bool
{
return
request
()
->
isDelete
();
}
...
...
@@ -87,7 +88,7 @@ class Requests
* 判断是否为Ajax方式
* @return bool
*/
public
function
isAjax
()
public
function
isAjax
()
:
bool
{
return
request
()
->
isAjax
();
}
...
...
@@ -96,7 +97,7 @@ class Requests
* 获取域名地址
* @return string
*/
public
function
getWebsiteAddress
()
public
function
getWebsiteAddress
()
:
string
{
$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'
]
.
"/"
;
...
...
src/helper/UnIqIds.php
浏览文件 @
adca5657
...
...
@@ -13,6 +13,7 @@
// | github 仓库地址 :https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
declare
(
strict_types
=
1
);
namespace
DtApp\ThinkLibrary\helper
;
...
...
@@ -31,7 +32,7 @@ class UnIqIds
* @param string $prefix 编码前缀
* @return string
*/
public
function
random
(
$size
=
10
,
$type
=
1
,
$prefix
=
''
)
public
function
random
(
$size
=
10
,
$type
=
1
,
$prefix
=
''
)
:
string
{
$numbs
=
'0123456789'
;
$chars
=
'abcdefghijklmnopqrstuvwxyz'
;
...
...
@@ -51,7 +52,7 @@ class UnIqIds
* @param string $prefix
* @return string
*/
public
function
date
(
$size
=
16
,
$prefix
=
''
)
public
function
date
(
$size
=
16
,
$prefix
=
''
)
:
string
{
if
(
$size
<
14
)
$size
=
14
;
$string
=
$prefix
.
date
(
'Ymd'
)
.
(
date
(
'H'
)
+
date
(
'i'
))
.
date
(
's'
);
...
...
@@ -65,11 +66,11 @@ class UnIqIds
* @param string $prefix
* @return string
*/
public
function
number
(
$size
=
12
,
$prefix
=
''
)
public
function
number
(
$size
=
12
,
$prefix
=
''
)
:
string
{
$time
=
time
()
.
''
;
if
(
$size
<
10
)
$size
=
10
;
$string
=
$prefix
.
(
$time
[
0
]
+
$time
[
1
])
.
substr
(
$time
,
2
)
.
rand
(
0
,
9
);
$string
=
$prefix
.
(
$time
[
0
]
.
$time
[
1
])
.
substr
(
$time
,
2
)
.
rand
(
0
,
9
);
while
(
strlen
(
$string
)
<
$size
)
$string
.
=
rand
(
0
,
9
);
return
$string
;
}
...
...
src/helper/Urls.php
浏览文件 @
adca5657
...
...
@@ -13,6 +13,7 @@
// | github 仓库地址 :https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
declare
(
strict_types
=
1
);
namespace
DtApp\ThinkLibrary\helper
;
...
...
@@ -29,9 +30,9 @@ class Urls
* @param string $url
* @return string
*/
public
function
lenCode
(
string
$url
)
public
function
lenCode
(
string
$url
)
:
string
{
if
(
empty
(
$url
))
return
false
;
if
(
empty
(
$url
))
return
''
;
return
urlencode
(
$url
);
}
...
...
@@ -40,9 +41,9 @@ class Urls
* @param string $url
* @return string
*/
public
function
deCode
(
string
$url
)
public
function
deCode
(
string
$url
)
:
string
{
if
(
empty
(
$url
))
return
false
;
if
(
empty
(
$url
))
return
''
;
return
urldecode
(
$url
);
}
...
...
@@ -51,7 +52,7 @@ class Urls
* @param array $data
* @return string
*/
public
function
toParams
(
array
$data
)
public
function
toParams
(
array
$data
)
:
string
{
$buff
=
""
;
foreach
(
$data
as
$k
=>
$v
)
if
(
$k
!=
"sign"
&&
$v
!==
""
&&
!
is_array
(
$v
))
$buff
.
=
$k
.
"="
.
$v
.
"&"
;
...
...
src/service/WeChat/MessageManagementService.php
0 → 100644
浏览文件 @
adca5657
<?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\service\WeChat
;
use
DtApp\Curl\CurlException
;
use
DtApp\Curl\Get
;
use
DtApp\ThinkLibrary\Service
;
/**
* 微信公众号 - 消息管理
* Class MessageManagementService
* @package DtApp\ThinkLibrary\service\WeChat
*/
class
MessageManagementService
extends
Service
{
/**
* 设置所属行业
* https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html#0
* @param string $access_token
* @param array $data
* @return bool|mixed|string
* @throws CurlException
*/
public
function
setIndustry
(
string
$access_token
,
array
$data
=
[])
{
$url
=
"https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token=
{
$access_token
}
"
;
$curl
=
new
Get
();
if
(
is_array
(
$data
))
$data
=
json_encode
(
$data
);
return
$curl
->
http
(
$url
,
$data
,
true
);
}
}
src/service/WeMini/AccessTokenService.php
0 → 100644
浏览文件 @
adca5657
<?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\service\WeMini
;
use
DtApp\Curl\CurlException
;
use
DtApp\Curl\Get
;
use
DtApp\ThinkLibrary\Service
;
/**
* 微信小程序 - 接口调用凭据
* Class AccessTokenService
* @package DtApp\ThinkLibrary\service\WeMini
*/
class
AccessTokenService
extends
Service
{
/**
* 获取小程序全局唯一后台接口调用凭据(access_token)
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html
* @param string $appid
* @param string $secret
* @param string $grant_type
* @return bool|mixed|string
* @throws CurlException
*/
public
function
code2Session
(
string
$appid
,
string
$secret
,
string
$grant_type
=
'client_credential'
)
{
$url
=
"https://api.weixin.qq.com/cgi-bin/token?grant_type=
{
$grant_type
}
&appid=
{
$appid
}
&secret=
{
$secret
}
"
;
$curl
=
new
Get
();
return
$curl
->
http
(
$url
,
''
,
true
);
}
}
src/service/
Test
Service.php
→
src/service/
WeMini/CustomerMessage
Service.php
浏览文件 @
adca5657
...
...
@@ -14,19 +14,16 @@
// | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace
DtApp\ThinkLibrary\service
;
namespace
DtApp\ThinkLibrary\service
\WeMini
;
use
DtApp\ThinkLibrary\Service
;
/**
*
测试服务
* Class
Test
Service
* @package DtApp\ThinkLibrary\service
*
微信小程序 - 客服消息
* Class
CustomerMessage
Service
* @package DtApp\ThinkLibrary\service
\WeMini
*/
class
Test
Service
extends
Service
class
CustomerMessage
Service
extends
Service
{
public
function
index
()
{
return
'service.test.index'
;
}
}
src/service/WeMini/LoginService.php
0 → 100644
浏览文件 @
adca5657
<?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\service\WeMini
;
use
DtApp\Curl\CurlException
;
use
DtApp\Curl\Get
;
use
DtApp\ThinkLibrary\Service
;
/**
* 微信小程序 - 登录
* Class LoginService
* @package DtApp\ThinkLibrary\service\WeMini
*/
class
LoginService
extends
Service
{
/**
* 登录凭证校验
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html
* @param string $appid
* @param string $secret
* @param string $js_code
* @param string $grant_type
* @return bool|mixed|string
* @throws CurlException
*/
public
function
code2Session
(
string
$appid
,
string
$secret
,
string
$js_code
,
string
$grant_type
=
'authorization_code'
)
{
$url
=
"https://api.weixin.qq.com/sns/jscode2session?appid=
{
$appid
}
&secret=
{
$secret
}
&js_code=
{
$js_code
}
&grant_type=
{
$grant_type
}
"
;
$curl
=
new
Get
();
return
$curl
->
http
(
$url
,
''
,
true
);
}
}
src/service/WeMini/NewTmplService.php
浏览文件 @
adca5657
...
...
@@ -38,10 +38,10 @@ class NewTmplService extends Service
*/
public
function
addTemplate
(
string
$access_token
,
array
$data
=
[])
{
$url
=
"https://api.weixin.qq.com/wxaapi/newtmpl/addtemplate?access_token=
ACCESS_TOKEN
"
;
$url
=
"https://api.weixin.qq.com/wxaapi/newtmpl/addtemplate?access_token=
{
$access_token
}
"
;
$curl
=
new
Get
();
if
(
is_array
(
$data
))
$data
=
json_encode
(
$data
);
return
$curl
->
http
(
str_replace
(
'ACCESS_TOKEN'
,
$access_token
,
$url
)
,
$data
,
true
);
return
$curl
->
http
(
$url
,
$data
,
true
);
}
/**
...
...
@@ -54,13 +54,13 @@ class NewTmplService extends Service
*/
public
function
deleteTemplate
(
string
$access_token
,
string
$priTmplId
)
{
$url
=
"https://api.weixin.qq.com/wxaapi/newtmpl/deltemplate?access_token=
ACCESS_TOKEN
"
;
$url
=
"https://api.weixin.qq.com/wxaapi/newtmpl/deltemplate?access_token=
{
$access_token
}
"
;
$curl
=
new
Get
();
$data
=
[
'priTmplId'
=>
$priTmplId
];
if
(
is_array
(
$data
))
$data
=
json_encode
(
$data
);
return
$curl
->
http
(
str_replace
(
'ACCESS_TOKEN'
,
$access_token
,
$url
)
,
$data
,
true
);
return
$curl
->
http
(
$url
,
$data
,
true
);
}
/**
...
...
@@ -72,9 +72,9 @@ class NewTmplService extends Service
*/
public
function
getCategory
(
string
$access_token
)
{
$url
=
"https://api.weixin.qq.com/wxaapi/newtmpl/getcategory?access_token=
ACCESS_TOKEN
"
;
$url
=
"https://api.weixin.qq.com/wxaapi/newtmpl/getcategory?access_token=
{
$access_token
}
"
;
$curl
=
new
Get
();
return
$curl
->
http
(
str_replace
(
'ACCESS_TOKEN'
,
$access_token
,
$url
)
,
''
,
true
);
return
$curl
->
http
(
$url
,
''
,
true
);
}
/**
...
...
@@ -87,13 +87,13 @@ class NewTmplService extends Service
*/
public
function
getPubTemplateKeyWordsById
(
string
$access_token
,
string
$tid
)
{
$url
=
"https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatekeywords?access_token=
ACCESS_TOKEN
"
;
$url
=
"https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatekeywords?access_token=
{
$access_token
}
"
;
$curl
=
new
Get
();
$data
=
[
'tid'
=>
$tid
];
if
(
is_array
(
$data
))
$data
=
json_encode
(
$data
);
return
$curl
->
http
(
str_replace
(
'ACCESS_TOKEN'
,
$access_token
,
$url
)
,
$data
,
true
);
return
$curl
->
http
(
$url
,
$data
,
true
);
}
/**
...
...
@@ -106,10 +106,10 @@ class NewTmplService extends Service
*/
public
function
getPubTemplateTitleList
(
string
$access_token
,
array
$data
=
[])
{
$url
=
"https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles?access_token=
ACCESS_TOKEN
"
;
$url
=
"https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles?access_token=
{
$access_token
}
"
;
$curl
=
new
Get
();
if
(
is_array
(
$data
))
$data
=
json_encode
(
$data
);
return
$curl
->
http
(
str_replace
(
'ACCESS_TOKEN'
,
$access_token
,
$url
)
,
$data
,
true
);
return
$curl
->
http
(
$url
,
$data
,
true
);
}
/**
...
...
@@ -121,9 +121,9 @@ class NewTmplService extends Service
*/
public
function
getTemplateList
(
string
$access_token
)
{
$url
=
"https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate?access_token=
ACCESS_TOKEN
"
;
$url
=
"https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate?access_token=
{
$access_token
}
"
;
$curl
=
new
Get
();
return
$curl
->
http
(
str_replace
(
'ACCESS_TOKEN'
,
$access_token
,
$url
)
,
''
,
true
);
return
$curl
->
http
(
$url
,
''
,
true
);
}
/**
...
...
@@ -136,9 +136,9 @@ class NewTmplService extends Service
*/
public
function
send
(
string
$access_token
,
array
$data
=
[])
{
$url
=
"https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=
ACCESS_TOKEN
"
;
$url
=
"https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=
{
$access_token
}
"
;
$curl
=
new
Post
();
return
$curl
->
http
(
str_replace
(
'ACCESS_TOKEN'
,
$access_token
,
$url
)
,
$data
,
true
);
return
$curl
->
http
(
$url
,
$data
,
true
);
}
}
src/service/WeMini/QrCodeService.php
0 → 100644
浏览文件 @
adca5657
<?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\service\WeMini
;
use
DtApp\Curl\CurlException
;
use
DtApp\Curl\Post
;
use
DtApp\ThinkLibrary\Service
;
/**
* 微信小程序 - 小程序码
* Class QrCodeService
* @package DtApp\ThinkLibrary\service\WeMini
*/
class
QrCodeService
extends
Service
{
/**
* 获取小程序二维码,适用于需要的码数量较少的业务场景。通过该接口生成的小程序码,永久有效,有数量限制
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.createQRCode.html
* @param string $access_token 接口调用凭证
* @param array $data
* @return array|bool|mixed|string
* @throws CurlException
*/
public
function
createWxaQrCode
(
string
$access_token
,
array
$data
=
[])
{
$url
=
"https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=
{
$access_token
}
"
;
$curl
=
new
Post
();
return
$curl
->
http
(
$url
,
$data
);
}
/**
* 获取小程序码,适用于需要的码数量较少的业务场景。通过该接口生成的小程序码,永久有效,有数量限制
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.get.html
* @param string $access_token
* @param array $data
* @return array|bool|mixed|string
* @throws CurlException
*/
public
function
getWxaCode
(
string
$access_token
,
array
$data
=
[])
{
$url
=
"https://api.weixin.qq.com/wxa/getwxacode?access_token=
{
$access_token
}
"
;
$curl
=
new
Post
();
return
$curl
->
http
(
$url
,
$data
);
}
/**
* 获取小程序码,适用于需要的码数量极多的业务场景。通过该接口生成的小程序码,永久有效,数量暂无限制
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.getUnlimited.html
* @param string $access_token
* @param array $data
* @return array|bool|mixed|string
* @throws CurlException
*/
public
function
getWxaCodeUnLimit
(
string
$access_token
,
array
$data
=
[])
{
$url
=
"https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=
{
$access_token
}
"
;
$curl
=
new
Post
();
return
$curl
->
http
(
$url
,
$data
);
}
}
src/service/WeMini/UserInfoService.php
0 → 100644
浏览文件 @
adca5657
<?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\service\WeMini
;
use
DtApp\Curl\CurlException
;
use
DtApp\Curl\Get
;
use
DtApp\ThinkLibrary\Service
;
/**
* 微信小程序 - 用户信息
* Class UserInfoService
* @package DtApp\ThinkLibrary\service\WeMini
*/
class
UserInfoService
extends
Service
{
/**
* 用户支付完成后,获取该用户的 UnionId,无需用户授权
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.getPaidUnionId.html
* @param string $access_token
* @param string $openid
* @return bool|mixed|string
* @throws CurlException
*/
public
function
getPaidUnionId
(
string
$access_token
,
string
$openid
)
{
$url
=
"https://api.weixin.qq.com/wxa/getpaidunionid?access_token=
{
$access_token
}
&openid=
{
$openid
}
"
;
$curl
=
new
Get
();
return
$curl
->
http
(
$url
,
''
,
true
);
}
}
src/service/ip/QqWryService.php
0 → 100644
浏览文件 @
adca5657
<?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\service\ip
;
use
DtApp\ThinkLibrary\Service
;
/**
* IP-纯真数据库
* Class QqWryService
* @package DtApp\ThinkLibrary\service\ip
*/
class
QqWryService
extends
Service
{
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录