From 3dfeebcbdedfe1ef2bae5f8e3e821a037b6edf26 Mon Sep 17 00:00:00 2001 From: lccsw <805383944@qq.com> Date: Tue, 20 Dec 2022 14:50:35 +0800 Subject: [PATCH] edit-sylive-majia --- home/controllers/h5/market/sylive2/Act.php | 2 +- home/controllers/h5/market/sylive2/Biz.php | 2 +- home/controllers/h5/market/sylive2/Common.php | 12 +++++++++++- home/controllers/h5/market/sylive2/Stic.php | 14 +++++++++++--- home/controllers/h5/market/sylive2/User.php | 10 ++++++++-- home/controllers/h5/market/sylive2/Welcome.php | 7 +++++++ home/views/h5/market/sylive2/stic/index.php | 2 +- 7 files changed, 40 insertions(+), 9 deletions(-) diff --git a/home/controllers/h5/market/sylive2/Act.php b/home/controllers/h5/market/sylive2/Act.php index b798b33f..79e01155 100644 --- a/home/controllers/h5/market/sylive2/Act.php +++ b/home/controllers/h5/market/sylive2/Act.php @@ -409,7 +409,7 @@ class Act extends Wx { $ret['nickname'] && $update['nickname'] = strval($ret['nickname']); $ret['headimgurl'] && $update['headimg'] = strval($ret['headimgurl']); $ret['unionid'] && $update['unionid'] = $ret['unionid']; - $this->user_model->update($update,['userId'=>$this->uid]); + $this->user_model->update($update,['userId'=>$this->uid,'openid'=>$ret['openid']]); $_SESSION[self::SESSION_KEY]['all_info'] =1; } $skey = $this->input->get('skey'); diff --git a/home/controllers/h5/market/sylive2/Biz.php b/home/controllers/h5/market/sylive2/Biz.php index c773be49..17a1058e 100644 --- a/home/controllers/h5/market/sylive2/Biz.php +++ b/home/controllers/h5/market/sylive2/Biz.php @@ -72,7 +72,7 @@ class Biz extends Admin{ $ret['nickname'] && $update['nickname'] = strval($ret['nickname']); $ret['headimgurl'] && $update['headimg'] = strval($ret['headimgurl']); $ret['unionid'] && $update['unionid'] = $ret['unionid']; - $this->user_model->update($update,['userId'=>$this->uid]); + $this->user_model->update($update,['userId'=>$this->uid,'openid'=>$ret['openid']]); } $_SESSION[self::SESSION_KEY]['all_info'] =1; } diff --git a/home/controllers/h5/market/sylive2/Common.php b/home/controllers/h5/market/sylive2/Common.php index dd1fbbcd..0b790a5a 100644 --- a/home/controllers/h5/market/sylive2/Common.php +++ b/home/controllers/h5/market/sylive2/Common.php @@ -232,7 +232,7 @@ class Wx extends Common{ $row_wechat = $this->groups_user_model->get($where); if(!$row_wechat){ $row_wechat = $this->user_model->get(['status'=>0,'openid'=>$openid]);//普通用户角色 - }else{} + } if(!$row_wechat){ //创建用户 $add = array( "openid" => $openid, @@ -249,6 +249,16 @@ class Wx extends Common{ }else{ $this->uid = $row_wechat['userId']; } + //判断是否有绑定马甲 + $ma_user = ''; + $user = $this->user_model->get(['userId'=>$this->uid,'maJiaId>'=>0]); + $user['maJiaId'] && $ma_user = $this->user_model->get(['userId'=>$user['maJiaId'],'status'=>0]); + if($ma_user){ + $where = ['activityId' => $param['a_id'], 'status' => 0, "userId" => $ma_user['userId']]; + $row_wechat = $this->groups_user_model->get($where); //管理员用户 + !$row_wechat && $row_wechat = $this->user_model->get(['status'=>0,'userId'=>$ma_user['userId']]);//普通用户角色 + $this->uid = $row_wechat['userId']; + } $act_user = $this->act_user_model->get(['activityId'=>$param['a_id'],'userId'=>$this->uid]); if(!$act_user && $param['a_id']){ $act_data = [ diff --git a/home/controllers/h5/market/sylive2/Stic.php b/home/controllers/h5/market/sylive2/Stic.php index 2abe958a..c2d08bca 100644 --- a/home/controllers/h5/market/sylive2/Stic.php +++ b/home/controllers/h5/market/sylive2/Stic.php @@ -467,10 +467,13 @@ class Stic extends Admin{ } $jsondata = json_decode($row['jsondata'],true); $info['banner'] = $jsondata['banner'] ? build_qiniu_image_url($jsondata['banner']) : Sylive_entity::DF_BANNER; - $this->data['info'] = $info; + $activityStart = strtotime($row['activityStart'])>0 ? strtotime($row['activityStart']) : strtotime($row['timeStart'])-7*24*60*60; + $end_time = time()< strtotime($row['timeStart']) ? time() : strtotime($row['timeStart']); + $diff_seconds = $end_time - $activityStart; + $diff_days = ceil($diff_seconds/86400); $day_list = ['全部']; $timeEnd = strtotime($row['timeEnd']);//直播结束往前七天 - for($i=0;$i<8;$i++){ + for($i=0;$i<$diff_days;$i++){ $day_list[] = date('Y-m-d',$timeEnd - $i*24*60*60); } $this->data['day_list'] = $day_list; @@ -491,6 +494,7 @@ class Stic extends Admin{ $groups[] = ['value'=>'','type'=>'biz','title'=>'门店排名']; $groups[] = ['value'=>'','type'=>'user','title'=>'顾问排名']; $this->data['groups'] = $groups; + $this->data['info'] = $info; //微信分享 $wx_info = $this->share_info($row); $this->data['sign_package'] = $wx_info['sign_package']; @@ -572,9 +576,13 @@ class Stic extends Admin{ if(!$row){ throw new Hd_exception('参数错误',400); } + $activityStart = strtotime($row['activityStart'])>0 ? strtotime($row['activityStart']) : strtotime($row['timeStart'])-7*24*60*60; + $end_time = time()< strtotime($row['timeStart']) ? time() : strtotime($row['timeStart']); + $diff_seconds = $end_time - $activityStart; + $diff_days = ceil($diff_seconds/86400); $day_list = ['全部']; $timeEnd = strtotime($row['timeEnd']);//直播结束往前七天 - for($i=0;$i<8;$i++){ + for($i=0;$i<$diff_days;$i++){ $day_list[] = date('Y-m-d',$timeEnd - $i*24*60*60); } $group_user = $this->groups_user_model->get(['activityId'=>$this->a_id,'userId'=>$this->uid]); diff --git a/home/controllers/h5/market/sylive2/User.php b/home/controllers/h5/market/sylive2/User.php index a8c3ba3f..b0505ab2 100644 --- a/home/controllers/h5/market/sylive2/User.php +++ b/home/controllers/h5/market/sylive2/User.php @@ -159,12 +159,12 @@ class User extends Admin if (!$userId) { $this->show_json('', 400, '参数错误'); } - $user = $this->user_model->get(['userId' => $userId]); +// $user = $this->user_model->get(['userId' => $userId]); // if($user['openid'] && !$status){ // $this->show_json('', 400, '操作失败,用户已绑定微信公众号'); // } $this->user_model->update(['status' => $status], ['userId' => $userId]); - if($status){ + if($status==-1){ $day = date('Y-m-d H:i:s'); $where = [ 'userId' => $userId, @@ -172,6 +172,12 @@ class User extends Admin "activityId in (select activityId from lc_market_sylive_activity where timeEnd>'{$day}' and status=0)" => null ]; $this->groups_user_model->update(['status'=>-1],$where); + $where = [ + 'userId' => $userId, + 'groupsId>=' => 0, + "activityId in (select activityId from lc_market_sylive_activity where timeEnd>'{$day}' and status=0)" => null + ]; + $this->act_user_model->delete($where); } $this->show_json('', 200, '操作成功'); } diff --git a/home/controllers/h5/market/sylive2/Welcome.php b/home/controllers/h5/market/sylive2/Welcome.php index afbd07a1..7d71c1e7 100644 --- a/home/controllers/h5/market/sylive2/Welcome.php +++ b/home/controllers/h5/market/sylive2/Welcome.php @@ -11,6 +11,13 @@ class Welcome extends Admin { } public function index(){ + //判断是否绑定马甲 + $ma_user = ''; + $user = $this->user_model->get(['mobile'=>$this->mobile,'maJiaId>'=>0]); + $user['maJiaId'] && $ma_user = $this->user_model->get(['userId'=>$user['maJiaId'],"mobile != ''"=>null]); + if($ma_user){ + $this->mobile = $_SESSION[self::SESSION_KEY]['mobile'] = $ma_user['mobile']; + } $where = [ 'mobile' => $this->mobile, 'organizationId>' => 0, diff --git a/home/views/h5/market/sylive2/stic/index.php b/home/views/h5/market/sylive2/stic/index.php index 7dbc040b..4e075a18 100644 --- a/home/views/h5/market/sylive2/stic/index.php +++ b/home/views/h5/market/sylive2/stic/index.php @@ -72,7 +72,7 @@
-
直播结算后6小时同步数据
+
直播结束后6小时同步数据