edit-market-sylive
This commit is contained in:
@@ -50,6 +50,9 @@ class Plan extends CI_Controller
|
||||
$plan[] = array('url' => base_url(array('plan', 'biz', 'merge')), 'interval' => 20); //合并结算
|
||||
$plan[] = array('url' => base_url(array('plan', 'order', 'up_old_status')), 'interval' => 30); //更新旧订单状态
|
||||
$plan[] = array('url' => base_url(array('plan', 'order', 'out_time')), 'interval' => 10); //未支付订单过期
|
||||
|
||||
$plan[] = array('url' => base_url(array('plan', 'syt', 'subscribemsg')), 'interval' => 60); //私域通模板消息
|
||||
$plan[] = array('url' => base_url(array('plan', 'syt', 'syn_polyv')), 'interval' => 1); //私域通直播间数据同步
|
||||
$this->plan = $plan;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ require_once(COMMPATH . "/third_party/WeChat/WechatServer.php");
|
||||
class Syt extends CI_Controller
|
||||
{
|
||||
private $log_file = 'plan_syt.log';
|
||||
private $log_dir = 'market/sylive';
|
||||
private $options;
|
||||
public function __construct()
|
||||
{
|
||||
@@ -21,6 +22,9 @@ class Syt extends CI_Controller
|
||||
'encodingaeskey' => '',
|
||||
'debug' => false
|
||||
];
|
||||
$this->load->model('market/market_sylive_activity_model');
|
||||
$this->load->model('live/Live_polyv_session_model', 'mdPolyvSession');
|
||||
$this->load->library('PolyvApi');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,29 +80,51 @@ class Syt extends CI_Controller
|
||||
debug_log("[info] " . __FUNCTION__ . "# date:{$date}; total:{$total}; do:{$do};", $this->log_file);
|
||||
}
|
||||
|
||||
public function test(){
|
||||
require_once(COMMPATH . "/third_party/WeChat/WechatServer.php");
|
||||
$options = [
|
||||
'token' => '',
|
||||
'appid' => 'wxe66f905683582780',
|
||||
'appsecret' => '9546cd4de877be13ce203f3e6140633f',
|
||||
'encodingaeskey' => '',
|
||||
'debug' => false
|
||||
public function syn_polyv(){
|
||||
$where = [
|
||||
'status' => 0,
|
||||
"channelId <> ''" => null,
|
||||
"timeStart<" => date('Y-m-d H:i:s'),
|
||||
"timeStart>" => date('Y-m-d H:i:s',strtotime("-1 day"))
|
||||
];
|
||||
$wechatS = new WechatServer($options);
|
||||
$token = $wechatS->checkAuth();
|
||||
$content = '您预约直播已经开始啦!赶紧进入直播间观看直播领取福利吧~';
|
||||
$temp_arr = array(
|
||||
'touser' => 'ospBg6AXMlXNdgv_rzbFvBXAD4TU',
|
||||
'template_id' => '4eHuGYK69_GTjOlzkp8HK8iJNFuKboTpO7Igc1CC_fQ',
|
||||
'url' => 'https://liche-dev.xiaoyu.com/h5/market/sylive/act?skey=aWQ9MQ',
|
||||
'scene' => 0,
|
||||
'title' => '开播提醒',
|
||||
'data' => array(
|
||||
'content' => array('value' => $content)
|
||||
)
|
||||
);
|
||||
$re = $wechatS->subscribeTemplateMessage($temp_arr);
|
||||
}
|
||||
$rows = $this->market_sylive_activity_model->select($where,'activityId desc',1,20,'activityId,channelId');
|
||||
if($rows){
|
||||
foreach ($rows as $item) {
|
||||
debug_log("开始同步{$item['activityId']}活动直播",$this->log_file,$this->log_dir);
|
||||
$polyv = new PolyvApi(['channel_id' => $item['channelId']]);
|
||||
$pl_where = [
|
||||
'startTime' => strtotime($item['timeStart']),
|
||||
'endTime' => strtotime($item['timeEnd'])
|
||||
];
|
||||
$results = $polyv->getSessionStats($pl_where);
|
||||
if ($results['status'] == 'success') {
|
||||
foreach ($results['data']['list'] as $key => $value) {
|
||||
$re = $this->mdPolyvSession->get(['channelId' => $item['channelId'], 'sessionId' => $value['sessionId']]);
|
||||
$data = [
|
||||
'channelId' => $value['channelId'], 'sessionId' => $value['sessionId'], 'name' => $value['name'],
|
||||
'startTime' => $value['startTime'], 'endTime' => $value['endTime'], 'duration' => $value['duration'],
|
||||
'liveUV' => $value['liveUV'], 'livePV' => $value['livePV'], 'playbackUV' => $value['playbackUV'],
|
||||
'playbackPV' => $value['playbackPV'], 'totalPlayDuration' => $value['totalPlayDuration'],
|
||||
'session_time' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
if ($re) {//同步更新数据
|
||||
$this->mdPolyvSession->update($data, ['id' => $re['id']]);
|
||||
} else {//新增
|
||||
$data['c_time'] = time();
|
||||
$this->mdPolyvSession->add($data);
|
||||
}
|
||||
}
|
||||
$msg = "同步成功:".json_encode($results,JSON_UNESCAPED_UNICODE);
|
||||
echo $msg."<br>";
|
||||
} else {
|
||||
$msg = "接口错误:".$results['message'];
|
||||
echo $msg."<br>";
|
||||
|
||||
}
|
||||
debug_log($msg,$this->log_file,$this->log_dir);
|
||||
}
|
||||
}else{
|
||||
echo "暂无同步数据";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ class Act extends Wx {
|
||||
//直播参数
|
||||
$live_user = ['userId' => 888888888, 'userName' => '私域直播', 'pic' => '//livestatic.videocc.net/assets/wimages/missing_face.png'];
|
||||
$this->load->library('PolyvApi');
|
||||
$polyv = new PolyvApi();
|
||||
$polyv = new PolyvApi(['channel_id'=>$row['channelId']]);
|
||||
$liveSdk = $polyv->getLiveSdk();
|
||||
$liveSdk['user'] = $live_user;
|
||||
$info['live_status'] = $live_status;
|
||||
@@ -89,25 +89,36 @@ class Act extends Wx {
|
||||
}
|
||||
$info['statisticsurl'] = '/h5/market/sylive/stic?skey='.$info['skey'];
|
||||
$info['channelImg'] = build_qiniu_image_url($row['channelImg']);
|
||||
$info['live_url'] = 'https://live.liche.cn/watch/'.$row['channelId'];
|
||||
$this->data['info'] = $info;
|
||||
$this->data['sign_package'] = $sign_package;
|
||||
$this->data['share'] = $share;
|
||||
$this->data['_title'] = $row['title'];
|
||||
$this->show_view('h5/market/sylive/act/index');
|
||||
}
|
||||
|
||||
//获取最新订阅用户
|
||||
public function subscribemsg_lists(){
|
||||
$a_id = $this->input->get('a_id');
|
||||
$field = '';
|
||||
$field = 'uid,c_time';
|
||||
$lists = [];
|
||||
$where = [
|
||||
'a_id' => $a_id
|
||||
];
|
||||
$rows = $this->mdSytSubscribemsg->select($where,'id desc',0,30,$field);
|
||||
$rows = $this->mdSytSubscribemsg->select($where,'id desc',1,30,$field);
|
||||
if($rows){
|
||||
$users = [];
|
||||
$uids = implode(',',array_unique(array_column($rows,'uid')));
|
||||
if($uids){
|
||||
$where = [
|
||||
"userId in ($uids)" => null,
|
||||
];
|
||||
$users = $this->user_model->map('userId','nickname',$where,'','','','userId,nickname');
|
||||
}
|
||||
foreach ($rows as $item) {
|
||||
$nickname = $users[$item['uid']] ? $users[$item['uid']] : "用户{$item['uid']}";
|
||||
$lists[] = [
|
||||
'name' => substr($item['openid'], 0, 3) . "****" . substr($item['openid'], 7, 4),
|
||||
'name' => $nickname,
|
||||
'tip' => friendly_date($item['c_time']).'订阅了直播提醒',
|
||||
];
|
||||
}
|
||||
@@ -183,8 +194,12 @@ class Act extends Wx {
|
||||
];
|
||||
}
|
||||
}
|
||||
$user = $this->user_model->get(['userId'=>$this->uid]);
|
||||
$this->data['posterTip'] = '狸车集美店李菲菲诚挚邀请您参与';
|
||||
$user = $this->user_model->get(['userId'=>$this->uid],'uname');
|
||||
$where = [
|
||||
"organizationId = (select parentId from lc_market_sylive_organization where organizationId={$this->session['org_id']})" => null
|
||||
];
|
||||
$biz = $this->market_sylive_organization_model->get($where,'organizationName');
|
||||
$this->data['posterTip'] = "{$biz['organizationName']}{$user['uname']}诚挚邀请您参与";
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['shareTitle'] = $shareTitle;
|
||||
$this->show_view('h5/market/sylive/act/share');
|
||||
@@ -218,6 +233,7 @@ class Act extends Wx {
|
||||
'is_pay' => $is_pay
|
||||
];
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = $row['title'];
|
||||
$this->show_view('h5/market/sylive/act/item');
|
||||
}
|
||||
|
||||
@@ -283,13 +299,15 @@ class Act extends Wx {
|
||||
}
|
||||
}
|
||||
$order = $this->market_sylive_order_model->get(['uid'=>$this->uid,'status'=>1,'item_id'=>$a_id]);
|
||||
$pay_text = $order ? '(已支付)' : '(未支付)';
|
||||
$info = [
|
||||
'title' => $item['title'].$pay_text,
|
||||
'title' => $item['title'],
|
||||
'content' => $item['introduction'],
|
||||
'banner' => $banner,
|
||||
'state' => $order ? 0 : 1,
|
||||
'text' => $order ? '已抢购' : '未抢购'
|
||||
];
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = $row['title'];
|
||||
$this->show_view('h5/market/sylive/act/ucenter');
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ class Stic extends Admin{
|
||||
$this->load->model('market/market_sylive_activity_model');
|
||||
$this->load->model('market/market_sylive_activity_biz_model','mdSytActivityBiz');
|
||||
$this->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
|
||||
|
||||
$this->load->model('live/Live_polyv_session_model', 'mdPolyvSession');
|
||||
$this->load->library('market/sylive_entity');
|
||||
$this->group_id = $this->sylive_entity->get_level($this->session['org_id']);
|
||||
$this->data['skey'] = $this->input->get('skey');
|
||||
@@ -177,10 +179,14 @@ class Stic extends Admin{
|
||||
['title' => '下单用户', 'num' => "{$order_count}人"],
|
||||
['title' => '转化率', 'num' => $order_count ? round($order_count/$view_count*100,2)."%" : 0],
|
||||
];
|
||||
$poly_row = $this->mdPolyvSession->get(['channelId'=>$row['channelId']]);
|
||||
$duration = $poly_row['duration'] ? intval($poly_row['duration']/60) : "0";
|
||||
$livePV = $poly_row['livePV'] ? $poly_row['livePV'] : 0;
|
||||
$avg_UV_time = $poly_row['liveUV'] ? intval($poly_row['totalPlayDuration']/$poly_row['liveUV']) : 0;
|
||||
$cell2 = [
|
||||
['title' => '直播时长', 'num' => "0分钟"],
|
||||
['title' => '人均观看', 'num' => "0秒"],
|
||||
['title' => '观看次数', 'num' => "0次"],
|
||||
['title' => '直播时长', 'num' => "{$duration}分钟"],
|
||||
['title' => '人均观看', 'num' => "{$avg_UV_time}秒"],
|
||||
['title' => '观看次数', 'num' => "{$livePV}次"],
|
||||
];
|
||||
$biz_id = $this->group_id==3 ? $this->session['org_id'] : 0;
|
||||
$watch_lists = $this->sylive_entity->top_lists($a_id,'watch',1,10,$biz_id);
|
||||
@@ -234,7 +240,7 @@ class Stic extends Admin{
|
||||
];
|
||||
$skey = $this->input->get('skey');
|
||||
$page = $this->input->get('page');
|
||||
!$page && $page=10;
|
||||
!$page && $page=1;
|
||||
$param = $this->myencryption->base64url_decode($skey);
|
||||
$a_id = intval($param['a_id']);//活动id
|
||||
$where = [
|
||||
@@ -255,7 +261,7 @@ class Stic extends Admin{
|
||||
$users = $this->user_model->map('userId','nickname',$where,'','','','userId,nickname');
|
||||
}
|
||||
foreach ($rows as $key => $val) {
|
||||
$nickname = $users[$val['uid']] ? $users['uid'] : "用户{$val['uid']}";
|
||||
$nickname = $users[$val['uid']] ? $users[$val['uid']] : "用户{$val['uid']}";
|
||||
$lists[] = [
|
||||
'nickname' => $nickname,
|
||||
'action' => $map_kpi_name[$val['kpi']],
|
||||
|
||||
@@ -11,10 +11,19 @@
|
||||
<i class="iconfont icon-shuju text-middle"></i><span class="text-middle ml10">数据</span></a>
|
||||
</div>
|
||||
<div class="h-260"></div>
|
||||
<div class="pl25 pr25">
|
||||
<div>
|
||||
<div class="relative ml80 mr180 pl200 bg-ad4635 line-height-63 font-22 color-fff" v-if="info.e_time>0" v-html="showTime"></div>
|
||||
<div class="relative">
|
||||
<a class="block absolute top-0 bottom-0 left-0 right-0 z-index-4" :href="info.live_url"></a>
|
||||
<div id="player" class="relative z-index-0 player pt30 pb30"></div>
|
||||
</div>
|
||||
<div class="mt10 ml25 pl30 pr30 font-22 line-height-17 color-666" v-html="info.content"></div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="pl25 pr25" v-else>
|
||||
<div class="relative ml60 mr180 pl200 bg-ad4635 line-height-63 font-22 color-fff" v-if="info.e_time>0" v-html="showTime"></div>
|
||||
<div id="player" class="player pt30 pb30">
|
||||
<template v-if="info.live_status==2">
|
||||
<template>
|
||||
<div class="pv-ppt-layout pv-ppt-normal" style="width:100%;height:100%">
|
||||
<div class="pv-player-layout pv-player-zh_CN">
|
||||
<div class="plwrap" style="width: 100%; height: 100%;">
|
||||
@@ -26,7 +35,7 @@
|
||||
</div>
|
||||
<div class="mt10 pl30 pr30 font-22 line-height-17 color-666" v-html="info.content"></div>
|
||||
</div>
|
||||
|
||||
-->
|
||||
<div class="fixed left-0 bottom-0 right-0 inner30 bg-fff z-index-4" >
|
||||
<template v-if="info.live_status<2">
|
||||
<a class="block bg-fe9538 pt20 pb20 text-center font-36 color-fff ulib-r10" v-if="info.live_status==1" href="/h5/market/sylive/act/item?skey=<?=$info['skey']?>">立即抢购</a>
|
||||
@@ -75,7 +84,6 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?if($info['live_status']<2){?>
|
||||
<script>
|
||||
var chatroom = null;
|
||||
var liveSdk = null;
|
||||
@@ -105,7 +113,6 @@
|
||||
/******函数*******/
|
||||
};
|
||||
</script>
|
||||
<?}?>
|
||||
<script>
|
||||
let hostUrl = ''
|
||||
var app = new Vue({
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
</div>
|
||||
<!--end 轮播-->
|
||||
<div class="relative pl30 pr30 pb30 z-index-1 goods-con" v-if="info.title">
|
||||
<div class="relative bg-fff mb30 ml30 mr30 inner40 ulib-r20 box-shadow-darkGray">
|
||||
<div class="relative bg-fff mb30 ml30 mr30 inner40 ulib-r20 box-shadow-darkGray overflowhidden">
|
||||
<div :class="info.state==0?'orderTip text-center font-24 color-fff bg-888':'orderTip text-center font-24 color-fff bg-ff5a5a'">{{info.text}}</div>
|
||||
<div class="text-center">{{info.title}}</div>
|
||||
<div class="mt20 line-height-17 font-28 color-666 text-break" v-html="info.content"></div>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
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/market/sylive/h5.css?20220928">
|
||||
<link rel="stylesheet" href="/css/h5/market/sylive/h5.css?2022092901">
|
||||
<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>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="absolute box-middle left-0 right-0 pl40 pr40 pb220">
|
||||
<div class="pb50 color-fff">
|
||||
<div class="font-64">您好!</div>
|
||||
<div class="mt20 font-36">欢迎来到东风EV</div>
|
||||
<div class="mt20 font-36">欢迎来到私域直播</div>
|
||||
</div>
|
||||
<div class="bg-fff pl50 pr50 pt60 pb60 ulib-r20">
|
||||
<div class="text-center font-56">登录</div>
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
<!-- end 预热阶段-->
|
||||
<!--直播阶段-->
|
||||
<div v-if="tabid==2">
|
||||
<div class="mt30 bg-f9 inner20 overflowhidden text-center font-24 color-666 ulib-r20">直播结束后2小时同步数据</div>
|
||||
<div class="mt30 overflowhidden ulib-r20">
|
||||
<div class="bg-fff5ec fn-flex text-center">
|
||||
<div class="fn-flex-item pt40 pb40" v-for="item in live.cell1">
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user