From e4013528391965804a40d5a58dc2c5a9e585146e Mon Sep 17 00:00:00 2001 From: dengbw Date: Mon, 21 Nov 2022 17:06:57 +0800 Subject: [PATCH] market_activity_1121_2 --- home/controllers/h5/market/Draw.php | 2 +- home/views/h5/market/draw/index.php | 27 +++++++++++++++---- market/controllers/api/sylive/Activity.php | 7 ++++- market/controllers/api/sylive/Statistics.php | 28 +++++++++++++++----- 4 files changed, 51 insertions(+), 13 deletions(-) diff --git a/home/controllers/h5/market/Draw.php b/home/controllers/h5/market/Draw.php index 09745b7b..6f6f9e03 100644 --- a/home/controllers/h5/market/Draw.php +++ b/home/controllers/h5/market/Draw.php @@ -99,7 +99,7 @@ class Draw extends CI_Controller } $winTypeAry = $this->mdSyliveOrder->winTypeAry($activityId); $price = $winTypeAry[$winType]['price']; - $limit = $winNum >= 50 ? 100 : 30; + $limit = $winNum >= 50 ? 100 : 50; //随机数据 $sql = "SELECT id,userId,mobile,uname,totalPrice FROM lc_market_sylive_order WHERE activityId={$activityId} AND win=0 AND status=1 AND totalPrice>={$price} ORDER BY RAND() LIMIT {$limit}"; diff --git a/home/views/h5/market/draw/index.php b/home/views/h5/market/draw/index.php index 36f7127d..db8df711 100644 --- a/home/views/h5/market/draw/index.php +++ b/home/views/h5/market/draw/index.php @@ -90,12 +90,18 @@ 开始抽奖 - 立即开奖 -
{{msgTip}}
+ + 立即开奖 + 放弃开奖 + 确认放弃开奖 + +
{{msgTip}}
-
@@ -150,6 +156,7 @@ isStartAc: false, isOpen: false, isShowLogin: true, + isShowReset: false, drawCode: '', msgTip: '' }, @@ -195,6 +202,7 @@ if (that.isSubmiting) return; clearTimeout(that.timer); that.msgTip = ""; + this.isShowReset = false; if (!that.isOpen && that.winNum > 0) { that.draw = {list: [], result: [], type: 0, prizeUrl: ''}; that.list = []; @@ -319,6 +327,15 @@ } }); }, + //放弃开奖 + reset() { + //提交中奖数据 + clearTimeout(this.timer); + this.list = []; + this.draw = {list: [], result: [], type: 0, prizeUrl: ''}; + this.isStartAc = false; + this.isOpen = true; + }, } }) diff --git a/market/controllers/api/sylive/Activity.php b/market/controllers/api/sylive/Activity.php index 8fedafb4..654de27a 100644 --- a/market/controllers/api/sylive/Activity.php +++ b/market/controllers/api/sylive/Activity.php @@ -135,11 +135,12 @@ class Activity extends BaseController } $skey = $this->myencryption->base64url_encode("a_id=" . $activityId); $url = http_host_com('home') . "/h5/market/sylive?skey=" . $skey;//活动连接 + $serviceLink = $jsondata['serviceLink'] ? $jsondata['serviceLink'] : ''; $list[] = [ 'activityId' => $activityId, 'title' => $v['title'], 'channelId' => $v['channelId'], 'bizIds' => $bizIds, 'teamIds' => $teamIds, 'pay' => $pay, 'introduction' => $v['introduction'], 'shareTitle' => $shareTitle, 'dateRange' => $dateRange, 'coupon' => $coupon, 'drawCode' => $v['drawCode'], 'bgImg' => $bgImg, 'channelImg' => $channelImg, 'banner' => $banner, 'sharePhoto' => $sharePhoto, 'shareImg' => $shareImg, 'item' => $item, 'url' => $url, - 'mchId' => $v['mchId'], 'protocolTitle' => $v['protocolTitle'], 'protocol' => $v['protocol'] + 'mchId' => $v['mchId'], 'protocolTitle' => $v['protocolTitle'], 'protocol' => $v['protocol'], 'serviceLink' => $serviceLink , 's_time' => $v['timeStart'], 'e_time' => $v['timeEnd'], 'status' => $status, 'createTime' => $v['createTime']]; } } @@ -171,6 +172,7 @@ class Activity extends BaseController $mchId = $this->input_param('mchId'); $protocolTitle = $this->input_param('protocolTitle'); $protocol = $this->input_param('protocol'); + $serviceLink = $this->input_param('serviceLink'); if (!$title) { $this->return_json('请输入活动标题'); } @@ -211,6 +213,7 @@ class Activity extends BaseController } $jsondata['pay'] = $pay; $jsondata['banner'] = $banner; + $jsondata['serviceLink'] = $serviceLink; $jsondata = json_encode($jsondata, JSON_UNESCAPED_UNICODE); $addDate = ['title' => $title, 'bgImg' => $bgImg, 'channelImg' => $channelImg, 'channelId' => $channelId, 'jsondata' => $jsondata , 'introduction' => $introduction, 'shareTitle' => $shareTitle, 'sharePhoto' => $sharePhoto, 'shareImg' => $setShareImg @@ -310,6 +313,7 @@ class Activity extends BaseController $mchId = $this->input_param('mchId'); $protocolTitle = $this->input_param('protocolTitle'); $protocol = $this->input_param('protocol'); + $serviceLink = $this->input_param('serviceLink'); if (!$activityId) { $this->return_json('参数错误'); } @@ -411,6 +415,7 @@ class Activity extends BaseController } $jsondata['pay'] = $pay; $jsondata['banner'] = $banner; + $jsondata['serviceLink'] = $serviceLink; $jsondata = json_encode($jsondata, JSON_UNESCAPED_UNICODE); $organizationIds = $organizationIds ? ',' . implode(',', $organizationIds) . ',' : ''; $upDate = ['title' => $title, 'bgImg' => $bgImg, 'channelImg' => $channelImg, 'channelId' => $channelId, 'introduction' => $introduction, diff --git a/market/controllers/api/sylive/Statistics.php b/market/controllers/api/sylive/Statistics.php index 993d117c..ac7f11b4 100644 --- a/market/controllers/api/sylive/Statistics.php +++ b/market/controllers/api/sylive/Statistics.php @@ -148,7 +148,8 @@ class Statistics extends BaseController $itemId = intval($this->input_param('itemId'));//商品 !$page && $page = 1; !$limit && $limit = 100; - $list = []; + $list = $legendData = $yAxisSeries = []; + $xAxisData = ['参与门店数', '参与顾问数', '全部顾问数', '浏览数', '预约数', '观看数', '订单数', '观看数', '人均观看']; $re = $this->mdSyliveActivity->get(['activityId' => $activityId]); if ($re) { $type = 0; @@ -198,7 +199,12 @@ class Statistics extends BaseController $allConsultant = $this->mdSyliveUser->count(["organizationId in({$str_organizationIds})" => null, 'status>=' => 0, 'organizationId>' => 0]); } $consultant > $allConsultant && $allConsultant = $consultant; - $list[] = ['areaName' => $re_area['organizationName'], 'biz' => count($v['biz']), 'consultant' => $consultant . '/' . $allConsultant + $biz = count($v['biz']); + $organizationName = $re_area['organizationName'] ? $re_area['organizationName'] : '-'; + $legendData[] = $organizationName; + $yAxisSeries[] = ['name' => $organizationName, 'type' => 'line' + , 'data' => [$biz, $consultant, $allConsultant, $browse, $subscribe, $watch, $orderTotal, $livePV, $watchDuration]]; + $list[] = ['areaName' => $organizationName, 'biz' => $biz, 'consultant' => $consultant . '/' . $allConsultant , 'browse' => $browse, 'subscribe' => $subscribe, 'watch' => $watch, 'order' => $orderTotal , 'livePV' => $livePV, 'watchDuration' => $watchDuration]; } @@ -218,7 +224,7 @@ class Statistics extends BaseController $orderTotal = $this->mdSyliveActivityKpidata->count(['kpi' => 'order', 'areaId' => $areaId, 'type' => $type, 'itemId' => $itemId, 'activityId' => $activityId]); } else { $sumOrder = $this->mdSyliveActivityBiz->sum('orderTotal', ['areaId' => $areaId, 'activityId' => $activityId]); - $orderTotal = $sumOrder['orderTotal']; + $orderTotal = intval($sumOrder['orderTotal']); } $livePV = $watchDuration = 0; if ($channelId) { @@ -236,8 +242,16 @@ class Statistics extends BaseController $allConsultant = $this->mdSyliveUser->count(["organizationId in({$str_organizationIds})" => null, 'status>=' => 0, 'organizationId>' => 0]); } $consultant > $allConsultant && $allConsultant = $consultant; - $list[] = ['areaName' => $re_area['organizationName'], 'biz' => count($v['biz']), 'consultant' => $consultant . '/' . $allConsultant - , 'browse' => $browse['browse'], 'subscribe' => $subscribe['subscribe'], 'watch' => $watch['watch'], 'order' => $orderTotal + $biz = count($v['biz']); + $browse = intval($browse['browse']); + $subscribe = intval($subscribe['subscribe']); + $watch = intval($watch['watch']); + $organizationName = $re_area['organizationName'] ? $re_area['organizationName'] : '-'; + $legendData[] = $organizationName; + $yAxisSeries[] = ['name' => $organizationName, 'type' => 'line' + , 'data' => [$biz, $consultant, $allConsultant, $browse, $subscribe, $watch, $orderTotal, $livePV, $watchDuration]]; + $list[] = ['areaName' => $organizationName, 'biz' => $biz, 'consultant' => $consultant . '/' . $allConsultant + , 'browse' => $browse, 'subscribe' => $subscribe, 'watch' => $watch, 'order' => $orderTotal , 'livePV' => $livePV, 'watchDuration' => $watchDuration]; } } @@ -248,7 +262,9 @@ class Statistics extends BaseController array_multisort($sortKey, $order, $list); $count = count($list); //$list = array_splice($list, 0, $limit); - $date = ['list' => $list, 'count' => $count]; + //折线图数据 + $chart = ['legendData' => $legendData, 'xAxisData' => $xAxisData, 'yAxisSeries' => $yAxisSeries]; + $date = ['list' => $list, 'count' => $count, 'chart' => $chart]; $this->return_response_list($date); }