Ver código fonte

Merge branch 'goods' of 121.43.114.153:/home/git/repositories/shopnc into goods

stanley-king 9 anos atrás
pai
commit
17be666c4a

+ 2 - 10
data/logic/payment.logic.php

@@ -42,19 +42,11 @@ class paymentLogic
         $obj_member = Model('member');
         $pd_amount = $obj_member->getPdAmount($member_id);
         //计算本次需要在线支付的订单总金额
+        $usebonus = 1;
         $pay_amount = 0;
         if (!empty($order_list)) {
             foreach ($order_list as $order_info) {
-                if (intval($usebonus) === 1) {  // 使用全部预存款(红包逻辑)
-                    if (floatval($pd_amount) > floatval($order_info['order_amount'])) {
-                        // 余额大于订单金额的情况
-                        $order_info['pd_amount'] = floatval($order_info['order_amount']);
-                        $pd_amount = floatval($pd_amount) - floatval($order_info['pd_amount']);
-                    } else if (floatval($pd_amount) > 0) {    // 余额小于等于订单金额的情况, $pd_amount不能等于0
-                        $order_info['pd_amount'] = floatval($pd_amount);
-                        $pd_amount = 0;
-                    }
-                }
+                
                 $pay_amount += ncPriceFormat(floatval($order_info['order_amount']) - floatval($order_info['pd_amount']));
             }
         }

+ 2 - 2
data/model/member.model.php

@@ -774,8 +774,8 @@ class memberModel extends Model
         //$pd_log_list =$this->getPdLogList($condition,20,'*','lg_id desc');
         $pd_log_list = $model_pd->getPdLogList($condition,'','*','lg_id desc');
 
-        // 订单数据查询条件, 生成订单查询语句, 在详细查询阶段进行批量查询
-        $condition_order = "order_id in(";
+        // 订单数据查询条件(只查询已完成订单), 生成订单查询语句, 在详细查询阶段进行批量查询
+        $condition_order = "refund_state=0 and delete_state=0 and order_id in(";
         foreach ($pd_log_list as $key => $value) {
             $use_list = array();
             $match = '';

+ 26 - 13
mobile/control/bonus.php

@@ -14,25 +14,27 @@ class bonusControl extends mobileMemberExControl
         parent::__construct();
     }
 
-    /**
-     * 获取红包列表
-     */
     public function bonus_listOp()
     {
         // 检验token
-        $token = $_GET['key'];
+        // $token = $_GET['key'];
 
-        if (empty($token)) {
-            return joutput_error(errcode::ErrInputParam);
-        }
-        if ($this->checkToken($token) != errcode::Success) {
-            return joutput_error($this->err_code);
-        }
+        // if (empty($token)) {
+        //     return joutput_error(errcode::ErrInputParam, '输入参数有误');
+        // }
 
+        // if ($this->checkToken($token) != errcode::Success) {
+        //     return joutput_error($this->err_code, errcode::msg($this->err_code));
+        // }
+
+        // 根据token获取用户ID
         $condition['user_id'] = $this->member_info['member_id'];
+        $condition['user_id'] = 36455;
+
         if (!empty($condition['user_id'])) {
 
             $ret = Model()->table("user_bonus")->where($condition)->select();
+
             // 红包总值(直接等于预存款值)
             $obj_member = Model('member');
             $total_value = $obj_member->getPdAmount($condition['user_id']);
@@ -73,21 +75,27 @@ class bonusControl extends mobileMemberExControl
     {
         // 检验token
         $token = $_GET['key'];
+
         if (empty($token)) {
-            return joutput_error(errcode::ErrInputParam);
+            return joutput_error(errcode::ErrInputParam, '输入参数有误');
         }
 
         if ($this->checkToken($token) != errcode::Success) {
-            return joutput_error($this->err_code);
+            return joutput_error($this->err_code, errcode::msg($this->err_code));
         }
 
+        // 获取user_id
         $condition['member_id'] = $this->member_info['member_id'];
+
         if (!empty($condition['member_id'])) {
 
             // get member_mobile 获取用户手机号
             $member = Model()->table("member")->field("member_mobile")->where($condition)->select();
+
             if (!empty($member)) {
+
                 $user_bonus = Model()->table("user_bonus")->where(array('user_mobile' => $member[0]['member_mobile'], 'user_id' => 0))->select();
+
                 // 更新user_bonus
                 if (!empty($user_bonus)) {
 
@@ -95,22 +103,27 @@ class bonusControl extends mobileMemberExControl
                     foreach ($user_bonus as $value) {
 
                         $bonus_type = Model()->table('bonus_type')->where(array('type_id' => $value['bonus_type_id']))->limit(1)->select();
+
                         $info = [];
                         $info['sender'] = $bonus_type[0]['sender'];
                         $info['type_name'] = $bonus_type[0]['type_name'];
                         $info['bonus_value'] = $value['bonus_value'];
+
                         array_push($bonus_info, $info);
                     }
                     // 更新为已领取
                     $data['user_id'] = $this->member_info['member_id'];
                     $ret = Model()->table('user_bonus')->where(array('user_mobile' => $member[0]['member_mobile']))->update($data);
+
                     // 返回存在红包
                     joutput_data(array('have_bonus' => 1, 'bonus_info' => $bonus_info));
+
                 } else {
                     joutput_data(array('have_bonus' => 0, 'bonus_info' => null));
                 }
+
             } else {
-                return joutput_error(errcode::ErrTokenExpire);
+                return joutput_error(errcode::ErrTokenExpire, "用户手机号没绑定");
             }
         }
     }

+ 1 - 0
mobile/control/control.php

@@ -154,6 +154,7 @@ class mbMemberControl extends mobileControl
         $this->member_info['store_id'] = $seller_info['store_id'];
 
         $this->err_code = errcode::Success;
+
         return true;
     }
 }

+ 5 - 0
mobile/control/efficacy.php

@@ -12,6 +12,10 @@ class efficacyControl extends mobileHomeControl
         parent::__construct();
     }
 
+    public function indexOp(){
+
+    }
+
     /**
      * 获取功效列表
      */
@@ -23,6 +27,7 @@ class efficacyControl extends mobileHomeControl
         foreach ($efficacy_list as $value) {
             $item['efficacy_id'] = $value['efficacy_id'];
             $item['efficacy_name']=$value['efficacy_name'];
+
             array_push($result,$item);
         }
         joutput_data(array("efficacy"=>$result));

+ 3 - 0
mobile/control/find.php

@@ -19,6 +19,7 @@ class findControl extends mobileHomeControl
     public function category_listOp()
     {
         $category_list = Model()->table('category_item')->where(array('enable' => '1'))->order('sort asc')->select();
+
         $result = array();
         foreach ($category_list as $value) {
 
@@ -26,8 +27,10 @@ class findControl extends mobileHomeControl
             $item['name'] = $value['name'];
             $item['type'] = $value['category_type'];
             $item['gc_id'] = $value['gc_id'];
+
             array_push($result, $item);
         }
         joutput_data(array("category" => $result));
     }
+
 }

+ 1 - 0
mobile/control/payment.php

@@ -33,6 +33,7 @@ class paymentControl extends mobileHomeControl{
 
     }
 
+
     /**
      * 支付回调
      */

+ 1 - 0
mobile/control/shop.php

@@ -21,6 +21,7 @@ class shopControl extends mobileHomeControl {
         $this->_get_Own_Store_List();
     }
 
+
     private  function  _get_Own_Store_List(){
 
         //获取自营店列表