add-sylive-item_limit
This commit is contained in:
@@ -20,6 +20,7 @@ class Item extends Wx{
|
||||
$param = $this->myencryption->base64url_decode($skey);
|
||||
$a_id = intval($param['a_id']);//活动id
|
||||
$itemId = intval($param['itemId']);//商品id
|
||||
$itemId = $this->input->get('item_id');
|
||||
$row = $this->market_sylive_items_model->get(['itemId'=>$itemId,'activityId'=>$a_id]);
|
||||
$act = $this->market_sylive_activity_model->get(['activityId'=>$a_id]);
|
||||
if(!$row){
|
||||
@@ -87,7 +88,8 @@ class Item extends Wx{
|
||||
'live_url' => $live_url,
|
||||
'a_id' => $a_id,
|
||||
'ifAddress' => $row['ifAddress'],
|
||||
'protocolTitle' => $act['protocolTitle']
|
||||
'protocolTitle' => $act['protocolTitle'],
|
||||
'item_status' => $row['status']
|
||||
];
|
||||
$this->data['province_arr'] = $province_arr;
|
||||
$this->data['city_arr'] = $city_arr;
|
||||
@@ -119,6 +121,9 @@ class Item extends Wx{
|
||||
if(!$row){
|
||||
$this->show_json('',400,'参数错误');
|
||||
}
|
||||
if($row['status']){
|
||||
$this->show_json('',400,'商品已下架');
|
||||
}
|
||||
if(time()< strtotime($row['timeStart'])){
|
||||
$this->show_json('',400,'尚未开始');
|
||||
}
|
||||
@@ -237,10 +242,12 @@ class Item extends Wx{
|
||||
if(!mobile_valid($mobile)){
|
||||
$this->show_json('',400,'请输入正确的手机号码');
|
||||
}
|
||||
if($item_id==8){ //特殊处理需要先购买权益商品
|
||||
$where = ['itemId'=>10,'userId'=>$this->uid];
|
||||
$item_row = $this->market_sylive_items_model->get(['itemId'=>$item_id,'activityId'=>$a_id]);
|
||||
if($item_row['needItemId']){ //特殊处理需要先购买权益商品
|
||||
$where = ['itemId'=>$item_row['needItemId'],'userId'=>$this->uid];
|
||||
if(!$this->market_sylive_order_model->count($where)){
|
||||
$this->show_json('',400,'请先购买权益');
|
||||
$need_item_row = $this->market_sylive_items_model->get(['itemId'=>$item_row['needItemId']],'title');
|
||||
$this->show_json('',400,"购买{$need_item_row['title']}方可获得秒杀资格");
|
||||
}
|
||||
}
|
||||
$act = $this->market_sylive_activity_model->get(['activityId'=>$a_id]);
|
||||
|
||||
@@ -35,13 +35,16 @@ class Stic extends Admin{
|
||||
$info['headimg'] = $user['headimg'];
|
||||
$group_user = $this->groups_user_model->get(['activityId'=>$this->a_id,'userId'=>$this->uid,'status'=>0]);
|
||||
$info['group_name'] = '';
|
||||
$info['is_biz'] = $group_user['bizId'] ? 1 : 0;
|
||||
$info['biz_id'] = $group_user['biz_id'] ? $group_user['biz_id'] : 0;
|
||||
if($groupsId){
|
||||
$group_lists = $this->sylive2_entity->get_group_lists($groupsId,$this->a_id);
|
||||
unset($group_lists[0]);
|
||||
$info['group_name'] = implode(' ',array_column($group_lists,'groupsName'));
|
||||
$groups = $this->groups_model->get(['groupsId'=>$groupsId]);
|
||||
$info['biz_id'] = $groups['ifBiz'] ? $groups['groupsId'] : 0;
|
||||
}
|
||||
$info['groupsId'] = $groupsId ? $groupsId : $group_user['groupsId'];
|
||||
$info['is_biz'] = $group_user['bizId'] ? 1 : 0;
|
||||
$info['tab'] = time()>=strtotime($row['timeStart']) ? 2 : 1;
|
||||
$this->data['info'] = $info;
|
||||
//微信分享
|
||||
@@ -607,4 +610,104 @@ class Stic extends Admin{
|
||||
$this->data['share'] = $wx_info['share'];
|
||||
$this->show_view('h5/market/sylive2/stic/rank');
|
||||
}
|
||||
|
||||
public function ajax_line(){
|
||||
$type = $this->input->get('type');
|
||||
$biz_id = $this->input->get('biz_id');
|
||||
$row = $this->market_sylive_activity_model->get(['activityId'=>$this->a_id],'activityStart,timeStart,timeEnd');
|
||||
$xAxisData = [];
|
||||
if($type==2){
|
||||
$activityStart = strtotime($row['timeStart']);
|
||||
$end_time = strtotime($row['timeEnd']);
|
||||
$diff_seconds = $end_time - $activityStart;
|
||||
$diff_hour = ceil($diff_seconds/3600);
|
||||
// $where = [
|
||||
// 'activityId' => $this->a_id,
|
||||
// 'bizId' => $biz_id,
|
||||
// 'kpi' => 'watch',
|
||||
// 'createTime>=' => $activityStart,
|
||||
// 'createTime<=' => $end_time,
|
||||
// ];
|
||||
// $watch_kpi_rows = $this->mdSytActivityKpiData->select_groupby('ctime',$where,'',0,0,'from_unixtime(createTime,"%H") as ctime,count(id) as total');
|
||||
// $where['kpi'] = 'order';
|
||||
// $order_kpi_rows = $this->mdSytActivityKpiData->select_groupby('ctime',$where,'',0,0,'from_unixtime(createTime,"%H") as ctime,count(id) as total');
|
||||
// $temp_s_data = $temp_b_data = [];
|
||||
for($i=0;$i<$diff_hour;$i++){
|
||||
$xAxisData[] = date('H:00',$activityStart + $i*60*60).'-'.date('H:00',$activityStart + ($i+1)*60*60);
|
||||
$watch_data[] = 0;
|
||||
$order_data[] = 0;
|
||||
}
|
||||
$title = '<span class="color-ff9d47">直播</span>走势图';
|
||||
$legendData = ['观看数', '订单数'];
|
||||
$seriesData = [
|
||||
[
|
||||
'name' => '观看数',
|
||||
'type' => 'line',
|
||||
'data' => $watch_data
|
||||
],
|
||||
[
|
||||
'name' => '订单数',
|
||||
'type' => 'line',
|
||||
'data' => $order_data
|
||||
],
|
||||
];
|
||||
// $xAxisData = ['9:00-10:00', '10:00-11:00', '11:00-12:00', '12:00-13:00'];
|
||||
}else{
|
||||
$activityStart = strtotime($row['activityStart'])>0 ? strtotime($row['activityStart']) : strtotime($row['timeStart'])-7*24*60*60;
|
||||
$end_time = time()< strtotime($row['timeStart']) ? time() : strtotime($row['timeStart']);
|
||||
$diff_seconds = $end_time - $activityStart;
|
||||
$diff_days = ceil($diff_seconds/86400);
|
||||
$where = [
|
||||
'activityId' => $this->a_id,
|
||||
'bizId' => $biz_id,
|
||||
'kpi' => 'browse',
|
||||
'createTime>=' => $activityStart,
|
||||
'createTime<=' => $end_time,
|
||||
];
|
||||
$browse_kpi_rows = $this->mdSytActivityKpiData->select_groupby('day',$where,'',0,0,'day,count(id) as total');
|
||||
$where['kpi'] = 'subscribe';
|
||||
$subscribe_rows = $this->mdSytActivityKpiData->select_groupby('day',$where,'',0,0,'day,count(id) as total');
|
||||
$temp_s_data = $temp_b_data = [];
|
||||
if($browse_kpi_rows){
|
||||
foreach ($browse_kpi_rows as $item) {
|
||||
$temp_b_data[$item['day']] = $item['total'];
|
||||
}
|
||||
}
|
||||
if($temp_s_data){
|
||||
foreach ($subscribe_rows as $item) {
|
||||
$temp_s_data[$item['day']] = $item['total'];
|
||||
}
|
||||
}
|
||||
$browse_data = $subscribe_data = [];
|
||||
for($i=0;$i<$diff_days;$i++){
|
||||
$xAxisData[] = date('m.d',$activityStart + $i*24*60*60);
|
||||
$day = date('Y-m-d',$activityStart + $i*24*60*60);
|
||||
$browse_data[] = $temp_b_data[$day] ? $temp_b_data[$day] : 0;
|
||||
$subscribe_data[] = $temp_s_data[$day] ? $temp_s_data[$day] : 0;
|
||||
}
|
||||
$title = '<span class="color-ff9d47">预热</span>走势图';
|
||||
$legendData = ['访问数', '订阅数'];
|
||||
$seriesData = [
|
||||
[
|
||||
'name' => '访问数',
|
||||
'type' => 'line',
|
||||
'data' => $browse_data
|
||||
],
|
||||
[
|
||||
'name' => '订阅数',
|
||||
'type' => 'line',
|
||||
'data' => $subscribe_data
|
||||
],
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
$data = [
|
||||
'title' => $title,
|
||||
'legendData' => $legendData,
|
||||
'xAxisData' => $xAxisData,
|
||||
'seriesData' => $seriesData
|
||||
];
|
||||
$this->show_json($data,200);
|
||||
}
|
||||
}
|
||||
@@ -45,11 +45,16 @@
|
||||
</a>
|
||||
</template>
|
||||
<template v-else-if="info.e_time>0">
|
||||
<a class="block bg-1a1a1a pt20 pb20 text-center color-fff ulib-r10" v-if="info.stock>0" @click="showReg" href="javascript:void(0)">
|
||||
<div class="font-32">立即支付<span>{{info.price}}</span>元</div>
|
||||
<div class="mt10 font-20 color-888" v-html="showTime"></div>
|
||||
</a>
|
||||
<div class="bg-999 pt30 pb30 text-center color-fff ulib-r10" v-else>已售罄</div>
|
||||
<template v-if="info.item_status==0">
|
||||
<a class="block bg-1a1a1a pt20 pb20 text-center color-fff ulib-r10" v-if="info.stock>0" @click="showReg" href="javascript:void(0)">
|
||||
<div class="font-32">立即支付<span>{{info.price}}</span>元</div>
|
||||
<div class="mt10 font-20 color-888" v-html="showTime"></div>
|
||||
</a>
|
||||
<div class="bg-999 pt30 pb30 text-center color-fff ulib-r10" v-else>已售罄</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="bg-999 pt30 pb30 text-center color-fff ulib-r10">商品已下架</div>
|
||||
</template>
|
||||
</template>
|
||||
<div class="bg-999 pt30 pb30 text-center color-fff ulib-r10" v-else>活动已结束</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/echarts.min.js?20221213"></script>
|
||||
<body class="bg-fff">
|
||||
<div class="height-500 fixed left-0 right-0 top-0 z-index-0 bg-1a1a1a"></div>
|
||||
<div class="bg-fff" id="app" ref="app">
|
||||
@@ -34,7 +35,7 @@
|
||||
<!--预热阶段-->
|
||||
<div v-if="tabid==1">
|
||||
<div class="mt30 bts-4-333 bbs-4-ff9d47 bg-fff overflowhidden ulib-r20">
|
||||
<div class="relative bbs-1-f4f4f4 last-b-none fn-flex text-center" v-if="role==2 || biz_id>0">
|
||||
<div class="relative bbs-1-f4f4f4 last-b-none fn-flex text-center" v-if="role==2 && biz_id>0">
|
||||
<a class="fn-flex-item pt40 pb40" v-for="item in h_lists" >
|
||||
<div class="font-32">{{item.num}}</div>
|
||||
<div class="mt10 font-22 color-666">{{item.title}}</div>
|
||||
@@ -58,6 +59,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt30 relative bg-fff inner40 pr30 overflowhidden box-shadow-lightGray ulib-r20" v-if="lineChart && lineChart.title">
|
||||
<div class="pb20 fn-clear">
|
||||
<b class="fn-fl font-40 text-italic" v-html="lineChart.title"></b>
|
||||
</div>
|
||||
<div id="beginChart" class="height-710"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end 预热阶段-->
|
||||
<!--直播阶段-->
|
||||
@@ -83,6 +91,12 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt30 relative bg-fff inner40 pr30 overflowhidden box-shadow-lightGray ulib-r20" v-if="lineChart && lineChart.title">
|
||||
<div class="pb20 fn-clear">
|
||||
<b class="fn-fl font-40 text-italic" v-html="lineChart.title"></b>
|
||||
</div>
|
||||
<div id="liveChart" class="height-710"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end 直播阶段-->
|
||||
@@ -184,6 +198,23 @@
|
||||
title:'',
|
||||
list:[],
|
||||
},
|
||||
lineChart:{
|
||||
// title:'',
|
||||
// legendData:['观看数', '订单数'],
|
||||
// xAxisData:['9:00-10:00', '10:00-11:00', '11:00-12:00', '12:00-13:00'],
|
||||
// seriesData:[
|
||||
// {
|
||||
// name: '观看数',
|
||||
// type: 'line',
|
||||
// data: [120, 90, 230, 210]
|
||||
// },
|
||||
// {
|
||||
// name: '订单数',
|
||||
// type: 'line',
|
||||
// data: [220, 18, 191, 234]
|
||||
// },
|
||||
// ]
|
||||
}
|
||||
},
|
||||
created(){
|
||||
|
||||
@@ -249,6 +280,8 @@
|
||||
let mainoffsetTop = document.querySelector('#main').offsetTop
|
||||
$('html,body').animate({scrollTop: mainoffsetTop+5},500);
|
||||
}
|
||||
$('#liveChart').hide()
|
||||
$('#beginChart').hide()
|
||||
this.tabid = id
|
||||
this.tabIndex = index
|
||||
this.isNoData = false
|
||||
@@ -278,6 +311,7 @@
|
||||
that.h_lists = result.data.h_lists
|
||||
that.sub_lists = result.data.sub_lists
|
||||
},'json')
|
||||
this.lineData()
|
||||
},
|
||||
|
||||
//拉取数据
|
||||
@@ -298,6 +332,7 @@
|
||||
that.h_lists = result.data.h_lists
|
||||
that.sub_lists = result.data.sub_lists
|
||||
},'json')
|
||||
// this.lineData()
|
||||
},
|
||||
|
||||
//获取大区列表
|
||||
@@ -358,6 +393,62 @@
|
||||
}
|
||||
}, 'json')
|
||||
},
|
||||
lineData(){
|
||||
if(!this.biz_id){
|
||||
return '';
|
||||
}
|
||||
var that = this
|
||||
$.get('/h5/market/sylive2/stic/ajax_line',{'type':that.tabid,'biz_id':that.biz_id}, function (response) {
|
||||
console.dir(response)
|
||||
that.lineChart = response.data
|
||||
var dom;
|
||||
setTimeout(function () {
|
||||
if(that.tabid==2){
|
||||
$('#liveChart').show()
|
||||
dom = document.getElementById('liveChart');
|
||||
}else{
|
||||
$('#beginChart').show()
|
||||
dom = document.getElementById('beginChart');
|
||||
}
|
||||
let myChart = echarts.init(dom, null, {
|
||||
renderer: 'canvas',
|
||||
useDirtyRect: false
|
||||
});
|
||||
let option;
|
||||
option = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
top: 'bottom',
|
||||
data: that.lineChart.legendData,
|
||||
},
|
||||
grid: {
|
||||
top: '4%',
|
||||
left: '2%',
|
||||
right: '2%',
|
||||
bottom: '11%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: that.lineChart.xAxisData,
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: that.lineChart.seriesData,
|
||||
};
|
||||
if (option && typeof option === 'object') {
|
||||
myChart.setOption(option);
|
||||
}
|
||||
window.addEventListener('resize', myChart.resize);
|
||||
}, 100);
|
||||
},'json')
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user