Change-Id: I9f5c9f88941acd89a609dc060cccd21058f68605
This commit is contained in:
vguanyiwgd 2024-05-21 17:03:04 +08:00
parent 9c33b22796
commit 3eb5bd4741
2 changed files with 115 additions and 6 deletions

View File

@ -40,9 +40,3 @@ $params = json_decode(base64_decode($str), true);
$head = $params['message']['head'];
$info = $params['message']['info'];
echo "<pre>";
print_r($params);
echo "</pre>";
exit;

115
api/nh_cz.php Normal file
View File

@ -0,0 +1,115 @@
<?
require_once("nh_config.php");
//ini_set("display_errors", 'on');
echo "<pre>";
print_r($params);
echo "</pre>";
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);