edit-market-sylive

This commit is contained in:
lccsw
2022-09-30 10:49:47 +08:00
parent 9fadfc4837
commit 4aa3acc5ba
4 changed files with 33 additions and 41 deletions
+3 -1
View File
@@ -81,13 +81,15 @@ class Syt extends CI_Controller
}
public function syn_polyv(){
$a_id = $this->input->get('a_id');
$where = [
'status' => 0,
"channelId <> ''" => null,
"timeStart<" => date('Y-m-d H:i:s'),
"timeStart>" => date('Y-m-d H:i:s',strtotime("-1 day"))
];
$rows = $this->market_sylive_activity_model->select($where,'activityId desc',1,20,'activityId,channelId');
$a_id && $where = ['activityId'=>$a_id];
$rows = $this->market_sylive_activity_model->select($where,'activityId desc',1,20,'activityId,channelId,timeStart,timeEnd');
if($rows){
foreach ($rows as $item) {
debug_log("开始同步{$item['activityId']}活动直播",$this->log_file,$this->log_dir);
+19 -9
View File
@@ -11,6 +11,7 @@ class Act extends Wx {
$this->load->model('market/market_sylive_organization_model');
$this->load->model('market/market_sylive_activity_model');
$this->load->model('market/market_sylive_subscribemsg_model','mdSytSubscribemsg');
$this->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
$this->load->model('market/market_sylive_order_model');
$this->load->library('market/sylive_entity');
$this->group_id = $this->sylive_entity->get_level($this->session['org_id']);
@@ -49,26 +50,27 @@ class Act extends Wx {
//浏览
$params = array('a_id' => $a_id, 'uid' => $this->uid,'cf_uid' => $act_user['channelId'], 'kpi' => 'browse');
$this->sylive_entity->kpi_log($params);
$live_status = 0;
$live_status = 0; //直播未开始
if(time()>strtotime($row['timeStart']) && time()<=strtotime($row['timeEnd'])){ //直播期间人数
$this->sylive_entity->kpi_log(['a_id' => $a_id, 'uid' => $this->uid,'cf_uid' => $act_user['channelId'], 'kpi' => 'watch']);
$row['liveStatus']!=1 && $this->market_sylive_activity_model->update(['liveStatus'=>1],['activityId'=>$a_id]); //更新直播间状态
$live_status = 1;
$live_status = 1; //直播中
}
if(time()>strtotime($row['timeEnd'])){ //直播结束
$row['liveStatus']!=2 && $this->market_sylive_activity_model->update(['liveStatus'=>2],['activityId'=>$a_id]); //更新直播间状态
$live_status = 2;
$live_status = 2; //直播结束
}
$share_skey = "a_id=" . $a_id . "&cf_uid=" . $this->uid . "&cf_share=" . $this->myencryption->random_string(6);
//微信分享
$share_url = http_host_com('home') . "/h5/market/sylive/act?skey=" . $this->myencryption->base64url_encode($share_skey);
$this->load->library('Jssdk');
$jssdk = new Jssdk('liche');
$shareTitle = $row['shareTitle'] ? json_decode($row['shareTitle'],true) : [];
$sign_package = $jssdk->getSignPackage();
$share = array(
'title' => $row['title'],
"img" => $row['bgImg'] ? build_qiniu_image_url($row['bgImg']) : '',
"desc" => '分享描述',
"img" => $row['sharePhoto'] ? build_qiniu_image_url($row['sharePhoto']) : '',
"desc" => $shareTitle[array_rand($shareTitle)],
"url" => $share_url
);
//直播参数
@@ -99,13 +101,21 @@ class Act extends Wx {
//获取最新订阅用户
public function subscribemsg_lists(){
$map_kpi_name = [
'browse' => '浏览进入直播间', 'subscribe' => '订阅了直播提醒'
];
$a_id = $this->input->get('a_id');
$field = 'uid,c_time';
$live_status = $this->input->get('live_status');
$field = 'uid,c_time,kpi';
$lists = [];
$where = [
'a_id' => $a_id
'a_id' => $a_id,
'kpi' => 'subscribe'
];
$rows = $this->mdSytSubscribemsg->select($where,'id desc',1,30,$field);
if($live_status){
$where['kpi'] = 'browse';
}
$rows = $this->mdSytActivityKpiData->select($where,'id desc',1,30,$field);
if($rows){
$users = [];
$uids = implode(',',array_unique(array_column($rows,'uid')));
@@ -119,7 +129,7 @@ class Act extends Wx {
$nickname = $users[$item['uid']] ? $users[$item['uid']] : "用户{$item['uid']}";
$lists[] = [
'name' => $nickname,
'tip' => friendly_date($item['c_time']).'订阅了直播提醒',
'tip' => friendly_date($item['c_time']).$map_kpi_name[$item['kpi']],
];
}
}
+8 -15
View File
@@ -6,6 +6,9 @@ defined('APPPATH') OR exit('No direct script access allowed');
* Time: 17:13
*/
abstract class Common extends CI_Controller{
const SESSION_KEY = 'market_sylive_session';
protected $data;
protected $white_login_method=[]; //授权白名单
protected $uid;
@@ -15,15 +18,14 @@ abstract class Common extends CI_Controller{
public function __construct(){
parent::__construct();
$this->load->helper('cookie');
$this->load->model('market/market_sylive_user_model', 'user_model');
$this->load->model('market/market_sylive_activity_user_model', 'act_user_model');
$this->load->library('hd_exception');
$this->load->library('MyEncryption');
$ukey = get_cookie('ukey');
if ($ukey) {
$this->session = json_decode(liche_authcode($ukey, 'DECODE', $this->secret), true);
session_start();
if ($_SESSION[self::SESSION_KEY]) {
$this->session = $_SESSION[self::SESSION_KEY];
$this->uid = $this->session['uid'];
}
}
@@ -98,7 +100,6 @@ class Admin extends Common{
const WX_SESSION = "market_wx_info";
public function __construct(){
parent::__construct();
session_start();
}
public function _remap($method){
@@ -115,14 +116,10 @@ class Admin extends Common{
throw new Hd_exception('该账户禁用', 400);
}
$this->uid = $row_wechat['userId'];
$session = ['uid' => $this->uid,'org_id'=>$row_wechat['organizationId']];
$ukey = liche_authcode(json_encode($session, JSON_UNESCAPED_UNICODE), 'ENCODE', $this->secret);
set_cookie("ukey", $ukey, 86400 * 30);
$this->session = $session;
$this->session = $_SESSION[self::SESSION_KEY] = ['uid' => $this->uid,'org_id'=>$row_wechat['organizationId']];
}
return $this->$method();
} catch(Hd_exception $e){//处理异常
// $code = $e->getCode();
$msg = $e->getMessage();
$data = array('heading' => 'Warning', 'message' => $msg);
return $this->load->view('errors/html/error_404',$data);
@@ -182,14 +179,10 @@ class Wx extends Common{
}
$this->act_user_model->add($act_data);
}
$session = ['uid' => $this->uid,'org_id'=>$row_wechat['organizationId']];
$ukey = liche_authcode(json_encode($session, JSON_UNESCAPED_UNICODE), 'ENCODE', $this->secret);
set_cookie("ukey", $ukey, 86400 * 30);
$this->session = $session;
$this->session = $_SESSION[self::SESSION_KEY] = ['uid' => $this->uid,'org_id'=>$row_wechat['organizationId']];
}
return $this->$method();
} catch(Hd_exception $e){//处理异常
// $code = $e->getCode();
$msg = $e->getMessage();
$data = array('heading' => 'Warning', 'message' => $msg);
return $this->load->view('errors/html/error_404',$data);
+3 -16
View File
@@ -198,30 +198,17 @@
//获取基础信息
getInfo(){
//this.info = {
// bg:"<?//=$info['bg']?>//",
// e_time: <?//=$info['s_time']?>//,//距离开始时间
// shareurl:'<?//=$info['shareurl']?>//',
// statisticsurl:'/h5/market/sylive/stic?skey=<?//=$info['skey']?>//',
// code:'',
// content:'<?//=$info['content']?>//',
// a_id:'<?//=$info['a_id']?>//',
// skey:'<?//=$info['skey']?>//',
// subscribemsg:'<?//=$info['subscribemsg']?>//',
// org_id:'<?//=$info['org_id']?>//',
//}
this.info = <?=json_encode($info,JSON_UNESCAPED_UNICODE)?>
this.info = <?=json_encode($info,JSON_UNESCAPED_UNICODE)?>;
},
//获取底部订阅提示
getNotice(){
let that = this
if(that.info.e_time<=0){
if(that.info.live_status==2){
return '';
}
$.get('/h5/market/sylive/act/subscribemsg_lists',{'a_id':that.info.a_id},function (result){
$.get('/h5/market/sylive/act/subscribemsg_lists',{'a_id':that.info.a_id,'live_status':that.info.live_status},function (result){
that.notice = result.data.lists
console.log(result.data.lists);
that.page = that.page + 1
alldelay = 0