Merge branch 'main' of http://47.92.79.122:3000/liaoyk/yzms
This commit is contained in:
commit
a4596fd009
102
show/api_pos.php
102
show/api_pos.php
|
@ -11,7 +11,8 @@ $json = file_get_contents("php://input");
|
||||||
$post = json_decode($json, true, 512, JSON_BIGINT_AS_STRING);
|
$post = json_decode($json, true, 512, JSON_BIGINT_AS_STRING);
|
||||||
|
|
||||||
$serialno = $post['serialno'];
|
$serialno = $post['serialno'];
|
||||||
if(!$serialno) exit;
|
if (!$serialno)
|
||||||
|
exit;
|
||||||
|
|
||||||
// 获取数据库表数据,POS机设备信息
|
// 获取数据库表数据,POS机设备信息
|
||||||
$deviceInfo = $db->get_one("select * from tb_pos_device where serialno = '" . addslashes($serialno) . "'");
|
$deviceInfo = $db->get_one("select * from tb_pos_device where serialno = '" . addslashes($serialno) . "'");
|
||||||
|
@ -35,6 +36,7 @@ if(strlen($s1) > 2000) {
|
||||||
$db->query("insert into tb_pos_device_log set device_id = {$device_id}, serialno = '" . addslashes($serialno) . "', ip = '" . addslashes($ip) . "', path = '" . addslashes($qs) . "', request = '" . addslashes($s1) . "', response = '', addtime = now() ");
|
$db->query("insert into tb_pos_device_log set device_id = {$device_id}, serialno = '" . addslashes($serialno) . "', ip = '" . addslashes($ip) . "', path = '" . addslashes($qs) . "', request = '" . addslashes($s1) . "', response = '', addtime = now() ");
|
||||||
// 获取最近一次成功插入的记录的自增id
|
// 获取最近一次成功插入的记录的自增id
|
||||||
$log_id = $db->insert_id();
|
$log_id = $db->insert_id();
|
||||||
|
// 如果设备表中没有对应设备的信息,则更新设备记录表并直接返回
|
||||||
if (!$deviceInfo) {
|
if (!$deviceInfo) {
|
||||||
$db->query("update tb_pos_device_log set response='no_device' where id=" . $log_id);
|
$db->query("update tb_pos_device_log set response='no_device' where id=" . $log_id);
|
||||||
exit;
|
exit;
|
||||||
|
@ -54,12 +56,14 @@ if($sign2 !== $post['sign']) { //签名错误
|
||||||
|
|
||||||
// 将api和data数据处理编码后插入到tb_pos_device_log表,并终止脚本运行
|
// 将api和data数据处理编码后插入到tb_pos_device_log表,并终止脚本运行
|
||||||
// 回应时填充参数、返回的API接口数据、错误提示等。
|
// 回应时填充参数、返回的API接口数据、错误提示等。
|
||||||
function response_pos($api, $data) {
|
function response_pos($api, $data)
|
||||||
|
{
|
||||||
global $deviceInfo, $post, $log_id, $db;
|
global $deviceInfo, $post, $log_id, $db;
|
||||||
$noncestr = md5(microtime() . '_' . rand());
|
$noncestr = md5(microtime() . '_' . rand());
|
||||||
$time = time();
|
$time = time();
|
||||||
// 签名计算
|
// 签名计算
|
||||||
$sign = md5($time.$noncestr.$deviceInfo['cardpwd']);
|
$sign = md5($time.$noncestr.$deviceInfo['cardpwd']);
|
||||||
|
$sign = md5($time . $noncestr . $deviceInfo['cardpwd']);
|
||||||
$data['sign'] = $sign;
|
$data['sign'] = $sign;
|
||||||
|
|
||||||
$data['api'] = $api;
|
$data['api'] = $api;
|
||||||
|
@ -73,12 +77,14 @@ function response_pos($api, $data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 向本机地址发送请求,拼接端口号、路径、post参数和header,调用自定义gquery函数
|
// 向本机地址发送请求,拼接端口号、路径、post参数和header,调用自定义gquery函数
|
||||||
function self_query($path, $post) {
|
function self_query($path, $post)
|
||||||
|
{
|
||||||
return gquery("http://127.0.0.1:" . $_SERVER['SERVER_PORT'] . $path, $post, array('Host: ' . $_SERVER['SERVER_NAME']));
|
return gquery("http://127.0.0.1:" . $_SERVER['SERVER_PORT'] . $path, $post, array('Host: ' . $_SERVER['SERVER_NAME']));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从post参数中获取pay_mode等参数,实时消费接口中使用,包括infoquery takemeal takemealok posonline
|
// 从post参数中获取pay_mode等参数,实时消费接口中使用,包括infoquery takemeal takemealok posonline
|
||||||
function pos_check_user() {
|
function pos_check_user()
|
||||||
|
{
|
||||||
global $post, $db, $company_id;
|
global $post, $db, $company_id;
|
||||||
|
|
||||||
$pay_mode = $post['params']['pay_mode'];
|
$pay_mode = $post['params']['pay_mode'];
|
||||||
|
@ -88,16 +94,19 @@ function pos_check_user() {
|
||||||
// 返回code值和type
|
// 返回code值和type
|
||||||
if ($pay_mode == '5') { //二维码
|
if ($pay_mode == '5') { //二维码
|
||||||
$qr_code = trim($post['params']['qr_code']);
|
$qr_code = trim($post['params']['qr_code']);
|
||||||
if(!$qr_code) exit;
|
if (!$qr_code)
|
||||||
|
exit;
|
||||||
|
|
||||||
if(substr($qr_code, 0, 4) != '[st]' || substr($qr_code, -1) != ';') exit;
|
if (substr($qr_code, 0, 4) != '[st]' || substr($qr_code, -1) != ';')
|
||||||
|
exit;
|
||||||
|
|
||||||
// 截取qr_code,截取第4位到倒数第2位字符
|
// 截取qr_code,截取第4位到倒数第2位字符
|
||||||
$s = substr($qr_code, 4, -1);
|
$s = substr($qr_code, 4, -1);
|
||||||
|
|
||||||
// 将字符串分割成数组
|
// 将字符串分割成数组
|
||||||
$a = explode(",", $s);
|
$a = explode(",", $s);
|
||||||
if(count($a) != 2) exit;
|
if (count($a) != 2)
|
||||||
|
exit;
|
||||||
|
|
||||||
$code = $a[0];
|
$code = $a[0];
|
||||||
$hash = $a[1];
|
$hash = $a[1];
|
||||||
|
@ -107,7 +116,8 @@ function pos_check_user() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 搜索父字符串中子字符串的位置,如果pay_code中不以ymzs_开头,则退出
|
// 搜索父字符串中子字符串的位置,如果pay_code中不以ymzs_开头,则退出
|
||||||
if(strpos($pay_code, 'yzms_') !== 0) exit;
|
if (strpos($pay_code, 'yzms_') !== 0)
|
||||||
|
exit;
|
||||||
|
|
||||||
$uid = intval(substr($pay_code, 5));
|
$uid = intval(substr($pay_code, 5));
|
||||||
$uInfo = $db->get_one("select * from tb_user where id = '{$uid}' and enabled != '0' and company_id=" . $company_id);
|
$uInfo = $db->get_one("select * from tb_user where id = '{$uid}' and enabled != '0' and company_id=" . $company_id);
|
||||||
|
@ -158,9 +168,10 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
|
||||||
// 更新posdevice表的同步时间
|
// 更新posdevice表的同步时间
|
||||||
$db->query("update tb_pos_device set synctime=now() where id = " . $device_id);
|
$db->query("update tb_pos_device set synctime=now() where id = " . $device_id);
|
||||||
|
|
||||||
// 从tb_user表中获取所有启用且属于对应公司的用户列表,
|
// 从tb_user表中获取所有启用且属于公司公司的用户列表,id username cellphonne deptname
|
||||||
$userList_s = $db->get_all("select id, username, cellphone, deptname from tb_user where enabled = '1' and company_id = '{$company_id}'");
|
$userList_s = $db->get_all("select id, username, cellphone, deptname from tb_user where enabled = '1' and company_id = '{$company_id}'");
|
||||||
// 从tb_pos_device_user表中获取对应用户设备信息
|
// 从tb_pos_device_user表中获取对应用户设备信息
|
||||||
|
// 获取指定设备的同步状态
|
||||||
// 新版Android取餐机,宇航用于下发人脸、用户信息到Android取餐机用的记录表,方便知道每台机现在的同步情况
|
// 新版Android取餐机,宇航用于下发人脸、用户信息到Android取餐机用的记录表,方便知道每台机现在的同步情况
|
||||||
$userList_d = $db->get_all("select * from tb_pos_device_user where device_id = '{$device_id}'");
|
$userList_d = $db->get_all("select * from tb_pos_device_user where device_id = '{$device_id}'");
|
||||||
|
|
||||||
|
@ -171,6 +182,7 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
|
||||||
// 提取上一步得到的关联信息并添加到faceInfo数组中,判断此文件是否存在于服务器后台目录,存在则将item信息存进dict数据中,key是user_id,value是item
|
// 提取上一步得到的关联信息并添加到faceInfo数组中,判断此文件是否存在于服务器后台目录,存在则将item信息存进dict数据中,key是user_id,value是item
|
||||||
foreach ($data as $item) {
|
foreach ($data as $item) {
|
||||||
if (is_file("../backstage/" . $item['path'])) {
|
if (is_file("../backstage/" . $item['path'])) {
|
||||||
|
// 建立用户id到用户人脸信息的映射 id => faceInfo
|
||||||
$faceInfo[$item['user_id']] = $item;
|
$faceInfo[$item['user_id']] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,12 +193,16 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
|
||||||
$cardInfo = array();
|
$cardInfo = array();
|
||||||
// 提取上一步获取的信息并将数据循环加入到卡信息数组中,类似List[Dict],key是user_id,value是item
|
// 提取上一步获取的信息并将数据循环加入到卡信息数组中,类似List[Dict],key是user_id,value是item
|
||||||
foreach ($data as $item) {
|
foreach ($data as $item) {
|
||||||
|
// 建立用户id到用户卡信息的映射
|
||||||
$cardInfo[$item['user_id']] = $item;
|
$cardInfo[$item['user_id']] = $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从获取的该公司user_list表信息中循环遍历,获取对应用户id的facecode,path,cardno信息,添加到userList_s数组中
|
// 从获取的该公司user_list表信息中循环遍历,获取对应用户id的facecode,path,cardno信息,添加到userList_s数组中
|
||||||
// 最终facecode,path和cardno作为用户设备需要下发的信息添加到userList_s中
|
// 最终facecode,path和cardno作为用户设备需要下发的信息添加到userList_s中
|
||||||
|
// updateList_s: [[id => 1, name => x, age => 2], ...]
|
||||||
foreach ($userList_s as $key => $item) {
|
foreach ($userList_s as $key => $item) {
|
||||||
|
// 更新userList_s,给其加上facecode和facepath字段,并且加上cardno字段
|
||||||
|
// 即给对应的用户表查询结果增加facecode facepath cardno
|
||||||
$uid = $item['id'];
|
$uid = $item['id'];
|
||||||
$info1 = $faceInfo[$uid];
|
$info1 = $faceInfo[$uid];
|
||||||
$userList_s[$key]['facecode'] = $info1['facecode'] . '';
|
$userList_s[$key]['facecode'] = $info1['facecode'] . '';
|
||||||
|
@ -198,7 +214,8 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
|
||||||
|
|
||||||
$sUserInfo = array();
|
$sUserInfo = array();
|
||||||
// 遍历更新完成的userList_s中数据,存入sUserInfo数组中,key是用户id,value是对应的item信息
|
// 遍历更新完成的userList_s中数据,存入sUserInfo数组中,key是用户id,value是对应的item信息
|
||||||
// ["id1" => {xx}, "id2" => {xx}, "id3" => {xx}]
|
// sUserInfo: ["id1" => [id => 1, name => x], "id2" => {xx}, "id3" => {xx}]
|
||||||
|
// {"id1": {"id": "1", "name": "2"}, ...}
|
||||||
foreach ($userList_s as $item) {
|
foreach ($userList_s as $item) {
|
||||||
$sUserInfo[$item['id']] = $item;
|
$sUserInfo[$item['id']] = $item;
|
||||||
}
|
}
|
||||||
|
@ -207,6 +224,7 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
|
||||||
// 遍历获取的tb_pos_device_user表,即用户设备表,将其数据通过循环变为uid => item数据的数组
|
// 遍历获取的tb_pos_device_user表,即用户设备表,将其数据通过循环变为uid => item数据的数组
|
||||||
// 最终得到uid => item信息的数组
|
// 最终得到uid => item信息的数组
|
||||||
foreach ($userList_d as $item) {
|
foreach ($userList_d as $item) {
|
||||||
|
// dUserInfo: [id1 => [id => 1, name => 2, ...], ...]
|
||||||
$dUserInfo[$item['uid']] = $item;
|
$dUserInfo[$item['uid']] = $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,14 +236,24 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
|
||||||
|
|
||||||
$addList = array(); //增加列表
|
$addList = array(); //增加列表
|
||||||
$maxcount = 100;
|
$maxcount = 100;
|
||||||
// 遍历用户表
|
// 遍历当前公司用户表
|
||||||
|
// 其逻辑是:获取当前公司的用户表,然后获取对应设备中的用户列表,对比两张表中获取的数据,如果不同,则将用户添加到添加列表中
|
||||||
|
// 如果已下发并且距离上次下发时间已超过5分钟,也将用户添加到添加列表
|
||||||
|
// 其实这样做有bug,因为这样做设备的用户信息被记录在服务器而不是通过设备自主上传,因此服务器并不知道设备实时的人员名单,对于初始设备来说没有问题,但是如果设备重置过人员名单,那么将无法从服务器获取人员名单
|
||||||
foreach ($userList_s as $item) {
|
foreach ($userList_s as $item) {
|
||||||
|
// 增加名单有三种情况:
|
||||||
|
/*
|
||||||
|
1. 设备用户表中不存在用户表中对应租户部分用户的信息
|
||||||
|
2. 设备用户表中记录的用户人脸代码等信息和用户表中的人脸代码等信息不一致
|
||||||
|
3. 设备用户表中状态为已下发,但是过了5分钟之后仍未将设备用户表中的信息更新为已确认,即未收到已确认的信号
|
||||||
|
*/
|
||||||
$uid = $item['id'];
|
$uid = $item['id'];
|
||||||
// 设备用户表不存在对应用户的信息
|
// 设备用户表不存在对应用户的信息
|
||||||
if (!$dUserInfo[$uid]) {
|
if (!$dUserInfo[$uid]) {
|
||||||
// 往数组末尾添加一个item
|
// 往数组末尾添加一个item
|
||||||
$addList[] = $item;
|
$addList[] = $item;
|
||||||
if(count($addList) >= $maxcount) break; //限制一次20个
|
if (count($addList) >= $maxcount)
|
||||||
|
break; //限制一次20个
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 设备表的用户信息
|
// 设备表的用户信息
|
||||||
|
@ -240,7 +268,8 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
|
||||||
) {
|
) {
|
||||||
// 则将item加到addList末尾
|
// 则将item加到addList末尾
|
||||||
$addList[] = $item;
|
$addList[] = $item;
|
||||||
if(count($addList) >= $maxcount) break;
|
if (count($addList) >= $maxcount)
|
||||||
|
break;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +277,8 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
|
||||||
if ($item2['status'] == 1 && time() - strtotime($item2['sendtime']) > 300) { //距上次下发5分钟后还没收到确认
|
if ($item2['status'] == 1 && time() - strtotime($item2['sendtime']) > 300) { //距上次下发5分钟后还没收到确认
|
||||||
// 增加item到addList
|
// 增加item到addList
|
||||||
$addList[] = $item;
|
$addList[] = $item;
|
||||||
if(count($addList) >= $maxcount) break;
|
if (count($addList) >= $maxcount)
|
||||||
|
break;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,11 +293,11 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
|
||||||
if ($item['facepath']) {
|
if ($item['facepath']) {
|
||||||
$face_url = 'https://' . $host . '/backstage/' . $item['facepath'];
|
$face_url = 'https://' . $host . '/backstage/' . $item['facepath'];
|
||||||
}
|
}
|
||||||
|
// 获取设备用户表中对应设备和对应用户的数据
|
||||||
$row1 = $db->get_one("select * from tb_pos_device_user where device_id = '" . addslashes($device_id) . "' and uid = '" . addslashes($uid) . "'");
|
$row1 = $db->get_one("select * from tb_pos_device_user where device_id = '" . addslashes($device_id) . "' and uid = '" . addslashes($uid) . "'");
|
||||||
// sql拓展字符串
|
// sql拓展字符串
|
||||||
$sqlext = " name = '" . addslashes($item['username']) . "', cellphone = '" . addslashes($item['cellphone']) . "', deptname = '" . addslashes($item['deptname']) . "', cardno = '" . addslashes($item['cardno']) . "', facecode = '" . addslashes($item['facecode']) . "', sendtime = now(), status = 1, rs = '' ";
|
$sqlext = " name = '" . addslashes($item['username']) . "', cellphone = '" . addslashes($item['cellphone']) . "', deptname = '" . addslashes($item['deptname']) . "', cardno = '" . addslashes($item['cardno']) . "', facecode = '" . addslashes($item['facecode']) . "', sendtime = now(), status = 1, rs = '' ";
|
||||||
// 如果用户设备表中没有对应设备id和用户id的数据
|
// 如果用户设备表中没有对应设备id和用户id的数据,则插入记录,如果有,则更新
|
||||||
if (!$row1) {
|
if (!$row1) {
|
||||||
// 插入记录
|
// 插入记录
|
||||||
$db->query("insert into tb_pos_device_user set device_id = '" . addslashes($device_id) . "', uid = '" . addslashes($uid) . "', {$sqlext}, addtime = now() ", 'SILENT');
|
$db->query("insert into tb_pos_device_user set device_id = '" . addslashes($device_id) . "', uid = '" . addslashes($uid) . "', {$sqlext}, addtime = now() ", 'SILENT');
|
||||||
|
@ -333,7 +363,8 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
|
||||||
$db->query("update tb_pos_device_user set sendtime = now(), status = 4, rs = '',err_num=err_num+1 where id=" . $item['id']);
|
$db->query("update tb_pos_device_user set sendtime = now(), status = 4, rs = '',err_num=err_num+1 where id=" . $item['id']);
|
||||||
// 追加删除列表
|
// 追加删除列表
|
||||||
$delList[] = $item;
|
$delList[] = $item;
|
||||||
if(count($delList) >= $maxcount) break; //限制一次20个
|
if (count($delList) >= $maxcount)
|
||||||
|
break; //限制一次20个
|
||||||
} else {
|
} else {
|
||||||
// 错误次数大于等于3,直接删除记录
|
// 错误次数大于等于3,直接删除记录
|
||||||
$db->query("delete from tb_pos_device_user where id=" . $item['id']);
|
$db->query("delete from tb_pos_device_user where id=" . $item['id']);
|
||||||
|
@ -345,7 +376,8 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
|
||||||
// 不在用户表中,添加item到删除列表
|
// 不在用户表中,添加item到删除列表
|
||||||
if (!$sUserInfo[$uid]) {
|
if (!$sUserInfo[$uid]) {
|
||||||
$delList[] = $item;
|
$delList[] = $item;
|
||||||
if(count($delList) >= $maxcount) break; //限制一次20个
|
if (count($delList) >= $maxcount)
|
||||||
|
break; //限制一次20个
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -436,14 +468,16 @@ else if($qs == 'real') {
|
||||||
|
|
||||||
if ($uInfo['type'] == 'qr') { //取餐码
|
if ($uInfo['type'] == 'qr') { //取餐码
|
||||||
$uInfo = $db->get_one("select * from tb_user where id = '" . $order['uid'] . "'");
|
$uInfo = $db->get_one("select * from tb_user where id = '" . $order['uid'] . "'");
|
||||||
if(!$uInfo) exit;
|
if (!$uInfo)
|
||||||
|
exit;
|
||||||
$uid = $uInfo['id'];
|
$uid = $uInfo['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($order) break;
|
if ($order)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$order) {
|
if (!$order) {
|
||||||
|
@ -489,7 +523,8 @@ else if($qs == 'real') {
|
||||||
|
|
||||||
if ($rs['status'] != 1) {
|
if ($rs['status'] != 1) {
|
||||||
$message = '取餐失败';
|
$message = '取餐失败';
|
||||||
if($rs['message']) $message = $rs['message'];
|
if ($rs['message'])
|
||||||
|
$message = $rs['message'];
|
||||||
|
|
||||||
$arr = array(
|
$arr = array(
|
||||||
'result_code' => '2',
|
'result_code' => '2',
|
||||||
|
@ -544,8 +579,7 @@ else if($qs == 'real') {
|
||||||
'timeout' => $timeout, //取餐超时时间,秒为单位,注:特殊修改机型才有此功能
|
'timeout' => $timeout, //取餐超时时间,秒为单位,注:特殊修改机型才有此功能
|
||||||
);
|
);
|
||||||
response_pos($api, $arr);
|
response_pos($api, $arr);
|
||||||
}
|
} else if ($api == 'infoquery') { //消费前查询用户
|
||||||
else if($api == 'infoquery') { //消费前查询用户
|
|
||||||
$uInfo = pos_check_user();
|
$uInfo = pos_check_user();
|
||||||
$uid = $uInfo['id'];
|
$uid = $uInfo['id'];
|
||||||
|
|
||||||
|
@ -572,13 +606,13 @@ else if($qs == 'real') {
|
||||||
'detail' => array(),
|
'detail' => array(),
|
||||||
);
|
);
|
||||||
response_pos('infoquery', $arr);
|
response_pos('infoquery', $arr);
|
||||||
}
|
} else if ($api == 'posonline') { //消费
|
||||||
else if($api == 'posonline') { //消费
|
|
||||||
$uInfo = pos_check_user();
|
$uInfo = pos_check_user();
|
||||||
$uid = $uInfo['id'];
|
$uid = $uInfo['id'];
|
||||||
|
|
||||||
$amount = intval($post['params']['amount']);
|
$amount = intval($post['params']['amount']);
|
||||||
if($amount <= 0) exit;
|
if ($amount <= 0)
|
||||||
|
exit;
|
||||||
|
|
||||||
$amount = $amount / 100;
|
$amount = $amount / 100;
|
||||||
|
|
||||||
|
@ -586,16 +620,19 @@ else if($qs == 'real') {
|
||||||
$post = array('ftid' => $dining_hall_id, 'channelid' => $channel_id, 'fee' => $amount);
|
$post = array('ftid' => $dining_hall_id, 'channelid' => $channel_id, 'fee' => $amount);
|
||||||
if ($pay_mode == 0) { //0人脸
|
if ($pay_mode == 0) { //0人脸
|
||||||
$row1 = $db->get_one("select * from tb_user_face where user_id = '{$uid}'");
|
$row1 = $db->get_one("select * from tb_user_face where user_id = '{$uid}'");
|
||||||
if(!$row1) exit;
|
if (!$row1)
|
||||||
|
exit;
|
||||||
$post['type'] = 'face';
|
$post['type'] = 'face';
|
||||||
$post['code'] = $row1['card'];
|
$post['code'] = $row1['card'];
|
||||||
} else if ($pay_mode == 2) { //2卡序列号
|
} else if ($pay_mode == 2) { //2卡序列号
|
||||||
$row1 = $db->get_one("select * from tb_user_idcard where user_id = '{$uid}' and state = '1'");
|
$row1 = $db->get_one("select * from tb_user_idcard where user_id = '{$uid}' and state = '1'");
|
||||||
if(!$row1) exit;
|
if (!$row1)
|
||||||
|
exit;
|
||||||
$post['type'] = 'ic';
|
$post['type'] = 'ic';
|
||||||
$post['code'] = $row1['cardno'];
|
$post['code'] = $row1['cardno'];
|
||||||
} else if ($pay_mode == 5) { //5付款码
|
} else if ($pay_mode == 5) { //5付款码
|
||||||
if($uInfo['type'] != 'qr') exit;
|
if ($uInfo['type'] != 'qr')
|
||||||
|
exit;
|
||||||
|
|
||||||
$post['type'] = 'qr';
|
$post['type'] = 'qr';
|
||||||
$post['code'] = $uInfo['code'];
|
$post['code'] = $uInfo['code'];
|
||||||
|
@ -608,7 +645,8 @@ else if($qs == 'real') {
|
||||||
$rs = json_decode($s, true);
|
$rs = json_decode($s, true);
|
||||||
if ($rs['status'] != 1) {
|
if ($rs['status'] != 1) {
|
||||||
$message = '付款失败';
|
$message = '付款失败';
|
||||||
if($rs['message']) $message = $rs['message'];
|
if ($rs['message'])
|
||||||
|
$message = $rs['message'];
|
||||||
|
|
||||||
$arr = array(
|
$arr = array(
|
||||||
'result_code' => '2',
|
'result_code' => '2',
|
||||||
|
@ -646,9 +684,7 @@ else if($qs == 'real') {
|
||||||
);
|
);
|
||||||
response_pos('posonline', $arr);
|
response_pos('posonline', $arr);
|
||||||
}
|
}
|
||||||
}
|
} else if ($qs == 'takephoto') {
|
||||||
|
|
||||||
else if($qs == 'takephoto') {
|
|
||||||
$arr = array(
|
$arr = array(
|
||||||
'result_code' => '0', //0成功
|
'result_code' => '0', //0成功
|
||||||
'result_msg' => '',
|
'result_msg' => '',
|
||||||
|
|
Loading…
Reference in New Issue