update
This commit is contained in:
parent
16308b9303
commit
e3a2df651e
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
//微信App_ID已及APP_Secret
|
||||
const WEIXIN_APP_ID = 'wxfa9c8ea6a55f00d0';
|
||||
const WEIXIN_APP_SECRET = '999712592d00ad2f75b04421e030ba04';
|
||||
const WEIXIN_API_URL = 'https://api.weixin.qq.com/sns/jscode2session';
|
||||
const WEIXIN_MSG_KEY = 'MzebhFcmcIFT85xOr5TnrDVeLx5HMbpgAl5gw2PVvhX';
|
||||
const WEIXIN_TOKEN = 'kingsome';
|
||||
const WEIXIN_THUMB_URL = 'http://mmbiz.qpic.cn/mmbiz_jpg/6zVc6fZKcB3zuNoqEULTjPSHPcaR26qciaSykxSCvw4SSq1I4Y6TAp7udB2BjST4YB9NedeRFfywlUt3AunAcJg/0';
|
||||
const WEIXIN_THUMB_MEDIA_ID = 'h2oYnOGns5T7wcJmjFGWTsYnkz3j9Et3258n9xZ8eezOj-8Dzsk23Ao6SzHgV20A';
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
array(
|
||||
'instance_id' => 1,
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 3306,
|
||||
'user' => 'root',
|
||||
'passwd' => 'keji178',
|
||||
),
|
||||
);
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
array(
|
||||
'instance_id' => 1,
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'passwd' => ''
|
||||
),
|
||||
array(
|
||||
'instance_id' => 2,
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'passwd' => ''
|
||||
),
|
||||
);
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'1011' => array (
|
||||
"title" => '领取奖励',
|
||||
"pagepath" => "http://mmbiz.qpic.cn/mmbiz_jpg/" .
|
||||
"6zVc6fZKcB3zuNoqEULTjPSHPcaR26qciaSykxSCvw4SSq1I4Y6TAp7udB2BjST4YB9NedeRFfywlUt3AunAcJg/0",
|
||||
"thumb_media_id" => 'h2oYnOGns5T7wcJmjFGWTsYnkz3j9Et3258n9xZ8eezOj-8Dzsk23Ao6SzHgV20A'
|
||||
)
|
||||
);
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"listen_port": 10001,
|
||||
"notify_url": "https://kefu-test.kingsome.cn/webapp/index.php?c=Kefu&a=sendMsgAllUser",
|
||||
"sendtime1": 32400,
|
||||
"sendtime2": 64800,
|
||||
"sendtime3": 0
|
||||
}
|
@ -10,14 +10,19 @@ import tornado.ioloop
|
||||
import tornado.web
|
||||
|
||||
def md5Sign(params, secret, timestamp, connstr = '&', secret_connstr = ':'):
|
||||
print('md5in')
|
||||
print(params)
|
||||
params_str = ''
|
||||
for key in sorted(params.keys()):
|
||||
params_str = params_str + key + '=' + str(params[key]) + connstr
|
||||
print(params_str)
|
||||
if params_str != '' and connstr != '':
|
||||
params_str = params_str[0:-1]
|
||||
m = hashlib.md5()
|
||||
m.update(params_str)
|
||||
return m.hexdigest() + secret_connstr + str(timestamp) + secret
|
||||
m5 = hashlib.md5()
|
||||
|
||||
str1 = params_str + secret_connstr + str(timestamp) + secret
|
||||
m5.update(str1)
|
||||
return m5.hexdigest()
|
||||
|
||||
def getDaySeconds(time_val, incdays):
|
||||
time_zone = 8
|
||||
@ -25,7 +30,14 @@ def getDaySeconds(time_val, incdays):
|
||||
|
||||
def sendNotify(conf, sendtime):
|
||||
try:
|
||||
url = conf['notify_url']
|
||||
print('sendNotify')
|
||||
params = {'key' : 'kingsome'}
|
||||
secret = 'fc38349c5d084e920925e614c420be9f'
|
||||
timestamp = time.time()
|
||||
md5signstr = md5Sign(params, secret, timestamp)
|
||||
print(md5signstr)
|
||||
url = conf['notify_url'] + '×tamp=' + timestamp + '&sign=' + md5signstr
|
||||
print(url)
|
||||
req = urllib.request.Request(url)
|
||||
data = urllib.request.urlopen(req).readall()
|
||||
except:
|
||||
|
@ -409,7 +409,20 @@ class KefuController {
|
||||
public function sendMsgAllUser()
|
||||
{
|
||||
error_log('sendMsgAllUser:');
|
||||
#error_log('request:' . json_encode($_REQUEST['xxx']));
|
||||
error_log('request:' . json_encode($_REQUEST));
|
||||
if (phpcommon\md5Sign(array
|
||||
(
|
||||
'exclude_accountids' => $_REQUEST['key']
|
||||
),
|
||||
'fc38349c5d084e920925e614c420be9f',
|
||||
$_REQUEST['timestamp']
|
||||
) != $_REQUEST['sign']) {
|
||||
echo json_encode(array(
|
||||
'errcode' => 100,
|
||||
'errmsg' => '签名错误',
|
||||
));
|
||||
return;
|
||||
}
|
||||
$mysqls = $this->getAllMysql();
|
||||
foreach($mysqls as $mysql_conf) {
|
||||
$conn = $this->getAppointMysql($mysql_conf);
|
||||
|
@ -81,7 +81,7 @@ class WXBizMsgCrypt
|
||||
$encryptMsg = $xmlparse->generate($encrypt, $signature, $timeStamp, $nonce);
|
||||
return ErrorCode::$OK;
|
||||
}
|
||||
|
||||
|
||||
public function encryptJsonMsg($replyMsg, $timeStamp, $nonce, &$encryptMsg)
|
||||
{
|
||||
$pc = new Prpcrypt($this->encodingAesKey);
|
||||
@ -199,16 +199,16 @@ class WXBizMsgCrypt
|
||||
|
||||
$postData = json_decode($postData_str, true);
|
||||
$encrypt = $postData['Encrypt'];
|
||||
$touser_name = $postData['TuUserName'];
|
||||
#$touser_name = $postData['TuUserName'];
|
||||
|
||||
#error_log('token:' . $this->token);
|
||||
#error_log('timestamp:' . $timestamp);
|
||||
#error_log('nonce:' . $nonce);
|
||||
#error_log('encypt:' . $encrypt);
|
||||
|
||||
|
||||
//验证安全签名
|
||||
$sha1 = new SHA1;
|
||||
error_log('解密encrypt:' . $encrypt);
|
||||
#error_log('解密encrypt:' . $encrypt);
|
||||
$array = $sha1->getSHA1($this->token, $timestamp, $nonce, $encrypt);
|
||||
$ret = $array[0];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user