stylive_519

stylive_519_2
This commit is contained in:
dengbw
2022-05-19 16:01:48 +08:00
committed by lccsw
parent 723215c34f
commit 7db088250d
16 changed files with 1518 additions and 459 deletions
+9
View File
@@ -21,6 +21,7 @@ class Main extends HD_Controller
$this->load->model('topics/topics_model', 'mdTopics');
$this->load->model('live/Live_polyv_session_model', 'mdPolyvSession');
$this->load->model('app/licheb/app_licheb_users_log_model', 'mdUsersLog');
$this->load->model('app/licheb/syt_live_model', 'mdSytLive');
}
public function index()
@@ -66,6 +67,14 @@ class Main extends HD_Controller
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
$list = array();
$value = $this->mdSytLive->count(['status>' => -1]);
$list[] = array(
'title' => '私域通-直播(个)',
'value' => $value,
'btns' => array(
array('name' => '查看详情', 'url' => '/app/licheb/sytlive'),
),
);
$value = $this->mdTopics->count(array('app_id' => $this->app_id));
$list[] = array(
'title' => '专题(个)',
+47 -34
View File
@@ -57,7 +57,9 @@ class Sytlive extends HD_Controller
{
$params = $this->input->get();
$id = intval($params['id']);
$title = $session_id = $img = $img_url = $share_title = $share_img = $share_img_url = $time = $rule = '';
$title = $session_id = $img = $img_url = $share_title = $share_img = $share_img_url = $time = $rule = $prizes_note = '';
$img = $share_img = ['value' => '', 'src' => ''];
$prizes_list = [];
if ($id > 0) {
$re = $this->mdSytLive->get(array('id' => $id));
if (!$re || empty($re)) {
@@ -70,19 +72,27 @@ class Sytlive extends HD_Controller
$re['title'] && $title = $re['title'];
$re['session_id'] && $session_id = $re['session_id'];
if ($re['img']) {
$img = $re['img'];
$img_url = build_qiniu_image_url($re['img']);
$img['value'] = $re['img'];
$img['src'] = build_qiniu_image_url($re['img']);
}
$re['s_time'] && $time = $re['s_time'] . " ~ " . $re['e_time'];
if ($re['jsondata']) {
$jsondata = json_decode($re['jsondata'], true);
$jsondata['share_title'] && $share_title = $jsondata['share_title'];
$jsondata['share_desc'] && $share_desc = $jsondata['share_desc'];
if ($jsondata['share_img']) {
$share_img = $jsondata['share_img'];
$share_img_url = build_qiniu_image_url($jsondata['share_img']);
$share_img['value'] = $jsondata['share_img'];
$share_img['src'] = build_qiniu_image_url($jsondata['share_img']);
}
$jsondata['rule'] && $rule = $jsondata['rule'];
}
if ($re['prizes']) {//奖品配置
$prizes = json_decode($re['prizes'], true);
$prizes_note = $prizes['note'];
foreach ($prizes['list'] as $key => $value) {
$value['img_src'] = $value['img_value'] ? build_qiniu_image_url($value['img_value']) : '';
$prizes_list[] = $value;
}
}
} else {
$_title = '新增私域通-直播';
$dataInfo['editType'] = 2;
@@ -97,14 +107,14 @@ class Sytlive extends HD_Controller
$dataInfo['title'] = $title;
$dataInfo['session_id'] = $session_id;
$dataInfo['img'] = $img;
$dataInfo['img_url'] = $img_url;
$dataInfo['time'] = $time;
$dataInfo['share_title'] = $share_title;
$dataInfo['share_desc'] = $share_desc;
$dataInfo['share_img'] = $share_img;
$dataInfo['share_img_url'] = $share_img_url;
$dataInfo['rule'] = $rule;
$dataInfo['prizes_note'] = $prizes_note;
$this->data['info'] = $dataInfo;
$this->data['status_list'] = $status_list;
$this->data['prizes_list'] = $prizes_list;
$this->data['_title'] = $_title;
return $this->show_view('/app/licheb/syt/live_edit', true);
}
@@ -120,13 +130,20 @@ class Sytlive extends HD_Controller
if ($re) {
return $this->show_json(SYS_CODE_FAIL, '该直播场次已存在!');
}
//$jsonkpi = json_encode($info['kpi_list'], JSON_UNESCAPED_UNICODE);
$json_data['share_title'] = $info['share_title'];
$json_data['share_img'] = $info['share_img'];
$json_data['share_desc'] = $info['share_desc'];
$json_data['share_img'] = $info['share_img']['value'];
$json_data['rule'] = $info['rule'];
$jsondata = json_encode($json_data, JSON_UNESCAPED_UNICODE);
$addData = array("title" => $info['title'], "session_id" => $info['session_id'], "img" => $info['img'],
"jsondata" => $jsondata, "status" => $info['status'], "c_time" => time());
$prizes['note'] = $info['prizes_note'];
$prizes_list = [];
foreach ($info['prizes_list'] as $key => $value) {
unset($value['img_src']);
$prizes_list[] = $value;
}
$prizes['list'] = $prizes_list;
$prizes = json_encode($prizes, JSON_UNESCAPED_UNICODE);
$addData = ["title" => $info['title'], "session_id" => $info['session_id'], "img" => $info['img']['value'],
"jsondata" => $jsondata, "prizes" => $prizes, "status" => $info['status'], "c_time" => time()];
if ($info['time']) {
$time = explode(' ~ ', $info['time']);
$addData['s_time'] = $time[0];
@@ -151,32 +168,28 @@ class Sytlive extends HD_Controller
if (!$info['id']) {
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
$jsonkpi = json_encode($info['kpi_list'], JSON_UNESCAPED_UNICODE);
$json_data['share_title'] = $info['share_title'];
$json_data['remark'] = $info['remark'];
$json_data['share_desc'] = $info['share_desc'];
$json_data['share_img'] = $info['share_img']['value'];
$json_data['rule'] = $info['rule'];
$json_data['bg_color'] = $info['bg_color'];
$json_data['btn_color'] = $info['btn_color'];
//海报
$posters = array();
if ($info['posters']) {
foreach ($info['posters'] as $key => $value) {
$posters[] = array('url' => $value['value'], 'width' => $value['width'], 'height' => $value['height']);
}
}
$json_data['posters'] = $posters;
$jsondata = json_encode($json_data, JSON_UNESCAPED_UNICODE);
$brand_id = $info['brand_id'] ? implode(',', $info['brand_id']) : 0;
$updateData = array("brand_id" => $brand_id, "title" => $info['title'], "z_id" => $info['z_id'], "img" => $info['img']
, "jsonkpi" => $jsonkpi, "jsondata" => $jsondata);
$prizes['note'] = $info['prizes_note'];
$prizes_list = [];
foreach ($info['prizes_list'] as $key => $value) {
unset($value['img_src']);
$prizes_list[] = $value;
}
$prizes['list'] = $prizes_list;
$prizes = json_encode($prizes, JSON_UNESCAPED_UNICODE);
$updateData = ["title" => $info['title'], "session_id" => $info['session_id'], "img" => $info['img']['value'],
"jsondata" => $jsondata, "prizes" => $prizes];
if ($info['time']) {
$time = explode(' ~ ', $info['time']);
$updateData['s_time'] = $time[0];
$updateData['e_time'] = $time[1];
}
$this->mdSytLive->update($updateData, array('id' => $info['id']));
$this->mdSytLive->update($updateData, ['id' => $info['id']]);
$this->data['type'] = 'edit';
return $this->show_json(SYS_CODE_SUCCESS, '修改活动成功!');
return $this->show_json(SYS_CODE_SUCCESS, '修改直播成功!');
}
/**
@@ -285,8 +298,8 @@ class Sytlive extends HD_Controller
$msg = '请输入活动标题';
} else if (!$info['img']) {
$msg = '请上传头部图片';
} else if (!$info['session_id']) {
$msg = '请输入直播场次';
// } else if (!$info['session_id']) {
// $msg = '请输入直播场次';
} else if (!$info['time']) {
$msg = '请选择直播时间';
} else if (!$info['rule']) {
+64 -124
View File
@@ -55,15 +55,13 @@
<div class="am-para-input">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="cover"><i class="am-icon-cloud-upload"></i> 上传封面
data-file="1" data-mark="" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-params-source="vue_obj.info.img">
<i class="am-icon-cloud-upload"></i> 上传图片
</button>
<span class="f12 clr999 lh-default ml5">建议尺寸宽度690</span>
<input type="hidden" name="cover" id="cover_id"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
value="<?= $info['img'] ?>" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
src="<?= $info['img_url'] ?>"/>
:src="vue_obj.info.img.src"/>
</div>
</div>
</div>
@@ -89,7 +87,7 @@
<div class="am-form-group">
<label class="am-para-label">分享描述:</label>
<div class="am-para-input" style="width: 80%">
<input type="text" v-model="info.share_title">
<input type="text" v-model="info.share_desc">
</div>
</div>
<div class="am-form-group">
@@ -97,15 +95,12 @@
<div class="am-para-input">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="share_img"><i class="am-icon-cloud-upload"></i> 上传封面
data-file="1" data-mark="" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-params-source="vue_obj.info.share_img">
<i class="am-icon-cloud-upload"></i> 上传图片
</button>
<span class="f12 clr999 lh-default ml5">建议尺寸宽度690</span>
<input type="hidden" name="share_img" id="share_img_id"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
value="<?= $info['share_img'] ?>" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
src="<?= $info['share_img_url'] ?>"/>
:src="vue_obj.info.share_img.src"/>
</div>
</div>
</div>
@@ -132,28 +127,29 @@
<th class="text-center">图片</th>
<th class="text-center">标题</th>
<th class="text-center">排序</th>
<th class="text-center">链接</th>
<th class="text-center">价格</th>
<th class="text-right">
<a href="javascript:" style="margin-top: 2px;" class="btn btn-primary btn-sm"
<a href="javascript:" style="margin-top: 2px;"
class="btn btn-primary btn-sm"
@click='adModal()'>添加</a>
</th>
</tr>
</thead>
<tbody>
<template v-for="(item,index) in ad_list">
<template v-for="(item,index) in prizes_list">
<tr>
<td><img data-tips-image :src="item.img_url"></td>
<td><img data-tips-image :src="item.img_src"></td>
<td class="text-center">{{item.title}}</td>
<td class="text-center">
<div :id="'group_name_txt_'+index">{{item.order_view}} <a href="javascript:"
@click="showGroupEditForm(index)"><i
class="fa fa-edit"></i></a></div>
<div :id="'group_name_txt_'+index">{{item.order_view}} <a
href="javascript:"
@click="showGroupEditForm(index)"><i
class="fa fa-edit"></i></a></div>
<input :id="'group_name_'+index" @blur="editGroupName(index,item.id)"
style="display: none;" type="number" class="form-control"
v-model="item.order_view" placeholder="请输入排序值">
</td>
<td class="text-center" v-if="item.jump_type==1">报名弹窗</td>
<td class="text-center" v-else>{{item.link}}</td>
<td class="text-center">{{item.price}}</td>
<td class="text-right">
<a href="javascript:void(0);" style="margin-top:2px;"
class="btn btn-default btn-sm" @click='adModal(item)'>编辑</a>
@@ -164,7 +160,7 @@
</template>
</tbody>
</table>
<template v-if="ad_list.length <=0">
<template v-if="prizes_list.length <=0">
<div style="text-align: center;">无数据</div>
</template>
</div>
@@ -173,7 +169,7 @@
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
<label class="col-sm-2 control-label">标题</label>
<div class="col-sm-8">
<input type="text" class="form-control" v-model="ad_item.title"
<input type="text" class="form-control" v-model="prizes_item.title"
placeholder="请输入标题">
</div>
</div>
@@ -181,23 +177,31 @@
<label class="col-sm-2 control-label">图片</label>
<div class="col-sm-8">
<div class="input-group" style="width: 100%">
<input type="text" style="width: 60%" name="ad_img" id="ad_img"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
<input :value="vue_obj.prizes_img.value" type="text"
style="width: 60%;margin-right: 5px;"
class="form-control">
<img data-tips-image name="ad_img_url" id="ad_img_url"
style="height:auto;max-height:31px;min-width:31px;margin-left: 5px;margin-right: 5px;"
/>
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="ad_img">上传图片
data-file="1" data-mark="" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-params-source="vue_obj.prizes_img">
<i class="am-icon-cloud-upload"></i> 上传图片
</button>
<img data-tips-image
style="height:auto;max-height:32px;min-width:32px;margin-left: 5px;"
:src="vue_obj.prizes_img.src"/>
</div>
</div>
</div>
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
<label class="col-sm-2 control-label">价格</label>
<div class="col-sm-8">
<input type="text" class="form-control" v-model="prizes_item.price"
placeholder="请输入价格">
</div>
</div>
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
<label class="col-sm-2 control-label">排序值</label>
<div class="col-sm-4">
<input type="number" class="form-control" v-model="ad_item.order_view"
<input type="number" class="form-control" v-model="prizes_item.order_view"
placeholder="请输入排序">
</div>
<div style="padding-top:7px;">
@@ -243,13 +247,15 @@
data: {
info: {},
status_list: [],
ad_list: [],
ad_item: {},
prizes_list: [],
prizes_item: {},
prizes_img: {value: '', src: ''},
},
mounted() {
var that = this;
that.info = <?=json_encode($info)?>;
that.status_list = <?=json_encode($status_list)?>;
that.prizes_list = <?=json_encode($prizes_list)?>;
},
computed: {},
created: function () {
@@ -270,7 +276,7 @@
layer.msg("排序值不能为空!", {icon: 2});
return false;
}
this.ad_list.sort(function (a, b) {
this.prizes_list.sort(function (a, b) {
return b.order_view - a.order_view;
});
$("#group_name_" + index).hide();
@@ -279,52 +285,46 @@
adModal: function (item) {
var that = this;
var _title = '新增广告';
that.ad_item = {};
var _img = '';
var _img_url = '';
that.prizes_item = {};
if (item) {
that.ad_item = item;
that.prizes_item = item;
_title = '编辑广告';
_img = item.img;
_img_url = item.img_url;
that.prizes_img = {value: item.img_value, src: item.img_src};
} else {
that.ad_item = {"order_view": 50, "jump_type": 0};
that.prizes_item = {"order_view": 50};
that.prizes_img = {value: '', src: ''};
}
$('#ad_img').val(_img);
$("#ad_img_url").attr('src', _img_url);
layer.open({
type: 1,
area: ['50%', '38%'], //宽高
area: ['50%'], //宽高
content: $('#ad-modal'),
title: _title,
shade: false,
btn: ['确定', '取消'],
yes: function (index) {
_img = $('#ad_img').val();
_img_url = $("#ad_img_url")[0].src;
if (!item) {
that.ad_list.push({
title: that.ad_item.title,
img: _img,
img_url: _img_url,
link: that.ad_item.link,
order_view: that.ad_item.order_view,
jump_type: that.ad_item.jump_type
let timestamp = Date.parse(new Date());
let rand = parseInt(Math.random() * 1000);
let id = timestamp + rand;
that.prizes_list.push({
id: id,
title: that.prizes_item.title,
img_value: that.prizes_img.value,
img_src: that.prizes_img.src,
price: that.prizes_item.price,
order_view: that.prizes_item.order_view
});
} else {
item.img = _img;
item.img_url = _img_url;
}
that.ad_list.sort(function (a, b) {
that.prizes_list.sort(function (a, b) {
return b.order_view - a.order_view;
})
});
layer.close(index);
}
});
},
removeAd: function (index) {
var vm = this;
vm.ad_list.splice(index, 1);
vm.prizes_list.splice(index, 1);
},
editType: function (index) {
var vm = this;
@@ -348,15 +348,14 @@
},
saveEdit: function () {
var vm = this;
vm.info.img = $('#cover_id').val();
vm.info.time = $('#time_id').val();
vm.info.share_img = $('#share_img_id').val();
vm.info.prizes_list = vm.prizes_list;
$.ajax({
url: vm.info.edit_url,
type: 'post',
dataType: 'json',
data: {
info: vm.info
info: vm.info,
},
beforeSend: function () {
layer.load(1, {
@@ -387,7 +386,7 @@
saveStatus: function () {
var vm = this;
$.ajax({
url: '/app/licheb/sytactivity/edit_status',
url: '/app/licheb/sytlive/edit_status',
type: 'post',
dataType: 'json',
data: {
@@ -420,11 +419,6 @@
});
</script>
<style type="text/css">
.label-width {
width: 150px
}
.my-ul ul li {
padding: 10px;
}
@@ -435,64 +429,10 @@
height: 90px;
}
.auto-content {
width: min-content;
min-width: 50%;
}
.btn-group .disabled {
background-color: #eee;
opacity: 1;
}
.photo-upload {
position: relative;
font-size: 0;
}
.photo-upload:after {
content: "";
display: table;
clear: both;
}
.photo-upload-item {
position: relative;
float: left;
margin-right: 10px;
margin-bottom: 10px;
font-size: 12px; /*display:inline-block;width:120px;*/
}
.photo-upload-item > img {
}
.photo-upload-item-check,
.photo-upload-item-remove {
opacity: 0;
position: absolute;
top: -8px;
right: -8px;
width: 24px;
height: 24px;
line-height: 24px;
border: 1px solid #fff;
background-color: #eee;
border-radius: 50%;
text-align: center;
cursor: pointer;
}
.photo-upload-item:hover .photo-upload-item-remove {
opacity: 1;
transition: all .4s ease
}
.photo-upload-item-check {
opacity: 1;
background-color: #36f;
color: #fff;
}
</style>
<link rel="stylesheet" type="text/css" href="/static/css/appitem/font-awesome.min.css?v=1581252500">
<link rel="stylesheet" type="text/css" href="/static/css/appitem/AdminLTE.min.css?v=1581252500">
+6 -6
View File
@@ -48,12 +48,12 @@
</tr>
<tr>
<td colspan="7" class="align-r">
<a class="am-btn am-btn-primary am-btn-xs"
data-open="/receiver/customer?cfrom_id=35&t_id=<?= $v['id'] ?>">报名</a>
<a class="am-btn am-btn-primary am-btn-xs"
data-open="/app/licheb/sytbiz/lists?a_id=<?= $v['id'] ?>">门店</a>
<a class="am-btn am-btn-primary am-btn-xs"
data-open="/app/licheb/sytbiz/get_achievement?a_id=<?= $v['id'] ?>">业绩报告</a>
<!-- <a class="am-btn am-btn-primary am-btn-xs"-->
<!-- data-open="/receiver/customer?cfrom_id=35&t_id=--><?//= $v['id'] ?><!--">报名</a>-->
<!-- <a class="am-btn am-btn-primary am-btn-xs"-->
<!-- data-open="/app/licheb/sytbiz/lists?a_id=--><?//= $v['id'] ?><!--">门店</a>-->
<!-- <a class="am-btn am-btn-primary am-btn-xs"-->
<!-- data-open="/app/licheb/sytbiz/get_achievement?a_id=--><?//= $v['id'] ?><!--">业绩报告</a>-->
<a class="am-btn am-btn-primary am-btn-xs"
data-modal="/common/share_qrcode?url=<?= $v['url'] ?>"
data-title="分享二维码">分享二维码</a>
+4 -1
View File
@@ -34,9 +34,12 @@ class Plan extends CI_Controller
$plan[] = array('url' => base_url(array('plan', 'licheb', 'visit_sales_sms')), 'interval' => 1);//给销售发送待回访短信
$plan[] = array('url' => base_url(array('plan', 'licheb', 'customer_manager_sms')), 'interval' => 1);//给店长发送待分配短信
$plan[] = array('url' => base_url(array('plan', 'licheb', 'customer_manager_sms')), 'interval' => 1);//给店长发送待分配短信
$plan[] = array('url' => base_url(array('plan', 'items', 'stock_log')), 'interval' => 5);//库存车辆日志
$plan[] = array('url' => base_url(array('plan', 'licheb', 'users_log')), 'interval' => 2);//顾问日志
$plan[] = array('url' => base_url(array('plan', 'items', 'stock_log')), 'interval' => 5);//库存车辆日志
$plan[] = array('url' => base_url(array('plan', 'polyv', 'view_log')), 'interval' => 5);//直播观看详情数据
$plan[] = array('url' => base_url(array('plan', 'biz', 'settle')), 'interval' => 1);
$plan[] = array('url' => base_url(array('plan', 'biz', 'merge')), 'interval' => 20); //合并结算
$plan[] = array('url' => base_url(array('plan', 'order', 'up_old_status')), 'interval' => 30); //更新旧订单状态
+107
View File
@@ -0,0 +1,107 @@
<?php
/**
* Notes:保利威云直播
* Created on: 2022/05/17 17:15
* Created by: dengbw
*/
class Polyv extends HD_Controller
{
private $log_file;
public function __construct()
{
parent::__construct();
$this->log_file = 'polyv.log';
}
/**
* Notes:查询频道直播观看详情数据
* Created on: 2022/5/17 16:01
* Created by: dengbw
* https://liche-api-dev.xiaoyu.com/plan/polyv/view_log?sd=1
* https://api.liche.cn/plan/polyv/view_log
*/
public function view_log()
{
$this->load->model('live/Live_polyv_viewlog_model', 'mdPolyvViewlog');
$this->load->library('PolyvApi');
$startTime = $endTime = time();
$redis = &load_cache('redis');
$redisKey = 'polyv_view_log_endtime';
$get_endTime = $redis->get($redisKey);
$params = $this->input->get();
if ($get_endTime && (date('Y-m-d', $get_endTime) != date('Y-m-d'))) {
$get_endTime = '';
}
if (!$get_endTime || $params['sd']) {
$startTime = strtotime(date('Y-m-d') . ' 00:00:00');
} else if ($get_endTime) {
$startTime = $get_endTime;
}
$params['startTime'] = $startTime * 1000;
$params['endTime'] = $endTime * 1000;
$params['param3'] = 'live';
$params['page'] = 1;
$results = $this->getViewLog($params);
if ($results['status'] == 'success') {
$redis->save($redisKey, $endTime, 24 * 3600);//保存最后时间
$i = 10;
while (($i--) > 0) {
if ($results['status'] == 'success' && !$results['lastPage']
&& $results['pageNumber'] != $results['nextPageNumber']) {//循环分页
$params['page'] = $results['nextPageNumber'];
$results = $this->getViewLog($params);
continue;
} else {
break;
}
}
}
//if ($params['sd']) {
echo 'startTime=' . date('Y-m-d H:i:s', $startTime) . '&endTime=' . date('Y-m-d H:i:s', $endTime) . '<br><br>';
echo json_encode($results, JSON_UNESCAPED_UNICODE);
//}
}
/**
* Notes:新增/修改直播数据
* Created on: 2022/5/19 14:25
* Created by: dengbw
* @param $params
* @return bool|string
*/
private function getViewLog($params)
{
$polyv = new PolyvApi();
$results = $polyv->getViewLog($params);
if ($results['status'] == 'success') {
$addData = [];
foreach ($results['data']['contents'] as $key => $value) {
$re = $this->mdPolyvViewlog->get(['playId' => $value['playId']]);
$data = [
'channelId' => $value['channelId'], 'sessionId' => $value['sessionId'], 'playId' => $value['playId'],
'userId' => $value['userId'], 'playDuration' => $value['playDuration'], 'stayDuration' => $value['stayDuration'],
'flowSize' => $value['flowSize'], 'param1' => $value['param1'], 'param2' => $value['param2'],
'param3' => $value['param3'], 'param4' => $value['param4'], 'param5' => $value['param5'], 'ptype' => $value['ptype'],
'ipAddress' => $value['ipAddress'], 'country' => $value['country'], 'province' => $value['province'],
'city' => $value['city'], 'isp' => $value['isp'], 'referer' => $value['referer'], 'userAgent' => $value['userAgent'],
'operatingSystem' => $value['operatingSystem'], 'browser' => $value['browser'], 'isMobile' => $value['isMobile'],
'currentDay' => $value['currentDay'], 'createdTime' => $value['createdTime'], 'lastModified' => $value['lastModified'],
];
if ($re) {//同步更新数据
$this->mdPolyvViewlog->update($data, ['id' => $re['id']]);
} else {//新增
$data['c_time'] = time();
$addData[] = $data;
}
}
if ($addData && count($addData)) {//新增数据
$addData = array_reverse($addData);
$this->mdPolyvViewlog->add_batch($addData);
}
}
return $results;
}
}
+28
View File
@@ -23,6 +23,34 @@ class PolyvApi
$this->timestamp = time() * 1000;
}
/**
* Notes:h5创建SDK参数
* Created on: 2022/5/12 15:21
* Created by: dengbw
* @return array
*/
function getLiveSdk()
{
$params_sign = [
'appId' => $this->app_id,
'channelId' => $this->channel_id,
'timestamp' => $this->timestamp,
];
$sign = $this->getSign($params_sign);
return ['channelId' => $this->channel_id, 'sign' => $sign, 'timestamp' => $this->timestamp, 'appId' => $this->app_id];
}
/**
* Notes:获取参数
* Created on: 2022/5/16 17:38
* Created by: dengbw
* @return array
*/
function getLiveParam()
{
return ['appId' => $this->app_id, 'app_secret' => $this->app_secret, 'user_id' => $this->user_id, 'channelId' => $this->channel_id];
}
/**
* Notes:分页查询频道直播观看详情数据
* https://help.polyv.net/index.html#/live/api/channel/viewdata/viewlog_page
@@ -0,0 +1,18 @@
<?php
/**
* Notes:私域通-直播门店数据
* Created on: 2022/05/07 13:38
* Created by: dengbw
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Syt_live_biz_model extends HD_Model
{
private $table_name = 'lc_syt_live_biz';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
}
@@ -0,0 +1,18 @@
<?php
/**
* Notes:私域通-直播数据
* Created on: 2022/05/07 13:38
* Created by: dengbw
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Syt_live_data_model extends HD_Model
{
private $table_name = 'lc_syt_live_data';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
}
@@ -15,4 +15,21 @@ class Syt_live_model extends HD_Model
{
parent::__construct($this->table_name, 'default');
}
/**
* Notes:直播状态
* Created on: 2022/5/19 11:23
* Created by: dengbw
* @param string $id
* @return array|mixed
*/
public function lStatusAry($id = '')
{
$arr = [0 => '直播未开始', 1 => '直播已开始', 2 => '直播已结束'];
if (strlen($id)) {
return $arr[$id];
} else {
return $arr;
}
}
}
@@ -84,7 +84,8 @@ class Receiver_customers_model extends HD_Model
$arr[3] = ['name' => '网络推广', 'list' => [30 => '抖音', 31 => '区域媒体', 32 => '懂车帝', 33 => '易车',
34 => '汽车之家', 35 => '网红', 36 => '厂商分配', 37 => '狸车分配']];
$arr[4] = ['name' => '外展外拓', 'list' => [40 => '巡展', 41 => '车展', 42 => '静展', 43 => '大客户']];
$arr[5] = ['name' => '自媒体', 'list' => [50 => '小红书号', 51 => '咸鱼号', 52 => '抖音号', 53 => '狸车素材', 54 => '知乎号']];
$arr[5] = ['name' => '自媒体', 'list' => [50 => '小红书号', 51 => '咸鱼号', 52 => '抖音号', 53 => '狸车素材'
, 54 => '知乎号', 55 => '私域直播']];
if ($id) {
return $arr[$id];
} else {
+536 -29
View File
@@ -8,11 +8,16 @@ class Live extends Wxapp
private $session;
private $secret;
private $uid = 0;
private $of_id = 5;//自媒体
private $of2_id = 55;//私域直播
public function __construct()
{
parent::__construct(2);
$this->secret = "syt_live_2022505";
$this->load->model('app/licheb/syt_live_model', 'mdSytLive');
$this->load->model('app/licheb/syt_live_biz_model', 'mdSytLiveBiz');
$this->load->model('app/licheb/syt_live_data_model', 'mdSytLiveData');
$this->load->model('app/app_weixin_users_model', 'mdWeixinUsers');
$this->load->model('app/licheb/app_licheb_users_model', 'mdLichebUsers');
$ukey = get_cookie('ukey');
@@ -23,7 +28,7 @@ class Live extends Wxapp
//重置cookie
$reset = $this->input_param('reset');
if ($reset) {
set_cookie("ukey", "", 86400 * 30);
set_cookie("ukey", "", 86400 * 1);
$this->session = array();
$this->uid = 0;
}
@@ -54,17 +59,17 @@ class Live extends Wxapp
}
$cf_uid = intval($params['cf_uid']);//来源狸车宝用户id
$biz_id = intval($params['biz_id']);//门店id
echo json_encode($params, JSON_UNESCAPED_UNICODE);
// $re = $this->mdSytActivity->get(array("id" => $id, "status" => 1));
// if (!$re) {
// throw new Hd_exception("活动不存在", 400);
// }
//echo json_encode($params, JSON_UNESCAPED_UNICODE);
$re = $this->mdSytLive->get(array("id" => $id, "status" => 1));
if (!$re) {
throw new Hd_exception("直播不存在", 400);
}
$checkua = checkua();
$sign_package = [];
$url = http_host_com('home') . "/h5/syt/live?skey={$skey}";
if ($checkua == 'wxwork') {//企业微信
$this->load->library('wx_qyapi_agent', ['app' => 'liche_1000024']);
$this->load->library('wx_qyapi', ['app' => 'liche']);
$this->load->library('wx_qyapi_agent', ['app' => 'lichene_1000024']);
$this->load->library('wx_qyapi', ['app' => 'lichene']);
$this->set_auth_wxwork($url);
$sign_package = $this->wx_qyapi->getSignPackage();
} else if ($checkua == 'wx') {//微信
@@ -73,12 +78,26 @@ class Live extends Wxapp
$jssdk = new Jssdk('liche');
$sign_package = $jssdk->getSignPackage();
}
$live_user = ['userId' => 888888888, 'userName' => '私域直播', 'pic' => '//livestatic.videocc.net/assets/wimages/missing_face.png'];
if ($this->uid) {
$re_wu = $this->mdWeixinUsers->get(['id' => $this->uid]);
if ($re_wu) {//更新参数
$jsondata = $re_wu['jsondata'] ? json_decode($re_wu['jsondata'], true) : '';
$jsondata['live'] = $params;
$this->mdWeixinUsers->update(['jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE)], ['id' => $this->uid]);
if ($checkua == 'wxwork') {
$re_wu = $this->mdLichebUsers->get(['id' => $this->uid]);
if ($re_wu) {
$re_wu['unionid'] && $live_user['userId'] = $re_wu['unionid'];
$live_user['userName'] = $re_wu['nickname'] ? $re_wu['nickname'] : $re_wu['uname'];
$re_wu['headimg'] && $live_user['pic'] = $re_wu['headimg'];
}
} else if ($checkua == 'wx') {
$re_wu = $this->mdWeixinUsers->get(['id' => $this->uid]);
if ($re_wu) {
$re_wu['unionid'] && $live_user['userId'] = $re_wu['unionid'];
$re_wu['nickname'] && $live_user['userName'] = $re_wu['nickname'];
$re_wu['headimg'] && $live_user['pic'] = $re_wu['headimg'];
////更新参数
// $jsondata = $re_wu['jsondata'] ? json_decode($re_wu['jsondata'], true) : '';
// $jsondata['live'] = $params;
// $this->mdWeixinUsers->update(['jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE)], ['id' => $this->uid]);
}
}
if ($this->session['biz_id']) {//门店人员
$biz_id = $this->session['biz_id'];
@@ -86,17 +105,86 @@ class Live extends Wxapp
}
}
$share_skey = "id=" . $id . "&cf_uid=" . $cf_uid . '&biz_id=' . $biz_id;
echo '<br>share_skey:' . $share_skey;
//echo '<br>share_skey:' . $share_skey;
$share_url = http_host_com('home') . "/h5/syt/live?skey=" . $this->myencryption->base64url_encode($share_skey);
echo '<br>share_url:' . $share_url;
$title = '盲盒抽奖';
//echo '<br>share_url:' . $share_url;
$title = $re['title'];
$share_img = $share_desc = $rule_content = '';
if ($re['jsondata']) {
$jsondata = json_decode($re['jsondata'], true);
$jsondata['share_img'] && $share_img = build_qiniu_image_url($jsondata['share_img']);
$jsondata['share_desc'] && $share_desc = $jsondata['share_desc'];
$jsondata['rule'] && $rule_content = str_replace("\n", "<br>", $jsondata['rule']);
}
$winInfo = $prizeList = [];
$prizes = $re['prizes'] ? json_decode($re['prizes'], true) : [];
foreach ($prizes['list'] as $key => $value) {
$prizeList[$value['id']] = $value;
}
$res_data = $this->mdSytLiveData->select(['l_id' => $id, 'type' => 2], 'id DESC', 1, 15, 'jsondata');
foreach ($res_data as $key => $value) {
if ($value['jsondata']) {
$jsondata_l = json_decode($value['jsondata'], true);
$prize_name = $prizeList[$jsondata_l['prize_id']]['title'];
$mobile = mobile_asterisk($jsondata_l['mobile']);
$winInfo[] = ['title' => $mobile . '领取了盲盒,开出了' . $prize_name];
}
}
$info['id'] = $id;
$info['session_id'] = $re['session_id'];
$info['l_status'] = $re['l_status'];
$info['l_status_name'] = $this->mdSytLive->lStatusAry($re['l_status']);
$info['cf_uid'] = $cf_uid;
$info['biz_id'] = $biz_id;
$info['biz_uid'] = intval($this->session['biz_uid']);
$info['checkua'] = $checkua;
$info['winInfo'] = $winInfo;
$info['banner'] = $re['img'] ? build_qiniu_image_url($re['img']) : '';
$info['rule'] = ['title' => '活动规则', 'content' => $rule_content];
$info['isOpen'] = false;//是否已开奖
$info['lottery'] = false;//是否已中奖
$info['e_time'] = 15;//距离开奖时间
$info['serviceCode'] = 'http://www.xmfish.com/images/chanel/www/index2/b_mobile.jpg';
$info['msgMyPrize'] = ['title' => '', 'lottery' => ['title' => '', 'img' => '', 'name' => '', 'mobile' => '',
'time' => ['title' => '', 'content' => ''], 'other' => ['title' => '注意事项', 'content' => '您还未登记信息!']]];
//检查是否试中奖
$re_data = $this->mdSytLiveData->get(['l_id' => $id, 'type' => 2, 'if_biz' => $this->session['biz_id'] ? 1 : 0
, 'uid' => $this->session['biz_uid'] ? $this->session['biz_uid'] : $this->uid]);
if ($re_data) {
$jsondata = $re_data['jsondata'] ? json_decode($re_data['jsondata'], true) : '';
$prize_id = intval($jsondata['prize_id']);
if ($prize_id) {
$prizes_item = $prizeList[$prize_id];
if ($prizes_item) {
$info['isOpen'] = true;//已开奖
$info['lottery'] = true;//已中奖
$info['e_time'] = 0;
$info['msgMyPrize'] = ['title' => '我的试驾礼', 'lottery' => ['title' => $prizes_item['title']
, 'img' => build_qiniu_image_url($prizes_item['img_value']), 'price' => $prizes_item['price']
, 'name' => $jsondata['name'], 'mobile' => $jsondata['mobile'],
'time' => ['title' => '活动时间', 'content' => $prizes['note']],
'other' => ['title' => '注意事项', 'content' => '']]];
}
}
}
//直播参数
$this->load->library('PolyvApi');
$polyv = new PolyvApi();
$liveSdk = $polyv->getLiveSdk();
$liveSdk['user'] = $live_user;
$info['liveSdk'] = $liveSdk;
//分享
$share = [
'title' => $title,
"img" => 'http://bbs.xmfish.com/attachment/2022_05/097c021b16d9ed4c11e7cb6f97818350.jpg',
"desc" => '五一说走就走的旅行!下了两天雨,终于要大晴天了',
"img" => $share_img,
"desc" => $share_desc,
"url" => $share_url
];
if ($re['l_status'] == 1) {//加进入直播统计
$this->addLiveData(['type' => 1, 'l_id' => $id, 'cf_uid' => $cf_uid, 'biz_id' => $biz_id]);
}
$data = [
"info" => $info,
'_title' => $title,
"sign_package" => $sign_package,
"share" => $share,
@@ -106,6 +194,428 @@ class Live extends Wxapp
return $data;
}
function get_statistics()
{
$params = $this->input->get();
$id = intval($params['id']);
if (!$id) {
throw new Hd_exception('参数错误', 400);
}
if (!$this->session['biz_id']) {
throw new Hd_exception('无权限查看', 400);
}
$re = $this->mdSytLive->get(array("id" => $id, "status" => 1));
if (!$re) {
throw new Hd_exception("直播不存在", 400);
}
$this->load->model('live/Live_polyv_viewlog_model', 'mdPolyvViewlog');
$this->load->model("biz/biz_model", 'mdBiz');
$where = ['l_id' => $id, 'biz_id' => $this->session['biz_id']];
$re_biz = $this->mdSytLiveBiz->get($where);
//$watchs_num = $this->mdSytLiveData->count(['l_id' => $id, 'biz_id' => $this->session['biz_id'], 'type' => 1]);
$watchs = $enrolls = $playDuration = $watchs_num = 0;
if ($re_biz) {
$watchs = $re_biz['watchs'];
$enrolls = $re_biz['enrolls'];
}
$dynamic = $watchsList = $enrollsList = [];
$res = $this->mdSytLiveData->select($where, 'id DESC', 1, 15, 'uid,if_biz,type,c_time');
if ($res) {
$users_wx = $users_cb = $map_wx = $map_cb = [];
foreach ($res as $key => $value) {
if ($value['if_biz']) {
$users_cb[] = $value['uid'];
} else {
$users_wx[] = $value['uid'];
}
}
if ($users_wx) {
$str_ids = implode(',', array_unique($users_wx));
$map_wx = $this->mdWeixinUsers->map('id', 'nickname,uname', ["id in({$str_ids})" => null]);
}
if ($users_cb) {
$str_ids = implode(',', array_unique($users_cb));
$map_cb = $this->mdLichebUsers->map('id', 'nickname,uname', ["id in({$str_ids})" => null]);
}
foreach ($res as $key => $value) {
$type_name = $value['type'] == 2 ? ' 领取了试驾盒' : ' 进入了直播间';
if ($value['if_biz']) {
$name = $map_cb[$value['uid']]['nickname'] ? $map_cb[$value['uid']]['nickname'] : $map_cb[$value['uid']]['uname'];
} else {
$name = $map_wx[$value['uid']]['nickname'] ? $map_wx[$value['uid']]['nickname'] : $map_wx[$value['uid']]['uname'];
}
!$name && $name = '无用户名';
$dynamic[] = ['title' => $name . $type_name, 'time' => friendly_date($value['c_time'], 'mohu')];
}
}
if ($re['session_id']) {
$this->load->library('PolyvApi');
$polyv = new PolyvApi();
$liveParam = $polyv->getLiveParam();
$where_live = ['param3' => 'live', 'channelId' => $liveParam['channelId'], 'sessionId' => $re['session_id'],
"param1 in (select distinct unionid from lc_syt_live_data where l_id={$id} AND biz_id={$this->session['biz_id']} AND type=1)" => null];
$re_sum = $this->mdPolyvViewlog->sum('playDuration', $where_live);
$playDuration = ceil($re_sum['playDuration'] / $watchs);
$watchs_num = $this->mdPolyvViewlog->count($where_live);
}
$res_watchs = $this->mdSytLiveBiz->select(['l_id' => $id], 'watchs DESC,id ASC', 1, 10, 'biz_id,watchs');
if ($res_watchs) {
$str_ids = implode(',', array_unique(array_column($res_watchs, 'biz_id')));
$map_biz = $this->mdBiz->map('id', 'biz_name', ["id in({$str_ids})" => null]);
foreach ($res_watchs as $key => $value) {
$watchsList[] = ['ranking' => ($key + 1), 'name' => $map_biz[$value['biz_id']], 'num' => $value['watchs'] . '人'];
}
}
$res_enrolls = $this->mdSytLiveBiz->select(['l_id' => $id], 'enrolls DESC,id ASC', 1, 10, 'biz_id,enrolls');
if ($res_enrolls) {
$str_ids = implode(',', array_unique(array_column($res_enrolls, 'biz_id')));
$map_biz = $this->mdBiz->map('id', 'biz_name', ["id in({$str_ids})" => null]);
foreach ($res_enrolls as $key => $value) {
$enrollsList[] = ['ranking' => ($key + 1), 'name' => $map_biz[$value['biz_id']], 'num' => $value['enrolls'] . '人'];
}
}
$survey = [['title' => '累计观看(次)', 'num' => $watchs_num, 'url' => ''], ['title' => '人均观看(秒)', 'num' => $playDuration, 'url' => '']
, ['title' => '观看用户', 'num' => $watchs, 'url' => '/h5/syt/live/statistics_view?id=' . $id], ['title' => '报名用户(人)', 'num' => $enrolls, 'url' => '']];
$info = ['tabid' => 1, 'tab' => [['id' => 1, 'title' => '活动数据'], ['id' => 2, 'title' => '活动排名']],
'survey' => $survey, 'dynamic' => $dynamic, 'watchsList' => $watchsList, 'enrollsList' => $enrollsList];
$data = [
"info" => $info,
'_title' => '活动数据',
'view' => 'h5/syt/live_statistics',
];
return $data;
}
function get_statistics_view()
{
$params = $this->input->get();
$id = intval($params['id']);
if (!$id) {
throw new Hd_exception('参数错误', 400);
}
if (!$this->session['biz_id']) {
throw new Hd_exception('无权限查看', 400);
}
$re = $this->mdSytLive->get(array("id" => $id, "status" => 1));
if (!$re) {
throw new Hd_exception("直播不存在", 400);
}
$info = ['id' => $id, 'thead' => ['观看昵称', '观看次数', '停留时长'], 'isDataEnd' => false, 'isNoData' => false, 'list' => []];
$res = $this->statistics_view_list(['id' => $id, 'session_id' => $re['session_id']]);
$info['session_id'] = $re['session_id'];
$info['isNoData'] = $res['total'] == 0 ? true : false;
$info['isDataEnd'] = count($res['list']) == $res['total'] ? true : false;
$info['list'] = $res['list'];
$data = [
"info" => $info,
'_title' => '活动数据_观看用户',
'view' => 'h5/syt/live_statistics_view',
];
return $data;
}
function get_statistics_view_list()
{
$params = $this->input->get();
$data = $this->statistics_view_list($params);
$data['code'] = 200;
return $data;
}
function statistics_view_list($params = [])
{
$this->load->model('live/Live_polyv_viewlog_model', 'mdPolyvViewlog');
$page = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] ? intval($params['size']) : 10;
$where = ['l_id' => $params['id'], 'biz_id' => $this->session['biz_id']];
$total = $this->mdSytLiveData->count($where, 'unionid');
$list = [];
if ($total) {
$res = $this->mdSytLiveData->select($where, 'id DESC', $page, $size, 'distinct(unionid),uid,if_biz,unionid');
$users_wx = $users_cb = $map_wx = $map_cb = [];
foreach ($res as $key => $value) {
if ($value['if_biz']) {
$users_cb[] = $value['uid'];
} else {
$users_wx[] = $value['uid'];
}
}
if ($users_wx) {
$str_ids = implode(',', array_unique($users_wx));
$map_wx = $this->mdWeixinUsers->map('id', 'nickname,uname,headimg', ["id in({$str_ids})" => null]);
}
if ($users_cb) {
$str_ids = implode(',', array_unique($users_cb));
$map_cb = $this->mdLichebUsers->map('id', 'nickname,uname,headimg', ["id in({$str_ids})" => null]);
}
$this->load->library('PolyvApi');
$polyv = new PolyvApi();
$liveParam = $polyv->getLiveParam();
foreach ($res as $key => $value) {
if ($value['if_biz']) {
$name = $map_cb[$value['uid']]['nickname'] ? $map_cb[$value['uid']]['nickname'] : $map_cb[$value['uid']]['uname'];
$headimg = $map_cb[$value['uid']]['headimg'];
} else {
$name = $map_wx[$value['uid']]['nickname'] ? $map_wx[$value['uid']]['nickname'] : $map_wx[$value['uid']]['uname'];
$headimg = $map_wx[$value['uid']]['headimg'];
}
$where_live = ['param3' => 'live', 'channelId' => $liveParam['channelId'], 'sessionId' => $params['session_id']
, 'param1' => $value['unionid']];
$num = $this->mdPolyvViewlog->count($where_live);
$re_sum = $this->mdPolyvViewlog->sum('playDuration', $where_live);
$time = 0;
if ($re_sum['playDuration']) {
$format = $re_sum['playDuration'] >= 3600 ? 'H时i分s秒' : 'i分s秒';
$time = gmdate($format, $re_sum['playDuration']);
}
$tip = '';
$re = $this->mdSytLiveData->count(array_merge($where, ['type' => 2, 'unionid' => $value['unionid']]));
$re && $tip = '报名';
!$name && $name = '无用户名';
!$headimg && $headimg = '/img/h5/avatar.png';
$list[] = ['headimg' => $headimg, 'name' => $name, 'tip' => $tip, 'num' => $num, 'time' => $time];
}
}
return ['total' => $total, 'list' => $list];
}
/**
* Notes:修改直播状态
* Created on: 2022/5/19 11:57
* Created by: dengbw
* @return array
* @throws Hd_exception
*/
function post_l_status()
{
$params = $this->input->post();
$id = intval($params['id']);
$l_status = intval($params['l_status']);
$session_id = $params['session_id'];
if (!$id || !$session_id) {
throw new Hd_exception('参数错误', 400);
}
$re = $this->mdSytLive->get(array("id" => $id, "status" => 1));
if (!$re) {
throw new Hd_exception("直播不存在", 400);
}
$upData = ['l_status' => $l_status];
if (!$re['session_id']) {
$upData['session_id'] = $session_id;
} else {
$session_id = $re['session_id'];
}
$this->mdSytLive->update($upData, ["id" => $re['id']]);
$data = [
"code" => 200,
"msg" => '状态更新成功',
'l_status' => $l_status,
'l_status_name' => $this->mdSytLive->lStatusAry($l_status),
'session_id' => $session_id
];
return $data;
}
/**
* Notes:抽盲盒
* Created on: 2022/5/11 17:35
* Created by: dengbw
*/
function post_lottery()
{
$params = $this->input->post();
$id = intval($params['id']);
if (!$id) {
throw new Hd_exception('参数错误', 400);
}
$re = $this->mdSytLive->get(array("id" => $id, "status" => 1));
if (!$re) {
throw new Hd_exception("直播不存在", 400);
}
if ($re['l_status'] != 1) {
throw new Hd_exception($this->mdSytLive->lStatusAry($re['l_status']), 400);
}
$msgWin = ['title1' => '恭喜您', 'title2' => '获得试驾好礼啦'];
$msgMyPrize = [];
$prizes = $re['prizes'] ? json_decode($re['prizes'], true) : [];
if ($prizes && $prizes['list']) {
$msgWin['content'] = $prizes['note'];
$count = count($prizes['list']) - 1;
$num = rand(0, $count);
$prizes_item = $prizes['list'][$num];
if ($prizes_item) {
$msgWin['id'] = $prizes_item['id'];
$msgWin['name'] = $prizes_item['title'];
$msgWin['price'] = $prizes_item['price'];
$msgWin['img'] = $prizes_item['img_value'] ? build_qiniu_image_url($prizes_item['img_value']) : '';
$msgMyPrize = ['title' => '我的试驾礼', 'lottery' => ['title' => $msgWin['name']
, 'img' => $msgWin['img'], 'price' => $msgWin['price'], 'name' => '', 'mobile' => '',
'time' => ['title' => '活动时间', 'content' => $prizes['note']],
'other' => ['title' => '注意事项', 'content' => '您还未登记信息!']]];
}
} else {
throw new Hd_exception("暂无盲盒奖品", 400);
}
$data = [
"code" => 200,
"msg" => '抽奖成功',
'msgWin' => $msgWin,
'msgMyPrize' => $msgMyPrize,
];
return $data;
}
/**
* Notes:登记信息
* Created on: 2022/5/16 10:32
* Created by: dengbw
* @throws Hd_exception
*/
function post_enroll()
{
$params = $this->input->post();
$mobile = $params['mobile'];
$name = $params['name'];
if (!$name) {
throw new Hd_exception('请输入您的姓名', 400);
}
if (!mobile_valid($mobile)) {
throw new Hd_exception('请输入正确的手机号', 400);
}
$id = intval($params['id']);
$biz_id = intval($params['biz_id']);
$cf_uid = intval($params['cf_uid']);
$prize_id = intval($params['prize_id']);
$re = $this->mdSytLive->get(array("id" => $id, "status" => 1));
if (!$re) {
throw new Hd_exception("直播不存在", 400);
}
if ($re['l_status'] != 1) {
throw new Hd_exception($this->mdSytLive->lStatusAry($re['l_status']), 400);
}
$uid = $this->session['biz_uid'] ? $this->session['biz_uid'] : $this->uid;
$this->load->model("biz/biz_model", 'mdBiz');
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
$re_data = $this->mdSytLiveData->get(['type' => 2, 'l_id' => $id, 'if_biz' => $this->session['biz_id'] ? 1 : 0, 'uid' => $uid]);
if ($re_data) {
throw new Hd_exception('您已经登记过了', 400);
}
if (!$biz_id) {//无门店加入线索池
$cf_id = 35;
$this->load->model('receiver/receiver_clues_model', 'mdClues');
$re_clue = $this->mdClues->get(['out_id' => $id, 'cf_id' => $cf_id, 'mobile' => $mobile]);
if ($re_clue) {
throw new Hd_exception('您已经登记过', 400);
}
$add_data = [
'name' => $name,
'mobile' => $mobile,
'cf_id' => $cf_id,
'out_id' => $id,
'cf_platform' => 'h5',
'en_time' => date('Y-m-d H:i:s'),
'c_time' => time()
];
$this->mdClues->db->trans_begin();
$enroll_id = $this->mdClues->add($add_data);
$jsondata = ['name' => $name, 'mobile' => $mobile, 'enroll_id' => $enroll_id, 'enroll_type' => 2, 'prize_id' => $prize_id];
$id_d = $this->addLiveData(['type' => 2, 'l_id' => $id, 'cf_uid' => $cf_uid, 'biz_id' => $biz_id, 'jsondata' => $jsondata]);
if ($enroll_id && $id_d) {
$this->mdClues->db->trans_commit();
throw new Hd_exception('登记成功', 200);
} else {
$this->mdClues->db->trans_rollback();
throw new Hd_exception('登记失败,请重试', 400);
}
}
$re_cus = $this->mdCustomers->get(['biz_id' => $biz_id, 'mobile' => $mobile, 'of_id' => $this->of_id
, 'of2_id' => $this->of2_id, 't_id' => $id]);
if ($re_cus) {
throw new Hd_exception('您已经登记过', 400);
}
$city_id = $county_id = 0;
$re_biz = $this->mdBiz->get(['id' => $biz_id, 'status' => 1]);
if ($re_biz) {
$city_id = $re_biz['city_id'];
$county_id = $re_biz['county_id'];
}
$add_data = [
'name' => $name,
'mobile' => $mobile,
'biz_id' => $biz_id,
'city_id' => $city_id,
'county_id' => $county_id,
'cf_title' => '自有资源',
'of_id' => $this->of_id,
'of2_id' => $this->of2_id,
'admin_id' => $cf_uid,
't_id' => $id,
'p_time' => date('Y-m-d H:i:s'),
'c_time' => time()
];
$this->mdCustomers->db->trans_begin();
$enroll_id = $this->mdCustomers->add($add_data);
$jsondata = ['name' => $name, 'mobile' => $mobile, 'enroll_id' => $enroll_id, 'enroll_type' => 1, 'prize_id' => $prize_id];
$id_d = $this->addLiveData(['type' => 2, 'l_id' => $id, 'cf_uid' => $cf_uid, 'biz_id' => $biz_id, 'jsondata' => $jsondata]);
if ($enroll_id && $id_d) {
$this->mdCustomers->db->trans_commit();
throw new Hd_exception('登记成功', 200);
} else {
$this->mdCustomers->db->trans_rollback();
throw new Hd_exception('登记失败,请重试', 400);
}
}
/**
* Notes:直播数据
* Created on: 2022/5/16 10:31
* Created by: dengbw
* @param $params
* @return mixed
*/
private function addLiveData($params)
{
$add_data = [
'l_id' => $params['l_id'],
'unionid' => $this->session['unionid'],
'uid' => $this->session['biz_uid'] ? $this->session['biz_uid'] : $this->uid,
'cf_uid' => $params['cf_uid'],
'biz_id' => $params['biz_id'],
'type' => $params['type'],
'if_biz' => $this->session['biz_uid'] ? 1 : 0,
'c_time' => time()
];
$params['jsondata'] && $add_data['jsondata'] = json_encode($params['jsondata'], JSON_UNESCAPED_UNICODE);
$id = $this->mdSytLiveData->add($add_data);
if ($id && $params['biz_id']) {//更新门店数据
$re_biz = $this->mdSytLiveBiz->get(['l_id' => $params['l_id'], 'biz_id' => $params['biz_id']]);
if ($re_biz) {
if ($params['type'] == 2) {//试驾盲盒人
$this->mdSytLiveBiz->update(['enrolls = enrolls+1' => null], ['id' => $re_biz['id']]);
} else {//进直播间人
$re_count = $this->mdSytLiveData->count(['l_id' => $add_data['l_id'], 'biz_id' => $add_data['biz_id']
, 'uid' => $add_data['uid'], 'type' => $add_data['type'], 'if_biz' => $add_data['if_biz']]);
if ($re_count == 1) {//人只统计一次
$this->mdSytLiveBiz->update(['watchs = watchs+1' => null], ['id' => $re_biz['id']]);
}
}
} else {
$add_data = [
'l_id' => $params['l_id'],
'biz_id' => $params['biz_id'],
'c_time' => time()
];
if ($params['type'] == 2) {
$add_data['enrolls'] = 1;
} else {
$add_data['watchs'] = 1;
}
$this->mdSytLiveBiz->add($add_data);
}
}
return $id;
}
/**
* Notes:微信未登录授权登录
* Created on: 2020/10/28 21:07
@@ -129,7 +639,6 @@ class Live extends Wxapp
$ret = json_decode($res, true);
$openid = $ret['openid'];
$unionid = $ret['unionid'];
$mobile = '';
if ($openid) {
$row_wechat = $this->mdWeixinUsers->get(array('openid' => $openid));
if (!$row_wechat) {//用户授权信息未记录到wechat
@@ -152,7 +661,6 @@ class Live extends Wxapp
} else {
!$unionid && $unionid = $row_wechat['unionid'];
$this->uid = $row_wechat['id'];
$mobile = $row_wechat['mobile'];
}
}
if ($this->uid) {
@@ -164,9 +672,9 @@ class Live extends Wxapp
$biz_uid = $re_licheb_users['id'];
}
}
$session = ['uid' => $this->uid, "unionid" => $unionid, "mobile" => $mobile, "biz_id" => $biz_id, "biz_uid" => $biz_uid];
$session = ['uid' => $this->uid, "unionid" => $unionid, "biz_id" => $biz_id, "biz_uid" => $biz_uid];
$ukey = liche_authcode(json_encode($session, JSON_UNESCAPED_UNICODE), 'ENCODE', $this->secret);
set_cookie("ukey", $ukey, 86400 * 30);
set_cookie("ukey", $ukey, 86400 * 1);
$this->session = $session;
}
} elseif ($auth) {//信息授权获取用户微信昵称/头像
@@ -189,9 +697,9 @@ class Live extends Wxapp
*/
private function set_auth_wxwork($url = '')
{
// if ($this->uid) {
// return;
// }
if ($this->uid) {
return;
}
$config = $this->wx_qyapi_agent->getConfig();
$code = $this->input->get('code');
if ($code) {//授权码获取微信信息
@@ -207,11 +715,10 @@ class Live extends Wxapp
if ($re_u) {
$this->uid = $biz_uid = $re_u['id'];
$biz_id = intval($re_u['biz_id']);
$mobile = $re_u['mobile'];
$unionid = '';
$session = ['uid' => $this->uid, "unionid" => $unionid, "mobile" => $mobile, "biz_id" => $biz_id, "biz_uid" => $biz_uid];
$unionid = $re_u['unionid'] ? $re_u['unionid'] : '';
$session = ['uid' => $this->uid, "unionid" => $unionid, "biz_id" => $biz_id, "biz_uid" => $biz_uid];
$ukey = liche_authcode(json_encode($session, JSON_UNESCAPED_UNICODE), 'ENCODE', $this->secret);
set_cookie("ukey", $ukey, 86400 * 30);
set_cookie("ukey", $ukey, 86400 * 1);
$this->session = $session;
}
}
+369 -263
View File
@@ -1,13 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?= $_title ?></title>
<link rel="stylesheet" href="/css/h5/syt/live.css?v=2022505">
<link rel="stylesheet" href="/css/h5/syt/live.css?v=2022513">
<link rel="stylesheet" href="https://qs.haodian.cn/web/javascript/swiper/css/swiper.min.css">
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/jquery.3.4.1.min.js"></script>
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/vue.2.6.10.min.js"></script>
@@ -16,10 +15,11 @@
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/swiper/js/swiper.min.js"></script>
<script type="text/javascript" src="//player.polyv.net/livesdk/polyv-live.min.js"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<? if ($checkua == 'wxwork') { ?>
<? if ($info['checkua'] == 'wxwork') { ?>
<script type="text/javascript" src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
<? } ?>
</head>
<body class="bg-fff">
<div id="app">
<div class="container"
@@ -27,9 +27,9 @@
<div class="pl25 pr25">
<!-- Swiper -->
<div class="pt30 pb30">
<div class="swiper-container winInfo-swiper" v-if="winInfo.length > 0 ">
<div class="swiper-container winInfo-swiper" v-if="info.winInfo.length > 0 ">
<div class="swiper-wrapper">
<div class="swiper-slide relative pr60" v-for="item in winInfo">
<div class="swiper-slide relative pr60" v-for="item in info.winInfo">
<div class="text-nowrap font-28 color-fff">{{item.title}}</div>
<div class="absolute right-0 box-middle imgsize-25X25 icon-arrow-right"></div>
</div>
@@ -38,63 +38,134 @@
</div>
<!-- end Swiper -->
<div>
<img class="block wp100" :src="banner" alt="#"/>
<img class="block wp100" :src="info.banner" alt="#"/>
</div>
<div id="player" class="player pt20 pb20"></div>
<div v-if="info.l_status==2" class="player pt20 pb20"><img
src="https://liveimages.videocc.net/uploaded/images/2022/02/g6w0bwga4p.png"></div>
<div v-show="info.l_status!=2" id="player" class="player pt20 pb20"></div>
<div class="inner30 bg-fff9ea ulib-r10">
<div class="font-36">{{rule.title}}</div>
<div class="mt10 font-24 line-height-18 color-666" v-html="rule.content"></div>
<div class="font-36">{{info.rule.title}}</div>
<div class="mt10 font-24 line-height-18 color-666" v-html="info.rule.content"></div>
</div>
</div>
<div style="display:none;padding-top:30vw;" v-show="!isOpen">
<div class="fixed left-0 right-0 bottom-0 ml25 mr25 mb25">
<div class="draw-bg" v-if="e_time <=0 ">
<div class="draw-gift pl30 pr30 text-center fn-flex">
<div class="fn-flex-item"><img class="imgsize-160X160"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/gift.png"
alt="#"/></div>
<div class="fn-flex-item"><img class="imgsize-160X160"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/gift.png"
alt="#"/></div>
<div class="fn-flex-item"><img class="imgsize-160X160"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/gift.png"
alt="#"/></div>
</div>
<div v-if="info.l_status!=1" style="padding-top:30vw">
<div class="fixed left-0 right-0 bottom-0 ml25 mr25">
<div class="pt40 pb60 bg-fff ulib-rt20">
<div class="relative pl130 pr130 text-center">
<a class="block absolute left-0 box-middle ml30" @click="showMyPrize">
<img class="imgsize-40X40"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-gift.png"
alt="#"/>
<div class="mt10 font-18 color-666">盲盒礼物</div>
<div class="font-18 color-666">我的盲盒</div>
</a>
<a class="block absolute right-0 box-middle mr30">
<a class="block absolute right-0 box-middle mr30" v-if="info.biz_uid" @click="jumpBiz">
<img class="imgsize-40X40"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-flag.png"
alt="#"/>
<div class="mt10 font-18 color-666">门店活动</div>
<div class="font-18 color-666">活动数据</div>
</a>
<a class="block red-ff7300-fd1401 pt20 pb20 font-36 text-bold text-italic color-fff ulib-r750"
@click="runLottery">开启试驾盲盒</a>
<div class="mt20 font-22 color-666" v-html="showTime"></div>
<a v-else class="block absolute right-0 box-middle mr30"
@click="isShowService=!isShowService">
<img class="imgsize-40X40"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-service.png"
alt="#"/>
<div class="font-18 color-666">添加客服</div>
</a>
<a class="block red-fe8980-ffb97f pt20 pb20 font-36 text-bold text-italic color-fff ulib-r750">{{info.l_status_name}}</a>
</div>
</div>
<div class="pt40 pb40 bg-fff ulib-rt20" v-else>
</div>
</div>
<div v-else :style="'padding-top:'+ [!info.isOpen&&info.e_time <=0?'70vw':'30vw']">
<div class="fixed left-0 right-0 bottom-0 ml25 mr25">
<div class="pb20 bg-fff ulib-rt20" v-if="!info.isOpen">
<div class="draw-bg" v-if="info.e_time <=0 ">
<div class="draw-gift pl30 pr30 text-center fn-flex">
<div class="fn-flex-item"><img class="imgsize-160X160"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/gift.png"
alt="#"/></div>
<div class="fn-flex-item"><img class="imgsize-160X160"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/gift.png"
alt="#"/></div>
<div class="fn-flex-item"><img class="imgsize-160X160"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/gift.png"
alt="#"/></div>
</div>
<div class="relative pl130 pr130 text-center">
<a class="block absolute left-0 box-middle ml30" @click="showMyPrize">
<img class="imgsize-40X40"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-gift.png"
alt="#"/>
<div class="mt10 font-18 color-666">我的盲盒</div>
</a>
<a class="block absolute right-0 box-middle mr30" v-if="info.biz_uid" @click="jumpBiz">
<img class="imgsize-40X40"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-flag.png"
alt="#"/>
<div class="mt10 font-18 color-666">活动数据</div>
</a>
<a v-else class="block absolute right-0 box-middle mr30"
@click="isShowService=!isShowService">
<img class="imgsize-40X40"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-service.png"
alt="#"/>
<div class="font-18 color-666">添加客服</div>
</a>
<a class="block red-ff7300-fd1401 pt20 pb20 font-36 text-bold text-italic color-fff ulib-r750"
@click="runLottery">开启试驾盲盒</a>
<div class="mt20 font-22 color-666" v-html="showTime"></div>
</div>
</div>
<div class="pt40 pb30" v-else>
<div class="relative pl130 pr130 text-center">
<a class="block absolute left-0 box-middle ml30" @click="showMyPrize">
<img class="imgsize-40X40"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-gift.png"
alt="#"/>
<div class="font-18 color-666">我的盲盒</div>
</a>
<a class="block absolute right-0 box-middle mr30" v-if="info.biz_uid" @click="jumpBiz">
<img class="imgsize-40X40"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-flag.png"
alt="#"/>
<div class="font-18 color-666">活动数据</div>
</a>
<a v-else class="block absolute right-0 box-middle mr30"
@click="isShowService=!isShowService">
<img class="imgsize-40X40"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-service.png"
alt="#"/>
<div class="font-18 color-666">添加客服</div>
</a>
<a class="block red-fe8980-ffb97f pt20 pb20 font-36 text-bold text-italic color-fff ulib-r750">开启试驾盲盒</a>
<div class="mt20 font-22 color-666" v-html="showTime"></div>
</div>
</div>
</div>
<div class="pt40 pb60 bg-fff ulib-rt20" v-else>
<div class="relative pl130 pr130 text-center">
<a class="block absolute left-0 box-middle ml30" @click="showMyPrize">
<img class="imgsize-40X40"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-gift.png"
alt="#"/>
<div class="font-18 color-666">盲盒礼物</div>
<div class="font-18 color-666">我的盲盒</div>
</a>
<a class="block absolute right-0 box-middle mr30">
<a class="block absolute right-0 box-middle mr30" v-if="info.biz_uid" @click="jumpBiz">
<img class="imgsize-40X40"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-flag.png"
alt="#"/>
<div class="font-18 color-666">门店活动</div>
<div class="font-18 color-666">活动数据</div>
</a>
<a class="block red-fe8980-ffb97f pt20 pb20 font-36 text-bold text-italic color-fff ulib-r750">开启试驾盲盒</a>
<div class="mt20 font-22 color-666" v-html="showTime"></div>
<a v-else class="block absolute right-0 box-middle mr30"
@click="isShowService=!isShowService">
<img class="imgsize-40X40"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-service.png"
alt="#"/>
<div class="font-18 color-666">添加客服</div>
</a>
<a class="block red-fe8980-ffb97f pt20 pb20 font-36 text-bold text-italic color-fff ulib-r750">已开启试驾盲盒</a>
</div>
</div>
</div>
@@ -140,7 +211,7 @@
</div>
<div class="pb70 text-center">
<div class="inline-block pt25 pb25 pl100 pr100 red-ff7300-fd1401 font-32 color-fff ulib-r750"
@click="isShowMsgWin=!isShowMsgWin">知道了
@click="isShowMsgWin=!isShowMsgWin,isShowMsgReg=!isReg">知道了
</div>
</div>
</div>
@@ -154,26 +225,76 @@
<div class="msgMain">
<i class="close" @click="isShowMsgMyPrize=!isShowMsgMyPrize"></i>
<div class="bg-fff ulib-r20" style="width:78vw;">
<div class="inner40 text-center" v-if="msgMyPrize.list.length == 0 ">
<div class="inner40 text-center" v-if="info.msgMyPrize.lottery.title==''">
<h2 class="pt20 pb20 font-34 color-333 line-height-18">暂时未中奖</h2>
</div>
<div class="inner40 text-center" v-else>
<h2 class="pb20 font-34 color-333 line-height-18" v-html="msgMyPrize.title"></h2>
<!-- Swiper -->
<div class="swiper-container myPrizeInfo-swiper">
<div class="swiper-wrapper">
<div class="swiper-slide relative" v-for="item in msgMyPrize.list">
<div><img class="imgsize-350X180" :src="item.img" alt="#"/></div>
<div class="mt20 font-32 text-bold">{{item.title}}</div>
<div class="relative mt30 font-28">{{item.time.title}}</div>
<div class="mt10 font-28 color-666" v-html="item.time.content"></div>
<div class="relative mt30 font-32">{{item.other.title}}</div>
<div class="mt10 font-28 color-666" v-html="item.other.content"></div>
</div>
</div>
<div class="swiper-pagination"></div>
<h2 class="pb20 font-34 color-333 line-height-18" v-html="info.msgMyPrize.title"></h2>
<div class="swiper-slide relative">
<div><img class="imgsize-350X180" :src="info.msgMyPrize.lottery.img" alt="#"/></div>
<div class="mt20 font-32 text-bold">{{info.msgMyPrize.lottery.title}}</div>
<div class="relative mt10 font-28">{{info.msgMyPrize.lottery.price}}</div>
<div class="relative mt30 font-28">{{info.msgMyPrize.lottery.time.title}}</div>
<div class="mt10 font-28 color-666" v-html="info.msgMyPrize.lottery.time.content"></div>
<template v-if="!info.lottery && info.msgMyPrize.lottery.other.content">
<div class="relative mt30 font-32">{{info.msgMyPrize.lottery.other.title}}</div>
<div class="mt10 font-28 color-666"
v-html="info.msgMyPrize.lottery.other.content"></div>
</template>
</div>
<div class="mt20 mb10 font-32 text-underline color-fd1401"
@click="isShowMsgMyPrize=!isShowMsgMyPrize,isShowMsgReg=true">登记信息
</div>
</div>
</div>
</div>
</div>
</transition>
<transition name="fade">
<div class="msg msg-text" style="display:none;" v-show="isShowMsgReg">
<div class="msgBg" @click="isShowMsgReg=!isShowMsgReg"></div>
<div class="msgMain">
<div class="content">
<div class="word">
<div class="pt10 pb10 font-36 text-center">登记信息</div>
<div class="mt30 relative bg-f6 ulib-r10">
<input v-if="info.lottery" class="wp100 inner30 font-30 bg-f6 bds-none ulib-r10" type="text"
v-model="info.msgMyPrize.lottery.name" disabled="disabled"/>
<input v-else class="wp100 inner30 font-30 bg-f6 bds-none ulib-r10" type="text"
v-model="info.msgMyPrize.lottery.name" placeholder="请输入您的姓名"/>
</div>
<div class="mt30 relative bg-f6 ulib-r10">
<input v-if="info.lottery" class="wp100 inner30 font-30 bg-f6 bds-none ulib-r10" type="tel"
v-model="info.msgMyPrize.lottery.mobile" disabled="disabled"/>
<input v-else class="wp100 inner30 font-30 bg-f6 bds-none ulib-r10" type="tel"
v-model="info.msgMyPrize.lottery.mobile" placeholder="请输入您的手机号"/>
</div>
</div>
<div class="mt40 pb20 pl40 pr40 text-center">
<div class="inline-block pt25 pb25 pl100 pr100 red-ff7300-fd1401 font-32 color-fff ulib-r750"
@click="enroll">确认
</div>
</div>
</div>
</div>
</div>
</transition>
<!--添加客服-->
<transition name="fade">
<div class="msg msg-text" style="display: none;" v-show="isShowService">
<div class="msgBg" @click="isShowService=!isShowService"></div>
<div class="msgMain">
<div class="bg-fff ulib-r20" style="width:78vw;">
<div class="inner40 text-center">
<img class="mt20 imgsize-300X300" :src="info.serviceCode" alt="#"/>
<div class="pt20 text-center font-24 color-666">添加客服</div>
</div>
<div class="pb50 text-center">
<div class="inline-block pt20 pb20 pl100 pr100 bg-b5 font-32 color-fff ulib-r750"
@click="isShowService=!isShowService">知道了
</div>
<!-- end Swiper -->
</div>
</div>
</div>
@@ -182,144 +303,61 @@
</div>
<script>
var chatroom = null;
var liveSdk = null;
window.onload = function () {
//注意事项:appSecret,appId不建议在前端显示,不安全,请您一定要请求后端接口获取sign
//参数开始
var appSecret = "447d5ce803d84f599794a3274177f796";
var appId = "g45uep0s6v";
var channelId = "2810581";
//参数结束
var userId = "test-001"
var params = {
appId: appId,
channelId: channelId,
timestamp: new Date().getTime(),
};
var sign = getSign(params);
// 第三步:创建SDK实例
var liveSdk = new PolyvLiveSdk({
channelId: channelId,
sign: sign, // 频道验证签名
timestamp: params.timestamp, // 毫秒级时间戳
appId: appId, // polyv 后台的appId
user: {
userId: userId,
userName: "polyv-test",
pic: "//livestatic.videocc.net/assets/wimages/missing_face.png",
},
});
// 第四步:监听频道信息读取完成事件,初始化播放器
liveSdk.on(PolyvLiveSdk.EVENTS.CHANNEL_DATA_INIT, (event, data) => {
liveSdk.setupPlayer({
el: "#player",
type: "auto",
autoplay: true, // 设置自动播放
});
console.log('---频道信息---')
console.log(data)
});
/******函数*******/
//计算sign,仅demo使用,请您一定要请求后端接口获取sign
function getSign(params) {
var paramsStr = "";
$.each(params, function (key, val) {
paramsStr += key + "" + val;
});
var finalStr = appSecret + paramsStr + appSecret;
return md5(finalStr).toUpperCase();
}
};
</script>
<script>
let hostUrl = ''
<script type="text/javascript">
var app = new Vue({
el: '#app',
data: {
winInfo: [
{
title: '134*****666领取了盲盒,开出了XXX',
},
{
title: '134*****666领取了盲盒,开出了XXX',
},
{
title: '134*****666领取了盲盒,开出了XXX',
},
],
banner: 'https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/banner.png',
rule: {
title: '活动规则',
content: '<p>盲盒,是指消费者不能提前得知具体产品款式的玩具盒子,具有随机属性。</p><p>这种诞生于日本的潮玩,最初名字叫mini figures</p><p>流行欧美后也开始被称作blind box。</p><p>盲盒作为一种潮流玩具,盲盒精准切入年轻消费者市场,众多如考古盲盒、文具盲盒、美妆盲盒、零食盲盒等“盲盒+”商业模式也迅速产生。</p>',
},
isOpen: false,//是否已开奖
e_time: 5,//距离开奖时间
info: <?=json_encode($info)?>,
bundleIntervalEvent: '',//倒计时
isShowMsgText: false,//是否显示文字提示弹框
msgText: {//文字提示弹框参数
title: '',
content: '',
},
isShowMsgWin: false,//是否显示中奖
msgWin: {//中奖提示弹框参数
title1: '',
title2: '',
name: '',
content: '',
img: '',
title1: '', title2: '', name: '', content: '', img: ''
},
isShowMsgMyPrize: false,//我的奖品
msgMyPrize: {//中奖提示弹框参数
title: '',
list: [],
},
isShowMsgReg: false,//是否显示登记信息弹框
isReg: false,//是否已登记信息
isSubmiting: false,
isShowService: false,//是否客服弹框
},
created() {
},
computed: {
//用计算属性显示结果
showTime() {
//剩余秒数<=0
if (this.e_time <= 0) {
if (this.info.e_time <= 0) {
return "点击开启盲盒";
}
// 剩余秒数>0
else {
let day = Math.floor(this.e_time / 86400);
let hour = Math.floor((this.e_time % 86400) / 3600);
let min = Math.floor(((this.e_time % 86400) % 3600) / 60);
let sec = Math.floor(((this.e_time % 86400) % 3600) % 60);
let day = Math.floor(this.info.e_time / 86400);
let hour = Math.floor((this.info.e_time % 86400) / 3600);
let min = Math.floor(((this.info.e_time % 86400) % 3600) / 60);
let sec = Math.floor(((this.info.e_time % 86400) % 3600) % 60);
if (day > 0) {
return ("<span class='text-middle'>倒计时:</span><em class='text-middle color-ff7200 pl5 pr5'" + day + "</em><em class='text-middle'>天</em><em class='text-middle color-ff7200 pl5 pr5'>" + (hour < 10 ? "0" : "") + hour + "</em><em class='text-middle'>时</em><em class='text-middle color-ff7200 pl5 pr5'>" + (min < 10 ? "0" : "") + min + "</em><em class='text-middle'>分</em><em class='text-middle color-ff7200 pl5 pr5'>" + (sec <
10 ? "0" : "") + sec + "</em><em class='text-middle'>秒</em>才能点击");
10 ? "0" : "") + sec + "</em><em class='text-middle'>秒</em>后可开启盲盒");
} else if (hour > 0) {
return ("<span class='text-middle'>倒计时:</span><em class='text-middle color-ff7200 pl5 pr5'>" + (hour < 10 ? "0" : "") + hour + "</em><em class='text-middle'>时</em><em class='text-middle color-ff7200 pl5 pr5'>" + (min < 10 ? "0" : "") + min + "</em><em class='text-middle'>分</em><em class='text-middle color-ff7200 pl5 pr5'>" + (sec <
10 ? "0" : "") + sec + "</em><em class='text-middle'>秒</em>才能点击");
10 ? "0" : "") + sec + "</em><em class='text-middle'>秒</em>后可开启盲盒");
} else if (min > 0) {
return ("<span class='text-middle'>倒计时:</span><em class='text-middle color-ff7200 pl5 pr5'>" + (min < 10 ? "0" : "") + min + "</em><em class='text-middle'>分</em><em class='text-middle color-ff7200 pl5 pr5'>" + (sec <
10 ? "0" : "") + sec + "</em><em class='text-middle'>秒</em>才能点击");
10 ? "0" : "") + sec + "</em><em class='text-middle'>秒</em>后可开启盲盒");
} else if (sec > 0) {
return ("<span class='text-middle'>倒计时:</span><em class='text-middle color-ff7200 pl5 pr5'>" + (sec <
10 ? "0" : "") + sec + "</em><em class='text-middle'>秒</em>才能点击");
10 ? "0" : "") + sec + "</em><em class='text-middle'>秒</em>后可开启盲盒");
}
}
}
},
mounted() {
//倒计时
this.bundleIntervalEvent = setInterval(this.intervalEvent, 1000);
//中奖信息滚动
if ($('.winInfo-swiper .swiper-slide').length > 1) {
var swiper = new Swiper('.winInfo-swiper', {
@@ -334,123 +372,191 @@
},
});
}
},
beforeDestroy() {
clearInterval(this.bundleIntervalEvent);
},
methods: {
//报名生成倒计时
//跳转门店
jumpBiz() {
let that = this;
window.location.href = '/h5/syt/live/statistics?id=' + that.info.id;
},
//开启试驾盲盒
runLottery() {
let that = this;
if (that.info.l_status != 1) {
mDialog.msg({content: that.info.l_status_name});
return;
}
$.ajax({
url: '/h5/syt/live/lottery',
type: 'post',
dataType: 'json',
data: {id: that.info.id},
beforeSend: function () {
},
success: function (data) {
if (200 == data['code']) {
//接口请求成功需要修改开奖状态,更新我的中奖产品
that.info.isOpen = true;
//没有中奖
// that.isShowMsgText=true;
// that.msgText.title = '很遗憾没有中奖!';
//中奖了
that.isShowMsgWin = true;
that.msgWin = data['msgWin'];
if (data['msgMyPrize']) {
that.info.msgMyPrize = data['msgMyPrize'];
}
} else {
mDialog.msg({content: data.msg});
}
},
complete: function () {
}
});
},
//登记信息
enroll() {
let that = this;
if (that.info.l_status != 1) {
mDialog.msg({content: that.info.l_status_name});
return;
}
if (that.info.lottery) {
this.isShowMsgReg = false;
return;
}
if (this.isSubmiting) return;
if (!that.msgWin.id) {
mDialog.msg({content: "请先开启试驾盲盒"});
return;
}
if (!that.info.msgMyPrize.lottery.name) {
mDialog.msg({content: "请输入您的姓名"});
return;
}
if (!/^1[3456789]\d{9}$/.test(that.info.msgMyPrize.lottery.mobile)) {
mDialog.msg({content: "请输入正确的手机号"});
return;
}
$.ajax({
url: '/h5/syt/live/enroll',
type: 'post',
dataType: 'json',
data: {
id: that.info.id,
name: that.info.msgMyPrize.lottery.name,
mobile: that.info.msgMyPrize.lottery.mobile,
cf_uid: that.info.cf_uid,
biz_id: that.info.biz_id,
prize_id: that.msgWin.id
},
beforeSend: function () {
},
success: function (data) {
mDialog.msg({content: data.msg});
if (200 == data['code']) {
this.isShowMsgReg = false;
that.info.lottery = true;
}
},
complete: function () {
this.isSubmiting = true;
}
});
},
//显示我的礼品
showMyPrize() {
let that = this;
if (that.info.l_status == 0) {
mDialog.msg({content: that.info.l_status_name});
return;
}
if (!that.info.isOpen) {
mDialog.msg({content: "未开启试驾盲盒"});
return;
}
this.isShowMsgMyPrize = true;//我的奖品
},
//盲盒生成倒计时
intervalEvent() {
if (this.e_time > 0) {
this.e_time--;
if (this.info.e_time > 0) {
this.info.e_time--;
} else {
clearInterval(this.bundleIntervalEvent);
}
},
//开启试驾盲盒
runLottery() {
//接口请求成功需要修改开奖状态,更新我的中奖产品
this.isOpen = true
//没有中奖
// this.isShowMsgText=true
// this.msgText.title = '很遗憾没有中奖!'
//中奖了
this.isShowMsgWin = true
this.msgWin.title1 = '恭喜您!'
this.msgWin.title2 = '获得试驾好礼啦'
this.msgWin.name = '乳胶枕'
this.msgWin.content = '(试驾领取 2022年05月31日 - 06月30日)'
this.msgWin.img = 'http://img.cms.xmfish.com/data/upload/20223/file_1646705498.jpg'
},
//显示我的礼品
showMyPrize() {
this.isShowMsgMyPrize = true,//我的奖品
this.msgMyPrize = {//中奖提示弹框参数
title: '我的试驾礼',
list: [
{
title: '乳胶枕',
img: 'http://img.cms.xmfish.com/data/upload/20223/file_1646705498.jpg',
time: {
title: '活动时间',
content: '2022年05月31日 - 2023年04月30日',
},
other: {
title: '其他事项',
content: 'XXXX',
},
},
{
title: '乳胶枕',
img: 'http://img.cms.xmfish.com/data/upload/20223/file_1646705498.jpg',
time: {
title: '活动时间',
content: '2022年05月31日 - 2023年04月30日',
},
other: {
title: '其他事项',
content: 'XXXX',
},
},
{
title: '乳胶枕',
img: 'http://img.cms.xmfish.com/data/upload/20223/file_1646705498.jpg',
time: {
title: '活动时间',
content: '2022年05月31日 - 2023年04月30日',
},
other: {
title: '其他事项',
content: 'XXXX',
},
},
{
title: '乳胶枕',
img: 'http://img.cms.xmfish.com/data/upload/20223/file_1646705498.jpg',
time: {
title: '活动时间',
content: '2022年05月31日 - 2023年04月30日',
},
other: {
title: '其他事项',
content: 'XXXX',
},
},
],
}
//我的盲盒礼物
setTimeout(
function () {
if ($('.myPrizeInfo-swiper .swiper-slide').length > 1) {
var swiper = new Swiper('.myPrizeInfo-swiper', {
loop: true,
lazy: true,
centeredSlides: true,
autoplay: {
delay: 5000,
stopOnLastSlide: false,
disableOnInteraction: true,
},
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
}
}, 200)
},
}
}
})
</script>
<? if ($checkua == 'wxwork') { ?>
<? if ($info['l_status'] != 2) { ?>
<script type="text/javascript">
var liveSdk = null;
window.onload = function () {
var liveSdk = new PolyvLiveSdk({
channelId: "<?= $info['liveSdk']['channelId'] ?>",
sign: "<?= $info['liveSdk']['sign'] ?>", // 频道验证签名
timestamp: "<?= $info['liveSdk']['timestamp'] ?>", // 毫秒级时间戳
appId: "<?= $info['liveSdk']['appId'] ?>", // polyv 后台的appId
user: {
userId: "<?= $info['liveSdk']['user']['userId'] ?>",
userName: "<?= $info['liveSdk']['user']['userName'] ?>",
pic: "<?= $info['liveSdk']['user']['pic'] ?>",
},
});
// 监听频道信息读取完成事件,初始化播放器
liveSdk.on(PolyvLiveSdk.EVENTS.CHANNEL_DATA_INIT, (event, data) => {
liveSdk.setupPlayer({
el: "#player",
type: "auto",
autoplay: true, // 设置自动播放
});
// liveSdk.player.on('ended', function() {
// console.log('播放结束');
// });
// // 监听流状态变化刷新播放器
// liveSdk.on(PolyvLiveSdk.EVENTS.STREAM_UPDATE, function() {
// liveSdk.reloadPlayer();
// console.log('----------->reloadPlayer');
// });
if (!app.info.session_id && data.sessionId && data.status == 'Y') {
set_l_status(data.sessionId, 1);
} else if (app.info.session_id == data.sessionId && data.status == 'N') {
set_l_status(data.sessionId, 2);
}
console.log(data);
});
};
function set_l_status(session_id, l_status) {
$.ajax({
url: '/h5/syt/live/l_status',
type: 'post',
dataType: 'json',
data: {
id: app.info.id,
session_id: session_id,
l_status: l_status,
},
beforeSend: function () {
},
success: function (re) {
if (200 == re['code']) {
app.info.l_status = re['l_status'];
app.info.l_status_name = re['l_status_name'];
app.info.session_id = re['session_id'];
console.log('更新l_status=' + re['l_status']);
}
},
complete: function () {
}
});
}
</script>
<? } ?>
<? if ($info['checkua'] == 'wxwork') { ?>
<script type="text/javascript">
wx.config({
beta: true,// 必须这么写,否则wx.invoke调用形式的jsapi会有问题
@@ -502,7 +608,7 @@
console.log('res', res);
});
</script>
<? }elseif ($checkua == 'wx') { ?>
<? }elseif ($info['checkua'] == 'wx') { ?>
<script type="text/javascript">
wx.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印
@@ -522,12 +628,12 @@
desc: '<?=$share['desc']?>', // 分享描述
success: function () {
// 用户成功分享后执行的回调函数
alert(option.title);
option.success()
//alert(option.title);
//option.success()
},
cancel: function () {
// 用户取消分享后执行的回调函数
option.error()
//option.error()
}
});
//自定义“分享给朋友”及“分享到QQ”按钮的分享内容
@@ -538,12 +644,12 @@
desc: '<?=$share['desc']?>', // 分享描述
success: function () {
// 用户成功分享后执行的回调函数
alert(option.title);
option.success()
//alert(option.title);
//option.success()
},
cancel: function () {
// 用户取消分享后执行的回调函数
option.error()
//option.error()
}
});
});
+187
View File
@@ -0,0 +1,187 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?= $_title ?></title>
<link rel="stylesheet" href="/css/h5/syt/live.css?v=2022513">
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/jquery.3.4.1.min.js"></script>
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/vue.2.6.10.min.js"></script>
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/mDialog.js"></script>
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript//vue-mugen-scroll.js"></script>
</head>
<body class="bg-fff">
<div id="app">
<div class="container"
style="background-image:url(https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/bd-bg.png)">
<div class="pl25 pr25">
<div class="fn-flex pt50 pb50 pl100 pr100 text-center">
<div class="fn-flex-item" v-for="item in info.tab"><a
:class="'relative inline-block color-fff tab-menu '+ [info.tabid == item.id?'font-36 active':'font-32']"
@click="changeTab(item.id)" href="javascript:">{{item.title}}</a></div>
</div>
<div v-if="info.tabid==info.tab[0].id">
<div class="bg-fff mb30 pt40 pb40 pl30 pr30 box-shadow-lightGray ulib-r10">
<div class="fn-flex text-center">
<a class="fn-flex-item" v-for="item in info.survey"
:href="item.url ? item.url : 'javascript:void(0);'">
<div class="font-40 color-ff7200">{{item.num}}</div>
<div class="mt10 font-22 color-666">{{item.title}}
<i v-if="item.url" class="inline-block imgsize-20X20 bg-no-repeat bg-size-cover"
style="background-image:url('https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-arrow-right2.png');"></i>
</div>
</a>
</div>
</div>
<!--实时动态-->
<div class="bg-fff mb30 inner40 box-shadow-lightGray ulib-r10">
<div class="pb20 fn-clear">
<img class="fn-fl" style="width:21.5vw;"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/tt-dynamic.png"
alt="#"/>
<div class="fn-fr pt5 pb10 pl20 pr15 bds-1-666 ulib-r750"
@click="isShowDynamicMore=!isShowDynamicMore" v-if="isShowDynamicMore">
<span class="text-middle font-28">展开收起</span><i
class="inline-block text-middle imgsize-25X25 bg-no-repeat bg-size-cover"
style="background-image:url('https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-arrow-up.png');"></i>
</div>
<div class="fn-fr pt5 pb10 pl20 pr15 bds-1-666 ulib-r750"
@click="isShowDynamicMore=!isShowDynamicMore" v-else>
<span class="text-middle font-28">展开更多</span><i
class="inline-block text-middle imgsize-25X25 bg-no-repeat bg-size-cover"
style="background-image:url('https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-arrow-down.png');"></i>
</div>
</div>
<div class="font-32 color-666" v-for="(item,index) in info.dynamic" v-if="info.dynamic.length>0">
<div class="pt15 pb15 fn-clear" v-if="isShowDynamicMore">
<div class="fn-fl">{{item.title}}</div>
<div class="fn-fr">{{item.time}}</div>
</div>
<div class="pt15 pb15 fn-clear" v-else-if="index<12">
<div class="fn-fl">{{item.title}}</div>
<div class="fn-fr">{{item.time}}</div>
</div>
</div>
<div class="pt20 pb20 text-center font-32 color-666" v-else>暂时无数据</div>
</div>
<!--end 实时动态-->
</div>
<div v-else-if="info.tabid==info.tab[1].id">
<!--观看排行-->
<div class="bg-fff mb30 inner40 box-shadow-lightGray ulib-r10">
<div class="pb20 fn-clear">
<img class="fn-fl" style="width:26.7vw;"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/tt-view.png" alt="#"/>
<div class="fn-fr pt5 pb10 pl20 pr15 bds-1-666 ulib-r750"
@click="isShowViewMore=!isShowViewMore" v-if="isShowViewMore">
<span class="text-middle font-28">展开收起</span><i
class="inline-block text-middle imgsize-25X25 bg-no-repeat bg-size-cover"
style="background-image:url('https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-arrow-up.png');"></i>
</div>
<div class="fn-fr pt5 pb10 pl20 pr15 bds-1-666 ulib-r750"
@click="isShowViewMore=!isShowViewMore" v-else>
<span class="text-middle font-28">展开更多</span><i
class="inline-block text-middle imgsize-25X25 bg-no-repeat bg-size-cover"
style="background-image:url('https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-arrow-down.png');"></i>
</div>
</div>
<div class="font-32 color-666" v-for="(item,index) in info.watchsList" v-if="info.watchsList.length>0">
<div class="pt20 pb20 fn-clear" v-if="isShowViewMore">
<div class="fn-fl">
<img class="imgsize-50X50 text-middle" v-if="item.ranking<4"
:src="'https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-num-'+item.ranking+'.png'"
alt="#"/>
<span class="inline-block w-50 text-center text-middle" v-else>{{item.ranking}}</span>
<span class="text-middle">{{item.name}}</span>
</div>
<div class="fn-fr">{{item.num}}</div>
</div>
<div class="pt20 pb20 fn-clear" v-else-if="index<5">
<div class="fn-fl">
<img class="imgsize-50X50 text-middle" v-if="item.ranking<4"
:src="'https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-num-'+item.ranking+'.png'"
alt="#"/>
<span class="inline-block w-50 text-center text-middle" v-else>{{item.ranking}}</span>
<span class="text-middle">{{item.name}}</span>
</div>
<div class="fn-fr">{{item.num}}</div>
</div>
</div>
<div class="pt20 pb20 text-center font-32 color-666" v-else>暂时无数据</div>
</div>
<!--end 观看排行-->
<!--报名排行-->
<div class="bg-fff mb30 inner40 box-shadow-lightGray ulib-r10">
<div class="pb20 fn-clear">
<img class="fn-fl" style="width:26.7vw;"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/tt-reg.png" alt="#"/>
<div class="fn-fr pt5 pb10 pl20 pr15 bds-1-666 ulib-r750" @click="isShowRegMore=!isShowRegMore"
v-if="isShowRegMore">
<span class="text-middle font-28">展开收起</span><i
class="inline-block text-middle imgsize-25X25 bg-no-repeat bg-size-cover"
style="background-image:url('https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-arrow-up.png');"></i>
</div>
<div class="fn-fr pt5 pb10 pl20 pr15 bds-1-666 ulib-r750" @click="isShowRegMore=!isShowRegMore"
v-else>
<span class="text-middle font-28">展开更多</span><i
class="inline-block text-middle imgsize-25X25 bg-no-repeat bg-size-cover"
style="background-image:url('https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-arrow-down.png');"></i>
</div>
</div>
<div class="font-32 color-666" v-for="(item,index) in info.enrollsList" v-if="info.enrollsList.length>0">
<div class="pt20 pb20 fn-clear" v-if="isShowRegMore">
<div class="fn-fl">
<img class="imgsize-50X50 text-middle" v-if="item.ranking<4"
:src="'https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-num-'+item.ranking+'.png'"
alt="#"/>
<span class="inline-block w-50 text-center text-middle" v-else>{{item.ranking}}</span>
<span class="text-middle">{{item.name}}</span>
</div>
<div class="fn-fr">{{item.num}}</div>
</div>
<div class="pt20 pb20 fn-clear" v-else-if="index<5">
<div class="fn-fl">
<img class="imgsize-50X50 text-middle" v-if="item.ranking<4"
:src="'https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/icon-num-'+item.ranking+'.png'"
alt="#"/>
<span class="inline-block w-50 text-center text-middle" v-else>{{item.ranking}}</span>
<span class="text-middle">{{item.name}}</span>
</div>
<div class="fn-fr">{{item.num}}</div>
</div>
</div>
<div class="pt20 pb20 text-center font-32 color-666" v-else>暂时无数据</div>
</div>
<!--end 报名排行-->
</div>
</div>
</div>
</div>
<script>
var app = new Vue({
el: '#app',
data: {
info: <?=json_encode($info)?>,
isShowDynamicMore: false,
isShowViewMore: false,
isShowRegMore: false,
},
created() {
},
computed: {},
mounted() {
},
beforeDestroy() {
},
methods: {
//tab切换
changeTab(id) {
this.info.tabid = id
},
},
})
</script>
</body>
</html>
+105
View File
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?= $_title ?></title>
<link rel="stylesheet" href="/css/h5/syt/live.css?v=2022513">
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/jquery.3.4.1.min.js"></script>
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/vue.2.6.10.min.js"></script>
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/mDialog.js"></script>
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript//vue-mugen-scroll.js"></script>
</head>
<body class="bg-fff">
<div id="app">
<div class="container"
style="background-image:url(https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/bd-bg.png)">
<div class="pl25 pr25">
<div class="fn-flex pt40 pb40 pl40 pr20 font-28 color-fff">
<div class="fn-flex-item" flexsize="2">{{info.thead[0]}}</div>
<div class="fn-flex-item text-center" flexsize="1">{{info.thead[1]}}</div>
<div class="fn-flex-item text-center" flexsize="1">{{info.thead[2]}}</div>
</div>
<div class="bg-fff pt20 pb20 pl40 pr20 box-shadow-lightGray ulib-r10">
<div class="fn-flex pt20 pb20" v-for="(item,index) in info.list">
<div class="fn-flex-item" flexsize="2">
<img class="text-middle imgsize-32X32 ulib-r750" :src="item.headimg" alt="#"/>
<span class="text-middle font-28">{{item.name}}</span>
<span class="bg-ff7200 pl10 pr10 font-22 color-fff ulib-r750"
v-if='item.tip'>{{item.tip}}</span>
</div>
<div class="fn-flex-item text-center font-26 color-666" flexsize="1">{{item.num}}</div>
<div class="fn-flex-item text-center font-26 color-666" flexsize="1">{{item.time}}</div>
</div>
<mugen-scroll :handler="fetchData" :should-handle="!loading" scroll-container="scroll-list-ul">
<div class="pt100 pb100 text-center color-ccc" v-if="info.isNoData"><i
class="iconfont icon-none text-middle"></i><span
class="text-middle fongt-22">暂无数据</span></div>
<div class="pt20 pb20 text-center color-ccc" v-else-if="!info.isDataEnd"><i
class="iconfont icon-jiazai text-middle"></i><span
class="text-middle fongt-22">请稍等...</span></div>
<div class="pt20 pb20 text-center fongt-22 color-ccc" v-else-if="info.isDataEnd">我们是有底线的</div>
</mugen-scroll>
</div>
</div>
</div>
</div>
<script>
var app = new Vue({
el: '#app',
data: {
info: <?=json_encode($info)?>,
page: 1, //页数
loading: false,
},
created() {
},
computed: {},
mounted() {
},
beforeDestroy() {
},
methods: {
fetchData: function () {
this.loading = true;
this.getRecommendList()
},
getRecommendList() {
var that = this;
if (!that.info.isNoData && !that.info.isDataEnd) {
that.page = that.page + 1;
$.ajax({
url: '/h5/syt/live/statistics_view_list',
type: 'get',
dataType: 'json',
data: {id: that.info.id, session_id: that.info.session_id, page: that.page},
beforeSend: function () {
},
success: function (response) {
if (200 == response['code']) {
if (response['list']) {
that.info.list = that.info.list.concat(response['list']);
}
if (response.data.total == 0) {
that.isNoData = true;
} else if (that.list.length == response.data.total) {
that.isDataEnd = true;
}
}
},
complete: function () {
that.loading = false;
}
});
}
}
},
})
</script>
</body>
</html>
File diff suppressed because one or more lines are too long