diff --git a/home/controllers/h5/market/sylive2/Common.php b/home/controllers/h5/market/sylive2/Common.php index d7dd329e..d38b7f73 100644 --- a/home/controllers/h5/market/sylive2/Common.php +++ b/home/controllers/h5/market/sylive2/Common.php @@ -260,6 +260,7 @@ class Wx extends Common{ !$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 = [ @@ -301,11 +302,25 @@ class Wx extends Common{ if($act_user['levelId3']!=$row_wechat['levelId3']){ $update_ac_user['levelId3'] = $row_wechat['levelId3']; } + if($param['cf_uid']){ + $p_act_user = $this->act_user_model->get(['userId'=>$param['cf_uid'],'activityId'=>$param['a_id']],'userId,channelId'); + $update_ac_user['pid'] = $p_act_user['userId']; + } $update_ac_user && $this->act_user_model->update($update_ac_user,['id'=>$act_user['id']]); } $_SESSION[self::SESSION_KEY]['userId'] = $this->uid; $_SESSION[self::SESSION_KEY]['act_uid'] = $act_user['id']; echo ("");exit; + }else{ + //更新pid + $skey = $this->input->get('skey'); + $param = $this->myencryption->base64url_decode($skey); + $act_user = $this->act_user_model->get(['activityId'=>$param['a_id'],'userId'=>$this->uid]); + if($param['cf_uid']){ + $p_act_user = $this->act_user_model->get(['userId'=>$param['cf_uid'],'activityId'=>$param['a_id']],'userId,channelId'); + $update_ac_user['pid'] = $p_act_user['userId']; + } + $update_ac_user && $this->act_user_model->update($update_ac_user,['id'=>$act_user['id']]); } return $this->$method(); } catch(Hd_exception $e){//处理异常 diff --git a/home/controllers/h5/market/sylive2/Item.php b/home/controllers/h5/market/sylive2/Item.php index 57f32c98..a731a601 100644 --- a/home/controllers/h5/market/sylive2/Item.php +++ b/home/controllers/h5/market/sylive2/Item.php @@ -156,8 +156,13 @@ class Item extends Wx{ } $user = $this->user_model->get(['userId'=>$this->uid]); $act_user = $this->act_user_model->get(['userId'=>$this->uid,'activityId'=>$a_id]); - $p_user = []; - $act_user['channelId'] && $p_user = $this->act_user_model->get(['userId'=>$act_user['channelId'],'activityId'=>$a_id]); + + if($act_user['channelId'] != $act_user['pid']) { + $p_user = $this->act_user_model->get(['userId'=>$act_user['pid'], 'activityId'=>$a_id]); + } else{ + $p_user = $this->act_user_model->get(['userId'=>$act_user['channelId'], 'activityId'=>$a_id]); + } + $unpay = $this->market_sylive_order_model->get(['itemId'=>$itemId,'activityId'=>$a_id,'status'=>0,'userId'=>$this->uid,'expireTime>'=>time(),'type'=>0]); if(!$unpay){ $mb_count = $redis_obj->sCard($mb_key); //获取集合中用户数量 diff --git a/home/controllers/h5/market/sylive2/Notify.php b/home/controllers/h5/market/sylive2/Notify.php index bb103ee4..29a95658 100644 --- a/home/controllers/h5/market/sylive2/Notify.php +++ b/home/controllers/h5/market/sylive2/Notify.php @@ -68,10 +68,16 @@ class Notify extends CI_Controller { if($res){ $act_user = $this->act_user_model->get(['userId'=>$order['userId'],'activityId'=>$order['activityId']]); + if($kpi == 'order') { + $cf_uid = $act_user['channelId'] == $act_user['pid'] ? $act_user['channelId'] : $act_user['pid']; + }else{ + $cf_uid = $act_user['channelId']; + } + $params = [ 'a_id' => $order['activityId'], 'uid' => $order['userId'], - 'cf_uid' => $act_user['channelId'], + 'cf_uid' => $cf_uid, 'kpi' => $kpi, 'tagId' => $order['id'], 'jsondata'=> ['order_id'=>$order['id'],'sid'=>$sid,'mch_id'=>$this->mch_id], diff --git a/market/controllers/api/sylive/GroupsOrder.php b/market/controllers/api/sylive/GroupsOrder.php index ad36ba1e..fc2db75d 100644 --- a/market/controllers/api/sylive/GroupsOrder.php +++ b/market/controllers/api/sylive/GroupsOrder.php @@ -127,7 +127,7 @@ class groupsOrder extends BaseController foreach ($res as $v) { $consultant = $this->consultantGet(['activityId' => $v['activityId'], 'userId' => $v['userId'] , 'levelId1' => $v['levelId1'], 'levelId2' => $v['levelId2'], 'levelId3' => $v['levelId3'] - , 'bizId' => $v['bizId'], 'cfUserId' => $v['cfUserId']]); + , 'bizId' => $v['bizId'], 'cfUserId' => $v['cfUserId'], 'itemId' => $v['itemId']]); $insiders = $map_user[$v['userId']] ? '是' : '否';//内部人员 $list1 = [ 'id' => $v['id'], 'sid' => $v['sid'], 'uname' => $v['uname'], 'mobile' => $v['mobile'], 'itemTitle' => $v['itemTitle'] @@ -214,8 +214,9 @@ class groupsOrder extends BaseController $levelId3 = intval($params['levelId3']); $bizId = intval($params['bizId']); $cfUserId = intval($params['cfUserId']); + $itemId = intval($params['itemId']); if (!$bizId && $params['userId']) { - $re = $this->mdSyliveActivityKpidata->get(['activityId' => $params['activityId'], 'userId' => $params['userId'], 'kpi' => 'order']); + $re = $this->mdSyliveActivityKpidata->get(['activityId' => $params['activityId'], 'userId' => $params['userId'], 'itemId' => $itemId]); if ($re) { $levelId1 = $re['levelId1']; $levelId2 = $re['levelId2']; @@ -247,6 +248,7 @@ class groupsOrder extends BaseController $consultantMobile = $re_user['mobile']; } } + return ['stores' => $stores, 'consultant' => $consultant, 'consultantMobile' => $consultantMobile, 'levelName1' => $levelName1, 'levelName2' => $levelName2, 'levelName3' => $levelName3]; }