yzms/show/pos.php

66 lines
1.6 KiB
PHP
Raw Permalink Normal View History

2024-04-01 15:54:27 +08:00
<?
require_once(dirname(__FILE__)."/common.php");
$act = trim($_GET['act']);
//pos机用户登录 以及获取新版本
function return_json($status,$data) {
$result = array();
$result['status'] = $status;
$result['data'] = $data;
return json_encode($result);
}
if($act == 'login') {
$hids = array(1 => '信息大厦饭堂', 2 => '魁奇饭堂');
$d = date("Y-m-d");
$loginname = $_REQUEST['loginName'];
$password = $_REQUEST['loginPwd'];
$password = md5($password);
//判断用户是否存在
$rs = $db->get_one("select a.*,b.company_name from tb_pos_user a,tb_company b where a.company_id = b.id and loginname = '".$loginname."' and password='".$password."' and a.enabled = 1");
if(!$rs) {
echo return_json(-1,"登录失败");
exit;
}
$dining_hall_id = $rs['dining_hall_id'];
//获取该用户所管辖的饭堂
$ftrs = $db->get_all("select a.name,b.* from tb_dining_hall a,tb_pos_channel b where a.id = b.dining_hall_id and b.enabled = 1 and a.id = ".$dining_hall_id);
$data = array();
$data['company_info'] = array(
'company_id' => $rs['company_id'],
'company_name' => $rs['company_name'],
);
foreach($ftrs as $k => $v) {
$data['dining_hall_info'][] = array(
'dining_hall_id' => $dining_hall_id,
'channel_id' => $v['id'],
'dining_hall_name' => $v['name']."-".$v['channel_name'],
);
}
echo return_json(1,$data);
}
if($act == 'check') {
$takecode = trim($_GET['takecode']);
if(!$takecode) exit;
require 'include/qrcode/qrlib.php';
$t = "qr_".time()."_".rand().".png";
QRcode::png(getEncodeStr($takecode), $t, 'L',7 , 0);
header("Content-Type: image/png");
echo file_get_contents($t);
@unlink($t);
exit;
}