diff --git a/Application/Qrcode/Controller/JumpController.class.php b/Application/Qrcode/Controller/JumpController.class.php index dc3378f07..f99022df6 100644 --- a/Application/Qrcode/Controller/JumpController.class.php +++ b/Application/Qrcode/Controller/JumpController.class.php @@ -72,7 +72,15 @@ class JumpController extends HomeController } // 二维码: $qrcodePromotionList = M('qrcode_promotion_list', 'tab_')->where(['id' => $id])->find(); - + $qrcode = json_decode($qrcodePromotionList['qrcode_img'], true); + $qrcodeCnt = count($qrcode); + $intervalMin = $qrcodePromotionList['interval_min']; + $elapseMin = floor((time() - $qrcodePromotionList['create_time']) / 60); + $imgIndex = 0; + if ($intervalMin > 0) { + $imgIndex = floor($elapseMin / $intervalMin); + $imgIndex = $imgIndex % $qrcodeCnt; + } // 背景图 $qrcodePromotion = M('qrcode_promotion', 'tab_')->where(['id' => $qrcodePromotionList['qp_id']])->find(); @@ -80,7 +88,7 @@ class JumpController extends HomeController 'id' => $_REQUEST['id'], 'status' => 1, 'background_img' => $qrcodePromotion['background_img'], - 'qrcode_img' => $qrcodePromotionList['qrcode_img'] + 'qrcode_img' => $qrcode[$imgIndex] ]); } diff --git a/Application/Qrcode/Controller/QrCodePromotionController.class.php b/Application/Qrcode/Controller/QrCodePromotionController.class.php index d48225558..8e1919eef 100644 --- a/Application/Qrcode/Controller/QrCodePromotionController.class.php +++ b/Application/Qrcode/Controller/QrCodePromotionController.class.php @@ -198,7 +198,8 @@ class QrCodePromotionController extends BaseController 'short_link' => '', 'create_time' => time(), 'status' => 0, - 'qrcode_img' => $params['img'], + 'qrcode_img' => json_encode($params['img'], JSON_FORCE_OBJECT), + 'interval_min' => $params['interval_min'], ]); if ($id > 0) { $h5Link = ($isHttps? 'https://': 'http://').$_SERVER['HTTP_HOST']."/index.php?s=/Qrcode/Jump/jumpMp/id/{$id}"; diff --git a/Application/Qrcode/View/default/QrCodePromotion/linkAdd.html b/Application/Qrcode/View/default/QrCodePromotion/linkAdd.html index c32ff3cb2..8e4209c49 100644 --- a/Application/Qrcode/View/default/QrCodePromotion/linkAdd.html +++ b/Application/Qrcode/View/default/QrCodePromotion/linkAdd.html @@ -13,19 +13,25 @@