当前位置: 首页>>代码示例>>PHP>>正文


PHP obj::makePaySn方法代码示例

本文整理汇总了PHP中obj::makePaySn方法的典型用法代码示例。如果您正苦于以下问题:PHP obj::makePaySn方法的具体用法?PHP obj::makePaySn怎么用?PHP obj::makePaySn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在obj的用法示例。


在下文中一共展示了obj::makePaySn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _createOrderStep4

 /**
  * 生成订单
  * @param array $input
  * @throws Exception
  * @return array array(支付单sn,订单列表)
  */
 private function _createOrderStep4()
 {
     extract($this->_order_data);
     $member_id = $this->_member_info['member_id'];
     $member_name = $this->_member_info['member_name'];
     $member_email = $this->_member_info['member_email'];
     $model_order = Model('order');
     //存储生成的订单数据
     $order_list = array();
     //存储通知信息
     $notice_list = array();
     //每个店铺订单是货到付款还是线上支付,店铺ID=>付款方式[在线支付/货到付款]
     $store_pay_type_list = $this->_logic_buy_1->getStorePayTypeList(array_keys($store_cart_list), $input_if_offpay, $input_pay_name);
     foreach ($store_pay_type_list as $k => &$v) {
         if (empty($input_if_offpay_batch[$k])) {
             $v = 'online';
         }
     }
     $pay_sn = $this->_logic_buy_1->makePaySn($member_id);
     $order_pay = array();
     $order_pay['pay_sn'] = $pay_sn;
     $order_pay['buyer_id'] = $member_id;
     $order_pay_id = $model_order->addOrderPay($order_pay);
     if (!$order_pay_id) {
         throw new Exception('订单保存失败[未生成支付单]');
     }
     //收货人信息
     list($reciver_info, $reciver_name) = $this->_logic_buy_1->getReciverAddr($input_address_info);
     foreach ($store_cart_list as $store_id => $goods_list) {
         //取得本店优惠额度(后面用来计算每件商品实际支付金额,结算需要)
         $promotion_total = !empty($store_promotion_total[$store_id]) ? $store_promotion_total[$store_id] : 0;
         //本店总的优惠比例,保留3位小数
         $should_goods_total = $store_final_order_total[$store_id] - $store_freight_total[$store_id] + $promotion_total;
         $promotion_rate = abs(number_format($promotion_total / $should_goods_total, 5));
         if ($promotion_rate <= 1) {
             $promotion_rate = floatval(substr($promotion_rate, 0, 5));
         } else {
             $promotion_rate = 0;
         }
         //每种商品的优惠金额累加保存入 $promotion_sum
         $promotion_sum = 0;
         $order = array();
         $order_common = array();
         $order_goods = array();
         $order['order_sn'] = $this->_logic_buy_1->makeOrderSn($order_pay_id);
         $order['pay_sn'] = $pay_sn;
         $order['store_id'] = $store_id;
         $order['store_name'] = $goods_list[0]['store_name'];
         $order['buyer_id'] = $member_id;
         $order['buyer_name'] = $member_name;
         $order['buyer_email'] = $member_email;
         $order['add_time'] = TIMESTAMP;
         $order['payment_code'] = $store_pay_type_list[$store_id];
         $order['order_state'] = $store_pay_type_list[$store_id] == 'online' ? ORDER_STATE_NEW : ORDER_STATE_PAY;
         $order['order_amount'] = $store_final_order_total[$store_id];
         $order['shipping_fee'] = $store_freight_total[$store_id];
         $order['goods_amount'] = $order['order_amount'] - $order['shipping_fee'];
         $order['order_from'] = $order_from;
         //中山小修改货到付款bug>>>
         if ($order['payment_code'] == "") {
             $order['payment_code'] = "offline";
         }
         //中山小修改货到付款bug<<<
         $order_id = $model_order->addOrder($order);
         if (!$order_id) {
             throw new Exception('订单保存失败[未生成订单数据]');
         }
         $order['order_id'] = $order_id;
         $order_list[$order_id] = $order;
         $order_common['order_id'] = $order_id;
         $order_common['store_id'] = $store_id;
         $order_common['order_message'] = $input_pay_message[$store_id];
         //代金券
         if (isset($input_voucher_list[$store_id])) {
             $order_common['voucher_price'] = $input_voucher_list[$store_id]['voucher_price'];
             $order_common['voucher_code'] = $input_voucher_list[$store_id]['voucher_code'];
         }
         $order_common['reciver_info'] = $reciver_info;
         $order_common['reciver_name'] = $reciver_name;
         $order_common['reciver_city_id'] = $input_city_id;
         //发票信息
         $order_common['invoice_info'] = $this->_logic_buy_1->createInvoiceData($input_invoice_info);
         //保存促销信息
         if (is_array($store_mansong_rule_list[$store_id])) {
             $order_common['promotion_info'] = addslashes($store_mansong_rule_list[$store_id]['desc']);
         }
         $order_id = $model_order->addOrderCommon($order_common);
         if (!$order_id) {
             throw new Exception('订单保存失败[未生成订单扩展数据]');
         }
         //生成order_goods订单商品数据
         $i = 0;
         foreach ($goods_list as $goods_info) {
             if (!$goods_info['state'] || !$goods_info['storage_state']) {
//.........这里部分代码省略.........
开发者ID:Maplecms,项目名称:shopnc-api,代码行数:101,代码来源:buy.logic.php


注:本文中的obj::makePaySn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。