From 94b2ee0208c9eeb97fbd11388982ba01ac1459bc Mon Sep 17 00:00:00 2001 From: lccsw <805383944@qq.com> Date: Mon, 21 Nov 2022 17:38:39 +0800 Subject: [PATCH] edit-sylive-item_pay --- .../market/Market_sylive_activity_model.php | 12 +++ home/controllers/h5/market/sylive/Act.php | 5 +- home/controllers/h5/market/sylive/Common.php | 4 +- home/controllers/h5/market/sylive/Item.php | 42 ++++++---- home/controllers/h5/market/sylive/Notify.php | 25 +++--- home/controllers/h5/market/sylive/Ucenter.php | 5 +- .../views/h5/market/sylive/item/agreement.php | 46 +---------- home/views/h5/market/sylive/item/detail.php | 81 +++++++++++-------- 8 files changed, 113 insertions(+), 107 deletions(-) diff --git a/common/models/market/Market_sylive_activity_model.php b/common/models/market/Market_sylive_activity_model.php index 108babe3..858af198 100644 --- a/common/models/market/Market_sylive_activity_model.php +++ b/common/models/market/Market_sylive_activity_model.php @@ -15,4 +15,16 @@ class Market_sylive_activity_model extends HD_Model parent::__construct($this->table_name, 'default'); } + /** + * 支付配置信息 + * @param $mch_id + * @return string|string[] + */ + public function pay_config($mch_id=''){ + $conf_arr = [ + '1614399682' => APPPATH."../api/third_party/WXconfig/dcz_WxPay.Config.php", //东创紫联支付配置 + '1604032585' => APPPATH."../api/third_party/WXconfig/hdy_WxPay.Config.php", //好店云支付配置 + ]; + return $mch_id ? $conf_arr[$mch_id] : $conf_arr; + } } \ 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 c3584686..b78e0333 100644 --- a/home/controllers/h5/market/sylive/Act.php +++ b/home/controllers/h5/market/sylive/Act.php @@ -404,7 +404,10 @@ class Act extends Wx { } $user = $this->user_model->get(['userId'=>$this->uid]); $notify_url = http_host_com('home').'/h5/market/sylive/notify'; - $result = $this->unorder($unpay['sid'],$unpay['totalPrice'],$user['openid'],$unpay['itemTitle'],$notify_url,$unpay['expireTime'],['wx_type'=>'dc']); + $other_data = []; + $pay_config = $this->market_sylive_activity_model->pay_config($row['mchId']); + $pay_config && $other_data['pay_config'] = $pay_config; + $result = $this->unorder($unpay['sid'],$unpay['totalPrice'],$user['openid'],$unpay['itemTitle'],$notify_url,$unpay['expireTime'],$other_data); if(!$result['code']){ $this->show_json('',400,$result['msg']); } diff --git a/home/controllers/h5/market/sylive/Common.php b/home/controllers/h5/market/sylive/Common.php index 08e8dcac..1345a01b 100644 --- a/home/controllers/h5/market/sylive/Common.php +++ b/home/controllers/h5/market/sylive/Common.php @@ -136,8 +136,8 @@ abstract class Common extends CI_Controller{ protected function unorder($trade_no,$price,$openid,$body,$notify_url,$expire_time,$other_data=[]){ if(!$body){return false;} require_once APPPATH."../api/third_party/WXpay/WxPay.Api.php"; - if($other_data['wx_type']=='dc'){ - require_once APPPATH."../api/third_party/WXconfig/dcz_WxPay.Config.php"; + if($other_data['pay_config'] && file_exists($other_data['pay_config'])){ + require_once $other_data['pay_config']; }else{ require_once APPPATH."../api/third_party/WXconfig/hdy_WxPay.Config.php"; } diff --git a/home/controllers/h5/market/sylive/Item.php b/home/controllers/h5/market/sylive/Item.php index bb4cf389..6a4b51b4 100644 --- a/home/controllers/h5/market/sylive/Item.php +++ b/home/controllers/h5/market/sylive/Item.php @@ -52,19 +52,20 @@ class Item extends Wx{ $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]); - if($channel_user['bizId'] && $channel_user['organizationId']){ - $need_shop = 0; - } - } + $need_shop = 0; + //是否需要选择门店 时隐藏 +// $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]); +// if($channel_user['bizId'] && $channel_user['organizationId']){ +// $need_shop = 0; +// } +// } $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'); - } +// if($need_shop){ +// $province_arr = $this->msa_bizinfo_model->select(['status'=>0,'activityId'=>4],'',0,0,'distinct provinceName as name'); +// } $user = $this->user_model->get(['userId'=>$this->uid],'unionid,nickname,headimg'); $userid = $user['unionid'] ? $user['unionid'] : $this->uid; $ts = time()*1000; @@ -83,7 +84,9 @@ class Item extends Wx{ 'validity' => $validity, 'introTitle' => '权益说明', 'need_shop' => $need_shop, - 'live_url' => $live_url + 'live_url' => $live_url, + 'a_id' => $a_id, + 'ifAddress' => $row['ifAddress'] ]; $this->data['province_arr'] = $province_arr; $this->data['city_arr'] = $city_arr; @@ -217,7 +220,11 @@ class Item extends Wx{ $this->market_sylive_order_model->update($update,['id'=>$unpay['id']]); } $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']); + $other_data = []; + $act = $this->market_sylive_activity_model->get(['activityId'=>$row['activityId']],'mchId'); + $pay_config = $this->market_sylive_activity_model->pay_config($act['mchId']); + $pay_config && $other_data['pay_config'] = $pay_config; + $result = $this->unorder($unpay['sid'],$unpay['totalPrice'],$user['openid'],$unpay['itemTitle'],$notify_url,$unpay['expireTime'],$other_data); if(!$result['code']){ $this->show_json('',400,$result['msg']); } @@ -278,6 +285,13 @@ class Item extends Wx{ } public function agreement(){ + $a_id = $this->input->get('a_id'); + $act = $this->market_sylive_activity_model->get(['activityId'=>$a_id]); + $info = [ + 'title' => $act['protocolTitle'], + 'content' => $act['protocol'] + ]; + $this->data['info'] = $info; $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 6f01adaa..4eb0d45a 100644 --- a/home/controllers/h5/market/sylive/Notify.php +++ b/home/controllers/h5/market/sylive/Notify.php @@ -8,6 +8,7 @@ class Notify extends CI_Controller { private $log_dir = 'market/sylive'; private $log_file = 'wx_pay.log'; private $notify; + private $mch_id; public function __construct(){ parent::__construct(); @@ -16,17 +17,21 @@ class Notify extends CI_Controller { $this->load->model('market/market_sylive_activity_model'); $this->load->model('market/market_sylive_activity_orders_model','mdSytActivityOrders'); $this->load->library('market/sylive_entity'); - $method = $this->router->fetch_method(); - if($method=='biz'){ //好店云 - require_once APPPATH."../api/third_party/WXconfig/hdy_WxPay.Config.php"; - }else{ //默认东创紫联 - require_once APPPATH."../api/third_party/WXconfig/dcz_WxPay.Config.php"; - } try{ - //如果返回成功则验证签名 - $config = new WxPayConfig(); + $WxPayNotifyResults = new WxPayNotifyResults(); $input = file_get_contents("php://input"); debug_log("[input] ". __FUNCTION__ . "# $input:" . json_encode($input,JSON_UNESCAPED_UNICODE), $this->log_file,$this->log_dir); + $result = $WxPayNotifyResults->FromXml($input); + $data = $result->GetValues(); + $this->mch_id = $data['mch_id']; + $config = $this->market_sylive_activity_model->pay_config($this->mch_id); + if($config && file_exists($config)){ + require_once $config; + }else{ + require_once APPPATH."../api/third_party/WXconfig/hdy_WxPay.Config.php"; + } + //验证签名 + $config = new WxPayConfig(); $result = WxPayNotifyResults::Init($config, $input); $this->notify = $result->GetValues(); debug_log("[info] ". __FUNCTION__ . "# notify:" . json_encode($this->notify,JSON_UNESCAPED_UNICODE), $this->log_file,$this->log_dir); @@ -60,7 +65,7 @@ class Notify extends CI_Controller { 'uid' => $order['userId'], 'cf_uid' => $act_user['channelId'], 'kpi' => 'order', - 'jsondata'=> ['order_id'=>$order['id'],'sid'=>$sid] + 'jsondata'=> ['order_id'=>$order['id'],'sid'=>$sid,'mch_id'=>$this->mch_id] ]; $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); @@ -139,7 +144,7 @@ class Notify extends CI_Controller { 'cf_uid' => $act_user['channelId'], 'kpi' => 'order', 'tagId' => $order['id'], - 'jsondata'=> ['order_id'=>$order['id'],'sid'=>$sid] + 'jsondata'=> ['order_id'=>$order['id'],'sid'=>$sid,'mch_id'=>$this->mch_id] ]; $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); diff --git a/home/controllers/h5/market/sylive/Ucenter.php b/home/controllers/h5/market/sylive/Ucenter.php index 2949e5e7..244d3fff 100644 --- a/home/controllers/h5/market/sylive/Ucenter.php +++ b/home/controllers/h5/market/sylive/Ucenter.php @@ -24,13 +24,12 @@ class Ucenter extends Wx{ if(!$row){ throw new Hd_exception('参数错误',400); } + $jsondata = json_decode($row['jsondata'],true); $lists = []; $lists[] = ['title'=>'我的权益','url'=>"/h5/market/sylive/ucenter/orders?skey={$params['skey']}"]; $lists[] = ['title'=>'我的抽奖','url'=>"/h5/market/sylive/ucenter/win?skey={$params['skey']}"]; - if($this->a_id!=5){ - $lists[] = ['title'=>'联系客服','url'=>"https://work.weixin.qq.com/kfid/kfc77374393839a9d9b?enc_scene=ENCAEt1rsV7GcticSp5Xyc245thCkz9T6YRm7gShvqffNqW3A89DzkZvzjusx44EinUTe"]; - } + $jsondata['serviceLink'] && $lists[] = ['title'=>'联系客服','url'=>$jsondata['serviceLink']]; $user = $this->user_model->get(['userId'=>$this->uid],'unionid,nickname,headimg'); $info = [ diff --git a/home/views/h5/market/sylive/item/agreement.php b/home/views/h5/market/sylive/item/agreement.php index 21859a82..2ea0ef2c 100644 --- a/home/views/h5/market/sylive/item/agreement.php +++ b/home/views/h5/market/sylive/item/agreement.php @@ -3,49 +3,11 @@
-
关于用户门票须知
+
+
+
-
- 尊敬的用户:感谢您使用本平台提供的互联网信息服务,在您使用本平台提供的在线服务前,请您仔细阅读本服务条款,未成年人应在法定监护人陪同下阅读,在您熟读本条款后请勾选已阅读并同意支付,即视为接受本服务各项条款。相关条款具体规定如下: -
-
- 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、 - 以上条款的最终解释权归本平台所有,因本协议引起的以及与本协议有关的一切争议,双方应通过友好协商或联系在线客服咨询解决;如仍有争议, 双方均有权将争议提交至武汉经济技术开发区人民法院诉讼解决。 -
+
diff --git a/home/views/h5/market/sylive/item/detail.php b/home/views/h5/market/sylive/item/detail.php index a8219b65..5e10e706 100644 --- a/home/views/h5/market/sylive/item/detail.php +++ b/home/views/h5/market/sylive/item/detail.php @@ -89,7 +89,7 @@ - 《关于用户门票须知》 + 《关于用户门票须知》
@@ -390,46 +390,57 @@ this.isShowSuccess = false }, showSuccess: function (){ - this.isShowSuccess = true; - //选择省市初始化 - setTimeout(function () { - let area = new LArea(); - area.init({ - 'trigger': '#region', //触发选择控件的文本框,同时选择完毕后name属性输出到该位置 - 'valueTo': '#regionvalue', //选择完毕后id属性输出到该位置 - 'keys': { - id: 'value', - name: 'text' - }, //绑定数据源相关字段 id对应valueTo的value属性输出 name对应trigger的value属性输出 - 'type': 2, - 'data': [provs_data, citys_data, dists_data] - }); - if(that.region !=''){ - for(var i in provs_data){ - if(provs_data[i].text==that.region.split(",")[0]){ - var x=i; - var city=citys_data[provs_data[i].value]; - for(var j in city){ - if(city[j].text==that.region.split(",")[1]){ - var y=j; - var district=dists_data[city[j].value]; - for(var k in district){ - if(district[k].text==that.region.split(",")[2]){ - var z=k; + if(this.info.ifAddress){ //需要填写收货地址 + this.isShowSuccess = true; + //选择省市初始化 + setTimeout(function () { + let area = new LArea(); + area.init({ + 'trigger': '#region', //触发选择控件的文本框,同时选择完毕后name属性输出到该位置 + 'valueTo': '#regionvalue', //选择完毕后id属性输出到该位置 + 'keys': { + id: 'value', + name: 'text' + }, //绑定数据源相关字段 id对应valueTo的value属性输出 name对应trigger的value属性输出 + 'type': 2, + 'data': [provs_data, citys_data, dists_data] + }); + if(that.region !=''){ + for(var i in provs_data){ + if(provs_data[i].text==that.region.split(",")[0]){ + var x=i; + var city=citys_data[provs_data[i].value]; + for(var j in city){ + if(city[j].text==that.region.split(",")[1]){ + var y=j; + var district=dists_data[city[j].value]; + for(var k in district){ + if(district[k].text==that.region.split(",")[2]){ + var z=k; + } } } } } } + area.value=[x,y,z];//控制初始位置,注意:该方法并不会影响到input的value + }else{ + area.value=[12,1,1];//控制初始位置,注意:该方法并不会影响到input的value } - area.value=[x,y,z];//控制初始位置,注意:该方法并不会影响到input的value - }else{ - area.value=[12,1,1];//控制初始位置,注意:该方法并不会影响到input的value - } - area.success = function(){ - that.regionvalue = $("#regionvalue").val(); - } - }, 200) + area.success = function(){ + that.regionvalue = $("#regionvalue").val(); + } + }, 200) + }else{ + mDialog.msg({ + duration: 250, + pause: 2000, + content: '支付成功', + onClose:function(){ + window.location = "/h5/market/sylive/ucenter?skey="; + } + }); + } }, //提交地址 postAddress() {