From 3eb5bd474118b5241951ce91279136131120d58d Mon Sep 17 00:00:00 2001 From: vguanyiwgd Date: Tue, 21 May 2024 17:03:04 +0800 Subject: [PATCH] update Change-Id: I9f5c9f88941acd89a609dc060cccd21058f68605 --- api/nh_config.php | 6 --- api/nh_cz.php | 115 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 6 deletions(-) create mode 100644 api/nh_cz.php diff --git a/api/nh_config.php b/api/nh_config.php index bbd8360..c629ef3 100644 --- a/api/nh_config.php +++ b/api/nh_config.php @@ -40,9 +40,3 @@ $params = json_decode(base64_decode($str), true); $head = $params['message']['head']; $info = $params['message']['info']; - - -echo "
";
-print_r($params);
-echo "
"; -exit; \ No newline at end of file diff --git a/api/nh_cz.php b/api/nh_cz.php new file mode 100644 index 0000000..c82d8de --- /dev/null +++ b/api/nh_cz.php @@ -0,0 +1,115 @@ +"; +print_r($params); +echo ""; +exit; +$name = $info['input1']; +$cellphone = $info['input2']; +$oaid = $info['input3']; + + +$err_code = ''; +$err_message = ''; + +$row = $db->get_one("select * from tb_user where cellphone = '".addslashes($cellphone)."' and (username = '".addslashes($name)."' or username = '".addslashes($db->dbenc($name))."') and oaid='".addslashes($oaid)."' and enabled != '0'"); + +if(!$row) { + $err_code = 'JH02'; + $err_message = '用户信息不存在'; +} + +$uid = $row['id']; + +if($err_code) { + $info_r = array ( + 'format' => 'json', + 'message' => array ( + 'head' => array ( + 'channel' => $head['channel'], + 'returnCode' => $err_code, + 'returnMessage' => $err_message, + 'timeStamp' => date("YmdHis")."000", + 'transCode' => 'queryBill', + 'transFlag' => '02', + 'transSeqNum' => $head['transSeqNum'], + ), + 'info' => array ( + // 'custName' => $info['input1'], + 'epayCode' => $info['epayCode'], + 'input1' => $info['input1'], + 'input2' => $info['input2'], + 'input3' => $info['input3'], + // 'merchantId' => $nh_merchantId, + 'remark' => '', + 'totalBillCount' => '0', + 'traceNo' => $info['traceNo'], + + 'bills' => array ( + + ), + + ), + ), + ); +} else { + $payBillNo = 'YZMSCZ'.md5(microtime().rand()); + $info_r = array ( + 'format' => 'json', + 'message' => array ( + 'head' => array ( + 'channel' => $head['channel'], + 'returnCode' => '0000', + 'returnMessage' => '查询成功', + 'timeStamp' => date("YmdHis")."000", + 'transCode' => 'queryBill', + 'transFlag' => '02', + 'transSeqNum' => $head['transSeqNum'], + ), + 'info' => array ( + // 'custName' => $info['input1'], + 'epayCode' => $info['epayCode'], + 'input1' => $info['input1'], + 'input2' => $info['input2'], + 'input3' => $info['input3'], + 'merchantId' => $nh_merchantId, + 'remark' => '', + 'totalBillCount' => '1', + 'traceNo' => $info['traceNo'], + + 'bills' => array ( + array ( + 'billName' => '饭堂充值', + 'billNo' => $payBillNo, + /*'descDetails' => array ( + array ( + 'sCpt' => '姓名:', + 'sVal' => $info['input1'], + ), + array ( + 'sCpt' => '学号:', + 'sVal' => $info['input2'], + ), + ),*/ + 'expireDate' => date("Ymd", time()+86400), + 'feeAmt' => '0.00', + 'oweAmt' => '0.00', + ), + ), + + ), + ), + ); + $db->query("insert into tb_recharge_nhcz_log set payBillNo = '".addslashes($payBillNo)."', input1 = '".addslashes($info['input1'])."', input2 = '".addslashes($info['input2'])."', uid = '".$uid."', traceNo = '".addslashes($info['traceNo'])."', transSeqNum = '".addslashes($head['transSeqNum'])."', amount = '0', addtime = now() "); +} +$rs = base64_encode(json_encode($info_r, JSON_UNESCAPED_UNICODE)); + +openssl_sign($rs, $signedMsg, $privatekey); + +$sign = base64_encode($signedMsg); +echo $sign."||".$rs; +//file_put_contents("3.txt", $sign."||".$rs); \ No newline at end of file