浏览代码

购物车界面增加该接口

stanley-king 8 年之前
父节点
当前提交
a6e12b0273
共有 1 个文件被更改,包括 36 次插入2 次删除
  1. 36 2
      mobile/control/cart.php

+ 36 - 2
mobile/control/cart.php

@@ -5,9 +5,10 @@
 
 defined('InShopNC') or exit('Access Invalid!');
 
-require_once (BASE_ROOT_PATH . '/helper/goods_helper.php');
-require_once (BASE_ROOT_PATH . '/helper/activity_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/goods_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/activity_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/algorithm.php');
+require_once(BASE_ROOT_PATH . '/helper/predeposit_helper.php');
 
 
 class cart_item
@@ -54,6 +55,39 @@ class cartControl extends mobileControl
     public function __construct() {
         parent::__construct();
     }
+
+    public function rate_moneyOp()
+    {
+        if($_SESSION['is_login'] == 1)
+        {
+            $pred = new predeposit_helper($_SESSION['member_id']);
+            $bonus_rate = $pred->bonus_rate();
+
+            if($bonus_rate != null)
+            {
+                $rates = $bonus_rate->format();
+                $rates_money = [];
+                foreach ($rates as $rate => $money) {
+                    $item['rate']  = $rate;
+                    $item['total'] = $money;
+                    $rates_money[] = $item;
+                }
+            } else {
+                $rates_money = null;
+            }
+
+            if(empty($rates_money)) {
+                $result['bonus_rate'] = null;
+            } else {
+                $result['bonus_rate'] = $rates_money;
+            }
+            return self::outsuccess($result);
+        }
+        else {
+            return self::outsuccess(null);
+        }
+    }
+
     public function listOp()
     {
         $model_cart	= Model('cart');