private function reflashSource() { $getTime = json_decode(file_get_contents($GLOBALS['mypath'] . '/tmpfiles/jock_time.dat'), true); if (date('d', time()) != date('d', $getTime['gettedTime'])) { $mhand = new interfaceHandler($GLOBALS['weixinId']); $jock = $mhand->getByCurl('http://api.laifudao.com/open/xiaohua.json'); $jock = preg_replace('/\\,\\]$/', ']', $jock); file_put_contents($GLOBALS['mypath'] . '/tmpfiles/jock.dat', $jock); // wxlog('getJockOnline'); $temp = json_encode(array('gettedTime' => time())); file_put_contents($GLOBALS['mypath'] . '/tmpfiles/jock_time.dat', $temp); $this->initJokeNum($jock); } }
public function getlist() { $mhandler = new interfaceHandler(); $data = $mhandler->postByCurl('http://dynamic.12306.cn/otsquery/query/queryRemanentTicketAction.do?method=queryststrainall', 'date=2015-5-7&fromstation=BJP&tostation=SHH&starttime=00:00--24:00'); return $data; }
if (0 == $inf['stu']) { $date = array(); $date['appid'] = APP_ID; $date['mch_id'] = MCH_ID; $date['nonce_str'] = getRandStr(32); $date['body'] = 'gshopPay'; $date['spbill_create_ip'] = $_SERVER['REMOTE_ADDR']; $date['out_trade_no'] = $_POST['order_id']; $date['total_fee'] = $inf['total_fee'] * 100; $date['notify_url'] = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; $date['trade_type'] = 'JSAPI'; $date['openid'] = $inf['c_id']; $sign = makeSign($date, KEY); $date['sign'] = $sign; $xml = toXml($date); $handler = new interfaceHandler(WEIXIN_ID); $data = $handler->postByCurl('https://api.mch.weixin.qq.com/pay/unifiedorder', $xml); // mylog('prePayInf:' . $data); $dataArray = xmlToArray($data); $dataJson = json_encode($dataArray, JSON_UNESCAPED_UNICODE); // mylog('formated payInf' . getArrayInf($dataArray)); } if ('SUCCESS' == $dataArray['return_code']) { if ('SUCCESS' == $dataArray['result_code']) { if (signVerify($dataArray)) { $_SESSION['userKey']['package'] = 'prepay_id=' . $dataArray['prepay_id']; echo 'ok'; exit; } } else { echo '支付失败,错误代码' . $dataArray['err_code'] . ':' . $dataArray['err_code'] . $dataArray['err_code_des'];
function getUnionId($openId, $weixinId = 0) { if ($GLOBALS['ready']) { $itfc = $GLOBALS['mInterface']; } else { $itfc = new interfaceHandler($weixinId); } $url = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=' . $openId . '&lang=zh_CN'; $jsonData = $itfc->getByCurl($url); return json_decode($jsonData, true); }