|
@@ -158,8 +158,12 @@ class member_buyControl extends mbMemberControl
|
|
|
$param['pay_name'] = "online";
|
|
|
|
|
|
$param['usebonus'] = $_POST['usebonus'];
|
|
|
+ $param['usepred'] = $_POST['usepred'];
|
|
|
$param['room_id'] = $_POST['room_id'];
|
|
|
$usebonus = $_POST['usebonus'];
|
|
|
+ $_POST['pd_pay'] = 1;
|
|
|
+ $usepred = $_POST['pd_pay'];
|
|
|
+ $param['pd_pay'] = 1;
|
|
|
|
|
|
$logic_buy = logic('buy');
|
|
|
$result = $logic_buy->buyStep2($param, $_SESSION['member_id'], $_SESSION['member_name'], $_SESSION['member_email']);
|
|
@@ -172,7 +176,7 @@ class member_buyControl extends mbMemberControl
|
|
|
$payment = $_POST['payment'];
|
|
|
|
|
|
$payer = new pay_helper($pay_sn);
|
|
|
- $out_put = $payer->pay($payment,$usebonus,$err);
|
|
|
+ $out_put = $payer->pay($payment,$usebonus,$usepred,$err);
|
|
|
|
|
|
if($out_put == false) {
|
|
|
return self::outerr($err['code'],$err['msg']);
|
|
@@ -354,130 +358,25 @@ class member_buyControl extends mbMemberControl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /// 旧接口
|
|
|
- public function payOp()
|
|
|
- {
|
|
|
- $pay_sn = $_GET['pay_sn'];
|
|
|
- $payment = $_GET['payment'];
|
|
|
- $usebonus = intval($_GET['usebonus']) == 0 ? false : true;
|
|
|
-
|
|
|
- if(empty($pay_sn) || empty($payment)) {
|
|
|
- return self::outerr(errcode::ErrParamter,"支付号或者支付类型错误");
|
|
|
- }
|
|
|
-
|
|
|
- $payer = new pay_helper($pay_sn);
|
|
|
- $out_put = $payer->pay($payment,$usebonus,$err);
|
|
|
-
|
|
|
- if($out_put == false) {
|
|
|
- return self::outerr($err['code'],$err['msg']);
|
|
|
- } else {
|
|
|
- $out_put['payment'] = $payment;
|
|
|
- $out_put['pay_sn'] = $pay_sn;
|
|
|
-
|
|
|
- return self::outsuccess($out_put);
|
|
|
- }
|
|
|
- }
|
|
|
- /**
|
|
|
- * 购物车、直接购买第一步:选择收获地址和配置方式
|
|
|
- */
|
|
|
- public function buy_step1Op()
|
|
|
- {
|
|
|
- $cart_id = explode(',', urldecode($_POST['cart_id']));
|
|
|
- $logic_buy = logic('buy');
|
|
|
-
|
|
|
- //得到购买数据
|
|
|
- $result = $logic_buy->buyStep1($cart_id, $_POST['ifcart'], $_SESSION['member_id'], $_SESSION['store_id']);
|
|
|
- if (!$result['state']) {
|
|
|
- return self::outerr(errcode::ErrOrder, $result['msg']);
|
|
|
- } else {
|
|
|
- $result = $result['data'];
|
|
|
- }
|
|
|
-
|
|
|
- //整理数据
|
|
|
- $store_cart_list = array();
|
|
|
- foreach ($result['store_cart_list'] as $key => $value) {
|
|
|
- $store_cart_item = array();
|
|
|
- $store_cart_item['goods_list'] = $value;
|
|
|
- $store_cart_item['store_goods_total'] = $result['store_goods_total'][$key];
|
|
|
- if (!empty($result['store_premiums_list'][$key])) {
|
|
|
- $result['store_premiums_list'][$key][0]['premiums'] = true;
|
|
|
- $result['store_premiums_list'][$key][0]['goods_total'] = 0.00;
|
|
|
- $store_cart_item['goods_list'][] = $result['store_premiums_list'][$key][0];
|
|
|
- }
|
|
|
- $store_cart_item['store_mansong_rule_list'] = $result['store_mansong_rule_list'][$key];
|
|
|
- $store_cart_item['store_voucher_list'] = $result['store_voucher_list'][$key];
|
|
|
- if (!empty($result['cancel_calc_sid_list'])) {
|
|
|
- $store_cart_item['freight'] = '0';
|
|
|
- $store_cart_item['freight_message'] = $result['cancel_calc_sid_list'][$key]['desc'];
|
|
|
- } else {
|
|
|
- $store_cart_item['freight'] = '1';
|
|
|
- $store_cart_item['freight_message'] = $result['need_calc_sid_list']['desc'];
|
|
|
- }
|
|
|
- $store_cart_item['store_name'] = $value[0]['store_name'];
|
|
|
- array_push($store_cart_list, $store_cart_item);
|
|
|
- }
|
|
|
-
|
|
|
- $buy_list = array();
|
|
|
- $buy_list['store_cart_list'] = $store_cart_list;
|
|
|
- $buy_list['freight_hash'] = $result['freight_list'];
|
|
|
- $buy_list['address_info'] = $result['address_info'];
|
|
|
- $buy_list['ifshow_offpay'] = null;
|
|
|
- $buy_list['vat_hash'] = $result['vat_hash'];
|
|
|
- $buy_list['inv_info'] = $result['inv_info'];
|
|
|
- $buy_list['available_predeposit'] = $result['available_predeposit'];
|
|
|
- $buy_list['available_rc_balance'] = $result['available_rc_balance'];
|
|
|
-
|
|
|
- return self::outsuccess($buy_list);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 购物车、直接购买第二步:保存订单入库,产生订单号,开始选择支付方式
|
|
|
- */
|
|
|
- public function buy_step2Op()
|
|
|
+ private function pay_goods($cart_ids)
|
|
|
{
|
|
|
- $param = array();
|
|
|
- $param['ifcart'] = $_POST['ifcart'];
|
|
|
- $param['cart_id'] = explode(',', urldecode($_POST['cart_id']));
|
|
|
- $param['address_id'] = $_POST['address_id'];
|
|
|
-
|
|
|
- $param['vat_hash'] = $_POST['vat_hash'];
|
|
|
- $param['offpay_hash'] = $_POST['offpay_hash'];
|
|
|
- $param['offpay_hash_batch'] = $_POST['offpay_hash_batch'];
|
|
|
- $param['pay_name'] = $_POST['pay_name'];
|
|
|
- $param['invoice_id'] = $_POST['invoice_id'];
|
|
|
-
|
|
|
- //处理代金券
|
|
|
- $voucher = array();
|
|
|
- $post_voucher = explode(',', $_POST['voucher']);
|
|
|
- if (!empty($post_voucher)) {
|
|
|
- foreach ($post_voucher as $value) {
|
|
|
- list($voucher_t_id, $store_id, $voucher_price) = explode('|', $value);
|
|
|
- $voucher[$store_id] = $value;
|
|
|
+ if (boolval($_POST['ifcart']) == true)
|
|
|
+ {
|
|
|
+ $mod_cart = Model('cart');
|
|
|
+ $items = $mod_cart->listCart('db', array('cart_id' => array('in', $cart_ids)), false);
|
|
|
+ $id_num = [];
|
|
|
+ foreach ($items as $val) {
|
|
|
+ $cart_id = $val['cart_id'];
|
|
|
+ $goods_num = $val['goods_num'];
|
|
|
+ $id_num[] = "{$cart_id}|{$goods_num}";
|
|
|
}
|
|
|
+ return $id_num;
|
|
|
+ } else {
|
|
|
+ $id_num = $cart_ids;
|
|
|
+ return $id_num;
|
|
|
}
|
|
|
- $param['voucher'] = $voucher;
|
|
|
-
|
|
|
- //手机端暂时不做支付留言,页面内容太多了
|
|
|
- //$param['pay_message'] = json_decode($_POST['pay_message']);
|
|
|
- $param['pd_pay'] = $_POST['pd_pay'];
|
|
|
- $param['rcb_pay'] = $_POST['rcb_pay'];
|
|
|
- $param['password'] = $_POST['password'];
|
|
|
- $param['fcode'] = $_POST['fcode'];
|
|
|
- $param['order_from'] = 2;
|
|
|
- $logic_buy = logic('buy');
|
|
|
-
|
|
|
- $result = $logic_buy->buyStep2($param, $_SESSION['member_id'], $_SESSION['member_name'], $_SESSION['member_email']);
|
|
|
- if (!$result['state']) {
|
|
|
- return self::outerr(errcode::ErrOrder, $result['msg']);
|
|
|
- }
|
|
|
-
|
|
|
- return self::outsuccess(array('pay_sn' => $result['data']['pay_sn']));
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 验证密码
|
|
|
- */
|
|
|
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
public function check_passwordOp()
|
|
|
{
|
|
|
if (empty($_POST['password'])) {
|
|
@@ -494,40 +393,4 @@ class member_buyControl extends mbMemberControl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 更换收货地址
|
|
|
- */
|
|
|
- public function change_addressOp()
|
|
|
- {
|
|
|
- $logic_buy = Logic('buy');
|
|
|
- $data = $logic_buy->changeAddr($_POST['freight_hash'], $_POST['city_id'], $_POST['area_id'], $_SESSION['member_id']);
|
|
|
- if (!empty($data) && $data['state'] == 'success') {
|
|
|
- return self::outsuccess($data);
|
|
|
- } else {
|
|
|
- return self::outerr(errcode::ErrOrder, '地址修改失败');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @param $cart_ids
|
|
|
- * @return array
|
|
|
- */
|
|
|
- private function pay_goods($cart_ids)
|
|
|
- {
|
|
|
- if (boolval($_POST['ifcart']) == true)
|
|
|
- {
|
|
|
- $mod_cart = Model('cart');
|
|
|
- $items = $mod_cart->listCart('db', array('cart_id' => array('in', $cart_ids)), false);
|
|
|
- $id_num = [];
|
|
|
- foreach ($items as $val) {
|
|
|
- $cart_id = $val['cart_id'];
|
|
|
- $goods_num = $val['goods_num'];
|
|
|
- $id_num[] = "{$cart_id}|{$goods_num}";
|
|
|
- }
|
|
|
- return $id_num;
|
|
|
- } else {
|
|
|
- $id_num = $cart_ids;
|
|
|
- return $id_num;
|
|
|
- }
|
|
|
- }
|
|
|
}
|