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