From 6002fd44dfa268cbbabc580d4bcaa9586f0d09a7 Mon Sep 17 00:00:00 2001 From: lccsw <805383944@qq.com> Date: Wed, 12 Oct 2022 17:33:26 +0800 Subject: [PATCH] add-sylive-hidden_wx_share --- home/controllers/h5/market/sylive/Act.php | 6 ++++- home/controllers/h5/market/sylive/Biz.php | 12 +++++++++ home/controllers/h5/market/sylive/Common.php | 23 +++++++++------- home/controllers/h5/market/sylive/Stic.php | 7 +++++ home/views/h5/market/sylive/act/index.php | 1 - home/views/h5/market/sylive/biz/brands.php | 1 + home/views/h5/market/sylive/biz/index.php | 2 +- home/views/h5/market/sylive/biz/lists.php | 2 +- home/views/h5/market/sylive/header.php | 1 + .../h5/market/sylive/hidden_wx_share.php | 27 +++++++++++++++++++ home/views/h5/market/sylive/stic/index.php | 2 +- 11 files changed, 69 insertions(+), 15 deletions(-) create mode 100644 home/views/h5/market/sylive/hidden_wx_share.php diff --git a/home/controllers/h5/market/sylive/Act.php b/home/controllers/h5/market/sylive/Act.php index e0e3344a..53f5a2d6 100644 --- a/home/controllers/h5/market/sylive/Act.php +++ b/home/controllers/h5/market/sylive/Act.php @@ -73,7 +73,11 @@ class Act extends Wx { $info['org_id'] = $this->session['org_id']; $info['subscribemsg'] = $subscribemsg; $info['code'] = ''; - $info['shareurl'] = '/h5/market/sylive/act/share?skey='.$info['skey']; + if($this->group_id<4){ + $info['shareurl'] = '/h5/market/sylive/act/share?skey='.$info['skey']; + }else{ + $info['shareurl'] = ''; + } $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']; diff --git a/home/controllers/h5/market/sylive/Biz.php b/home/controllers/h5/market/sylive/Biz.php index 93066c3e..a3e8b01b 100644 --- a/home/controllers/h5/market/sylive/Biz.php +++ b/home/controllers/h5/market/sylive/Biz.php @@ -35,6 +35,9 @@ class Biz extends Admin { $row = $this->market_sylive_organization_model->get(['organizationId'=>$biz_id]); $this->data['headimg'] = $this->liche_img; $this->data['biz_name'] = $row['organizationName']; + //微信分享 + $wx_info = $this->share_info(); + $this->data['sign_package'] = $wx_info['sign_package']; $this->show_view('h5/market/sylive/biz/index'); } @@ -46,6 +49,9 @@ class Biz extends Admin { $area_id = $this->input->get('area_id'); $this->data['area_id'] = $area_id; $this->data['group_id'] = $this->group_id; + //微信分享 + $wx_info = $this->share_info(); + $this->data['sign_package'] = $wx_info['sign_package']; $this->show_view('h5/market/sylive/biz/lists'); } //大区列表 @@ -53,6 +59,9 @@ class Biz extends Admin { if($this->group_id!=0){ throw new Hd_exception('权限不足',400); } + //微信分享 + $wx_info = $this->share_info(); + $this->data['sign_package'] = $wx_info['sign_package']; $this->show_view('h5/market/sylive/biz/brands'); } //顾问 @@ -60,6 +69,9 @@ class Biz extends Admin { if($this->group_id!=3){ throw new Hd_exception('权限不足',400); } + //微信分享 + $wx_info = $this->share_info(); + $this->data['sign_package'] = $wx_info['sign_package']; $this->show_view('h5/market/sylive/biz/detail'); } public function nav(){ diff --git a/home/controllers/h5/market/sylive/Common.php b/home/controllers/h5/market/sylive/Common.php index e9dae793..c1d8d45b 100644 --- a/home/controllers/h5/market/sylive/Common.php +++ b/home/controllers/h5/market/sylive/Common.php @@ -95,21 +95,24 @@ abstract class Common extends CI_Controller{ } } //微信分享信息 - public function share_info($act_row){ + public function share_info($act_row=[]){ $a_id = $act_row['activityId']; $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 = $act_row['shareTitle'] ? json_decode($act_row['shareTitle'],true) : []; $sign_package = $jssdk->getSignPackage(); - $share = array( - 'title' => $act_row['title'], - "img" => $act_row['sharePhoto'] ? build_qiniu_image_url($act_row['sharePhoto']) : '', - "desc" => $shareTitle[array_rand($shareTitle)], - "url" => $share_url - ); + $share = []; + if($act_row){ + //微信分享 + $share_url = http_host_com('home') . "/h5/market/sylive/act?skey=" . $this->myencryption->base64url_encode($share_skey); + $shareTitle = $act_row['shareTitle'] ? json_decode($act_row['shareTitle'],true) : []; + $share = array( + 'title' => $act_row['title'], + "img" => $act_row['sharePhoto'] ? build_qiniu_image_url($act_row['sharePhoto']) : '', + "desc" => $shareTitle[array_rand($shareTitle)], + "url" => $share_url + ); + } return ['sign_package' => $sign_package ,'share' => $share]; } } diff --git a/home/controllers/h5/market/sylive/Stic.php b/home/controllers/h5/market/sylive/Stic.php index 101c62fb..c86a3e4a 100644 --- a/home/controllers/h5/market/sylive/Stic.php +++ b/home/controllers/h5/market/sylive/Stic.php @@ -288,14 +288,21 @@ class Stic extends Admin{ ]; $skey = $this->input->get('skey'); $page = $this->input->get('page'); + $type = $this->input->get('type'); !$page && $page=1; $param = $this->myencryption->base64url_decode($skey); $a_id = intval($param['a_id']);//活动id + $row = $this->market_sylive_activity_model->get(['activityId'=>$a_id]); $where = [ 'a_id'=>$a_id, // 'kpi'=>'watch', 'cf_uid'=>$this->uid ]; + if($type==1){ //预热 + $where['c_time<='] = strtotime($row['timeStart']); + }else{ //开始 + $where['c_time>='] = strtotime($row['timeStart']); + } $total = $this->mdSytActivityKpiData->count($where); $lists = []; if($total){ diff --git a/home/views/h5/market/sylive/act/index.php b/home/views/h5/market/sylive/act/index.php index e1445fad..5a7ded8a 100644 --- a/home/views/h5/market/sylive/act/index.php +++ b/home/views/h5/market/sylive/act/index.php @@ -1,6 +1,5 @@ -