1
This commit is contained in:
parent
d63b889fd6
commit
7f6bb855e3
@ -24,10 +24,10 @@ class Table extends BaseModel
|
|||||||
public function getQrcodeAttr($value,$data)
|
public function getQrcodeAttr($value,$data)
|
||||||
{
|
{
|
||||||
$qrcode = [
|
$qrcode = [
|
||||||
'h5' => '',
|
// 'h5' => '',
|
||||||
'weixin' => '',
|
'weixin' => '',
|
||||||
'alipay' => '',
|
// 'alipay' => '',
|
||||||
'qrcode' => '',
|
// 'qrcode' => '',
|
||||||
];
|
];
|
||||||
//生成存储路径
|
//生成存储路径
|
||||||
if(!file_exists('./temp/food')){
|
if(!file_exists('./temp/food')){
|
||||||
@ -35,6 +35,7 @@ class Table extends BaseModel
|
|||||||
}
|
}
|
||||||
//生成微信小程序码
|
//生成微信小程序码
|
||||||
$wechat_path = '/temp/food/wechat-table-' . $data['table_id'] . '.png';
|
$wechat_path = '/temp/food/wechat-table-' . $data['table_id'] . '.png';
|
||||||
|
|
||||||
if(!is_file('.' . $wechat_path)){
|
if(!is_file('.' . $wechat_path)){
|
||||||
$wx = new Wechat;
|
$wx = new Wechat;
|
||||||
if($wx->getUnlimitedQRCode($data['applet_id'],$wechat_path,'table-'.$data['shop_id'].'-'.$data['table_id'])){
|
if($wx->getUnlimitedQRCode($data['applet_id'],$wechat_path,'table-'.$data['shop_id'].'-'.$data['table_id'])){
|
||||||
@ -43,36 +44,36 @@ class Table extends BaseModel
|
|||||||
}else{
|
}else{
|
||||||
$qrcode['weixin'] = $wechat_path;
|
$qrcode['weixin'] = $wechat_path;
|
||||||
}
|
}
|
||||||
//如果已经发布H5端代码
|
// //如果已经发布H5端代码
|
||||||
if(is_file('./h5/food/index.html')){
|
// if(is_file('./h5/food/index.html')){
|
||||||
$h5_path = '/temp/food/h5-table-' . $data['table_id'] . '.png';
|
// $h5_path = '/temp/food/h5-table-' . $data['table_id'] . '.png';
|
||||||
if(!is_file('.' . $h5_path)){
|
// if(!is_file('.' . $h5_path)){
|
||||||
$writer = new PngWriter();
|
// $writer = new PngWriter();
|
||||||
$code = CodeMode::create(base_url() . 'h5/food/#/?applet_id=' . $data['applet_id'] . '&q=table-' . $data['shop_id'].'-'.$data['table_id'])->setSize(500);
|
// $code = CodeMode::create(base_url() . 'h5/food/#/?applet_id=' . $data['applet_id'] . '&q=table-' . $data['shop_id'].'-'.$data['table_id'])->setSize(500);
|
||||||
$result = $writer->write($code);
|
// $result = $writer->write($code);
|
||||||
$result->saveToFile('.' . $h5_path);
|
// $result->saveToFile('.' . $h5_path);
|
||||||
}
|
// }
|
||||||
$qrcode['h5'] = $h5_path;
|
// $qrcode['h5'] = $h5_path;
|
||||||
}
|
// }
|
||||||
//生成支付宝小程序码
|
//生成支付宝小程序码
|
||||||
$alipay_path = '/temp/food/alipay-table-' . $data['shop_id'] . '.png';
|
// $alipay_path = '/temp/food/alipay-table-' . $data['shop_id'] . '.png';
|
||||||
if(!is_file('.' . $alipay_path)){
|
// if(!is_file('.' . $alipay_path)){
|
||||||
$alipay = new Alipay($data['applet_id']);
|
// $alipay = new Alipay($data['applet_id']);
|
||||||
if($alipay->openAppQrcodeCreate('table-'.$data['shop_id'].'-'.$data['table_id'],$alipay_path)){
|
// if($alipay->openAppQrcodeCreate('table-'.$data['shop_id'].'-'.$data['table_id'],$alipay_path)){
|
||||||
$qrcode['alipay'] = $alipay_path;
|
// $qrcode['alipay'] = $alipay_path;
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
$qrcode['alipay'] = $alipay_path;
|
// $qrcode['alipay'] = $alipay_path;
|
||||||
}
|
// }
|
||||||
//生成小程序聚合码
|
//生成小程序聚合码
|
||||||
$qrcode_path = '/temp/food/qrcode-table-' . $data['shop_id'] . '.png';
|
// $qrcode_path = '/temp/food/qrcode-table-' . $data['shop_id'] . '.png';
|
||||||
if(!is_file('.' . $qrcode_path)){
|
// if(!is_file('.' . $qrcode_path)){
|
||||||
$writer = new PngWriter();
|
// $writer = new PngWriter();
|
||||||
$code = CodeMode::create(base_url() . 'food/' . $data['applet_id'] . '/table-'. $data['shop_id'].'-'.$data['table_id'])->setSize(500);
|
// $code = CodeMode::create(base_url() . 'food/' . $data['applet_id'] . '/table-'. $data['shop_id'].'-'.$data['table_id'])->setSize(500);
|
||||||
$result = $writer->write($code);
|
// $result = $writer->write($code);
|
||||||
$result->saveToFile('.' . $qrcode_path);
|
// $result->saveToFile('.' . $qrcode_path);
|
||||||
}
|
// }
|
||||||
$qrcode['qrcode'] = $qrcode_path;
|
// $qrcode['qrcode'] = $qrcode_path;
|
||||||
return $qrcode;
|
return $qrcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -120,7 +120,7 @@
|
|||||||
let list = <?= json_encode($list)?>;
|
let list = <?= json_encode($list)?>;
|
||||||
$.showAction({
|
$.showAction({
|
||||||
title: '餐桌码',
|
title: '餐桌码',
|
||||||
area: '990px',
|
area: '300px',
|
||||||
content: template('tpl-qrcode', {qrcode:list[data.index].qrcode}),
|
content: template('tpl-qrcode', {qrcode:list[data.index].qrcode}),
|
||||||
uCheck: true,
|
uCheck: true,
|
||||||
btn: ['取消'],
|
btn: ['取消'],
|
||||||
|
|||||||
@ -1,13 +1,6 @@
|
|||||||
<script id="tpl-qrcode" type="text/template">
|
<script id="tpl-qrcode" type="text/template">
|
||||||
<div class="am-padding-xs am-padding-top-sm">
|
<div class="am-padding-xs am-padding-top-sm">
|
||||||
<div class="user-qrcode">
|
|
||||||
{{ if qrcode.h5 }}
|
|
||||||
<img src="{{ qrcode.h5}}">
|
|
||||||
{{ else / }}
|
|
||||||
<div class="online">等待上线</div>
|
|
||||||
{{ /if }}
|
|
||||||
<div class="text">H5端</div>
|
|
||||||
</div>
|
|
||||||
<div class="user-qrcode">
|
<div class="user-qrcode">
|
||||||
{{ if qrcode.weixin }}
|
{{ if qrcode.weixin }}
|
||||||
<img src="{{ qrcode.weixin}}">
|
<img src="{{ qrcode.weixin}}">
|
||||||
@ -16,21 +9,6 @@
|
|||||||
{{ /if }}
|
{{ /if }}
|
||||||
<div class="text">微信小程序</div>
|
<div class="text">微信小程序</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="user-qrcode">
|
|
||||||
{{ if qrcode.alipay }}
|
|
||||||
<img src="{{ qrcode.alipay}}">
|
|
||||||
{{ else / }}
|
|
||||||
<div class="online">等待上线</div>
|
|
||||||
{{ /if }}
|
|
||||||
<div class="text">支付宝小程序</div>
|
|
||||||
</div>
|
|
||||||
<div class="user-qrcode">
|
|
||||||
{{ if qrcode.qrcode }}
|
|
||||||
<img src="{{ qrcode.qrcode}}">
|
|
||||||
{{ else / }}
|
|
||||||
<div class="online">等待上线</div>
|
|
||||||
{{ /if }}
|
|
||||||
<div class="text">小程序聚合码</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
@ -1 +1 @@
|
|||||||
{"errcode":41001,"errmsg":"access_token missing rid: 655efa91-1df1ebb0-67ca51a1"}
|
{"errcode":41001,"errmsg":"access_token missing rid: 656edda7-22ddb70b-7410cc76"}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
//000000000600
|
//000000000600
|
||||||
exit();?>
|
exit();?>
|
||||||
1701756591
|
1701764602
|
||||||
Loading…
x
Reference in New Issue
Block a user