From d18e6bf2af53fcc1f8a09e1ca212f5af64cf7fc7 Mon Sep 17 00:00:00 2001 From: lccsw <805383944@qq.com> Date: Sun, 5 Mar 2023 10:19:43 +0800 Subject: [PATCH] add-syt-customer --- .../libraries/market/Sylive2_data_entity.php | 39 +- home/controllers/h5/market/sylive2/Act.php | 118 +++- home/controllers/h5/market/sylive2/Common.php | 19 + .../h5/market/sylive2/Customer.php | 194 ++++++ home/controllers/h5/market/sylive2/Order.php | 324 ++++++++++ home/controllers/h5/market/sylive2/Stic.php | 80 ++- .../controllers/h5/market/sylive2/Ucenter.php | 79 ++- home/views/h5/market/sylive2/act/index.php | 280 +++++++-- .../h5/market/sylive2/customer/index.php | 564 ++++++++++++++++++ home/views/h5/market/sylive2/header.php | 2 +- home/views/h5/market/sylive2/item/detail.php | 15 +- home/views/h5/market/sylive2/nav_biz.php | 23 + home/views/h5/market/sylive2/order/apply.php | 187 ++++++ .../h5/market/sylive2/order/exchange.php | 216 +++++++ home/views/h5/market/sylive2/order/index.php | 175 ++++++ home/views/h5/market/sylive2/stic/index.php | 51 +- home/views/h5/market/sylive2/stic/rank.php | 8 +- home/views/h5/market/sylive2/stic/ranking.php | 509 ++++++---------- .../views/h5/market/sylive2/stic/ranking1.php | 501 ++++++++++++++++ .../h5/market/sylive2/stic/rankingback.php | 420 +++++++++++++ .../h5/market/sylive2/ucenter/detail.php | 47 +- .../h5/market/sylive2/ucenter/orders.php | 91 ++- home/views/h5/market/sylive2/ucenter/win.php | 89 ++- www/home/css/h5/market/sylive/h5.css | 2 +- 24 files changed, 3571 insertions(+), 462 deletions(-) create mode 100644 home/controllers/h5/market/sylive2/Customer.php create mode 100644 home/controllers/h5/market/sylive2/Order.php create mode 100644 home/views/h5/market/sylive2/customer/index.php create mode 100644 home/views/h5/market/sylive2/nav_biz.php create mode 100644 home/views/h5/market/sylive2/order/apply.php create mode 100644 home/views/h5/market/sylive2/order/exchange.php create mode 100644 home/views/h5/market/sylive2/order/index.php create mode 100644 home/views/h5/market/sylive2/stic/ranking1.php create mode 100644 home/views/h5/market/sylive2/stic/rankingback.php diff --git a/common/libraries/market/Sylive2_data_entity.php b/common/libraries/market/Sylive2_data_entity.php index 5abbd3a9..cea2a81c 100644 --- a/common/libraries/market/Sylive2_data_entity.php +++ b/common/libraries/market/Sylive2_data_entity.php @@ -7,11 +7,12 @@ class Sylive2_data_entity{ const DF_IMG = 'https://qs.haodian.cn/web/images/project/H5-ShiYu/goodslogo.jpg'; //东风图标 private $ci; + private $show_echarts = false; private $map_kpi_biz = [ 'browse' => 'browse', 'subscribe' => 'subscribe', 'order' => 'orderTotal','watch' => 'watch','beforeOrder' => 'beforeOrderTotal' ]; - public function __construct(){ + public function __construct($params = []){ $this->ci = &get_instance(); $this->ci->load->model('market/market_sylive_user_model', 'user_model'); $this->ci->load->model('market/market_sylive_activity_user_model', 'act_user_model'); @@ -24,6 +25,7 @@ class Sylive2_data_entity{ $this->ci->load->model('market/market_sylive_viewlog_model'); $this->load->model('market/market_sylive_groups_model', 'groups_model'); $this->load->model('market/market_sylive_groups_user_model', 'groups_user_model'); + $params['show_echarts'] && $this->show_echarts = true; } /** @@ -31,9 +33,11 @@ class Sylive2_data_entity{ */ public function top_kpidata($groupby,$where,$order,$page=1,$page_size=20,$select='',$tagId=0){ $total = $this->ci->mdSytActivityKpiData->count($where,$groupby); - $lists = []; + $pieChart = $lists = []; if($total){ $rows = $this->ci->mdSytActivityKpiData->select_groupby($groupby, $where, $order, $page, $page_size, $select); + $other_total = 0; + $this->show_echarts && $other_total = $this->ci->mdSytActivityKpiData->count($where); $biz_rows = $target_rows = []; if($groupby=='bizId'){ $biz_ids = implode(',',array_column($rows,'tagId')); @@ -49,6 +53,7 @@ class Sylive2_data_entity{ } $num_tip = $where['kpi'] == 'order' ? '单' : '人'; $start = $page>1 ? ($page-1)*$page_size : 0; + $i = 0; foreach ($rows as $key=>$val) { $headimg = ''; if($groupby=='bizId'){ @@ -73,11 +78,20 @@ class Sylive2_data_entity{ 'headimg' => $headimg, 'tip' => $tip, ]; + if($this->show_echarts && $val['t']>0 && $i<5){ + $pieChart[] = ['value'=>$val['t'],'name'=>$name]; + $other_total -= $val['t']; + } + $i++; + } + if($this->show_echarts && $other_total>0){ + $pieChart[] = ['value'=>$other_total,'name'=>'其它']; } } $data = [ 'total' => $total, - 'lists' => $lists + 'lists' => $lists, + 'pieChart' => $pieChart ]; return $data; } @@ -85,10 +99,17 @@ class Sylive2_data_entity{ * @return void */ public function top_groups_user($groupby,$where,$order,$page=1,$page_size=20,$select='',$kpi,$tagId=0){ + $pieChart = []; $total = $this->ci->groups_user_model->count($where,$groupby); $lists = []; if($total){ $rows = $this->ci->groups_user_model->select_groupby($groupby, $where, $order, $page, $page_size, $select); + $other_total = 0; + if($this->show_echarts){ + $sum_key = $this->map_kpi_biz[$kpi]; + $sum_key && $other_sum = $this->ci->groups_user_model->sum($sum_key,$where); + $other_sum[$sum_key] && $other_total = $other_sum[$sum_key]; + } $biz_rows = $target_rows = []; if($groupby=='bizId'){ $biz_ids = implode(',',array_column($rows,'tagId')); @@ -104,6 +125,7 @@ class Sylive2_data_entity{ } $start = $page>1 ? ($page-1)*$page_size : 0; $num_tip = $kpi == 'order' ? '单' : '人'; + $i = 0; foreach ($rows as $key=>$val) { $tip = $headimg = $name = ''; if($groupby=='bizId'){ @@ -126,11 +148,20 @@ class Sylive2_data_entity{ 'headimg' => $headimg, 'tip' => $tip, ]; + if($this->show_echarts && $val['t']>0 && $i<5){ + $pieChart[] = ['value'=>$val['t'],'name'=>$name]; + $other_total -= $val['t']; + } + $i++; + } + if($this->show_echarts && $other_total>0){ + $pieChart[] = ['value'=>$other_total,'name'=>'其它']; } } $data = [ 'total' => $total, - 'lists' => $lists + 'lists' => $lists, + 'pieChart' => $pieChart ]; return $data; } diff --git a/home/controllers/h5/market/sylive2/Act.php b/home/controllers/h5/market/sylive2/Act.php index 79e01155..4cd02e8b 100644 --- a/home/controllers/h5/market/sylive2/Act.php +++ b/home/controllers/h5/market/sylive2/Act.php @@ -17,6 +17,8 @@ class Act extends Wx { $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->model('market/market_sylive_customer_model'); + $this->load->model('market/market_sylive_items_model'); $this->load->library('market/sylive_entity'); $this->load->library('market/sylive2_entity'); $this->load->library('qiniu'); @@ -113,11 +115,24 @@ class Act extends Wx { $info['live_url'] = "https://live.haodian.cn/watch/{$row['channelId']}?userid={$userid}&ts={$ts}&sign={$sign}"; } $info['my_url'] = http_host_com('home')."/h5/market/sylive2/act/userinfo?skey={$this->skey}&type=my"; - //微信分享 - $wx_info = $this->share_info($row); $info['show_code'] = $is_show_code ? 1 : 0; $info['alert_code'] = $alert_code ? 1 : 0; + $info['appoint_mobile'] = false; + $info['is_appoint'] = false; + if($jsondata['signBespeak']['status']){ + $info['appoint_mobile'] = true; + //判断是否已报名 + $where = ['activityId'=>$this->a_id,'userId'=>$this->uid]; + $appoint = $this->market_sylive_customer_model->count($where); + $info['is_appoint'] = $appoint ? true : false; + } + $info['appoint_title'] = $jsondata['signBespeak']['title'] ? $jsondata['signBespeak']['title'] : ''; + $info['appoint_msg'] = $jsondata['signBespeak']['content'] ? $jsondata['signBespeak']['content'] : ''; + $info['notice_color'] = $jsondata['barrageColor'] ? '#fff' : '#333'; + $info['btn_text'] = $jsondata['button']['title'] ? $jsondata['button']['title'] : '开播提醒'; $this->data['info'] = $info; + //微信分享 + $wx_info = $this->share_info($row); $this->data['sign_package'] = $wx_info['sign_package']; $this->data['share'] = $wx_info['share']; $this->data['_title'] = $row['title']; @@ -143,6 +158,8 @@ class Act extends Wx { } $rows = $this->mdSytActivityKpiData->select($where,'id desc',1,30,$field); if($rows){ + $act_row = $this->market_sylive_activity_model->get(['activityId'=>$a_id]); + $jsondata = json_decode($act_row['jsondata'],true); $users = []; $uids = implode(',',array_unique(array_column($rows,'userId'))); if($uids){ @@ -153,9 +170,15 @@ class Act extends Wx { } foreach ($rows as $item) { $nickname = $users[$item['userId']] ? $users[$item['userId']] : "用户{$item['userId']}"; + //报名使用自定标题 + if($jsondata['signBespeak']['status'] && !$live_status && $jsondata['barrage']['title']){ + $tip = $jsondata['barrage']['title']; + }else{ + $tip = $map_kpi_name[$item['kpi']]; + } $lists[] = [ 'name' => $nickname, - 'tip' => $map_kpi_name[$item['kpi']], + 'tip' => $tip, ]; } } @@ -461,4 +484,93 @@ class Act extends Wx { $this->show_json([],400,'参数错误'); } } + + //获取验证码 + public function get_code(){ + $mobile = $this->input->post('mobile'); + if(!mobile_valid($mobile)){ + $this->show_json('',400,'请输入正确的手机号码'); + } + $redis = &load_cache('redis'); + $key = "sylive_appointment_code_".$mobile; + $code = $redis->get($key); + if(!$code){ + $this->load->helper('string'); + $code = random_string('numeric', 4); + $redis->save($key, $code, 60*5); + } + $content = "【好店云】您的验证码为: {$code},五分钟之内有效,请勿泄露于他人,!"; + b2m_send_sms($mobile,$content); + $this->show_json('',200, '验证码已发送'); + } + //预约 + public function appointment(){ + $mobile = $this->input->post('mobile'); + $code = $this->input->post('code'); + $a_id = $this->input->post('a_id'); + if(!$a_id){ + $this->show_json('',400, '参数错误'); + } + $redis = &load_cache('redis'); + $key = "sylive_appointment_code_".$mobile; + $c_code = $redis->get($key); + if(!$code || $code!=$c_code){ + $this->show_json('',400, '请输入正确的验证码'); + } + $row = $this->market_sylive_customer_model->get(['activityId'=>$this->a_id,'mobile'=>$mobile]); + if($row){ + $update = [ + 'ifAppointment' => 1 + ]; + !$row['userId'] && $update['userId'] = $this->uid; + $this->market_sylive_customer_model->update($update,['customerId'=>$row['customerId']]); + }else{ + $ac_row = $this->market_sylive_activity_model->get(['activityId'=>$a_id],'jsondata'); + $jsondata = json_decode($ac_row['jsondata'],true); + $act_user_row = $this->act_user_model->get(['id'=>$this->act_uid]); + $add_data = [ + 'activityId' => $a_id, + 'userId' => $this->uid, + 'ifAppointment' => 1, + 'mobile' => $mobile, + 'createTime' => date('Y-m-d H:i:s') + ]; + $act_user_row['channelId'] && $add_data['cfUserId'] = $act_user_row['channelId']; + $act_user_row['bizId'] && $add_data['bizId'] = $act_user_row['bizId']; + $act_user_row['levelId1'] && $add_data['levelId1'] = $act_user_row['levelId1']; + $act_user_row['levelId2'] && $add_data['levelId2'] = $act_user_row['levelId2']; + $act_user_row['levelId3'] && $add_data['levelId3'] = $act_user_row['levelId3']; + $add_data['cfUserId'] && $add_data['status'] = 1; + $this->market_sylive_customer_model->add($add_data); + if($jsondata['signBespeak']['status'] && $jsondata['signBespeak']['itemId']){ //绑定新增商品订单 + $itemId = $jsondata['signBespeak']['itemId']; + $item = $this->market_sylive_items_model->get(['itemId'=>$itemId]); + $p_user = []; + $act_user_row['channelId'] && $p_user = $this->act_user_model->get(['userId'=>$act_user_row['channelId'],'activityId'=>$a_id]); + $this->load->helper('order'); + $unpay = [ + 'sid' => create_order_no('350200','market'), + 'activityId' => $a_id, + 'userId' => $this->uid, + 'itemId' => $itemId, + 'itemTitle' => $item['title'], + 'itemPrice' => 0, + 'totalPrice' => 0, + 'expireTime' => 0,//订单过期时间 + 'status' => 1, + 'payTime' => date('Y-m-d H:i:s'), + 'createTime' => date('Y-m-d H:i:s') + ]; + $mobile && $unpay['mobile'] = $mobile; + $p_user['bizId'] && $unpay['bizId'] = $p_user['bizId']; + $p_user['levelId1'] && $unpay['levelId1'] = $p_user['levelId1']; + $p_user['levelId2'] && $unpay['levelId2'] = $p_user['levelId2']; + $p_user['levelId3'] && $unpay['levelId3'] = $p_user['levelId3']; + $p_user['userId'] && $unpay['cfUserId'] = $p_user['userId']; + $this->market_sylive_order_model->add($unpay); + } + } + $redis->delete($key); + $this->show_json('',200, '预约成功'); + } } diff --git a/home/controllers/h5/market/sylive2/Common.php b/home/controllers/h5/market/sylive2/Common.php index 0b790a5a..184735a9 100644 --- a/home/controllers/h5/market/sylive2/Common.php +++ b/home/controllers/h5/market/sylive2/Common.php @@ -282,6 +282,25 @@ class Wx extends Common{ } $row_wechat['groupsId'] && $act_data['channelId'] = $this->uid;//管理员自己归属到自己 $act_user['id'] = $this->act_user_model->add($act_data); + }else{ + //更新分组信息 + $update_ac_user = []; + if($act_user['bizId']!=$row_wechat['bizId']){ + $update_ac_user['bizId'] = $row_wechat['bizId']; + } + if($act_user['groupsId']!=$row_wechat['groupsId']){ + $update_ac_user['groupsId'] = $row_wechat['groupsId']; + } + if($act_user['levelId1']!=$row_wechat['levelId1']){ + $update_ac_user['levelId1'] = $row_wechat['levelId1']; + } + if($act_user['levelId2']!=$row_wechat['levelId2']){ + $update_ac_user['levelId2'] = $row_wechat['levelId2']; + } + if($act_user['levelId3']!=$row_wechat['levelId3']){ + $update_ac_user['levelId3'] = $row_wechat['levelId3']; + } + $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']; diff --git a/home/controllers/h5/market/sylive2/Customer.php b/home/controllers/h5/market/sylive2/Customer.php new file mode 100644 index 00000000..6a6861b2 --- /dev/null +++ b/home/controllers/h5/market/sylive2/Customer.php @@ -0,0 +1,194 @@ +load->model('market/market_sylive_items_model'); + $this->load->model('market/market_sylive_order_model'); + $this->load->model('market/Market_sylive_activity_draw_model', 'mdSyliveActivityDraw'); + $this->load->model('market/market_sylive_checkdata_model'); + $this->load->model('market/market_sylive_customer_model'); + $this->a_id = $this->input->get('a_id'); + $this->a_id && $_SESSION[self::SESSION_KEY]['a_id'] = $this->a_id; + !$this->a_id && $this->a_id = $_SESSION[self::SESSION_KEY]['a_id']; + $skey = $this->myencryption->base64url_encode("a_id=" . $this->a_id); + $this->data['act_url'] = "/h5/market/sylive2/act?skey={$skey}"; + $this->group_user = $this->groups_user_model->get(['activityId' => $this->a_id, 'userId' => $this->uid, 'status' => 0]); + $this->data['is_biz'] = $this->group_user['bizId'] ? 1 : 0; + if($this->group_user['bizId'] && $this->group_user['type']){ //店长 + $this->is_shop_manager = 1; + } + } + + public function index() + { + $tab = [ + ['id'=>2,'title'=>'待回访'], + ['id'=>3,'title'=>'已回访'] + ]; + $this->is_shop_manager && array_unshift($tab,['id'=>1,'title'=>'待分配']); + $gw_rows = $this->groups_user_model->select(['activityId' => $this->a_id, 'bizId' => $this->group_user['bizId'], 'status' => 0],'','','','groupsUserId,userId'); + $uids = implode(',',array_column($gw_rows,'userId')); + $gw_list = []; + if($gw_rows && $uids){ + $where = ["userId in ({$uids})"=>null]; + $user_rows = $this->user_model->map('userId','uname',$where,'','','','userId,uname'); + foreach ($gw_rows as $item) { + $gw_list[] = [ + 'id' => $item['userId'], + 'title' => $user_rows[$item['userId']] + ]; + } + } + $visitTagAry = $this->market_sylive_customer_model->visitTagAry(); + $re = $this->market_sylive_activity_model->get(['activityId' => $this->a_id], 'jsondata'); + $jsonData = $re['jsondata'] ? json_decode($re['jsondata'], true) : []; + $visitTag = []; + foreach ($visitTagAry as $key => $item) { + $tip = $jsonData['visitTag'][$key] ? "({$jsonData['visitTag'][$key]})" : ''; + $visitTag[] = [ + 'id' => $key, + 'title' => $item.$tip + ]; + } + $this->data['visitTag'] = $visitTag; + $this->data['tabId'] = $this->is_shop_manager ? 1 : 2; + $this->data['tab'] = $tab; + $this->data['gw_list'] = $gw_list; + $this->data['is_shop_manager'] = $this->is_shop_manager; + $this->data['_title'] = '客户'; + $this->show_view('h5/market/sylive2/customer/index'); + } + + public function ajax_list(){ + $page = $this->input->get('page'); + $tabid = intval($this->input->get('tabid'))-1; + $employeeId = intval($this->input->get('employeeId')); + $tagId = intval($this->input->get('tagId')); + !$page && $page = 1; + $size = 10; + $where = [ + 'status' => $tabid, + 'activityId' => $this->a_id + ]; + if($this->is_shop_manager){ + $where['bizId'] = $this->group_user['bizId']; + }else{ + $where['cfUserId'] = $this->uid; + } + $employeeId && $where['cfUserId'] = $employeeId; + $tagId && $where['visitTagId'] = $tagId; + $total = $this->market_sylive_customer_model->count($where); + $lists = []; + if($total){ + $rows = $this->market_sylive_customer_model->select($where,'customerId desc',$page,$size); + $visitTagAry = $this->market_sylive_customer_model->visitTagAry(); + $re = $this->market_sylive_activity_model->get(['activityId' => $this->a_id], 'jsondata'); + $jsonData = $re['jsondata'] ? json_decode($re['jsondata'], true) : []; + $uids = implode(',',array_column($rows,'cfUserId')); + $where = ["userId in ({$uids})"=>null]; + $gw_user_rows = $this->user_model->map('userId','',$where,'','','','userId,uname,headimg,nickname'); + $uids = implode(',',array_unique(array_column($rows,'userId'))); + $where = ["userId in ({$uids})"=>null]; + $user_rows = $this->user_model->map('userId','nickname',$where,'','','','userId,nickname'); + foreach ($rows as $key => $val) { + $employee_name = ''; + $gw_user = $gw_user_rows[$val['cfUserId']][0] ? $gw_user_rows[$val['cfUserId']][0] : []; + $nicakname = $user_rows[$val['userId']]; + if($val['status']>0 && $gw_user){ + $employee_name = $gw_user['uname']; + $headimg = $gw_user['headimg']; + } + $tip = $jsonData['visitTag'][$val['visitTagId']] ? ":{$jsonData['visitTag'][$val['visitTagId']]}" : ''; + $lists[] = [ + 'id' => $val['customerId'], + 'status' => $val['status'],//0未分配 /1已分配 /2战败 + 'customer_name' => $val['name'] ? $val['name'] : $nicakname, + 'tel' => $val['mobile'], + 'employee_name' => $employee_name, + 'headimg' => $headimg, + 'grade' => $val['level'], + 'is_rights' => $val['userId'] ? 1 : 0,//0未领权益 /1已领权益 + 'is_appoint' => $val['userId'] ? 1 : 0,//0未预约 /1已预约 + 'is_wechat' => intval($val['ifWechat']),//0未加微 /1已加微 + 'tip' => $visitTagAry[$val['visitTagId']].$tip, + ]; + } + } + $data = [ + 'total' => $total, + 'lists' => $lists + ]; + $this->show_json($data,200); + } + + public function allot_single(){ + $customerId = $this->input->post('customerId'); + $cfUserId = $this->input->post('cfUserId'); + $where = [ + 'customerId' => $customerId, + 'bizId' => $this->group_user['bizId'], + ]; + $row = $this->market_sylive_customer_model->get($where); + if(!$row){ + $this->show_json('',400,'参数错误'); + } + if($row['status']){ + $this->show_json('',400,'该客户已分配'); + } + $this->market_sylive_customer_model->update(['cfUserId'=>$cfUserId,'status'=>1],['customerId'=>$row['customerId']]); + $this->show_json('',200,'保存成功'); + } + + public function allot_mult(){ + $info = $this->input->post('info'); + if(!$info){ + $this->show_json('',400,'参数错误'); + } + $total = array_sum(array_column($info,'num')); + if($total<=0){ + $this->show_json('',400,'请填写分配数量'); + } + foreach ($info as $key=>$value) { + if($value['num']>0){ + $sql = "update lc_market_sylive_customer set cfUserId={$value['id']},status=1 where activityId={$this->a_id} and bizId={$this->group_user['bizId']} and status=0 limit {$value['num']}"; + $this->market_sylive_customer_model->db->query($sql); + $this->market_sylive_customer_model->db->affected_rows(); + } + } + $this->show_json('',200,'保存成功'); + } + + public function addTag(){ + $customerId = $this->input->post('customerId'); + $visitTagId = $this->input->post('followId'); + $is_wechat = $this->input->post('is_wechat'); + if(!$visitTagId){ + $this->show_json('',400,'请选择标签'); + } + $where = [ + 'customerId' => $customerId, + 'bizId' => $this->group_user['bizId'], + ]; + $row = $this->market_sylive_customer_model->get($where); + if(!$row){ + $this->show_json('',400,'参数错误'); + } + $update = [ + 'visitTagId'=>$visitTagId, + 'ifWechat' => $is_wechat ? 1 : 0, + 'status' => 2 + ]; + $this->market_sylive_customer_model->update($update,['customerId'=>$row['customerId']]); + $this->show_json('',200,'保存成功'); + } +} \ No newline at end of file diff --git a/home/controllers/h5/market/sylive2/Order.php b/home/controllers/h5/market/sylive2/Order.php new file mode 100644 index 00000000..78b48aa7 --- /dev/null +++ b/home/controllers/h5/market/sylive2/Order.php @@ -0,0 +1,324 @@ +load->model('market/market_sylive_items_model'); + $this->load->model('market/market_sylive_order_model'); + $this->load->model('market/Market_sylive_activity_draw_model', 'mdSyliveActivityDraw'); + $this->load->model('market/market_sylive_checkdata_model'); + $this->a_id = $this->input->get('a_id'); + $this->a_id && $_SESSION[self::SESSION_KEY]['a_id'] = $this->a_id; + !$this->a_id && $this->a_id = $_SESSION[self::SESSION_KEY]['a_id']; + $skey = $this->myencryption->base64url_encode("a_id=" . $this->a_id); + $this->data['act_url'] = "/h5/market/sylive2/act?skey={$skey}"; + $this->group_user = $this->groups_user_model->get(['activityId' => $this->a_id, 'userId' => $this->uid, 'status' => 0]); + $this->data['is_biz'] = $this->group_user['bizId'] ? 1 : 0; + } + + public function index() + { + $where = [ + 'activityId' => $this->a_id, + 'status' => 0 + ]; + $goods_rows = $this->market_sylive_items_model->select($where, 'sort desc,itemId desc', 0, 0, 'itemId,title'); + $goods = [ + ['id' => 0, 'title' => '全部'] + ]; + if ($goods_rows) { + foreach ($goods_rows as $val) { + $goods[] = [ + 'id' => $val['itemId'], + 'title' => $val['title'] + ]; + } + } + $this->data['goods'] = $goods; + //微信分享 + $wx_info = $this->share_info(); + $this->data['sign_package'] = $wx_info['sign_package']; + $this->data['share'] = $wx_info['share']; + $this->show_view('h5/market/sylive2/order/index'); + } + + public function exchange() + { + //微信分享 + $wx_info = $this->share_info(); + $this->data['sign_package'] = $wx_info['sign_package']; + $this->data['share'] = $wx_info['share']; + $this->show_view('h5/market/sylive2/order/exchange'); + } + + public function apply() + { + $id = $this->input->get('id'); + $iswin = $this->input->get('iswin'); + $where = [ + 'id' => $id + ]; + $iswin && $where['win'] = 1; + if($this->group_user['bizId'] && $this->group_user['type']==1){ + $where['bizId'] = $this->group_user['bizId']; + }else{ + $where['cfUserId'] = $this->uid; + } + $row = $this->market_sylive_order_model->get($where); + if (!$row) { + throw new Hd_exception('参数错误', 400); + } + $time = $iswin ? '开奖时间 ' . date('Y.m.d H:i:s', strtotime($row['winTime'])) : '下单时间 ' . date('Y.m.d H:i:s', strtotime($row['createTime'])); + $user_row = $this->user_model->get(["userId" => $row['userId']], 'userId,nickname,headimg'); + $jsondata = json_decode($row['jsondata'], true); + $ifAddress = true; + if ($iswin) { + $re_draw = $this->mdSyliveActivityDraw->get(['activityId' => $row['activityId']]); + $winTypeAry = []; + if ($re_draw && $re_draw['winType']) { + $json_winType = json_decode($re_draw['winType'], true); + foreach ($json_winType as $v) { + $v['img'] && $v['img'] = build_qiniu_image_url($v['img']); + $winTypeAry[$v['id']] = ['img' => $v['img'], 'tag' => $v['tag'], 'title' => $v['title']]; + } + } + $winTypeItem = $winTypeAry[$row['winType']]; + $img = $winTypeItem['img']; + $title = $winTypeItem['title']; + $grade = $winTypeItem['tag']; + if(isset($winTypeItem['ifAddress']) && !$winTypeItem['ifAddress']){ + $ifAddress = false; + } + } else { + $item_row = $this->market_sylive_items_model->get(["itemId" => $row['itemId']]); + $grade = ''; + $title = $row['itemTitle']; + $imgs = json_decode($item_row['imgs'], true); + $img = $imgs['banner'][0] ? build_qiniu_image_url($imgs['banner'][0]) : ''; + !$item_row['ifAddress'] && $ifAddress = false; + } + $info = [ + 'id' => $row['id'], + 'iswin' => $iswin ? 1 : 0, + 'cate' => $iswin ? '抽奖' : '订单', + 'nickname' => $user_row['nickname'], + 'headimg' => $user_row['headimg'], + 'tel' => $row['mobile'], + 'customer_name' => $row['uname'], + 'address' => $jsondata['address']['detail'] ? $jsondata['address']['detail'] : '', + 'grade' => $grade, + 'name' => $title, + 'img' => $img, + 'time' => $time, + 'ifAddress' => $ifAddress ? 1 : 0, + 'region' => $jsondata['address']['region'] ? $jsondata['address']['region'] : '' + ]; + $this->data['info'] = $info; + $this->show_view('h5/market/sylive2/order/apply'); + } + + public function add_apply() + { + $info = $this->input->post('info'); + $iswin = $info['iswin']; + $where = [ + 'id' => $info['id'] + ]; + $iswin && $where['win'] = 1; + if($this->group_user['bizId'] && $this->group_user['type']==1){ + $where['bizId'] = $this->group_user['bizId']; + }else{ + $where['cfUserId'] = $this->uid; + } + $row = $this->market_sylive_order_model->get($where); + if (!$row) { + $this->show_json([], 400,'参数错误'); + } + $type = $iswin ? 1 : 0; + if($this->market_sylive_checkdata_model->get(['cfId'=>$row['id'],'type'=>$type,'ifCheck'=>0])){ + $this->show_json([], 200,'审核中'); + } + $add_data = [ + 'cfId' => $row['id'], + 'cfUid' => $this->uid, + 'type' => $type, + 'createTime' => time() + ]; + $o_update = []; + $jsondata = json_decode($row['jsondata'],true); + $address = $jsondata['address']['detail']; + $region = $jsondata['address']['region']; + if($address!=$info['address'] || $region!=$info['region'] || $row['uname']!=$info['customer_name'] || $row['mobile']!=$info['tel']){ + $old_info = [ + 'uname' => $row['uname'], + 'mobile' => $row['mobile'], + 'address' => $address, + 'region' => $region + ]; + $add_data['jsondata'] = json_encode(['old_info'=>$old_info],JSON_UNESCAPED_UNICODE); + $o_update['uname'] = $info['customer_name']; + $o_update['mobile'] = $info['tel']; + $jsondata['address']['detail'] =$info['address']; + $jsondata['address']['region'] =$info['region']; + $o_update['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE); + } + $res = $this->market_sylive_checkdata_model->add($add_data); + if(is_numeric($res)){ + if($iswin){ + $o_update['winUseStatus'] = 1; + }else{ + $o_update['useStatus'] = 1; + } + + $this->market_sylive_order_model->update($o_update,['id'=>$row['id']]); + $this->show_json([], 200,'提交成功'); + }else{ + $this->show_json([], 400,'提交失败'); + } + + } + + public function o_lists() + { + $iswin = $this->input->get('iswin'); + $item_id = $this->input->get('item_id'); + $page = $this->input->get('page'); + $size = $this->input->get('size'); + $keyword = $this->input->get('keyword'); + $used = $this->input->get('used'); + !$page && $page = 1; + !$size && $size = 20; + $where = [ + 'status' => 1, + 'activityId' => $this->a_id + ]; + $item_id && $where['itemId'] = $item_id; + if($this->group_user['bizId'] && $this->group_user['type']==1){ + $where['bizId'] = $this->group_user['bizId']; + }else{ + $where['cfUserId'] = $this->uid; + } + $keyword && $where["uname like '%{$keyword}%' or mobile like '%{$keyword}%'"] = null; + if ($used) { + if($iswin){ + $re_draw = $this->mdSyliveActivityDraw->get(['activityId' => $this->a_id],'winType'); + $type_arr = []; + if ($re_draw && $re_draw['winType']) { + $json_winType = json_decode($re_draw['winType'], true); + foreach ($json_winType as $v) { + $v['ifCode'] && $type_arr[] = $v['id']; + } + } + $type_ids = 0; + $type_arr && $type_ids = implode(',',$type_arr); + $where["winType in ({$type_ids})"] = null; + }else{ + $where["itemId in (select itemId from lc_market_sylive_items where ifCode=1 and activityId={$this->a_id})"] = null; + } + $status_key = $iswin ? 'winUseStatus' : 'useStatus'; + if ($used == 2) { + $where[$status_key] = 2; + } else { + $where["{$status_key} != 2"] = null; + } + } + $order_total = $this->market_sylive_order_model->count($where); + $where['win'] = 1; + $win_total = $this->market_sylive_order_model->count($where); + if (!$iswin) { + unset($where['win']); + } + $rows = $this->market_sylive_order_model->select($where, 'id desc', $page, $size); + $lists = []; + if ($rows) { + $item_ids = implode(',', array_unique(array_column($rows, 'itemId'))); + $item_rows = []; + if ($item_ids) { + $item_rows = $this->market_sylive_items_model->map('itemId', '', ["itemId in ({$item_ids})" => null], '', 0, 0, 'itemId,imgs'); + } + $user_ids = implode(',', array_unique(array_column($rows, 'userId'))); + $user_rows = []; + if ($user_ids) { + $user_rows = $this->user_model->map('userId', '', ["userId in ({$user_ids})" => null], '', 0, 0, 'userId,nickname,headimg'); + } + if ($iswin) { + $re_draw = $this->mdSyliveActivityDraw->get(['activityId' => $this->a_id]); + $winTypeAry = []; + if ($re_draw && $re_draw['winType']) { + $json_winType = json_decode($re_draw['winType'], true); + foreach ($json_winType as $v) { + $v['img'] && $v['img'] = build_qiniu_image_url($v['img']); + $winTypeAry[$v['id']] = ['img' => $v['img'], 'tag' => $v['tag'], 'title' => $v['title']]; + } + } + } + foreach ($rows as $key => $val) { + $url = 'javascript:;'; + $ck_rows = $this->market_sylive_checkdata_model->select(['cfId' => $val['id'], 'type' => $iswin ? 1 : 0], 'id desc', 1, 1, 'ifCheck,descrip'); + $success = $fail = ''; + if ($ck_rows) { + $ck_row = $ck_rows[0]; + if ($ck_row['ifCheck'] == 1) { + $success = '审核通过:恭喜您!您的奖品将在7个工作日内发出 >'; + } elseif ($ck_row['ifCheck'] == -1) { + $fail = "审核失败:{$ck_row['descrip']}"; + } else { + $success = '审核中'; + } + } + + $jsondata = json_decode($val['jsondata'], true); + $item = $item_rows[$val['itemId']] ? $item_rows[$val['itemId']][0] : []; + $imgs = json_decode($item['imgs'], true); + $img = $imgs['banner'][0] ? build_qiniu_image_url($imgs['banner'][0]) : ''; + $user = $user_rows[$val['userId']] ? $user_rows[$val['userId']][0] : []; + $time = $iswin ? '开奖时间 ' . date('Y.m.d H:i:s', strtotime($val['winTime'])) : '下单时间 ' . date('Y.m.d H:i:s', strtotime($val['createTime'])); + $address = $jsondata['address'] ? $jsondata['address']['region'] . ' ' . $jsondata['address']['detail'] : ''; + if ($iswin) { + $winTypeItem = $winTypeAry[$val['winType']]; + $img = $winTypeItem['img']; + $title = $winTypeItem['title']; + $grade = $winTypeItem['tag']; + $used = $val['winUseStatus'] == 2 ? 1 : ''; + $val['winUseStatus'] != 2 && $url = "/h5/market/sylive2/order/apply?id={$val['id']}&iswin=1"; + } else { + $grade = ''; + $title = $val['itemTitle']; + $used = $val['useStatus'] == 2 ? 1 : ''; + $val['useStatus'] != 2 && $url = "/h5/market/sylive2/order/apply?id={$val['id']}"; + } + $lists[] = [ + 'nickname' => $user['nickname'], + 'headimg' => $user['headimg'], + 'tel' => $val['mobile'], + 'customer_name' => $val['uname'], + 'address' => $address, + 'grade' => $grade, + 'name' => $title, + 'img' => $img, + 'time' => $time, + 'success' => $success, + 'fail' => $fail, + 'used' => $used, + 'cate' => $iswin ? '抽奖' : '订单', + 'url' => $url + ]; + } + } + $data = [ + 'lists' => $lists, + 'total' => $iswin ? $win_total : $order_total, + 'order_total' => $order_total, + 'win_total' => $win_total + ]; + $this->show_json($data, 200); + } +} \ No newline at end of file diff --git a/home/controllers/h5/market/sylive2/Stic.php b/home/controllers/h5/market/sylive2/Stic.php index f73fd695..b478c460 100644 --- a/home/controllers/h5/market/sylive2/Stic.php +++ b/home/controllers/h5/market/sylive2/Stic.php @@ -5,6 +5,7 @@ require_once 'Common.php'; class Stic extends Admin{ private $a_id; + private $group_user; public function __construct(){ parent::__construct(); @@ -20,6 +21,8 @@ class Stic extends Admin{ !$this->a_id && $this->a_id = $_SESSION[self::SESSION_KEY]['a_id']; $skey = $this->myencryption->base64url_encode("a_id=" . $this->a_id); $this->data['act_url'] = "/h5/market/sylive2/act?skey={$skey}"; + $this->group_user = $this->groups_user_model->get(['activityId'=>$this->a_id,'userId'=>$this->uid,'status'=>0]); + $this->data['is_biz'] = $this->group_user['bizId'] ? 1 : 0; } public function index(){ @@ -33,7 +36,7 @@ class Stic extends Admin{ $info['banner'] = $jsondata['banner'] ? build_qiniu_image_url($jsondata['banner']) : Sylive_entity::DF_BANNER; $info['nickname'] = $user['nickname']; $info['headimg'] = $user['headimg']; - $group_user = $this->groups_user_model->get(['activityId'=>$this->a_id,'userId'=>$this->uid,'status'=>0]); + $group_user = $this->group_user; $info['group_name'] = ''; $info['is_biz'] = $group_user['bizId'] ? 1 : 0; $info['biz_id'] = $group_user['biz_id'] ? $group_user['biz_id'] : 0; @@ -53,10 +56,11 @@ class Stic extends Admin{ $this->data['share'] = $wx_info['share']; $this->show_view('h5/market/sylive2/stic/index'); } + //预约阶段数据 public function lists_ready(){ $groupsId = $this->input->get('groupsId'); - $group_user = $this->groups_user_model->get(['activityId'=>$this->a_id,'userId'=>$this->uid,'status'=>0]); + $group_user = $this->group_user; !$groupsId && $groupsId = $group_user['groupsId']; $group_row = $this->groups_model->get(['groupsId'=>$groupsId,'activityId'=>$this->a_id]); $disk = $this->sylive2_entity->level_disk($this->a_id); @@ -98,10 +102,13 @@ class Stic extends Admin{ $owner_browse_count = $this->mdSytActivityKpiData->count($where); //浏览数据 $where['kpi'] = 'subscribe'; $owner_subscribe_count = $this->mdSytActivityKpiData->count($where); //订阅数据 + $where['kpi'] = 'beforeOrder'; + $order_count = $this->mdSytActivityKpiData->count($where); //下单数据 $mine = [ ['title'=>'访问用户','num'=>"{$owner_browse_count}人",'url'=>'/h5/market/sylive2/stic/users?type=owner&kpi=browse'], ['title'=>'预约用户','num'=>"{$owner_subscribe_count}人",'url'=>'/h5/market/sylive2/stic/users?type=owner&kpi=subscribe'], ['title'=>'预约率','num'=>$owner_browse_count ? round($owner_subscribe_count/$owner_browse_count*100,2)."%" : 0], + ['title'=>'下单数','num'=>"{$order_count}单"], ]; $sub_lists = [ ['title'=>'我的','lists'=>$mine], @@ -115,10 +122,13 @@ class Stic extends Admin{ $biz_browse_count = $this->mdSytActivityKpiData->count($where); //浏览数据 $where['kpi'] = 'subscribe'; $biz_subscribe_count = $this->mdSytActivityKpiData->count($where); //订阅数据 + $where['kpi'] = 'beforeOrder'; + $order_count = $this->mdSytActivityKpiData->count($where); //下单数据 $biz = [ ['title'=>'访问用户','num'=>"{$biz_browse_count}人",'url' => "/h5/market/sylive2/stic/users?type=biz&type_id={$group_user['bizId']}&kpi=browse"], ['title'=>'预约用户','num'=>"{$biz_subscribe_count}人",'url' => "/h5/market/sylive2/stic/users?type=biz&type_id={$group_user['bizId']}&kpi=subscribe"], ['title'=>'预约率','num'=>$biz_browse_count ? round($biz_subscribe_count/$biz_browse_count*100,2)."%" : 0], + ['title'=>'下单数','num'=>"{$order_count}单"], ]; $sub_lists[] = ['title'=>'本店','lists'=>$biz]; } @@ -126,9 +136,11 @@ class Stic extends Admin{ if(!$group_row['groupsLevel'] && !$group_row['ifBiz']){//顶级 $browse_count = $this->mdSytActivityKpiData->count(['activityId' => $this->a_id, 'kpi' => 'browse']); $subscribe_count = $this->mdSytActivityKpiData->count(['activityId' => $this->a_id, 'kpi' => 'subscribe']); + $order_count = $this->mdSytActivityKpiData->count(['activityId' => $this->a_id, 'kpi' => 'beforeOrder']); }else{ $browse_count = $group_row['browse'];//浏览数据 $subscribe_count = $group_row['subscribe'];//订阅数据 + $order_count = $group_user['beforeOrderTotal'];//下单数 } $b_url = $sub_url = ''; if($group_row['ifBiz']){ @@ -139,6 +151,7 @@ class Stic extends Admin{ ['title'=>'访问用户','num'=>"{$browse_count}人",'url'=>$b_url], ['title'=>'预约用户','num'=>"{$subscribe_count}人",'url'=>$sub_url], ['title'=>'预约率','num'=>$browse_count ? round($subscribe_count/$browse_count*100,2)."%" : 0], + ['title'=>'下单数','num'=>"{$order_count}单"], ]; $title = $disk[$group_row['groupsLevel']+1]? '所有'.$disk[$group_row['groupsLevel']+1] : '所有门店'; $group_row['ifBiz'] && $title = $group_row['groupsName']; @@ -154,7 +167,7 @@ class Stic extends Admin{ //直播统计数据 public function lists_live(){ $groupsId = $this->input->get('groupsId'); - $group_user = $this->groups_user_model->get(['activityId'=>$this->a_id,'userId'=>$this->uid,'status'=>0]); + $group_user = $this->group_user; !$groupsId && $groupsId = $group_user['groupsId']; $group_row = $this->groups_model->get(['groupsId'=>$groupsId,'activityId'=>$this->a_id]); $row = $this->market_sylive_activity_model->get(['activityId'=>$this->a_id]); @@ -243,7 +256,7 @@ class Stic extends Admin{ $type = $this->input->get('type'); !$page && $page=1; $row = $this->market_sylive_activity_model->get(['activityId'=>$this->a_id]); - $group_user = $this->groups_user_model->get(['activityId'=>$this->a_id,'userId'=>$this->uid,'status'=>0]); + $group_user = $this->group_user; $where = [ 'activityId'=>$this->a_id, 'bizId'=>$group_user['bizId'], @@ -491,6 +504,12 @@ class Stic extends Admin{ } } } + $where = [ + 'activityId' => $this->a_id, + 'status' => 0 + ]; + $goods = $this->market_sylive_items_model->select($where,'sort desc,itemId desc',0,0,'itemId,title'); + $this->data['goods'] = $goods ? $goods : []; $groups[] = ['value'=>'','type'=>'biz','title'=>'门店排名']; $groups[] = ['value'=>'','type'=>'user','title'=>'顾问排名']; $this->data['groups'] = $groups; @@ -503,6 +522,7 @@ class Stic extends Admin{ } public function ajax_rank(){ + $sylive2_data_entity = new sylive2_data_entity(['show_echarts'=>true]); $map_kpi_biz = [ 'browse' => 'browse', 'subscribe' => 'subscribe', 'order' => 'orderTotal','watch' => 'watch','beforeOrder' => 'beforeOrderTotal' ]; @@ -517,7 +537,7 @@ class Stic extends Admin{ $group_user = $this->groups_user_model->get(['activityId'=>$this->a_id,'userId'=>$this->uid]); $page = $params['page'] ? intval($params['page']) : 1; $size = 20; - if(strtotime($params['day']) || $params['itemId']){//根据日期排行 +// if(strtotime($params['day']) || $params['itemId']){//根据日期排行 $kpi = $params['kpi']; $tagId = 0; $where = [ @@ -540,32 +560,34 @@ class Stic extends Admin{ $where["$group_by>"] = 0; $tagId = $group_user['userId']; } - strtotime($params['day']) && $where['day'] = date('Y-m-d',strtotime($params['day'])); - $params['itemId'] && $where["itemId"] = $params['itemId']; - $data = $this->sylive2_data_entity->top_kpidata($group_by,$where,'t desc,id desc',$page,$size,$select,$tagId); - }else{ - $kpi = $map_kpi_biz[$params['kpi']]; - $where = [ - 'activityId' => $this->a_id, - 'status' => 0 - ]; - if($params['type']=='level'){ - $group_by = "levelId{$params['value']}"; - $select = "{$group_by} as tagId,sum({$kpi}) as t"; - $where["$group_by>"] = 0; - }elseif($params['type']=='biz'){ - $group_by = 'bizId'; - $select = "bizId as tagId,sum({$kpi}) as t"; - $where["$group_by>"] = 0; - }else{ - $group_by = 'userId'; - $select = "bizId,userId as tagId,sum({$kpi}) as t"; - $where["$group_by>"] = 0; + if($params['day']){ + strtotime($params['day']) && $where['day'] = date('Y-m-d',strtotime($params['day'])); } - $data = $this->sylive2_data_entity->top_groups_user($group_by,$where,'t desc,groupsUserId desc',$page,$size,$select,$params['kpi'],$group_user['bizId']); - } + $params['itemId'] && $where["itemId"] = $params['itemId']; + $data = $sylive2_data_entity->top_kpidata($group_by,$where,'t desc,id desc',$page,$size,$select,$tagId); +// }else{ +// $kpi = $map_kpi_biz[$params['kpi']]; +// $where = [ +// 'activityId' => $this->a_id, +// 'status' => 0 +// ]; +// if($params['type']=='level'){ +// $group_by = "levelId{$params['value']}"; +// $select = "{$group_by} as tagId,sum({$kpi}) as t"; +// $where["$group_by>"] = 0; +// }elseif($params['type']=='biz'){ +// $group_by = 'bizId'; +// $select = "bizId as tagId,sum({$kpi}) as t"; +// $where["$group_by>"] = 0; +// }else{ +// $group_by = 'userId'; +// $select = "bizId,userId as tagId,sum({$kpi}) as t"; +// $where["$group_by>"] = 0; +// } +// $data = $sylive2_data_entity->top_groups_user($group_by,$where,'t desc,groupsUserId desc',$page,$size,$select,$params['kpi'],$group_user['bizId']); +// } $data['title'] = $title_arr[$params['kpi']]; - $data['url'] = "/h5/market/sylive2/stic/rank?kpi={$params['kpi']}&day={$params['day']}&index={$params['index']}&show_day=1"; + $data['url'] = "/h5/market/sylive2/stic/rank?kpi={$params['kpi']}&day={$params['day']}&index={$params['index']}&show_day=1&itemId={$params['itemId']}"; $this->show_json($data,200); } diff --git a/home/controllers/h5/market/sylive2/Ucenter.php b/home/controllers/h5/market/sylive2/Ucenter.php index f0d05f29..5374f1a4 100644 --- a/home/controllers/h5/market/sylive2/Ucenter.php +++ b/home/controllers/h5/market/sylive2/Ucenter.php @@ -11,6 +11,8 @@ class Ucenter extends Wx{ $this->load->model('market/market_sylive_items_model'); $this->load->model('market/market_sylive_order_model'); $this->load->model('market/market_sylive_activity_model'); + $this->load->model('market/market_sylive_checkdata_model'); + $this->load->library('AliWuliu'); $this->load->library('market/sylive_entity'); $this->skey = $this->input->get('skey'); $param = $this->myencryption->base64url_decode($this->skey); @@ -54,7 +56,8 @@ class Ucenter extends Wx{ $where = [ 'activityId' => $this->a_id, 'userId' => $this->uid, - 'win' => 1 + 'win' => 1, + 'status' => 1 ]; $total = $this->market_sylive_order_model->count($where);; $lists = []; @@ -69,15 +72,20 @@ class Ucenter extends Wx{ $winTypeAry[$v['id']] = ['img' => $v['img'], 'tag' => $v['tag'], 'title' => $v['title']]; } } - $rows = $this->market_sylive_order_model->select($where,'id desc',$page,$size,'id,winType'); + $rows = $this->market_sylive_order_model->select($where,'id desc',$page,$size,'id,winType,winUseStatus'); + $oids = implode(',',array_column($rows,'id')); + $oids&& $check_rows = $this->market_sylive_checkdata_model->map('cfId','jsondata',["cfId in ({$oids})"=>null,'type'=>1,'ifCheck'=>1],'id desc','','','cfId,jsondata'); foreach ($rows as $key => $val) { + $ck_jsondata = $check_rows[$val['id']] ? json_decode($check_rows[$val['id']],true) : []; $winTypeItem = $winTypeAry[$val['winType']]; if($winTypeItem){ $lists[] = [ 'id' => $val['id'], 'img' => $winTypeItem['img'], 'title' => $winTypeItem['tag'], - 'goods' => $winTypeItem['title'] + 'goods' => $winTypeItem['title'], + 'is_writeoff' => $val['winUseStatus']==2 ? 1 : 0, + 'courierNo' => $ck_jsondata['courierNo'] ]; } } @@ -143,6 +151,21 @@ class Ucenter extends Wx{ $gw_tel = $pid_user['mobile']; $logo = $pid_user['headimg']; } + //获取物流信息 + $check_row = $this->market_sylive_checkdata_model->select(['cfId'=>$order['id'],'type'=>0,'ifCheck'=>1],'id desc',1,1,'jsondata'); + $check_row && $ck_jsondata = json_decode($check_row[0]['jsondata'],true); + $express = ['title'=>'','code'=>'','list'=>[]]; + $show_express = 0; + if($ck_jsondata && $ck_jsondata['courierNo']){ + $show_express = 1; + $express['code'] = $ck_jsondata['courierNo']; + $mobile_last = strlen($order['mobile'])>4 ? substr($order['mobile'],-4) : '1234'; + $res = $this->aliwuliu->kdi("{$ck_jsondata['courierNo']}:$mobile_last"); + if($res['code']){ + $express['title'] = $res['result']['expName']; + $express['list'] = $res['result']['list']; + } + } $info = [ 'bg' => "https://qs.haodian.cn/web/images/project/H5-ShiYu/mine-bg.jpg", 'logo' => $logo, @@ -154,7 +177,10 @@ class Ucenter extends Wx{ 'content' => $item['descrip'] ? $item['descrip'] : '', 'order' => $order, 'skey' => $this->data['skey'], - 'ifAddress' => $item['ifAddress'] + 'ifAddress' => $item['ifAddress'], + 'is_writeoff' => $order['useStatus']==2 ? 1 : 0, + 'show_express' => $show_express, + 'express' => $express ]; $this->data['info'] = $info; $this->show_view('h5/market/sylive2/ucenter/detail'); @@ -177,19 +203,25 @@ class Ucenter extends Wx{ $item_ids = implode(',',array_unique(array_column($rows,'itemId'))); $item_rows = []; if($item_ids){ - $item_rows = $this->market_sylive_items_model->map('itemId','',["itemId in ({$item_ids})"],'',0,0,'itemId,imgs'); + $item_rows = $this->market_sylive_items_model->map('itemId','',["itemId in ({$item_ids})"=>null],'',0,0,'itemId,imgs'); } + $oids = implode(',',array_column($rows,'id')); + $oids&& $check_rows = $this->market_sylive_checkdata_model->map('cfId','jsondata',["cfId in ({$oids})"=>null,'type'=>0,'ifCheck'=>1],'id desc','','','cfId,jsondata'); foreach ($rows as $val) { $item = $item_rows[$val['itemId']] ? $item_rows[$val['itemId']][0] : []; $imgs = json_decode($item['imgs'],true); $img = $imgs['banner'][0] ? build_qiniu_image_url($imgs['banner'][0]) : ''; + $ck_jsondata = $check_rows[$val['id']] ? json_decode($check_rows[$val['id']],true) : []; $lists[] = [ + 'id' => $val['id'], 'sid' => $val['sid'], 'img' => $img, 'title' => $val['itemTitle'], 'time' => date('Y.m.d H:i:s',strtotime($val['createTime'])), 'price' => $val['totalPrice'], - 'url' => "/h5/market/sylive2/ucenter/detail?skey={$this->skey}&id={$val['id']}" + 'url' => "/h5/market/sylive2/ucenter/detail?skey={$this->skey}&id={$val['id']}", + 'is_writeoff' => $val['useStatus']==2 ? 1 : 0, + 'courierNo' => $ck_jsondata['courierNo'] ]; } } @@ -219,4 +251,39 @@ class Ucenter extends Wx{ $this->market_sylive_order_model->update($update,['id'=>$order['id']]); $this->show_json([],200,'保存成功'); } + + public function get_wuli(){ + $id = $this->input->get('id'); + $type = $this->input->get('type'); // 1中奖订单 0普通订单 + $where = [ + 'id' => $id, + 'userId' => $this->uid, + 'status' => 1 + ]; + $type && $where['win'] = 1; + $row = $this->market_sylive_order_model->get($where); + if(!$row){ + $this->show_json('',400,'参数错误'); + } + $list = []; + $title = ''; + //获取物流信息 + $check_row = $this->market_sylive_checkdata_model->select(['cfId'=>$row['id'],'type'=>$type?1:0,'ifCheck'=>1],'id desc',1,1,'jsondata'); + $check_row && $ck_jsondata = json_decode($check_row[0]['jsondata'],true); + if($ck_jsondata['courierNo']){ + $mobile_last = strlen($row['mobile'])>4 ? substr($row['mobile'],-4) : '1234'; + $res = $this->aliwuliu->kdi("{$ck_jsondata['courierNo']}:$mobile_last"); + if($res['code']){ + $title = $res['result']['expName']; + $list = $res['result']['list']; + } + } + + $data = [ + 'title' => $title, + 'courierNo' => $ck_jsondata['courierNo'], + 'list' => $list + ]; + $this->show_json($data,200); + } } diff --git a/home/views/h5/market/sylive2/act/index.php b/home/views/h5/market/sylive2/act/index.php index 07b15e21..8ac85510 100644 --- a/home/views/h5/market/sylive2/act/index.php +++ b/home/views/h5/market/sylive2/act/index.php @@ -2,23 +2,26 @@
- # + # - @@ -64,13 +71,15 @@
-
- {{item.name}} - {{item.tip}} +
+ {{item.name}} + {{item.tip}}
-
- {{item.name}} - {{item.tip}} +
+ {{item.name}} + {{item.tip}}
@@ -91,10 +100,11 @@
- +
- # + # 长按识别二维码添加
@@ -106,6 +116,47 @@
+
+
+
+
+
+
预约直播
+
+ +
+
+
+ {{codeTx}} +
+
+
+ 取消 + 确定 +
+
+
+
+ +
+
+
+
+
+
{{succesTx.title}}
+
+
+ +
+
+
-load->view('h5/market/sylive/share_script')?> +load->view('h5/market/sylive/share_script') ?> diff --git a/home/views/h5/market/sylive2/customer/index.php b/home/views/h5/market/sylive2/customer/index.php new file mode 100644 index 00000000..ade304c8 --- /dev/null +++ b/home/views/h5/market/sylive2/customer/index.php @@ -0,0 +1,564 @@ + +
+
+
+
+ +
+
+
+ +
+
+ + + + +
+
+
+ 合计 {{total}} 人 +
+
+ + +
+ 统一分配 +
+ + + 合计 {{total}} 人 + +
+ +
+
+ 已预约 + · + 已加微信 + · + 已领权益 +
+
+
+ {{item.customer_name}} + · + + {{item.tel}} + + +
+
+
+ 顾问 + · + # + {{item.employee_name}} +
+ {{item.grade}} +
+
+
+ 分配 + 跟进 + 修改 +
+
{{item.tip}}
+
+ +
暂无数据
+
请稍等...
+
我们是有底线的
+
+
+
+ + load->view('h5/market/sylive2/nav_biz')?> + + +
+
+
+
+
+
+
客户标签
+
已添加微信
+
已添加微信
+
+ {{item.title}} +
+
+ 取消 + 保存 +
+
+
+
+ + +
+
+
+
+
+
选择顾问
+ +
+
+ 取消 + 保存 +
+
+
+
+ + +
+
+
+
+
+
+
分配方案
+
+ 待分配总数 + {{total}} +
+
+ +
+
+ {{item.title}} +
+
+ +
+
+
+
+
+
+ 取消 + 保存 +
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/home/views/h5/market/sylive2/header.php b/home/views/h5/market/sylive2/header.php index fafb307c..84337ff5 100644 --- a/home/views/h5/market/sylive2/header.php +++ b/home/views/h5/market/sylive2/header.php @@ -7,7 +7,7 @@ content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> <?=$_title?> - + diff --git a/home/views/h5/market/sylive2/item/detail.php b/home/views/h5/market/sylive2/item/detail.php index 7cf27338..a4193d91 100644 --- a/home/views/h5/market/sylive2/item/detail.php +++ b/home/views/h5/market/sylive2/item/detail.php @@ -23,8 +23,13 @@
{{info.title}}
{{info.validity}}
- ¥ - {{info.price}} + +
@@ -40,14 +45,16 @@