diff --git a/api/controllers/plan/Plan.php b/api/controllers/plan/Plan.php index a4ea0275..2e046b66 100644 --- a/api/controllers/plan/Plan.php +++ b/api/controllers/plan/Plan.php @@ -56,6 +56,7 @@ class Plan extends CI_Controller $plan[] = array('url' => base_url(array('plan', 'syt', 'api_viewlog')), 'interval' => 5); //私域通直播间播放日志数据同步 $plan[] = array('url' => base_url(array('plan', 'syt', 'out_time')), 'interval' => 1); //订单过期 $plan[] = array('url' => base_url(array('plan', 'syt', 'union_user')), 'interval' => 1); //直播数据关联用户 + $this->plan = $plan; } diff --git a/api/controllers/plan/Syt.php b/api/controllers/plan/Syt.php index ad641120..0392aef3 100644 --- a/api/controllers/plan/Syt.php +++ b/api/controllers/plan/Syt.php @@ -45,13 +45,20 @@ class Syt extends CI_Controller $res = $this->mdSytSubscribemsg->select($where, 'id asc', 1, 100); $log = array(); if ($res) { - $this->load->model('market/market_sylive_activity_model', 'mdSytActivity'); $wechatS = new WechatServer($this->options); $wechatS->checkAuth(); + $act_ids = implode(',',array_unique(array_column($res,'activityId'))); + $act_rows = []; + if($act_ids){ + $where = [ + "activityId in ($act_ids)" => null + ]; + $act_rows = $this->market_sylive_activity_model->map('activityId','',$where,'',0,0,'activityId,title'); + } foreach ($res as $key => $value) { - $re_a = $this->mdSytActivity->get(array("activityId" => $value['a_id'], "status" => 0)); - if ($re_a) { - $content = '您预约“' . $re_a['title'] . '”直播已经开始啦!赶紧进入直播间观看直播领取福利吧~'; + $act = $act_rows['activityId'] ? $act_rows['activityId'][0] : []; + if ($act) { + $content = '您预约“' . $act['title'] . '”直播已经开始啦!赶紧进入直播间观看直播领取福利吧~'; $temp_arr = array( 'touser' => $value['openId'], 'template_id' => $value['templateId'], @@ -69,6 +76,8 @@ class Syt extends CI_Controller $log[] = $value['a_id'] . '=' . $value['openid']; } } + }else{ + $this->mdSytSubscribemsg->update(['status' => -1], ['id' => $value['id']]); } } } @@ -260,7 +269,7 @@ class Syt extends CI_Controller $where = [ 'expireTime>' => 0, 'expireTime<' => time(), - 'status' => 0 + 'status' => 0, ]; $rows = $this->market_sylive_order_model->select($where,'id asc',1,20); if($rows){ @@ -432,4 +441,34 @@ class Syt extends CI_Controller } echo '更新完成'; } + + //更新经销商地址 + public function tem_bizinfo(){ + require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php'; + $this->load->model('market/market_sylive_activity_bizinfo_model'); + $file = FCPATH.'pdf/bizinfo.xlsx'; + $reader = \PHPExcel_IOFactory::createReader('Excel2007'); // 读取 excel 文档 + $PHPExcel = $reader->load($file); // 文档名称 + $objWorksheet = $PHPExcel->getActiveSheet(); + $rowCnt = $objWorksheet->getHighestRow(); //获取总行数 + for ($i = 2; $i <= $rowCnt; $i++) { //读取内容 + $areaName = $objWorksheet->getCell('A' . $i)->getValue(); + $bizName = $objWorksheet->getCell('B' . $i)->getValue(); + $provinceName = $objWorksheet->getCell('C' . $i)->getValue(); + $cityName = $objWorksheet->getCell('D' . $i)->getValue(); + $addData = [ + 'activityId' => 4, + 'areaName' => $areaName, + 'bizName' => $bizName, + 'provinceName' => $provinceName, + 'cityName' => $cityName, + ]; + if(!$this->market_sylive_activity_bizinfo_model->count($addData)){ + $addData['createTime'] = date('Y-m-d H:i:s'); + $this->market_sylive_activity_bizinfo_model->add($addData); + } + + } + echo '执行结束'; + } } diff --git a/common/models/market/Market_sylive_activity_bizinfo_model.php b/common/models/market/Market_sylive_activity_bizinfo_model.php new file mode 100644 index 00000000..5e94986f --- /dev/null +++ b/common/models/market/Market_sylive_activity_bizinfo_model.php @@ -0,0 +1,11 @@ +table_name, 'default'); + } +} \ No newline at end of file diff --git a/home/controllers/h5/market/sylive/Act.php b/home/controllers/h5/market/sylive/Act.php index f72d7c40..1e2387d7 100644 --- a/home/controllers/h5/market/sylive/Act.php +++ b/home/controllers/h5/market/sylive/Act.php @@ -115,17 +115,15 @@ class Act extends Wx { }else{ $info['live_url'] = "https://live.haodian.cn/watch/{$row['channelId']}?userid={$userid}&ts={$ts}&sign={$sign}"; } - //判断是否支付商品 - $is_pay = $this->market_sylive_order_model->count(['itemId'=>$a_id,'status'=>1,'userId'=>$this->uid]); //微信分享 $wx_info = $this->share_info($row); - $info['is_pay'] = $is_pay ? 1 : 0; $info['show_code'] = $is_show_code ? 1 : 0; $info['alert_code'] = $alert_code ? 1 : 0; $this->data['info'] = $info; $this->data['sign_package'] = $wx_info['sign_package']; $this->data['share'] = $wx_info['share']; $this->data['_title'] = $row['title']; + $this->data['skey'] = $info['skey']; $this->show_view('h5/market/sylive/act/index'); } @@ -293,9 +291,9 @@ class Act extends Wx { } $jsondata = json_decode($row['jsondata'],true); $item = $jsondata['item'] ? $jsondata['item'] : []; - $is_pay = $this->market_sylive_order_model->count(['itemId'=>$a_id,'status'=>1,'userId'=>$this->uid]); + $is_pay = $this->market_sylive_order_model->count(['itemId'=>$a_id,'status'=>1,'userId'=>$this->uid,'type'=>0]); if($is_pay){ - $url = http_host_com('home').'/h5/market/sylive/act/ucenter?skey='.$skey; + $url = http_host_com('home').'/h5/market/sylive/ucenter/mygift?skey='.$skey; redirect($url);exit; } $e_time = time() < strtotime($row['timeEnd']) ? strtotime($row['timeEnd']) - time() : 0; @@ -346,7 +344,7 @@ class Act extends Wx { $jsondata = json_decode($row['jsondata'],true); $item = $jsondata['item'] ? $jsondata['item'] : []; //判断是否已支付 - $o_row = $this->market_sylive_order_model->get(['itemId'=>$a_id,'status'=>1,'userId'=>$this->uid]); + $o_row = $this->market_sylive_order_model->get(['itemId'=>$a_id,'status'=>1,'userId'=>$this->uid,'type'=>0]); if($o_row){ $this->show_json('',400,'已支付,请勿重复支付'); } @@ -357,7 +355,7 @@ class Act extends Wx { if($row['stock']<=0){ $this->show_json('',400,'已售罄'); } - $unpay = $this->market_sylive_order_model->get(['itemId'=>$a_id,'status'=>0,'userId'=>$this->uid,'expireTime>'=>time()]); + $unpay = $this->market_sylive_order_model->get(['itemId'=>$a_id,'status'=>0,'userId'=>$this->uid,'expireTime>'=>time(),'type'=>0]); if(!$unpay){ $mb_count = $redis_obj->sCard($mb_key); //获取集合中用户数量 if($mb_count && $mb_count>$row['stock']+10){ @@ -413,79 +411,6 @@ class Act extends Wx { } $this->show_json($result['data'],200,'操作成功'); } - public function ucenter(){ - $skey = $this->input->get('skey'); - $param = $this->myencryption->base64url_decode($skey); - $a_id = intval($param['a_id']);//活动id - $row = $this->market_sylive_activity_model->get(['activityId'=>$a_id]); - if(!$row){ - throw new Hd_exception('参数错误',400); - } - $order = $this->market_sylive_order_model->get(['userId'=>$this->uid,'status'=>1,'itemId'=>$a_id]); - if(!$order){ - $url = http_host_com('home').'/h5/market/sylive/act/item?skey='.$skey; - redirect($url);exit; - } - $jsondata = json_decode($row['jsondata'],true); - $item = $jsondata['item'] ? $jsondata['item'] : []; - $validity = ''; - if($item['useTimeStart'] || $item['useTimeEnd']){ - $useTimeStart = date('Y-m-d',strtotime($item['useTimeStart'])); - $useTimeEnd = date('Y-m-d',strtotime($item['useTimeEnd'])); - $validity = "有效期 {$useTimeStart} - {$useTimeEnd}"; - } - $order = [ - 'uname' => $order['uname'] ? $order['uname'] : '', - 'utel' => $order['mobile'] ? $order['mobile'] : '', - 'slogan' => '尊享您的直播好礼', - 'valid_time' => $validity, - 'oid' => $order['sid'], - 'c_time' => date('Y-m-d H:i:s'), - ]; - $if_pid = 0; - $ac_user = $this->act_user_model->get(['userId'=>$this->uid,'activityId'=>$a_id],'channelId'); - $ac_user['channelId'] && $pid_user = $this->user_model->get(['userId'=>$ac_user['channelId']],'uname,organizationId,mobile,headimg'); - $logo = $gw_tel = $gw_slogan = $gw_title = ''; - if($ac_user['channelId'] && $pid_user['organizationId']>0){ - $group_id = $this->sylive_entity->get_level($pid_user['organizationId']); - if($group_id==3){ //顾问 - $if_pid = 1; - $where = [ - "organizationId in (select parentId from lc_market_sylive_organization where organizationId={$pid_user['organizationId']})" => null - ]; - $org = $this->market_sylive_organization_model->get($where); - }elseif($group_id==2){ //店长 - $if_pid = 1; - $where = [ - "organizationId" => $pid_user['organizationId'] - ]; - $org = $this->market_sylive_organization_model->get($where); - } - $gw_title = $pid_user['uname']; - $gw_slogan = $org['organizationName']; - $gw_tel = $pid_user['mobile']; - $logo = $pid_user['headimg']; - } - $info = [ - 'bg' => "https://qs.haodian.cn/web/images/project/H5-ShiYu/mine-bg.jpg", - 'logo' => $logo, - 'if_pid' => $if_pid, - 'title' => $gw_title, - 'slogan' => $gw_slogan, - 'cust_tel' => $gw_tel, - 'introTitle' => '权益说明', - 'content' => $item['introduction'] ? $item['introduction'] : '', - 'order' => $order, - 'skey' => $skey - ]; - $this->data['info'] = $info; - $this->data['_title'] = $row['title']; - //微信分享 - $wx_info = $this->share_info($row); - $this->data['sign_package'] = $wx_info['sign_package']; - $this->data['share'] = $wx_info['share']; - $this->show_view('h5/market/sylive/act/ucenter'); - } //获取微信用户信息 public function userinfo(){ diff --git a/home/controllers/h5/market/sylive/Item.php b/home/controllers/h5/market/sylive/Item.php new file mode 100644 index 00000000..bd827759 --- /dev/null +++ b/home/controllers/h5/market/sylive/Item.php @@ -0,0 +1,259 @@ +load->model('market/market_sylive_items_model'); + $this->load->model('market/market_sylive_activity_model'); + $this->load->model('market/market_sylive_order_model'); + $this->load->model('market/market_sylive_activity_bizinfo_model','msa_bizinfo_model'); + $this->load->library('market/sylive_entity'); + } + + public function detail(){ + $itemId = $this->input->get('iid'); + $skey = $this->input->get('skey'); + $param = $this->myencryption->base64url_decode($skey); + $a_id = intval($param['a_id']);//活动id + $row = $this->market_sylive_items_model->get(['itemId'=>$itemId,'activityId'=>$a_id]); + if(!$row){ + throw new Hd_exception('参数错误',400); + } + $imgs = json_decode($row['imgs'],true); + if($imgs['banner']){ + $banner = []; + foreach ($imgs['banner'] as $item) { + $banner[] = build_qiniu_image_url($item); + } + }else{ + $banner = $this->item_banner; + } + $e_time = time() < strtotime($row['timeEnd']) ? strtotime($row['timeEnd']) - time() : 0; + $s_time = time() < strtotime($row['timeStart']) ? strtotime($row['timeStart']) - time() : 0; + $is_pay = $this->market_sylive_order_model->count(['itemId'=>$itemId,'status'=>1,'userId'=>$this->uid,'type'=>0]); + if($is_pay){ + $url = http_host_com('home').'/h5/market/sylive/ucenter?skey='.$skey; + redirect($url);exit; + } + + $validity = ''; + if($row['useStart']!='0000-00-00 00:00:00' || $row['useEnd']!='0000-00-00 00:00:00'){ + $useTimeStart = date('Y-m-d',strtotime($row['useStart'])); + $useTimeEnd = date('Y-m-d',strtotime($row['useEnd'])); + $validity = "有效期 {$useTimeStart} - {$useTimeEnd}"; + } + $title = $row['title'] ? $row['title'] : ''; + $stock = $row['stock']; + $introduction = $row['descrip'] ? $row['descrip'] : ''; + $price = $row['price'] ? $row['price'] : ''; + //是否需要选择门店 + $need_shop = 1; + $ac_user = $this->act_user_model->get(['id'=>$this->act_uid]); + if($ac_user['channelId']){ + $channel_user = $this->act_user_model->get(['userId'=>$ac_user['channelId'],'activityId'=>$a_id]); + $channel_user['bizId'] && $need_shop = 0; + } + $need_shop = 1; + $biz_arr = $city_arr = $province_arr = []; + if($need_shop){ + $province_arr = $this->msa_bizinfo_model->select(['status'=>0,'activityId'=>4],'',0,0,'distinct provinceName as name'); + } + $info = [ + 'itemId' => $row['itemId'], + 'title' => $title, + 's_time' => $s_time, + 'e_time' => $e_time, + 'price' => $price, + 'content' => $introduction, + 'banner' => $banner, + 'stock' => $stock, + 'skey' => $skey, + 'validity' => $validity, + 'introTitle' => '权益说明', + 'need_shop' => $need_shop, + ]; + $this->data['province_arr'] = $province_arr; + $this->data['city_arr'] = $city_arr; + $this->data['biz_arr'] = $biz_arr; + $this->data['info'] = $info; + $this->data['_title'] = $row['title']; + //微信分享 + $wx_info = $this->share_info($row); + $this->data['sign_package'] = $wx_info['sign_package']; + $this->data['share'] = $wx_info['share']; + $this->show_view('h5/market/sylive/item/detail'); + } + + //支付 + public function post_pay(){ + $redis = load_cache('redis'); + $redis_obj = $redis->redis(); + $skey = $this->input->post('skey'); + $name = $this->input->post('name'); + $mobile = $this->input->post('telPhone'); + $code = $this->input->post('code'); + $province = $this->input->post('province'); + $city = $this->input->post('city'); + $biz = $this->input->post('biz'); + $itemId = $this->input->post('itemId'); + $param = $this->myencryption->base64url_decode($skey); + $a_id = intval($param['a_id']);//活动id + $row = $this->market_sylive_items_model->get(['itemId'=>$itemId]); + if(!$row){ + $this->show_json('',400,'参数错误'); + } + if(time()< strtotime($row['timeStart'])){ + $this->show_json('',400,'尚未开始'); + } + if(time() > strtotime($row['timeEnd'])){ + $this->show_json('',400,'活动已结束'); + } + $mb_key = "SYLIVE_MEMBERS_ITEM_ID_{$itemId}"; //集合缓存key + $code_key = "sylive_item_code_{$this->uid}_{$mobile}";//验证码 + if(!mobile_valid($mobile)){ + $this->show_json('',400,'请输入正确手机号'); + } + if(!$code || ($redis->get($code_key)!=$code)){ + $this->show_json('',400,'请输入正确验证码'); + } + //判断是否已支付 + $o_row = $this->market_sylive_order_model->get(['itemId'=>$itemId,'status'=>1,'userId'=>$this->uid,'type'=>0]); + if($o_row){ + $this->show_json('',400,'已支付,请勿重复支付'); + } + $pay_price = $row['price']; + if($pay_price<=0){ + $this->show_json('',400,'无需支付'); + } + if($row['stock']<=0){ + $this->show_json('',400,'已售罄'); + } + $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']]); + $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); //获取集合中用户数量 + if($mb_count && $mb_count>$row['stock']+10){ + $mb = $redis_obj->sMembers($mb_key); + $this->show_json('',400,'已售罄:'.json_encode($mb,JSON_UNESCAPED_UNICODE)); + } + try { + $province && $jsondata = ['biz'=>"{$province}-{$city}-{$biz}"]; + $this->market_sylive_order_model->db->trans_begin(); + //限购一件 + $u_row = $this->market_sylive_order_model->get(['itemId'=>$itemId,'activityId'=>$a_id,'status>='=>0,'userId'=>$this->uid,'expireTime>'=>time(),]); + if($u_row){ + throw new Exception('限购一件'); + } + $this->load->helper('order'); + $unpay = [ + 'sid' => create_order_no('350200','market'), + 'activityId' => $a_id, + 'userId' => $this->uid, + 'itemId' => $itemId, + 'itemTitle' => $row['title'], + 'totalPrice' => $pay_price, + 'expireTime' => time()+5*60,//订单过期时间 + 'createTime' => date('Y-m-d H:i:s') + ]; + $name && $unpay['uname'] = $name; + $mobile && $unpay['mobile'] = $mobile; + $p_user['teamId'] && $unpay['cfrom'] = 1; + $p_user['areaId'] && $unpay['areaId'] = $p_user['areaId']; + $p_user['bizId'] && $unpay['bizId'] = $p_user['bizId']; + $p_user['userId'] && $unpay['cfUserId'] = $p_user['userId']; + $jsondata && $unpay['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE); + $oid = $this->market_sylive_order_model->add($unpay); + if(!is_numeric($oid)){ + $this->market_sylive_order_model->db->trans_rollback(); + throw new Exception('创建订单失败'); + } + $this->market_sylive_items_model->update(['stock = stock-1' =>null],['itemId'=>$itemId,'stock>'=>0]); + $res = $this->market_sylive_items_model->db->affected_rows(); + if(!$res){ + throw new Exception('已售罄'); + } + $this->market_sylive_order_model->db->trans_commit(); + $redis_obj->sRem($mb_key,$this->uid); //删除集合 + }catch (Exception $e){ + $redis_obj->sRem($mb_key,$this->uid); //删除集合 + $this->market_sylive_order_model->db->trans_rollback(); + $this->show_json('',400,$e->getMessage()); + } + }else{ + $jsondata = json_decode($unpay['jsondata'],true); + $update = ['uname'=>$name,'mobile'=>$mobile]; + if($province){ + $jsondata['biz'] = "{$province}-{$city}-{$biz}"; + $update['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE); + } + $this->market_sylive_order_model->update($update,['id'=>$unpay['id']]); + } + $user = $this->user_model->get(['userId'=>$this->uid]); + $notify_url = http_host_com('home').'/h5/market/sylive/notify/item'; + $result = $this->unorder($unpay['sid'],$unpay['totalPrice'],$user['openid'],$unpay['itemTitle'],$notify_url,$unpay['expireTime'],['wx_type'=>'dc']); + if(!$result['code']){ + $this->show_json('',400,$result['msg']); + } + //删除缓存 + $redis->delete($code_key); + $data = [ + 'wxjson' => $result['data'], + 'oid' => $unpay['id'], + ]; + $this->show_json($data,200,'操作成功'); + } + + //获取验证码 + public function get_code(){ + $mobile = $this->input->post('mobile'); + if(!mobile_valid($mobile)){ + $this->show_json('',400,'请输入正确的手机号码'); + } + $redis = &load_cache('redis'); + $key = "sylive_item_code_{$this->uid}_{$mobile}"; + if(!$redis->get($key)){ + $this->load->helper('string'); + $code = random_string('numeric', 4); + $redis->save($key, $code, 60*5); + $content = "【好店云】您的验证码为: {$code},请勿泄露于他人!"; + echo $content;exit; + b2m_send_sms($mobile,$content); + } + $this->show_json('',200, '验证码已发送'); + } + + public function biz_info(){ + $type = $this->input->get('type'); + $p_name = $this->input->get('p_name'); + $c_name = $this->input->get('c_name'); + $where = [ + 'status'=>0, + 'activityId'=>4, + ]; + if($type=='city'){ + $where['provinceName'] = $p_name; + $lists = $this->msa_bizinfo_model->select($where,'',0,0,'distinct cityName as name'); + }elseif ($type=='biz'){ + $where['provinceName'] = $p_name; + $where['cityName'] = $c_name; + $lists = $this->msa_bizinfo_model->select($where,'',0,0,'bizName as name'); + }else{ + $lists = $this->msa_bizinfo_model->select($where,'',0,0,'distinct provinceName as name'); + } + $data = [ + 'lists' => $lists + ]; + $this->show_json($data,200); + } + + public function agreement(){ + $this->show_view('h5/market/sylive/item/agreement'); + } +} diff --git a/home/controllers/h5/market/sylive/Notify.php b/home/controllers/h5/market/sylive/Notify.php index 3f1c31b3..31b2b891 100644 --- a/home/controllers/h5/market/sylive/Notify.php +++ b/home/controllers/h5/market/sylive/Notify.php @@ -114,4 +114,48 @@ class Notify extends CI_Controller { echo ''; } + //商品-微信支付异步通知 + public function item(){ + try{ + $sid = $this->notify['out_trade_no']; + if($sid){ + debug_log("[start] ". __FUNCTION__ . ": out_trade_no:".$this->notify['out_trade_no'], $this->log_file,$this->log_dir); + $order = $this->order_model->get(array('sid'=>$sid)); + if(!$order){ + throw new Exception("{$sid}_订单不存在"); + } + if($order['status']){ + throw new Exception("{$sid}_订单已支付"); + } + if($this->notify['result_code'] != 'SUCCESS'){ //支付失败 + throw new Exception("支付失败,sid={$sid}"); + }else{ //支付成功 + $res = $this->order_model->update(['status'=>1,'payTime'=>date('Y-m-d H:i:s')],['id'=>$order['id']]); + if($res){ + $act_user = $this->act_user_model->get(['userId'=>$order['uid'],'activityId'=>$order['activityId']]); + $params = [ + 'a_id' => $order['itemId'], + 'uid' => $order['userId'], + 'cf_uid' => $act_user['channelId'], + 'kpi' => 'order', + 'jsondata'=> ['order_id'=>$order['id'],'sid'=>$sid] + ]; + $sy_res = $this->sylive_entity->kpi_log($params); + debug_log("[info] ". __FUNCTION__ . ":私域通增加记录-".json_encode($sy_res,JSON_UNESCAPED_UNICODE), $this->log_file,$this->log_dir); + debug_log("[success] ". __FUNCTION__ . ":操作成功", $this->log_file,$this->log_dir); + } + } + } + }catch (Exception $e){ + $msg = $e->getMessage(); + debug_log("[error] ". __FUNCTION__ . ":{$msg}", $this->log_file,$this->log_dir); + } + if($sid){ + debug_log("[finish] ". __FUNCTION__ . ": out_trade_no-".$this->notify['out_trade_no'], $this->log_file,$this->log_dir); + }else{ + debug_log("[finish] ". __FUNCTION__ . ": 参数错误-".json_encode($this->notify,JSON_UNESCAPED_UNICODE), $this->log_file,$this->log_dir); + } + echo ''; + } + } diff --git a/home/controllers/h5/market/sylive/Ucenter.php b/home/controllers/h5/market/sylive/Ucenter.php new file mode 100644 index 00000000..5990ea97 --- /dev/null +++ b/home/controllers/h5/market/sylive/Ucenter.php @@ -0,0 +1,252 @@ +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->library('market/sylive_entity'); + $this->skey = $this->input->get('skey'); + $param = $this->myencryption->base64url_decode($this->skey); + $this->a_id = intval($param['a_id']);//活动id + $this->data['skey'] = $this->skey; + } + + public function index(){ + $params = $this->input->get(); + $row = $this->market_sylive_activity_model->get(['activityId'=>$this->a_id]); + if(!$row){ + throw new Hd_exception('参数错误',400); + } + $lists = []; + if($this->a_id<4){ + //判断是否支付商品 + $is_pay = $this->market_sylive_order_model->count(['itemId'=>$this->a_id,'status'=>1,'userId'=>$this->uid,'type'=>0,'activityId<'=>4]); + $is_pay && $lists[] = ['title'=>'我的权益','url'=>"/h5/market/sylive/ucenter/mygift?skey={$params['skey']}"]; + } + + $lists[] = ['title'=>'我的订单','url'=>"/h5/market/sylive/ucenter/orders?skey={$params['skey']}"]; + $lists[] = ['title'=>'联系客服','url'=>"https://work.weixin.qq.com/kfid/kfc77374393839a9d9b?enc_scene=ENCAEt1rsV7GcticSp5Xyc245thCkz9T6YRm7gShvqffNqW3A89DzkZvzjusx44EinUTe"]; + $user = $this->user_model->get(['userId'=>$this->uid],'unionid,nickname,headimg'); + $info = [ + 'title' => $user['nickname'], + 'logo' => Sylive_entity::DF_IMG, + 'list' => $lists + ]; + $this->data['info'] = $info; + $this->data['params'] = $params; + $this->show_view('h5/market/sylive/ucenter/index'); + } + //我的权益 + public function mygift(){ + $row = $this->market_sylive_activity_model->get(['activityId'=>$this->a_id]); + if(!$row){ + throw new Hd_exception('参数错误',400); + } + $order = $this->market_sylive_order_model->get(['userId'=>$this->uid,'status'=>1,'itemId'=>$this->a_id,'type'=>0]); + if(!$order){ + $url = http_host_com('home').'/h5/market/sylive/act/item?skey='.$this->data['skey']; + redirect($url);exit; + } + $jsondata = json_decode($row['jsondata'],true); + $item = $jsondata['item'] ? $jsondata['item'] : []; + $validity = ''; + if($item['useTimeStart'] || $item['useTimeEnd']){ + $useTimeStart = date('Y-m-d',strtotime($item['useTimeStart'])); + $useTimeEnd = date('Y-m-d',strtotime($item['useTimeEnd'])); + $validity = "有效期 {$useTimeStart} - {$useTimeEnd}"; + } + $order_jsondata = json_decode($order['jsondata'],true); + $order = [ + 'id' => $order['id'], + 'uname' => $order['uname'] ? $order['uname'] : '', + 'utel' => $order['mobile'] ? $order['mobile'] : '', + 'slogan' => '尊享您的直播好礼', + 'valid_time' => $validity, + 'sid' => $order['sid'], + 'c_time' => date('Y-m-d H:i:s'), + 'region' => $order_jsondata['address']['region'] ? $order_jsondata['address']['region'] : '', + 'detail' => $order_jsondata['address']['detail'] ? $order_jsondata['address']['detail'] : '' + ]; + $if_pid = 0; + $ac_user = $this->act_user_model->get(['userId'=>$this->uid,'activityId'=>$this->a_id],'channelId'); + $ac_user['channelId'] && $pid_user = $this->user_model->get(['userId'=>$ac_user['channelId']],'uname,organizationId,mobile,headimg'); + $logo = $gw_tel = $gw_slogan = $gw_title = ''; + if($ac_user['channelId'] && $pid_user['organizationId']>0){ + $group_id = $this->sylive_entity->get_level($pid_user['organizationId']); + if($group_id==3){ //顾问 + $if_pid = 1; + $where = [ + "organizationId in (select parentId from lc_market_sylive_organization where organizationId={$pid_user['organizationId']})" => null + ]; + $org = $this->market_sylive_organization_model->get($where); + }elseif($group_id==2){ //店长 + $if_pid = 1; + $where = [ + "organizationId" => $pid_user['organizationId'] + ]; + $org = $this->market_sylive_organization_model->get($where); + } + $gw_title = $pid_user['uname']; + $gw_slogan = $org['organizationName']; + $gw_tel = $pid_user['mobile']; + $logo = $pid_user['headimg']; + } + $info = [ + 'bg' => "https://qs.haodian.cn/web/images/project/H5-ShiYu/mine-bg.jpg", + 'logo' => $logo, + 'if_pid' => $if_pid, + 'title' => $gw_title, + 'slogan' => $gw_slogan, + 'cust_tel' => $gw_tel, + 'introTitle' => '权益说明', + 'content' => $item['introduction'] ? $item['introduction'] : '', + 'order' => $order, + 'skey' => $this->data['skey'] + ]; + $this->data['info'] = $info; + $this->data['_title'] = $row['title']; + //微信分享 + $wx_info = $this->share_info($row); + $this->data['sign_package'] = $wx_info['sign_package']; + $this->data['share'] = $wx_info['share']; + $this->show_view('h5/market/sylive/ucenter/mygift'); + } + + //我的订单 + public function orders(){ + $this->show_view('h5/market/sylive/ucenter/orders'); + } + + //订单详情 + public function detail(){ + $oid = $this->input->get('id'); + $order = $this->market_sylive_order_model->get(['id'=>$oid,'userId' => $this->uid]); + if(!$order){ + throw new Hd_exception('参数错误',400); + } + $item = $this->market_sylive_items_model->get(['itemId'=>$order['itemId']]); + $validity = ''; + if($item['useStart'] || $item['timeEnd']){ + $useTimeStart = date('Y-m-d',strtotime($item['useStart'])); + $useTimeEnd = date('Y-m-d',strtotime($item['timeEnd'])); + $validity = "有效期 {$useTimeStart} - {$useTimeEnd}"; + } + $order_jsondata = json_decode($order['jsondata'],true); + $order = [ + 'id' => $order['id'], + 'uname' => $order['uname'] ? $order['uname'] : '', + 'utel' => $order['mobile'] ? $order['mobile'] : '', + 'slogan' => '尊享您的直播好礼', + 'valid_time' => $validity, + 'sid' => $order['sid'], + 'c_time' => date('Y-m-d H:i:s'), + 'region' => $order_jsondata['address']['region'] ? $order_jsondata['address']['region'] : '', + 'detail' => $order_jsondata['address']['detail'] ? $order_jsondata['address']['detail'] : '' + ]; + $if_pid = 0; + $ac_user = $this->act_user_model->get(['userId'=>$this->uid,'activityId'=>$this->a_id],'channelId'); + $ac_user['channelId'] && $pid_user = $this->user_model->get(['userId'=>$ac_user['channelId']],'uname,organizationId,mobile,headimg'); + $logo = $gw_tel = $gw_slogan = $gw_title = ''; + if($ac_user['channelId'] && $pid_user['organizationId']>0){ + $group_id = $this->sylive_entity->get_level($pid_user['organizationId']); + if($group_id==3){ //顾问 + $if_pid = 1; + $where = [ + "organizationId in (select parentId from lc_market_sylive_organization where organizationId={$pid_user['organizationId']})" => null + ]; + $org = $this->market_sylive_organization_model->get($where); + }elseif($group_id==2){ //店长 + $if_pid = 1; + $where = [ + "organizationId" => $pid_user['organizationId'] + ]; + $org = $this->market_sylive_organization_model->get($where); + } + $gw_title = $pid_user['uname']; + $gw_slogan = $org['organizationName']; + $gw_tel = $pid_user['mobile']; + $logo = $pid_user['headimg']; + } + $info = [ + 'bg' => "https://qs.haodian.cn/web/images/project/H5-ShiYu/mine-bg.jpg", + 'logo' => $logo, + 'if_pid' => $if_pid, + 'title' => $gw_title, + 'slogan' => $gw_slogan, + 'cust_tel' => $gw_tel, + 'introTitle' => '权益说明', + 'content' => $item['descrip'] ? $item['descrip'] : '', + 'order' => $order, + 'skey' => $this->data['skey'] + ]; + $this->data['info'] = $info; + $this->show_view('h5/market/sylive/ucenter/detail'); + } + + public function ajax_order(){ + $params = $this->input->get(); + $page = $params['page'] ? $params['page'] : 1; + $size = $params['size'] ? $params['size'] : 20; + $where = [ + 'activityId' => $this->a_id, + 'userId' => $this->uid, + 'type' => 0, + 'status' => 1 + ]; + $total = $this->market_sylive_order_model->count($where); + $lists = []; + if($total){ + $rows = $this->market_sylive_order_model->select($where,'id desc',$page,$size); + $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'); + } + 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]) : ''; + $lists[] = [ + '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/sylive/ucenter/detail?skey={$this->skey}&id={$val['id']}" + ]; + } + } + $data = [ + 'total' => $total, + 'lists' => $lists + ]; + $this->show_json($data,200); + } + + //修改地址 + public function edit_address(){ + $params = $this->input->post(); + if(!$params['region']||!$params['address']){ + $this->show_json([],400,'参数错误'); + } + $order = $this->market_sylive_order_model->get(['userId'=>$this->uid,'status'=>1,'id'=>$params['id']]); + if(!$order){ + $this->show_json([],400,'订单不存在'); + } + $jsondata = json_decode($order['jsondata'],true); + $jsondata['address']['region'] = $params['region']; + $jsondata['address']['detail'] = $params['address']; + $update = [ + 'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE) + ]; + $this->market_sylive_order_model->update($update,['id'=>$order['id']]); + $this->show_json([],200,'保存成功'); + } +} diff --git a/home/views/h5/market/sylive/act/index.php b/home/views/h5/market/sylive/act/index.php index 57cefbad..3d541e16 100644 --- a/home/views/h5/market/sylive/act/index.php +++ b/home/views/h5/market/sylive/act/index.php @@ -19,12 +19,7 @@ 活动已结束 - - - -
我的
-
- + load->view('h5/market/sylive/nav_my') ?>
diff --git a/home/views/h5/market/sylive/act/ucenter.php b/home/views/h5/market/sylive/act/ucenter.php deleted file mode 100644 index 46540abd..00000000 --- a/home/views/h5/market/sylive/act/ucenter.php +++ /dev/null @@ -1,99 +0,0 @@ - -
-
-
-
-
订单号 {{info.order.oid}}
-
{{info.order.c_time}}
-
-
{{info.order.uname}} · {{info.order.utel}}
-
-
{{info.order.slogan}}
-
{{info.order.valid_time}}
-
-
-
- -
- {{info.title}} - 专属顾问 -
-
{{info.slogan}}
- - 拨打电话 - -
-
-
{{info.introTitle}}
-
-
-
- - -
返回
-
-
- - -load->view('h5/market/sylive/share_script')?> - \ No newline at end of file diff --git a/home/views/h5/market/sylive/item/agreement.php b/home/views/h5/market/sylive/item/agreement.php new file mode 100644 index 00000000..219ad5b1 --- /dev/null +++ b/home/views/h5/market/sylive/item/agreement.php @@ -0,0 +1,44 @@ + +
+
+
+
+
关于用户门票须知
+
+
尊敬的用户:感谢您使用本平台提供的互联网信息服务,在您使用本平台提供的在线服务前,请您仔细阅读本服务条款,未成年人应在法定监护人陪同下阅读,在您熟读本条款后请勾选已阅读并同意支付,即视为接受本服务各项条款。相关条款具体规定如下:
+
+ 1、 + 您在本平台上支付的0.99元为纳米BOX 11.11对称嗨购日参与门票,支付的199元为纳米BOX 11.11对称嗨购日VIP门票费用(以下统一简称为”门票”)。门票获取开始时间为2022年11月11日9:00,截止时间为2022年11月11日22:00,一个用户账号(同一手机号码)最多可购买两种门票各一张,且门票权益不可叠加,用户可享受本平台的最高权益为199元纳米BOX 11.11对称嗨购日VIP门票权益。请您注意在规定活动时间内完成支付,本平台为官方指定独家支付平台,其他平台均不支持本项服务。
+
+ 2、 + 0.99元纳米BOX 11.11对称嗨购日参与门票和199元纳米BOX 11.11对称嗨购日VIP门票权益说明如下:
+
+
+ 0.99元纳米BOX 11.11对称嗨购日参与门票:当您完成支付即有机会获得平台提供的价值99元精美礼品一份。
+
+
+ 199元纳米BOX 11.11对称嗨购日VIP门票:当您完成支付即可获得价值100元京东卡一张以及99元精美礼品一份。
+
当您确认完成支付0.99元纳米BOX 11.11对称嗨购日参与门票,即视为您已接受平台为您提供的99元精品礼品权益锁定;当您确认完成支付199元纳米BOX 11.11对称嗨购日VIP门票,即视为您已接受平台为您提供的等值礼品权益(价值100元京东卡一张以及99元精美礼品一份)
+
感谢您的理解与支持,完成门票支付将视为您已同意接受以上各项权益说明条款,故除去不可抗力因素影响,本平台不提供退款服务。
+
+ 3、 + 当您同意接受0.99元纳米BOX 11.11对称嗨购日参与门票和199元纳米BOX 11.11对称嗨购日VIP门票权益说明,并进入支付页面时,平台支付页面将会弹出信息框,需要您在弹窗信息框内填写个人详细邮寄地址,以便我们为您邮寄权益礼品,请您注意个人信息的正确填写,若信息填写不全或信息不正确,将视为您主动放弃本次权益,礼品将不再邮寄。
+
+ 4、 + 奖品发放:0.99元纳米BOX 11.11对称嗨购日参与门票礼品权益,即价值99元精美礼品一份,将在您成功完成购车后30个自然日内邮寄发出;199元纳米BOX 11.11对称嗨购日VIP门票礼品权益,即价值100元京东卡一张和99元精美礼品一份,将在本次活动结束后30个自然日内邮寄发出。
+
+ 5、 + 本协议受中华人民共和国(指中国大陆,不包含香港特别行政区、澳门特别行政区及台湾地区)法律约束并据其进行解释。
+
+ 6、 + 以上条款的最终解释权归本平台所有,因本协议引起的以及与本协议有关的一切争议,双方应通过友好协商或联系在线客服咨询解决;如仍有争议, 双方均有权将争议提交至武汉经济技术开发区人民法院诉讼解决。
+
+
+
+ + + +
返回
+
+
+ \ No newline at end of file diff --git a/home/views/h5/market/sylive/item/detail.php b/home/views/h5/market/sylive/item/detail.php new file mode 100644 index 00000000..f186a2de --- /dev/null +++ b/home/views/h5/market/sylive/item/detail.php @@ -0,0 +1,505 @@ + + + + + +
+
+ +
+
+
+
+ # +
+
+
+
+
+
#
+ +
+
+
{{info.title}}
+
{{info.validity}}
+
+ ¥ + {{info.price}} +
+
+
+
+
+ {{info.introTitle}} +
+
+
+
+
+ +
+ + +
活动已结束
+
+ +
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+ {{codeTx}} +
+
+ + + +
+
+ + 《关于用户门票须知》 +
+
+ +
+
+
+
+
+
+
+
+
支付成功
+
请输入您的地址,我们会第一时间为您发出!
+
+ + +
+
+ +
+
+
+ 确认 +
+ +
+
+
+
+ + +load->view('h5/market/sylive/share_script')?> + \ No newline at end of file diff --git a/home/views/h5/market/sylive/nav_my.php b/home/views/h5/market/sylive/nav_my.php new file mode 100644 index 00000000..6d0037e8 --- /dev/null +++ b/home/views/h5/market/sylive/nav_my.php @@ -0,0 +1,4 @@ + + +
我的
+
\ No newline at end of file diff --git a/home/views/h5/market/sylive/ucenter/detail.php b/home/views/h5/market/sylive/ucenter/detail.php new file mode 100644 index 00000000..59959470 --- /dev/null +++ b/home/views/h5/market/sylive/ucenter/detail.php @@ -0,0 +1,230 @@ + + + + + +
+
+
+
+
订单号 {{info.order.sid}}
+
{{info.order.c_time}}
+
+
+
{{info.order.uname}}·{{info.order.utel}}
+
{{show_address}}
+
收货地址
+
+ +
+
{{info.order.slogan}}
+
{{info.order.valid_time}}
+
+
+
+ +
+ {{info.title}} + 专属顾问 +
+
{{info.slogan}}
+ + 拨打电话 + +
+
+
{{info.introTitle}}
+
+
+
+ load->view('h5/market/sylive/nav_my') ?> + +
+
+
+
+
+
请输入您的地址,我们会第一时间为您发出!
+
+ + +
+
+ +
+
+
+ 确认 +
+ +
+
+
+ +
+ +load->view('h5/market/sylive/share_script')?> + \ No newline at end of file diff --git a/home/views/h5/market/sylive/ucenter/index.php b/home/views/h5/market/sylive/ucenter/index.php new file mode 100644 index 00000000..6180202e --- /dev/null +++ b/home/views/h5/market/sylive/ucenter/index.php @@ -0,0 +1,73 @@ + +
+
+
+
+ # +
{{info.title}}
+
尊享您的直播好礼
+
+ +
+ + +
首页
+
+
+ + + \ No newline at end of file diff --git a/home/views/h5/market/sylive/ucenter/mygift.php b/home/views/h5/market/sylive/ucenter/mygift.php new file mode 100644 index 00000000..59959470 --- /dev/null +++ b/home/views/h5/market/sylive/ucenter/mygift.php @@ -0,0 +1,230 @@ + + + + + +
+
+
+
+
订单号 {{info.order.sid}}
+
{{info.order.c_time}}
+
+
+
{{info.order.uname}}·{{info.order.utel}}
+
{{show_address}}
+
收货地址
+
+ +
+
{{info.order.slogan}}
+
{{info.order.valid_time}}
+
+
+
+ +
+ {{info.title}} + 专属顾问 +
+
{{info.slogan}}
+ + 拨打电话 + +
+
+
{{info.introTitle}}
+
+
+
+ load->view('h5/market/sylive/nav_my') ?> + +
+
+
+
+
+
请输入您的地址,我们会第一时间为您发出!
+
+ + +
+
+ +
+
+
+ 确认 +
+ +
+
+
+ +
+ +load->view('h5/market/sylive/share_script')?> + \ No newline at end of file diff --git a/home/views/h5/market/sylive/ucenter/orders.php b/home/views/h5/market/sylive/ucenter/orders.php new file mode 100644 index 00000000..362320e6 --- /dev/null +++ b/home/views/h5/market/sylive/ucenter/orders.php @@ -0,0 +1,101 @@ + +
+
+ + load->view('h5/market/sylive/nav_my') ?> +
+ + + \ No newline at end of file diff --git a/www/api/pdf/bizinfo.xlsx b/www/api/pdf/bizinfo.xlsx new file mode 100644 index 00000000..8b7b737a Binary files /dev/null and b/www/api/pdf/bizinfo.xlsx differ