stanley-king пре 8 година
родитељ
комит
6cb06510c6
2 измењених фајлова са 13 додато и 89 уклоњено
  1. 1 89
      data/logic/payment.logic.php
  2. 12 0
      data/resource/sensitive_word/composer.json

+ 1 - 89
data/logic/payment.logic.php

@@ -9,92 +9,6 @@ require_once (BASE_ROOT_PATH . '/helper/predeposit_helper.php');
 
 class paymentLogic
 {
-    /**
-     * 尝试使用预存款, 可以扣除运费
-     * @param int $pay_sn
-     * @param int $member_id
-     * @return int
-     */
-    public function payPredeposit($pay_sn,$member_info )
-    {
-        //验证订单信息
-        $model_order = Model('order');
-        $condition = array();
-        $condition['pay_sn'] = $pay_sn;
-        if (!empty($member_info['member_id'])) {
-            $condition['buyer_id'] = $member_info['member_id'];
-        }
-        $order_pay_info = $model_order->getOrderPayInfo($condition);
-        if (empty($order_pay_info)) {
-            return -1;
-        }
-
-        $condition = array();
-        $condition['pay_sn'] = $pay_sn;
-        $order_list = $model_order->getNormalOrderList($condition);
-
-        // 获取余额数据
-        $obj_member = Model('member');
-        $pd_amount = $obj_member->getPdAmount($member_info['member_id']);
-        if (empty($order_list)) return -1;
-        if (floatval($pd_amount) <= 0.0) return -1;
-
-        $model_order = Model('order');
-        $model_pd = Model('predeposit');
-        $member_id = intval($member_info['member_id']);
-
-        try
-        {
-            DB::beginTransaction();
-            foreach ($order_list as $order_info)
-            {
-                // 使用全部预存款(红包逻辑)
-                $data_order = array();
-                $change_type = '';
-                // 计算运费+订单总额
-                $total_amount = floatval($order_info['order_amount']);
-                $increment_amount = 0.0;    // 预存款使用
-                if ((floatval($pd_amount) + floatval($order_info['pd_amount'])) > floatval($total_amount))  {
-                    // 预存款增量, 当二次付款并使用红包的时候, 需要进行二次计算预存款
-                    $increment_amount = floatval($total_amount) - floatval($order_info['pd_amount']);
-                    $order_info['pd_amount'] += $increment_amount; // 余额大于订单金额的情况
-                    $pd_amount = floatval($pd_amount) - floatval($increment_amount);
-                    $change_type = 'order_pay';
-                } else {    // 余额小于等于订单金额的情况, $pd_amount不能等于0
-                    $increment_amount = floatval($pd_amount);
-                    $order_info['pd_amount'] += floatval($pd_amount);
-                    $pd_amount = 0.0;
-                    $change_type = 'order_freeze';
-                }
-
-                $data_pd = array();
-                $data_pd['member_id'] = $member_id;
-                $data_pd['member_name'] = $member_info['member_name'];
-                $data_pd['amount'] = $increment_amount;
-                $data_pd['order_sn'] = $order_info['order_sn'];
-                //预存款立即支付,订单支付完成
-                $ret = $model_pd->changePd($change_type, $data_pd);
-                if (0 == $ret) {
-                    throw new Exception("订单更新失败");
-                }
-
-                // 修改订单
-                $data_order["pd_amount"] = $order_info['pd_amount'];
-                $ret = $model_order->editOrder($data_order, array('order_id' => $order_info['order_id']));
-
-                if (0 == $ret) {
-                    throw new Exception("订单更新失败");
-                }
-
-                DB::commit();
-                return 0;
-            }
-        } catch (Exception $e) {
-            DB::rollback();
-        }
-    }
-
-    //add by stanley
     public function calcPredeposit($pay_sn,$member_info,&$avail_pred,&$used_pred)
     {
         //验证订单信息
@@ -262,6 +176,7 @@ class paymentLogic
         if (!empty($member_id)) {
             $condition['buyer_id'] = $member_id;
         }
+
         $order_info = $model_order->getOrderInfo($condition);
         if (empty($order_info)) {
             return callback(false, '该订单不存在');
@@ -270,11 +185,8 @@ class paymentLogic
         $order_info['subject'] = '虚拟订单_' . $order_sn;
         $order_info['order_type'] = 'vr_order';
         $order_info['pay_sn'] = $order_sn;
-
-        $pay_amount = 0.0;
         //计算本次需要在线支付的订单总金额
         $pay_amount = ncPriceFormat(floatval($order_info['order_amount']) - floatval($order_info['pd_amount']));
-
         $order_info['api_pay_amount'] = $pay_amount;
 
         return callback(true, '', $order_info);

+ 12 - 0
data/resource/sensitive_word/composer.json

@@ -0,0 +1,12 @@
+{
+  "name": "vendor_name/package_name",
+  "description": "description_text",
+  "minimum-stability": "stable",
+  "license": "proprietary",
+  "authors": [
+    {
+      "name": "author's name",
+      "email": "email@example.com"
+    }
+  ]
+}