diff --git a/show/get.php b/show/get.php index 61a042f..fbe7aea 100644 --- a/show/get.php +++ b/show/get.php @@ -234,13 +234,15 @@ if($act == 'applet_unifiedorder') { $host = $_SERVER['HTTP_HOST']; $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; + $nonce_str = md5(time()."_".rand()); + $code = get_code('tb_recharge_pay_weixin', 'code', 12, 'num', "FTDC".date("Ymd")); $time_expire = date("YmdHis", time()+600); $data = array(); $data['appid'] = $applet_appid; $data['body'] = '订餐系统-充值'.($total_fee/100)."元"; $data['mch_id'] = $applet_mch_id; - $data['nonce_str'] = md5(time()."_".rand()); + $data['nonce_str'] = $nonce_str; $data['notify_url'] = "https://yzms.fsecity.com/show/wxpay_recv.php"; $data['out_trade_no'] = $code; $data['spbill_create_ip'] = $_SERVER['REMOTE_ADDR']; @@ -291,14 +293,14 @@ if($act == 'applet_unifiedorder') { } //临时增加redirect_url - $ua = $_SERVER['HTTP_USER_AGENT']; -// if(!stristr($ua, "android")) $mweb_url.= "&redirect_url=".urlencode($protocol.$host."/m/wx.html"); - $sql = "insert into tb_recharge_pay_weixin set code='{$code}', trade_type='{$trade_type}', uid={$uid}, prepay_id='{$prepay_id}', total_fee=".($total_fee/100).", time_expire='{$time_expire}', state=0, is_applet=1, addtime=now()"; - //echo $sql; - $db->query($sql, 'SILENT'); - if($db->affected_rows() != 1) { - echoRs(0, '下单失败!请重试2!'); - } +// $ua = $_SERVER['HTTP_USER_AGENT']; +//// if(!stristr($ua, "android")) $mweb_url.= "&redirect_url=".urlencode($protocol.$host."/m/wx.html"); +// $sql = "insert into tb_recharge_pay_weixin set code='{$code}', trade_type='{$trade_type}', uid={$uid}, prepay_id='{$prepay_id}', total_fee=".($total_fee/100).", time_expire='{$time_expire}', state=0, is_applet=1, addtime=now()"; +// //echo $sql; +// $db->query($sql, 'SILENT'); +// if($db->affected_rows() != 1) { +// echoRs(0, '下单失败!请重试2!'); +// } $data = array(); // if($isjsapi) { // @@ -313,7 +315,7 @@ if($act == 'applet_unifiedorder') { $signData['appId'] = $applet_mch_id; $signData['timeStamp'] = time(); - $signData['nonceStr'] = md5(time()."_".rand()); + $signData['nonceStr'] = $nonce_str; $signData['package'] = "prepay_id=".$prepay_id; $signData['signType'] = "MD5"; ksort($signData); @@ -323,7 +325,7 @@ if($act == 'applet_unifiedorder') { $s2 .= $key."=".$item; } $s2 .= "&key=".$applet_key; - $signData['paySign'] = strtoupper(md5($s2)); + $signData['paySign'] = md5($s2); $data['requestPayment'] = $signData; echoRs(1, 'ok', array('data' => $data));