This commit is contained in:
dengbw
2022-05-06 11:21:57 +08:00
parent c58653a103
commit 687fa60438
7 changed files with 592 additions and 14 deletions
+1 -1
View File
@@ -178,7 +178,7 @@ class Customer extends HD_Controller
$lists = [];
$offlineSources = $this->customers_model->offlineSources();
if ($count) {
$fileds = 'id,name,mobile,cf_title,cf_clues,cont_time,admin_id,status,biz_id,level,of_id,of2_id';
$fileds = 'id,name,mobile,cf_title,cont_time,admin_id,status,biz_id,level,of_id,of2_id';
$rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds);
//获取销售员
$admin_id_arr = array_unique(array_column($rows, 'admin_id'));
@@ -95,15 +95,6 @@
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">线下来源:</label>
<div class="am-form-group am-para-inline w150">
<select name="cf_clues" v-model="params.cf_clues">
<option value="">请选择</option>
<option :value="v" v-for="(v,i) in show_info.cfCluesAry">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">线上来源:</label>
<div class="am-form-group am-para-inline w120">
@@ -266,7 +257,6 @@
<td><?= $v['cf_title'] ?></td>
<td>
<?if($v['cf_name']){?><?= $v['cf_name'] ?>(线上)<br><?}?>
<?if($v['cf_clues']){?><?= $v['cf_clues'] ?>(线下)<?}?>
</td>
<td><?= $v['status_name'] ?></td>
<td><?= $v['c_time'] ?></td>
@@ -406,7 +396,6 @@
that.cfrom_id = 0;
that.cfrom_id2 = 0;
that.params.cf_title = '';
that.params.cf_clues = '';
that.params.payway = '';
that.params.brand_id = '';
that.params.city_id_admin = '';
@@ -517,7 +517,6 @@ class Customers extends Wxapp
$ismy = $this->input_param('ismy'); //是否只显示自己
$name = $this->input_param('name');
$mobile = $this->input_param('mobile');
//$cf_clues = $this->input_param('cf_clues');//线索来源
$admin_id = $this->input_param('admin_id');
$id = $this->input_param('cus_id');
$a_id = intval($this->input_param('a_id'));//私域通活动id
@@ -580,7 +579,6 @@ class Customers extends Wxapp
$cfrom && $where['cf_title'] = $cfrom;
$name && $where["name like '%{$name}%'"] = null;
$mobile && $where["mobile like '%$mobile%'"] = null;
//$cf_clues && $where['cf_clues'] = $cf_clues;
$count = $this->customers_model->count($where);
$lists = [];
+1
View File
@@ -243,6 +243,7 @@ class Persona extends CI_Controller
'of_id' => $params['of_id'],
'of2_id' => $params['of2_id'],
'cf_title' => '自有资源',
'cf_clues' => '企微私域',
'admin_id' => $admin_id,
'status' => 0,//未见客户
'p_time' => $date,//分配时间
+130
View File
@@ -0,0 +1,130 @@
<?php
ini_set('display_errors', 'On');
error_reporting(E_ERROR);
require_once APPPATH . 'controllers/h5/Wxapp.php';
class Live extends Wxapp
{
private $session;
private $secret;
private $uid = 0;
public function __construct()
{
parent::__construct(2);
$this->secret = "syt_live_2022505";
$this->load->model('app/app_weixin_users_model', 'mdWeixinUsers');
$this->load->model('app/licheb/app_licheb_users_model', 'mdLichebUsers');
$ukey = get_cookie('ukey');
if ($ukey) {
$this->session = json_decode(liche_authcode($ukey, 'DECODE', $this->secret), true);
$this->uid = $this->session['uid'];
}
//重置cookie
$reset = $this->input_param('reset');
$reset = 1;
if ($reset) {
set_cookie("ukey", "", 86400 * 30);
$this->session = array();
$this->uid = 0;
}
}
/**
* Notes:
* https://liche-dev.xiaoyu.com/h5/syt/live?reset=1
* https://www.liche.cn/h5/syt/live
* Created on: 2021/8/26 11:19
* Created by: dengbw
*/
function get()
{
$skey = 1111;
$url = http_host_com('home') . "/h5/syt/live?skey={$skey}";
$this->set_auth($url);
if ($this->uid && $this->session['biz_id']) {//门店人员
echo '门店人员<br>';
}
if ($this->session) {
echo json_encode($this->session, JSON_UNESCAPED_UNICODE);
}
$data = array(
'_title' => '盲盒抽奖',
'view' => 'h5/syt/live',
);
return $data;
}
/**
* Notes:未登录授权登录
* Created on: 2020/10/28 21:07
* Created by: dengbw
* @param $url
*/
protected function set_auth($url)
{
if ("wx" == checkua() && !$this->uid) {
$this->load->helper('url');
$this->load->config('wechat');
$config = $this->config->item('liche');
$code = $this->input->get('code');
$auth = 1;//是否信息授权
$auth && $url .= "&auth={$auth}";
if ($code) {//授权码获取微信信息
$auth_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$config['appid']}&secret={$config['appSecret']}&code={$code}&grant_type=authorization_code";
$res = file_get_contents($auth_url);
$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
$info_url = "https://api.weixin.qq.com/sns/userinfo?access_token={$ret['access_token']}&openid={$openid}&lang=zh_CN";
$res = file_get_contents($info_url);
$ret = json_decode($res, true);
$unionid = $ret['unionid'];
$add = array(
'nickname' => strval($ret['nickname']),
"headimg" => strval($ret['headimgurl']),
"unionid" => $unionid,
"openid" => $openid,
"app_id" => $this->app_id,
"c_time" => time()
);
$this->uid = $this->mdWeixinUsers->add($add);
if (!$this->uid) {
debug_log("[error]# " . $this->mdWeixinUsers->db->last_query(), __FUNCTION__, $this->log_dir);
}
} else {
!$unionid && $unionid = $row_wechat['unionid'];
$this->uid = $row_wechat['id'];
$mobile = $row_wechat['mobile'];
}
}
if ($this->uid) {
$biz_id = $biz_uid = 0;
if ($unionid) {
$re_licheb_users = $this->mdLichebUsers->get(array('unionid' => $unionid));
if ($re_licheb_users) {
$biz_id = intval($re_licheb_users['biz_id']);
$biz_uid = $re_licheb_users['id'];
}
}
$session = ['uid' => $this->uid, "unionid" => $unionid, "mobile" => $mobile, "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);
$this->session = $session;
}
} elseif ($auth) {//信息授权获取用户微信昵称/头像
$redirect_uri = urlencode($url);
$auth_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$config['appid']}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
redirect($auth_url);
} elseif (!$this->session) {//静默授权获取用户openid
$redirect_uri = urlencode($url);
$auth_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$config['appid']}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
redirect($auth_url);
}
}
}
}
+453
View File
@@ -0,0 +1,453 @@
<!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="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>
<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/md5.min.js"></script>
<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>
</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">
<!-- Swiper -->
<div class="pt30 pb30">
<div class="swiper-container winInfo-swiper" v-if="winInfo.length > 0 ">
<div class="swiper-wrapper">
<div class="swiper-slide relative pr60" v-for="item in 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>
</div>
</div>
</div>
<!-- end Swiper -->
<div>
<img class="block wp100" :src="banner" alt="#"/>
</div>
<div 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>
</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 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">
<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 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 pb40 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>
</a>
<a class="block absolute right-0 box-middle mr30">
<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 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>
</div>
<transition name="fade">
<div class="msg msg-text" style="display: none;" v-show="isShowMsgText">
<div class="msgBg"></div>
<div class="msgMain">
<div class="bg-fff ulib-r20" style="width:78vw;">
<div class="inner40">
<h2 class="pt40 pb20 text-center font-34 color-333 line-height-18" v-html="msgText.title"></h2>
<!-- <div class="pt20 pb20 text-center font-24 color-666" v-html="msgText.content"></div> -->
</div>
<div class="pb70 text-center">
<div class="inline-block pt25 pb25 pl100 pr100 red-ff7300-fd1401 font-32 color-fff ulib-r750"
@click="isShowMsgText=!isShowMsgText">知道了
</div>
</div>
</div>
</div>
</div>
</transition>
<transition name="fade">
<div class="msg msg-text" style="display:none;" v-show="isShowMsgWin">
<div class="msgBg"></div>
<div class="msgMain">
<div class="relative bg-fff bg-no-repeat bg-size-fullwidth bg-pos-top ulib-r20"
style="width:78vw;background-image:url(https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/mag-tt.png);">
<img class="absolute wp100 top-0 left-0"
src="https://qs.haodian.cn/web/images/special/liche/20220329-zhibo/fireworks.png" alt="#"/>
<div class="inner40 pb20 text-center">
<div style="height:27vw;">
<h2 class="text-center font-48 color-fff line-height-18">{{msgWin.title1}}</h2>
<div class="font-32 color-fff">{{msgWin.title2}}</div>
</div>
<div><img class="imgsize-350X180" :src="msgWin.img" alt="#"/></div>
<div class="mt20 font-32 text-block">{{msgWin.name}}</div>
<div class="pt20 pb20 text-center font-24 color-666" v-html="msgWin.content"></div>
</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">知道了
</div>
</div>
</div>
</div>
</div>
</transition>
<transition name="fade">
<div class="msg msg-text" style="display:none;" v-show="isShowMsgMyPrize">
<div class="msgBg"></div>
<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 ">
<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>
</div>
<!-- end Swiper -->
</div>
</div>
</div>
</div>
</transition>
</div>
<script>
var chatroom = null;
var liveSdk = null;
window.onload = function () {
//注意事项:appSecret,appId不建议在前端显示,不安全,请您一定要请求后端接口获取sign
//参数开始
var appSecret = "447d5ce803d84f599794a3274177f796";
var appId = "g45uep0s6v";
var channelId = "2904257";
//参数结束
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 = ''
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,//距离开奖时间
bundleIntervalEvent: '',//倒计时
isShowMsgText: false,//是否显示文字提示弹框
msgText: {//文字提示弹框参数
title: '',
content: '',
},
isShowMsgWin: false,//是否显示中奖
msgWin: {//中奖提示弹框参数
title1: '',
title2: '',
name: '',
content: '',
img: '',
},
isShowMsgMyPrize: false,//我的奖品
msgMyPrize: {//中奖提示弹框参数
title: '',
list: [],
},
},
created() {
},
computed: {
//用计算属性显示结果
showTime() {
//剩余秒数<=0
if (this.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);
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>才能点击");
} 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>才能点击");
} 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>才能点击");
} 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>才能点击");
}
}
}
},
mounted() {
//倒计时
this.bundleIntervalEvent = setInterval(this.intervalEvent, 1000);
//中奖信息滚动
if ($('.winInfo-swiper .swiper-slide').length > 1) {
var swiper = new Swiper('.winInfo-swiper', {
loop: true,
lazy: true,
direction: 'vertical',
centeredSlides: true,
autoplay: {
delay: 2000,
stopOnLastSlide: false,
disableOnInteraction: true,
},
});
}
},
beforeDestroy() {
clearInterval(this.bundleIntervalEvent);
},
methods: {
//报名生成倒计时
intervalEvent() {
if (this.e_time > 0) {
this.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>
</body>
</html>
File diff suppressed because one or more lines are too long