Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ylc.llewan.com
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
llewan
ylc.llewan.com
Commits
68d8bff1
Commit
68d8bff1
authored
Jan 19, 2019
by
734642908@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试广告投放
parent
17a1e476
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
128 additions
and
0 deletions
+128
-0
FlushController.class.php
Application/Home/Controller/FlushController.class.php
+128
-0
No files found.
Application/Home/Controller/FlushController.class.php
View file @
68d8bff1
...
...
@@ -69,6 +69,27 @@ class FlushController extends BaseController
}
public
function
cdnUrl
()
{
// $refreshURL = I("post.refresh_url",0);
$refreshURL
=
"https://res.g.llewan.com/uploadfile/common/qubapikashu-weixin/1.0.1/monsterData.json"
;
$url
=
"https://cdn.api.qcloud.com/v2/index.php?"
;
$params
[
'Action'
]
=
"RefreshCdnUrl"
;
$params
[
'Nonce'
]
=
rand
(
1000000000
,
9999999999
);
$params
[
'SecretId'
]
=
"AKIDghFh1BTzd5Njz4gtfHiy7B8veCZlucIo"
;
$params
[
'Timestamp'
]
=
time
();
$params
[
'urls.0'
]
=
$refreshURL
;
$secretKey
=
"ZzEJLPOH4mOGKbxGSUTHuMcidMwLZcT9"
;
$origin
=
"GETcdn.api.qcloud.com/v2/index.php?Action=RefreshCdnUrl&Nonce=
{
$params
[
'Nonce'
]
}
&SecretId=
{
$params
[
'SecretId'
]
}
&Timestamp=
{
$params
[
'Timestamp'
]
}
&urls.0=
{
$refreshURL
}
"
;
$origin
=
str_replace
(
'_'
,
'.'
,
$origin
);
$signStr
=
base64_encode
(
hash_hmac
(
'sha1'
,
$origin
,
$secretKey
,
true
));
$params
[
'Signature'
]
=
$signStr
;
$cdnRefreshURL
=
$url
.
http_build_query
(
$params
);
$result
=
file_get_contents
(
$cdnRefreshURL
);
echo
(
$result
);
}
public
function
testId
()
{
//连接本地的 Redis 服务
$redis
=
S
(
C
(
'REDIS'
));
...
...
@@ -95,6 +116,113 @@ class FlushController extends BaseController
$redis
->
del
(
'test_lock'
);
}
public
function
xcxQrcode
()
{
$appid
=
'wx62cbdff21c74d69d'
;
$secret
=
'42df86aa686101282378b8f42be23f48'
;
$url
=
'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='
.
$appid
.
'&secret='
.
$secret
;
$token
=
file_get_contents
(
$url
);
$token
=
json_decode
(
$token
,
true
)[
'access_token'
];
$send_url
=
"https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="
.
$token
;
$send_url
=
"https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token="
.
$token
;
$send_url
=
"https://api.weixin.qq.com/wxa/getwxacode?access_token="
.
$token
;
$postArr
=
array
(
// 'scene'=>'source_id=181818'
'path'
=>
'pages/index/index?source_id=2002'
,
'width'
=>
'280'
);
$re
=
curlPost
(
$send_url
,
json_encode
(
$postArr
)
);
file_put_contents
(
'new2002.jpg'
,
$re
);
}
//发起微信小程序支付参数处理
public
function
wechatXcxSign
()
{
$data
[
'wxappid'
]
=
'wxde2c29b8d9349652'
;
$data
[
'mch_id'
]
=
'1509771971'
;
$data
[
'nonce_str'
]
=
uniqid
()
.
mt_rand
();
$data
[
'send_name'
]
=
'测试红包'
;
$data
[
'mch_billno'
]
=
'1509771971'
.
date
(
'Ymd'
)
.
time
();
$data
[
'total_amount'
]
=
1
;
$data
[
'total_num'
]
=
1
;
$data
[
'client_ip'
]
=
'111.230.107.18'
;
$data
[
'notify_way'
]
=
'JSAPI'
;
$data
[
'wishing'
]
=
'红包祝福语'
;
$data
[
'act_name'
]
=
'活动名称'
;
$data
[
'remark'
]
=
'备注'
;
$data
[
're_openid'
]
=
'oPftV44nnKGy1QBAO67-4To7kvDo'
;
$sign
=
wechatCreateSign
(
$data
);
$textTpl
=
"<xml>
<wxappid><![CDATA[%s]]></wxappid>
<mch_id><![CDATA[%s]]></mch_id>
<nonce_str><![CDATA[%s]]></nonce_str>
<send_name><![CDATA[%s]]></send_name>
<mch_billno><![CDATA[%s]]></mch_billno>
<total_amount><![CDATA[%s]]></total_amount>
<total_num><![CDATA[%s]]></total_num>
<client_ip><![CDATA[%s]]></client_ip>
<notify_way><![CDATA[%s]]></notify_way>
<wishing><![CDATA[%s]]></wishing>
<act_name><![CDATA[%s]]></act_name>
<remark><![CDATA[%s]]></remark>
<re_openid><![CDATA[%s]]></re_openid>
<sign><![CDATA[%s]]></sign>
</xml>"
;
$resultStr
=
sprintf
(
$textTpl
,
$data
[
'appid'
],
$data
[
'mch_id'
],
$data
[
'nonce_str'
],
$data
[
'send_name'
],
$data
[
'mch_billno'
],
$data
[
'total_amount'
],
$data
[
'total_num'
],
$data
[
'client_ip'
],
$data
[
'notify_way'
],
$data
[
'wishing'
],
$data
[
'act_name'
],
$data
[
'remark'
],
$data
[
're_openid'
],
$sign
);
$wechatOrder
=
curlPost
(
'https://api.mch.weixin.qq.com/mmpaymkttransfers/sendminiprogramhb'
,
$resultStr
,
true
);
var_dump
(
$wechatOrder
);
exit
;
$orderObj
=
json_decode
(
json_encode
(
simplexml_load_string
(
$wechatOrder
,
'SimpleXMLElement'
,
LIBXML_NOCDATA
)),
true
);
if
(
!
empty
(
$orderObj
[
'prepay_id'
]))
{
$payArr
=
array
(
'appId'
=>
'wxfaf41889efd69020'
,
'package'
=>
'prepay_id='
.
$orderObj
[
'prepay_id'
]
,
'nonceStr'
=>
uniqid
()
.
mt_rand
()
,
'timeStamp'
=>
time
()
,
'signType'
=>
'MD5'
);
$xcxPayArr
=
array
(
'package'
=>
'prepay_id='
.
$orderObj
[
'prepay_id'
]
,
'nonceStr'
=>
$payArr
[
'nonceStr'
]
,
'timeStamp'
=>
strval
(
$payArr
[
'timeStamp'
])
,
'signType'
=>
'MD5'
,
'paySign'
=>
$this
->
wechatCreateSign
(
$payArr
)
);
return
$xcxPayArr
;
}
return
array
(
'description'
=>
$wechatOrder
);
}
public
function
actionSet
()
{
//access_token无效重新获取
$url
=
'https://game.test.llewan.com/config/getToken'
;
$token
=
file_get_contents
(
$url
);
$tokenArr
=
json_decode
(
$token
,
true
);
if
(
!
empty
(
$tokenArr
[
'd'
][
'token'
]))
{
$actionUrl
=
'https://api.weixin.qq.com/marketing/user_action_sets/add?version=v1.0&access_token='
.
$tokenArr
[
'd'
][
'token'
];
$postData
=
array
(
'type'
=>
'WEB'
,
'name'
=>
'firstTest'
,
'"description"'
=>
'第一次测试获取数据源ID'
);
$setId
=
curlPost
(
$actionUrl
,
$postData
,
true
);
var_dump
(
$setId
);
}
else
{
exit
(
json_encode
(
array
(
'c'
=>
2
,
'msg'
=>
'获取失败'
,
'error'
=>
$tokenArr
[
'error'
])));
}
}
}
...
...
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