1 Star 0 Fork 3

大海/QROpenAgreement

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.php 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
极客师傅 提交于 2020-04-01 00:34 . No commit message
<?php
require './class/function.php';
require './class/db.class.php';
require './lib/Smarty.class.php';
$smarty = new Smarty;
$db = ConnectMysqli::getIntance();
$wmj = $db->getRow('select * from config where k="wmj"');
$wmjcontent = $wmj['content'];
$config = json_decode($wmj['v'], true);
$lock_id = $_GET['id']*1 ;
$lock = $db->getRow('select * from locks where id='.$lock_id);
//$lock = ['sn'=>'WMJ16881234'];
if (!$lock) {
$data = array(
'state' => 0,
'msg' => '非法访问',
);
} else {
if( empty($_GET['agree']) )
{
//echo $wmjcontent;
$adata = array(
'lock_id'=>$lock_id ,
'content'=>$wmjcontent ,
);
$smarty->assign('adata', $adata);
return $smarty->display('agree.html');
}
if ($config['aeskey']) {
$lock['sn'] = aesEncrypt($lock['sn'], $config['aeskey']);
}
$result = httpPost('https://www.wmj.com.cn/api/openlock.html?appid='.$config['appid'].'&appsecret='.$config['appsecret'], $lock['sn']);
$result = json_decode(trim($result, "\xEF\xBB\xBF"), true);
if ($result['state']) {
$data = array(
'state' => 1,
'msg' => '开门成功',
);
} else {
$data = array(
'state' => 0,
'msg' => '开门失败',
);
}
}
$smarty->assign('data', $data);
$smarty->display('index.html');
?>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/jzwfcaidy/QROpenAgreement.git
git@gitee.com:jzwfcaidy/QROpenAgreement.git
jzwfcaidy
QROpenAgreement
QROpenAgreement
master

搜索帮助