Explorar el Código

remove bonus rate

stanley-king hace 6 años
padre
commit
9f1452734e

+ 13 - 11
data/logic/buy.logic.php

@@ -251,7 +251,7 @@ class buyLogic
      * @param string $member_email
      * @return array
      */
-    public function buyStep2($post, $member_id, $member_name, $member_email,$use_bonus)
+    public function buyStep2($post, $member_id, $member_name, $member_email)
     {
         $this->_member_info['member_id']    = $member_id;
         $this->_member_info['member_name']  = $member_name;
@@ -270,9 +270,9 @@ class buyLogic
             //第3步 得到购买相关金额计算等信息
             $this->_createOrderStep3();
             //第4步 生成订单
-            $this->_createOrderStep4($use_bonus,$account);
+            $this->_createOrderStep4($account);
             //第5步 处理预存款
-            $this->_createOrderStep5($use_bonus,$account);
+            $this->_createOrderStep5($account);
             $trans->commit();
         }
         catch (Exception $e)
@@ -598,7 +598,7 @@ class buyLogic
      * @throws Exception
      * @return array array(支付单sn,订单列表)
      */
-    private function _createOrderStep4($use_bonus,bonus\IPriceCalculate $priceCalculate)
+    private function _createOrderStep4(bonus\IPriceCalculate $priceCalculate)
     {
         // extract() 函数从数组中将变量导入到当前的符号表。
         extract($this->_order_data);
@@ -606,6 +606,8 @@ class buyLogic
         $member_id = $this->_member_info['member_id'];
         $member_name = $this->_member_info['member_name'];
         $member_email = $this->_member_info['member_email'];
+        $use_bonus = $this->_post_data['usebonus'];
+        $room_id = intval($this->_post_data['room_id']);
 
         $model_order = Model('order');
         //存储生成的订单数据
@@ -675,9 +677,10 @@ class buyLogic
                 $bonusable_goods_amount = $calcer['bonusable_goods_amount'];
                 $lowest_price_amount = $calcer['lowest_price_amount'];
                 $bonus_amount = $priceCalculate->bonus_amount($bonusable_goods_amount,$lowest_price_amount);
-                $order['bonus_amount'] = $bonus_amount;
+                $bonus_detail = $priceCalculate->bonus_detail($bonus_amount,$room_id);
+                $order['bonus_amount'] = serialize($bonus_detail);
             } else {
-                $order['bonus_amount'] = 0;
+                $order['bonus_amount'] = '';
             }
 
             $order['order_from'] = $order_from;
@@ -806,7 +809,8 @@ class buyLogic
             }
 
             //将因舍出小数部分出现的差值补到最后一个商品的实际成交价中(商品goods_price=0时不给补,可能是赠品)
-            if ($promotion_total > $promotion_sum) {
+            if ($promotion_total > $promotion_sum)
+            {
                 $i--;
                 for($i;$i>=0;$i--) {
                     if (floatval($order_goods[$i]['goods_price']) > 0) {
@@ -971,12 +975,10 @@ class buyLogic
      * 充值卡、预存款、红包支付
      *
      */
-    private function _createOrderStep5($use_bonus,bonus\IPriceCalculate $priceCalculate)
+    private function _createOrderStep5(bonus\IPriceCalculate $priceCalculate)
     {
         $buyer_info	= Model('member')->getMemberInfoByID($this->_member_info['member_id']);
-        if($use_bonus) {
-            $this->_logic_buy_1->bonusPay($this->_order_data['order_list'], $this->_post_data, $buyer_info,$priceCalculate);
-        }
+        $this->_logic_buy_1->bonusPay($this->_order_data['order_list'], $this->_post_data, $buyer_info,$priceCalculate);
 
         if (empty($this->_post_data['password'])) return;
         if ($buyer_info['member_paypwd'] == '' || $buyer_info['member_paypwd'] != md5($this->_post_data['password'])) return ;

+ 11 - 72
data/logic/buy_1.logic.php

@@ -676,92 +676,31 @@ class buy_1Logic
      * 预存款支付,依次循环每个订单
      * 如果预存款足够就单独支付了该订单,如果不足就暂时冻结,等API支付成功了再彻底扣除
      */
-    public function bonusPay($order_list, $input, $buyer_info,bonus\IPriceCalculate $priceCalculate)
+    public function bonusPay($order_list,$input,$buyer_info,bonus\IPriceCalculate $priceCalculate)
     {
         $member_id = $buyer_info['member_id'];
         $member_name = $buyer_info['member_name'];
 
-        $model_order = Model('order');
         $model_pd = Model('predeposit');
         foreach ($order_list as $order_info)
         {
-            //货到付款的订单、已经充值卡支付的订单跳过
+            //货到付款的订单、已经支付的订单跳过
             if ($order_info['payment_code'] == 'offline') continue;
             if ($order_info['order_state'] == ORDER_STATE_PAY) continue;
 
-            $bonus_amount = $order_info['bonus_amount'];
-//            $priceCalculate->pay();
+            $bonus_amount = unserialize($order_info['bonus_amount']);
+            $user_bonus = $bonus_amount['user_bonus'];
+            $room_id = $bonus_amount['room_id'];
+            $room_bonus = $bonus_amount['room_bonus'];
+
+            $priceCalculate->hold_bonus($user_bonus,$room_id,$room_bonus);
 
-            $order_amount = floatval($order_info['order_amount']) - floatval($order_info['rcb_amount']);
             $data_pd = array();
-            $data_pd['member_id'] = $member_id;
+            $data_pd['member_id']   = $member_id;
             $data_pd['member_name'] = $member_name;
-            $data_pd['amount'] = $order_amount;
+            $data_pd['amount']   = $user_bonus;
             $data_pd['order_sn'] = $order_info['order_sn'];
-
-            if ($available_pd_amount >= $order_amount)
-            {
-                //预存款立即支付,订单支付完成
-                $model_pd->changePd('order_pay',$data_pd);
-                $available_pd_amount -= $order_amount;
-
-                //支付被冻结的充值卡
-                $rcb_amount = floatval($order_info['rcb_amount']);
-                if ($rcb_amount > 0) {
-                    $data_pd = array();
-                    $data_pd['member_id'] = $member_id;
-                    $data_pd['member_name'] = $member_name;
-                    $data_pd['amount'] = $rcb_amount;
-                    $data_pd['order_sn'] = $order_info['order_sn'];
-                    $model_pd->changeRcb('order_comb_pay',$data_pd);
-                }
-
-                //记录订单日志(已付款)
-                $data = array();
-                $data['order_id'] = $order_info['order_id'];
-                $data['log_role'] = 'buyer';
-                $data['log_msg'] = L('order_log_pay');
-                $data['log_orderstate'] = ORDER_STATE_PAY;
-                $insert = $model_order->addOrderLog($data);
-                if (!$insert) {
-                    throw new Exception('记录订单预存款支付日志出现错误');
-                }
-
-                //订单状态 置为已支付
-                $data_order = array();
-                $data_order['order_state'] = ORDER_STATE_PAY;
-                $data_order['payment_time'] = time();
-                $data_order['payment_code'] = 'predeposit';
-                $data_order['pd_amount'] = $order_amount;
-                $result = $model_order->editOrder($data_order,array('order_id'=>$order_info['order_id']));
-                if (!$result) {
-                    throw new Exception('订单更新失败');
-                }
-                // 发送商家提醒
-                $param = array();
-                $param['code'] = 'new_order';
-                $param['store_id'] = $order_info['store_id'];
-                $param['param'] = array(
-                    'order_sn' => $order_info['order_sn']
-                );
-                QueueClient::push('sendStoreMsg', $param);
-            }
-            else
-            {
-                //暂冻结预存款,后面还需要 API彻底完成支付
-                if ($available_pd_amount > 0) {
-                    $data_pd['amount'] = $available_pd_amount;
-                    $model_pd->changePd('order_freeze',$data_pd);
-                    //预存款支付金额保存到订单
-                    $data_order = array();
-                    $data_order['pd_amount'] = $available_pd_amount;
-                    $result = $model_order->editOrder($data_order,array('order_id'=>$order_info['order_id']));
-                    $available_pd_amount = 0;
-                    if (!$result) {
-                        throw new Exception('订单更新失败');
-                    }
-                }
-            }
+            $model_pd->changeBonus('order_pay',$data_pd);
         }
     }
 

+ 125 - 117
data/logic/payment.logic.php

@@ -11,120 +11,120 @@ require_once (BASE_ROOT_PATH . '/helper/bonus_helper.php');
 
 class paymentLogic
 {
-    public function calcPredeposit($pay_sn,$member_info,&$avail_pred,&$used_pred)
-    {
-        //验证订单信息
-        $model_order = Model('order');
-        $order_pay_info = $model_order->getOrderPayInfo(array('pay_sn' => $pay_sn, 'buyer_id' => $member_info['member_id']));
-        if (empty($order_pay_info)) {
-            return false;
-        }
-        $member_id = intval($member_info['member_id']);
-
-        $mod_member = Model('member');
-        $pd_amount = $mod_member->getPdAmount($member_id);
-        $avail_pred = $pd_amount;
-
-        $order_list = $model_order->getNormalOrderList(array('pay_sn' => $pay_sn));
-        $pred_helper = new account($member_id);
-        $pd_amount = intval($pd_amount * 100 + 0.5);
-
-        $used_pred = intval(0);
-        $can_used = 0;
-        foreach ($order_list as $order_info)
-        {
-            $order_pd_amount = $pred_helper->calc_pred($order_info, $pd_amount, $no_cash);
-
-            $pd_amount -= $order_pd_amount;
-            $can_used  += $order_pd_amount;
-        }
-
-        $used_pred = floatval($used_pred) / 100;
-
-        return ($can_used / 100);
-    }
-
-    /**
-     * @param int $pay_sn
-     * @param int $member_id
-     */
-    //add by stanley
-    public function payPredepositEx($pay_sn, $member_info)
-    {
-        //验证订单信息
-        $model_order = Model('order');
-        $order_pay_info = $model_order->getOrderPayInfo(['pay_sn' => $pay_sn, 'buyer_id' => $member_info['member_id']],true);
-        if (empty($order_pay_info)) {
-            return false;
-        }
-        $member_id = intval($member_info['member_id']);
-
-        $mod_member = Model('member');
-        $pd_amount = $mod_member->getPdAmount($member_id);
-        $order_list = $model_order->getNormalOrderListEx(['pay_sn' => $pay_sn],true);
-
-        $model_pd = Model('predeposit');
-        $pred = new account($member_id,true);
-
-        $pd_amount = intval($pd_amount * 100 + 0.5);
-        foreach ($order_list as $order_info)
-        {
-            try
-            {
-                $trans = new trans_wapper(null, __METHOD__);
-
-                $order_pd_amount = $order_info['pd_amount'];
-                $order_amount = $order_info['order_amount'];
-
-                $rates = $pred->calc_rates($order_pd_amount);
-                if (!empty($rates)) {
-                    Model()->table('order')->where(['order_id' => $order_info['order_id']])->update(['bonus_rate' => serialize($rates)]);
-                }
-                $pred->pay_bonus($rates);
-
-                $no_cash = intval($order_amount * 100 + 0.5) == intval($order_pd_amount * 100 + 0.5);
-                $pd_amount -= $order_pd_amount;
-                $fEdit = true;
-                if ($no_cash) {
-                    $change_type = 'order_pay';
-                }
-                else
-                {
-                    if ($order_pd_amount > 0) {
-                        $change_type = 'order_freeze';
-                    } else {
-                        $fEdit = false;
-                    }
-                }
-
-                if ($fEdit)
-                {
-                    $data_pd = [];
-                    $data_pd['member_id'] = $member_id;
-                    $data_pd['member_name'] = $member_info['member_name'];
-                    $data_pd['amount'] = $order_pd_amount;
-                    $data_pd['order_sn'] = $order_info['order_sn'];
-                    //预存款立即支付,订单支付完成
-
-                    $ret = $model_pd->changePd($change_type, $data_pd);
-                    if (0 == $ret) {
-                        throw new Exception("订单更新失败");
-                    }
-                }
-                $trans->commit();
-            }
-            catch (Exception $e)
-            {
-                $trans->rollback();
-                return false;
-            }
-
-//            QueueClient::push('onPredeposit',['change_type' => $change_type, 'buyer_id' => $member_id, 'order_sn' => $order_info['order_sn']]);
-        }
-
-        return true;
-
-    }
+//    public function calcPredeposit($pay_sn,$member_info,&$avail_pred,&$used_pred)
+//    {
+//        //验证订单信息
+//        $model_order = Model('order');
+//        $order_pay_info = $model_order->getOrderPayInfo(array('pay_sn' => $pay_sn, 'buyer_id' => $member_info['member_id']));
+//        if (empty($order_pay_info)) {
+//            return false;
+//        }
+//        $member_id = intval($member_info['member_id']);
+//
+//        $mod_member = Model('member');
+//        $pd_amount = $mod_member->getPdAmount($member_id);
+//        $avail_pred = $pd_amount;
+//
+//        $order_list = $model_order->getNormalOrderList(array('pay_sn' => $pay_sn));
+//        $pred_helper = new account($member_id);
+//        $pd_amount = intval($pd_amount * 100 + 0.5);
+//
+//        $used_pred = intval(0);
+//        $can_used = 0;
+//        foreach ($order_list as $order_info)
+//        {
+//            $order_pd_amount = $pred_helper->calc_pred($order_info, $pd_amount, $no_cash);
+//
+//            $pd_amount -= $order_pd_amount;
+//            $can_used  += $order_pd_amount;
+//        }
+//
+//        $used_pred = floatval($used_pred) / 100;
+//
+//        return ($can_used / 100);
+//    }
+//
+//    /**
+//     * @param int $pay_sn
+//     * @param int $member_id
+//     */
+//    //add by stanley
+//    public function payPredepositEx($pay_sn, $member_info)
+//    {
+//        //验证订单信息
+//        $model_order = Model('order');
+//        $order_pay_info = $model_order->getOrderPayInfo(['pay_sn' => $pay_sn, 'buyer_id' => $member_info['member_id']],true);
+//        if (empty($order_pay_info)) {
+//            return false;
+//        }
+//        $member_id = intval($member_info['member_id']);
+//
+//        $mod_member = Model('member');
+//        $pd_amount = $mod_member->getPdAmount($member_id);
+//        $order_list = $model_order->getNormalOrderListEx(['pay_sn' => $pay_sn],true);
+//
+//        $model_pd = Model('predeposit');
+//        $pred = new account($member_id,true);
+//
+//        $pd_amount = intval($pd_amount * 100 + 0.5);
+//        foreach ($order_list as $order_info)
+//        {
+//            try
+//            {
+//                $trans = new trans_wapper(null, __METHOD__);
+//
+//                $order_pd_amount = $order_info['pd_amount'];
+//                $order_amount = $order_info['order_amount'];
+//
+//                $rates = $pred->calc_rates($order_pd_amount);
+//                if (!empty($rates)) {
+//                    Model()->table('order')->where(['order_id' => $order_info['order_id']])->update(['bonus_rate' => serialize($rates)]);
+//                }
+//                $pred->pay_bonus($rates);
+//
+//                $no_cash = intval($order_amount * 100 + 0.5) == intval($order_pd_amount * 100 + 0.5);
+//                $pd_amount -= $order_pd_amount;
+//                $fEdit = true;
+//                if ($no_cash) {
+//                    $change_type = 'order_pay';
+//                }
+//                else
+//                {
+//                    if ($order_pd_amount > 0) {
+//                        $change_type = 'order_freeze';
+//                    } else {
+//                        $fEdit = false;
+//                    }
+//                }
+//
+//                if ($fEdit)
+//                {
+//                    $data_pd = [];
+//                    $data_pd['member_id'] = $member_id;
+//                    $data_pd['member_name'] = $member_info['member_name'];
+//                    $data_pd['amount'] = $order_pd_amount;
+//                    $data_pd['order_sn'] = $order_info['order_sn'];
+//                    //预存款立即支付,订单支付完成
+//
+//                    $ret = $model_pd->changePd($change_type, $data_pd);
+//                    if (0 == $ret) {
+//                        throw new Exception("订单更新失败");
+//                    }
+//                }
+//                $trans->commit();
+//            }
+//            catch (Exception $e)
+//            {
+//                $trans->rollback();
+//                return false;
+//            }
+//
+////            QueueClient::push('onPredeposit',['change_type' => $change_type, 'buyer_id' => $member_id, 'order_sn' => $order_info['order_sn']]);
+//        }
+//
+//        return true;
+//
+//    }
 
     /**
      * 取得实物订单所需支付金额等信息, 移动支付时, 在使用红包时需要计算运费
@@ -154,9 +154,17 @@ class paymentLogic
         $pay_amount = 0;
         if (!empty($order_list))
         {
-
-            foreach ($order_list as $order_info) {
-                $pay_amount += ncPriceFormat(floatval($order_info['order_amount']) - floatval($order_info['pd_amount']));
+            foreach ($order_list as $order_info)
+            {
+                $bonus_amount = unserialize($order_info['bonus_amount']);
+                $user_bonus = $bonus_amount['user_bonus'];
+                $room_id = $bonus_amount['room_id'];
+                $room_bonus = $bonus_amount['room_bonus'];
+                $bonus_total = $user_bonus;
+                if($room_id > 0) {
+                    $bonus_total += $room_bonus;
+                }
+                $pay_amount += ncPriceFormat(floatval($order_info['order_amount']) - floatval($order_info['pd_amount']) - floatval($bonus_total));
                 $order_sn = $order_info['order_sn'];
             }
             $subject = "实物订单_{$order_sn}";

+ 121 - 26
helper/bonus/account.php

@@ -30,7 +30,9 @@ interface IPriceCalculate
     public function order_cash($goods_price, $goods_lowest_price);
     public function discount_gap($bonus_price, $goods_lowest_price);
     public function bonus_amount($goods_amount,$goods_lowest_amount);
-    public function pay($bonus_amount,$params);
+    public function bonus_way($bonus_amount);
+    public function bonus_detail($bonus_amount,$room_id);
+    public function hold_bonus($user_bonus,$room_id,$room_bonus);
 }
 
 class normal_calc implements IPriceCalculate
@@ -56,10 +58,16 @@ class normal_calc implements IPriceCalculate
     {
         return 0.00;
     }
-    public function pay($bonus_amount,$params) {
+    public function hold_bonus($user_bonus,$room_id,$room_bonus) {
 
     }
-
+    public function bonus_way($bonus_amount) {
+        return [];
+    }
+    public function bonus_detail($bonus_amount,$room_id)
+    {
+        return [];
+    }
 }
 
 class account implements IPriceCalculate
@@ -72,7 +80,6 @@ class account implements IPriceCalculate
     private $mRateVersion; //用来记录,红包过期带来的红包变化
     private $mFromSession;
     private $mRoomBonus;
-    private $mRoomAmount;
     private $mDirty;
 
     public function __construct($member_id, $from_session = false)
@@ -106,21 +113,56 @@ class account implements IPriceCalculate
     private function init_roombonus()
     {
         $this->mRoomBonus = [];
-        $this->mRoomAmount = 0.0;
-        $this->mRoomBonus = room_helper::user_rooms($this->member_id);
+        $items = room_helper::user_rooms($this->member_id);
+        foreach ($items as $item)
+        {
+            $amount = $item['shared_bonus'];
+//            $cent = intval($amount *  100 + 0.5);
+//            if($cent <= 0) continue;
 
-        $amount = 0;
-        foreach ($this->mRoomBonus as $bonus) {
-            $amount += $bonus['shared_bonus'];
+            $room_id= $item['room_id'];
+            $name   = $item['name'];
+            $avatar = $item['avatar'];
+            $this->mRoomBonus[] = ['room_id' => $room_id,'amount' => $amount,'name' => $name,'avatar' => $avatar];
+        }
+        if(!empty($this->mRoomBonus)) {
+            usort($this->mRoomBonus,['bonus\account','sort_room_bonus']);
+        }
+    }
+
+    private function find_room($amount)
+    {
+        $result = [];
+
+        $amount = intval(100 * $amount);
+        foreach ($this->mRoomBonus as $item) {
+            $cent = intval($item['amount'] * 100 + 0.5);
+            if($amount <= $cent) {
+                $result[] = $item;
+            }
+            else {
+                return $result;
+            }
         }
-        $this->mRoomAmount = intval($amount * 100 + 0.5) / 100;
+    }
+
+    static public function sort_room_bonus($l,$r)
+    {
+        $l_val = intval($l['amount'] * 100 + 0.5);
+        $r_val = intval($r['amount'] * 100 + 0.5);
+
+        if($l_val > $r_val)
+            return -1;
+        elseif($l_val < $r_val)
+            return 1;
+        else
+            return 0;
     }
 
     public function member_id()
     {
         return $this->member_id;
     }
-
     private function init_rate()
     {
         if ($this->mFromSession)
@@ -214,7 +256,12 @@ class account implements IPriceCalculate
 
     public function usable_bonus()
     {
-        return ($this->mRoomAmount + $this->total_bonus());
+        if(empty($this->mRoomBonus)) {
+            return $this->total_bonus();
+        } else {
+            $ramount = $this->mRoomBonus[0]['amount'];
+            return ($ramount + $this->total_bonus());
+        }
     }
 
     public function share_bonus_rates()
@@ -815,7 +862,7 @@ class account implements IPriceCalculate
     {
         $can_use = $goods_amount - $goods_lowest_amount;
         $can_use_cent = intval($can_use * 100 + 0.5);
-        $usable_cent = intval($this->usable_bonus() * 100 + 0.5);
+        $usable_cent  = intval($this->usable_bonus() * 100 + 0.5);
 
         if ($usable_cent >= $can_use_cent) {
             return ($can_use_cent / 100);
@@ -824,26 +871,74 @@ class account implements IPriceCalculate
         }
     }
 
-    public function pay($bonus_amount,$params) {
+    public function bonus_way($bonus_amount)
+    {
+        $result = [];
+        $need_cent = intval($bonus_amount * 100 + 0.5);
+        $mine_cent = intval($this->total_bonus() * 100 + 0.5);
 
+        if($mine_cent >= $need_cent) {
+            $result['available_bonus'] = $need_cent / 100;
+            $result['show_room'] = false;
+            $result['room_bonus'] = 0;
+            $result['rooms'] = [];
+        }
+        else
+        {
+            $result['available_bonus'] = $mine_cent / 100;
+            $room_bonus = ($need_cent - $mine_cent) / 100;
+            $rooms = $this->find_room($room_bonus);
+            if(empty($rooms)) {
+                $result['show_room'] = false;
+                $result['room_bonus'] = 0;
+                $result['rooms'] = [];
+            } else {
+                $result['show_room'] = true;
+                $result['room_bonus'] = $room_bonus;
+                $result['rooms'] = $rooms;
+            }
+        }
+
+        return $result;
+    }
+    public function bonus_detail($bonus_amount,$roomid)
+    {
+        $ways = $this->bonus_way($bonus_amount);
+        if($ways['show_room'] == false || $roomid <= 0) {
+            return ['user_bonus' => $ways['available_bonus']];
+        }
+
+        $room_val = 0;
+        foreach ($ways['rooms'] as $room)
+        {
+            if($roomid == $room['room_id']) {
+                $room_val = $ways['room_bonus'];
+                break;
+            }
+        }
+
+        return ['user_bonus' => $ways['available_bonus'],'room_bonus' => $room_val,'room_id' => $roomid];
+    }
+
+    public function hold_bonus($user_bonus,$room_id,$room_bonus)
+    {
+        if(intval($user_bonus * 100 + 0.5) > 0)
+        {
+            bonus_helper::withold($this->member_id, [30 => $user_bonus], bonus_helper::pay_order_withold);
+            $this->mPayRates->with_hold(30, $user_bonus);
+            $this->mDirty = true;
+        }
+
+        if($room_id > 0 && intval($room_bonus * 100 + 0.5) > 0) {
+
+        }
     }
+
     static public function admin_make_bonus($param, $rate_moneys)
     {
         return bonus_helper::make_bonus($param, $rate_moneys);
     }
 
-    //    static public function order_cash($goods_amount, &$rates)
-//    {
-//        if (isset($_SESSION['bonus_rate']) == false) {
-//            $pred = new account($_SESSION['member_id'], true);
-//            $bonus_rate = $pred->pay_bonus_rates();
-//        } else {
-//            $bonus_rate = self::create_moneycalc($_SESSION['bonus_rate']);
-//        }
-//
-//        return $bonus_rate->calc_money($goods_amount, $rates);
-//    }
-
     static public function bonus_refund($bonus_type)
     {
         $types = bonus\type::create_by_paramer($bonus_type);

+ 87 - 79
helper/buy_first.php

@@ -71,11 +71,20 @@ class buy_first
 
         $calcer = $this->calc_goods();
         $bonusable_goods_amount = $calcer['bonusable_goods_amount'];
-        $max_bonus_amount = $calcer['max_bonus_amount'];
         $lowest_price_amount = $calcer['lowest_price_amount'];
 
-        $result['available_pred'] = $this->mPriceCalculate->bonus_amount($bonusable_goods_amount,$lowest_price_amount);
-        $result['available_bonus'] = $this->mPriceCalculate->bonus_amount($bonusable_goods_amount,$lowest_price_amount);
+//        $result['available_pred'] = $this->mPriceCalculate->bonus_amount($bonusable_goods_amount,$lowest_price_amount);
+//        $result['available_bonus'] = $this->mPriceCalculate->bonus_amount($bonusable_goods_amount,$lowest_price_amount);
+
+        $total_bonus = $this->mPriceCalculate->bonus_amount($bonusable_goods_amount,$lowest_price_amount);
+        $ways = $this->mPriceCalculate->bonus_way($total_bonus);
+        $result['available_bonus'] = $ways['available_bonus'];
+        $result['available_pred']  = $ways['available_bonus'];
+
+        $result['show_room']  = $ways['show_room'];
+        $result['room_bonus']  = $ways['room_bonus'];
+        $result['rooms']  = $ways['rooms'];
+
         $order_cash = $this->mPriceCalculate->order_cash($bonusable_goods_amount,$lowest_price_amount);
         $discount_gap = $this->mPriceCalculate->discount_gap($order_cash,$lowest_price_amount);
         if($discount_gap == false) {
@@ -393,82 +402,81 @@ class buy_first
         return ['bonusable_goods_amount' => $goods_amount, 'max_bonus_amount' => $bonus_amount,'lowest_price_amount' => $lowest_amount];
     }
 
-    private function available_pred($goods_amount,$full_discount,$pd_total,&$rates,&$discount_gap,&$gap_show)
-    {
-        $full = intval($full_discount * 100 + 0.5);
-        $pred_amound = $this->pred_goods_amount();
-        $pred_cent = intval($pred_amound * 100 + 0.5);
-        if($pred_cent > 0)
-        {
-            $gap_show = true;
-            if($full > 0) {
-                $pred_amound = $pred_amound - ($pred_amound / $goods_amount) * $full_discount;
-            }
-            $bonus_goods_amount = $pred_amound;
-            $pred_amound = $pred_amound - account::order_cash($pred_amound,$rates);
-
-            $pred_cend = intval($pred_amound * 100 + 0.5);
-            $pd_total  = intval($pd_total * 100 + 0.5);
-
-            $ret = ($pred_cend > $pd_total) ? ($pd_total / 100) : ($pred_cend / 100);
-            $discount_gap = $this->mPriceCalculate->discount_gap($bonus_goods_amount - $ret,$bonus_goods_amount);
-
-            return $ret;
-        }
-        else
-        {
-            $rates = [];
-            $gap_show = false;
-            $discount_gap = 0.00;
-
-            return 0.00;
-        }
-    }
-
-
-    private function pred_goods_amount()
-    {
-        $pred_amount = 0.00;
-        $store_cart_list = $this->mLogicOut['store_cart_list'];
-        foreach ($store_cart_list as $store_id => $cart_list)
-        {
-            $opgoods = $this->mLogicOut['optional_goods'][$store_id];
-
-            foreach ($cart_list as $cart)
-            {
-                $goods_total = $cart['goods_total'];
-                if(intval($cart['bl_id']) > 0) {
-                }
-                elseif(!empty($cart['groupbuy_info'])) {
-                }
-                elseif(!empty($cart['xianshi_info'])) {
-                }
-                else
-                {
-                    if(empty($opgoods)) {
-                        $pred_amount += $goods_total;
-                    }
-                    else
-                    {
-                        $goods_id = intval($cart['goods_id']);
-                        if(array_key_exists($goods_id,$opgoods['goods_nums']))
-                        {
-                            $goods_price = $cart['goods_price'];
-                            $goods_num = intval($cart['goods_num']);
-                            $opnum = $opgoods['goods_nums'][$goods_id];
-                            if($goods_num > $opnum) {
-                                $pred_amount += $goods_price * ($goods_num - $opnum);
-                            }
-                        }
-                        else {
-                            $pred_amount += $goods_total;
-                        }
-                    }
-                }
-            }
-        }
-        return $pred_amount;
-    }
+//    private function available_pred($goods_amount,$full_discount,$pd_total,&$rates,&$discount_gap,&$gap_show)
+//    {
+//        $full = intval($full_discount * 100 + 0.5);
+//        $pred_amound = $this->pred_goods_amount();
+//        $pred_cent = intval($pred_amound * 100 + 0.5);
+//        if($pred_cent > 0)
+//        {
+//            $gap_show = true;
+//            if($full > 0) {
+//                $pred_amound = $pred_amound - ($pred_amound / $goods_amount) * $full_discount;
+//            }
+//            $bonus_goods_amount = $pred_amound;
+//            $pred_amound = $pred_amound - account::order_cash($pred_amound,$rates);
+//
+//            $pred_cend = intval($pred_amound * 100 + 0.5);
+//            $pd_total  = intval($pd_total * 100 + 0.5);
+//
+//            $ret = ($pred_cend > $pd_total) ? ($pd_total / 100) : ($pred_cend / 100);
+//            $discount_gap = $this->mPriceCalculate->discount_gap($bonus_goods_amount - $ret,$bonus_goods_amount);
+//
+//            return $ret;
+//        }
+//        else
+//        {
+//            $rates = [];
+//            $gap_show = false;
+//            $discount_gap = 0.00;
+//
+//            return 0.00;
+//        }
+//    }
+
+//    private function pred_goods_amount()
+//    {
+//        $pred_amount = 0.00;
+//        $store_cart_list = $this->mLogicOut['store_cart_list'];
+//        foreach ($store_cart_list as $store_id => $cart_list)
+//        {
+//            $opgoods = $this->mLogicOut['optional_goods'][$store_id];
+//
+//            foreach ($cart_list as $cart)
+//            {
+//                $goods_total = $cart['goods_total'];
+//                if(intval($cart['bl_id']) > 0) {
+//                }
+//                elseif(!empty($cart['groupbuy_info'])) {
+//                }
+//                elseif(!empty($cart['xianshi_info'])) {
+//                }
+//                else
+//                {
+//                    if(empty($opgoods)) {
+//                        $pred_amount += $goods_total;
+//                    }
+//                    else
+//                    {
+//                        $goods_id = intval($cart['goods_id']);
+//                        if(array_key_exists($goods_id,$opgoods['goods_nums']))
+//                        {
+//                            $goods_price = $cart['goods_price'];
+//                            $goods_num = intval($cart['goods_num']);
+//                            $opnum = $opgoods['goods_nums'][$goods_id];
+//                            if($goods_num > $opnum) {
+//                                $pred_amount += $goods_price * ($goods_num - $opnum);
+//                            }
+//                        }
+//                        else {
+//                            $pred_amount += $goods_total;
+//                        }
+//                    }
+//                }
+//            }
+//        }
+//        return $pred_amount;
+//    }
 
     public function check_fcode(&$err)
     {

+ 0 - 2
helper/model/goods_summary.php

@@ -250,8 +250,6 @@ class goods_summary
         $summary['goods_url'] = BASE_SITE_URL . "/mshop/goods_detail?goods_id={$summary['goods_id']}";
         $summary['goods_miniurl'] = "pages/details/details?goods_id={$summary['goods_id']}";
 
-        //todo need true data
-        $summary['lowest_price'] = 19000.00;
         return $summary;
     }
 

+ 7 - 10
helper/pay_helper.php

@@ -52,15 +52,16 @@ class pay_helper
         $this->mPaysn = $paysn;
     }
 
-    private function pay_bonus()
-    {
-        $pay_sn = $this->mPaysn;
-        $member_info = array('member_id' => session_helper::memberid(), 'member_name'  => session_helper::nickname());
-        $this->mPaymentLogic->payPredepositEx($pay_sn,$member_info);
-    }
+//    private function pay_bonus()
+//    {
+//        $pay_sn = $this->mPaysn;
+//        $member_info = array('member_id' => session_helper::memberid(), 'member_name'  => session_helper::nickname());
+//        $this->mPaymentLogic->payPredepositEx($pay_sn,$member_info);
+//    }
 
     public function pay($payment,$usebonus,&$err)
     {
+        $usebonus = false;
         if($this->mOrderType == self::real_order) {
             return $this->real_pay($payment,$usebonus,$err);
         } else {
@@ -71,10 +72,6 @@ class pay_helper
     private function real_pay($payment,$usebonus,&$err)
     {
         $pay_sn = $this->mPaysn;
-        if($usebonus) {
-            $this->pay_bonus();
-        }
-
         $payinfo = $this->mPaymentLogic->getRealOrderInfo($pay_sn, $_SESSION['member_id'],true);
         if (intval($payinfo['data']['api_pay_state']) != 0) {
             $err = array('code' => errcode::ErrPayment, 'msg' => $payinfo['msg']);

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 325
mobile/control/app_pay.php


+ 0 - 1
mobile/control/cart.php

@@ -280,7 +280,6 @@ class cartControl extends mobileControl
         return $blocks;
     }
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
     private function remove_err($cart_infos,$err_goods)
     {
         if(empty($err_goods)) return $cart_infos;

+ 2 - 1
mobile/control/crash_log.php

@@ -18,7 +18,8 @@ class crash_logControl extends mobileHomeControl
     public function uploadOp()
     {
         $crash_content = $_POST['content'];
-        if (!empty($crash_content)) {
+        if (!empty($crash_content))
+        {
             $platform = $_GET['client'];
             if (!empty($platform)) {
                 $path = BASE_DATA_PATH . '/log/' . $platform . '/';

+ 0 - 60
mobile/control/delivery.php

@@ -1,60 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 16/2/22
- * Time: 上午11:47
- */
-
-
-class deliveryControl extends mobileHomeControl
-{
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-
-    /**
-     * @desc:物流信息查询
-     * @author:jiafang.wang
-     * @since: 2016.2.22
-     */
-    public function queryOp()
-    {
-        //获取物流单号
-        //$order_sn = $_GET['order_sn'];
-        //$condition = ['order_sn' => $order_sn];
-        //$postid = Model()->table('goods')->where($condition)->field('shipping_code')->find();
-        $postid = '227270508536';
-
-
-        //查询本地是否有
-            //取参数
-            //请求快递100
-            //取得json
-            //存数据库
-        //获取物流公司
-
-        $com = 'shentong';
-        //key
-        $key = '5b634ac27f4c1a82';
-        //组装URL查询
-        $url = "http://api.kuaidi100.com/api";//?id={$key}&com={$com}&nu={$postid}&show=0&muti=1&order=desc";
-        $params = array();
-        {
-            $params['id'] = $key;
-            $params['com'] = $com;
-            $params['nu'] = $postid;
-            $params['show'] = 0;
-            $params['muti'] = 1;
-            $params['order'] = 'desc';
-        }
-
-        $response = http_request($url, $params, 'GET');
-        $data = json_decode($response);
-
-        Tpl::output('info', $data);
-        Tpl::showpage('express_info');
-    }
-}

+ 0 - 35
mobile/control/efficacy.php

@@ -1,35 +0,0 @@
-<?php
-/**
- *
- */
-
-
-defined('InShopNC') or exit('Access Invalid!');
-
-class efficacyControl extends mobileHomeControl
-{
-    public function __construct() {
-        parent::__construct();
-    }
-
-    public function indexOp(){
-
-    }
-
-    /**
-     * 获取功效列表
-     */
-    public function efficacy_listOp()
-    {
-        $efficacy_list = Model()->table('goods_efficacy')->order('sort asc')->select();
-
-        $result = array();
-        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));
-    }
-}

+ 0 - 81
mobile/control/find.php

@@ -1,81 +0,0 @@
-<?php
-/**
- * 手机app发现tab页中的请求内容
- */
-
-
-defined('InShopNC') or exit('Access Invalid!');
-
-class findControl extends mobileHomeControl
-{
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * 发现页面左边栏请求内容
-     */
-    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) {
-
-            $item['id'] = $value['id'];
-            $item['name'] = $value['name'];
-            $item['type'] = $value['category_type'];
-            $item['gc_id'] = $value['gc_id'];
-
-            array_push($result, $item);
-        }
-        joutput_data(array("category" => $result));
-    }
-
-    /**
-     * 此时需要带图片了
-     */
-    public function category_list_2Op()
-    {
-
-        $category_list = Model()->table('category_item')->where(array('category_type' => 'keyword', 'enable' => '1'))->order('sort asc')->select();
-
-        $result = array();
-        foreach ($category_list as $value) {
-
-            $item['id'] = $value['id'];
-            $item['name'] = $value['name'];
-            $item['type'] = $value['category_type'];
-            $item['gc_id'] = $value['gc_id'];
-            $item['img'] = $this->_formatPic($value['img']);
-
-            // 子查询
-            $child_list = Model()->table('goods_class')->where(array('gc_parent_id' => $value['gc_id']))->select();
-
-            $child = array();
-            foreach ($child_list as $child_value) {
-                $child_item['id'] = $child_value['gc_id'];
-                $child_item['gc_name'] = $child_value['gc_name'];
-                $child_item['gc_id'] = $child_value['gc_id'];
-                array_push($child, $child_item);
-            }
-
-            $item['child_item'] = $child;
-            array_push($result, $item);
-        }
-        joutput_data(array("category" => $result));
-    }
-
-    /**
-     * 添加图片路径
-     */
-    private function _formatPic($filename)
-    {
-        if (!isset($filename) || empty($filename)) {
-            return '';
-        }
-        return UPLOAD_SITE_URL . '/shop/class/' . $filename;
-    }
-
-}

+ 0 - 685
mobile/control/goods.php

@@ -1,685 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 16/3/18
- * Time: 下午10:11
- */
-
-defined('InShopNC') or exit('Access Invalid!');
-
-class goodsControl extends mobileControl
-{
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * 单个商品信息页
-     */
-    public function indexOp()
-    {
-        $goods_id = intval($_GET['goods_id']);
-        if (empty($_GET ['goods_id']) || $goods_id < 0) {
-            return self::outerr(errcode::ErrParamter, "goods_id = {$goods_id} must be > 0.");
-        }
-        // 商品详细信息
-        $model_goods = Model('goods');
-        $goods_detail = $model_goods->getGoodsDetail($goods_id);
-        $goods_info = $goods_detail['goods_info'];
-        if (empty($goods_info)) {
-            return self::outerr(errcode::ErrGoodsNotExist);
-        }
-        $rs = $model_goods->getGoodsList(array('goods_commonid' => $goods_info['goods_commonid']));
-        $count = 0;
-        foreach ($rs as $v) {
-            $count += $v['goods_salenum'];
-        }
-        $goods_info['goods_salenum'] = $count;
-        $model_store = Model('store');
-        $store_info = $model_store->getStoreOnlineInfoByID($goods_info['store_id']);
-        //  添加 end
-
-        Tpl::output('spec_list', $goods_detail['spec_list']);
-        Tpl::output('spec_image', $goods_detail['spec_image']);
-        Tpl::output('goods_image', $goods_detail['goods_image']);
-        Tpl::output('mansong_info', $goods_detail['mansong_info']);
-        Tpl::output('gift_array', $goods_detail['gift_array']);
-
-        // 生成缓存的键值
-        $hash_key = $goods_info['goods_id'];
-        $_cache = rcache($hash_key, 'product');
-        if (empty($_cache)) { // 查询SNS中该商品的信息
-            $snsgoodsinfo = Model('sns_goods')->getSNSGoodsInfo(array('snsgoods_goodsid' => $goods_info['goods_id']), 'snsgoods_likenum,snsgoods_sharenum');
-            $data = array();
-            $data['likenum'] = $snsgoodsinfo['snsgoods_likenum'];
-            $data['sharenum'] = $snsgoodsinfo['snsgoods_sharenum'];
-            // 缓存商品信息
-            wcache($hash_key, $data, 'product');
-        }
-        $goods_info = array_merge($goods_info, $_cache);
-
-        $inform_switch = true;
-        // 检测商品是否下架,检查是否为店主本人
-        if ($goods_info['goods_state'] != 1 || $goods_info['goods_verify'] != 1 || $goods_info['store_id'] == $_SESSION['store_id']) {
-            $inform_switch = false;
-        }
-        Tpl::output('inform_switch', $inform_switch);
-
-        // 如果使用运费模板
-        if ($goods_info['transport_id'] > 0) {
-            // 取得三种运送方式默认运费
-            $model_transport = Model('transport');
-            $transport = $model_transport->getExtendList(array('transport_id' => $goods_info['transport_id'], 'is_default' => 1));
-            if (!empty($transport) && is_array($transport)) {
-                foreach ($transport as $v) {
-                    $goods_info[$v['type'] . "_price"] = $v['sprice'];
-                }
-            }
-        }
-        Tpl::output('goods', $goods_info);
-
-        //v3-b11 抢购商品是否开始
-        $IsHaveBuy = 0;
-        if (!empty($_SESSION['member_id'])) {
-            $buyer_id = $_SESSION['member_id'];
-            $promotion_type = $goods_info["promotion_type"];
-            if ($promotion_type == 'groupbuy') {
-                //检测是否限购数量
-                $upper_limit = $goods_info["upper_limit"];
-                if ($upper_limit > 0) {
-                    //查询些会员的订单中,是否已买过了
-                    $model_order = Model('order');
-                    //取商品列表
-                    $order_goods_list = $model_order->getOrderGoodsList(array('goods_id' => $goods_id, 'buyer_id' => $buyer_id, 'goods_type' => 2));
-                    if ($order_goods_list) {
-                        //取得上次购买的活动编号(防一个商品参加多次团购活动的问题)
-                        $promotions_id = $order_goods_list[0]["promotions_id"];
-                        //用此编号取数据,检测是否这次活动的订单商品。
-                        $model_groupbuy = Model('groupbuy');
-                        $groupbuy_info = $model_groupbuy->getGroupbuyInfo(array('groupbuy_id' => $promotions_id));
-                        if ($groupbuy_info) {
-                            $IsHaveBuy = 1;
-                        } else {
-                            $IsHaveBuy = 0;
-                        }
-                    }
-                }
-            }
-        }
-        Tpl::output('IsHaveBuy', $IsHaveBuy);
-        //end
-        Tpl::output('store_id', $goods_info ['store_id']);
-
-        // 输出一级地区
-        $area_list = Model('area')->getTopLevelAreas();
-
-        if (strtoupper(CHARSET) == 'GBK') {
-            $area_list = Language::getGBK($area_list);
-        }
-        Tpl::output('area_list', $area_list);
-
-        //优先得到推荐商品
-        $goods_commend_list = $model_goods->getGoodsOnlineList(array('store_id' => $goods_info['store_id'], 'goods_commend' => 1), 'goods_id,goods_name,goods_jingle,goods_image,store_id,goods_price', 0, 'rand()', 5, 'goods_commonid');
-        Tpl::output('goods_commend', $goods_commend_list);
-
-
-        // 当前位置导航
-        $nav_link_list = Model('goods_class')->getGoodsClassNav($goods_info['gc_id'], 0);
-        $nav_link_list[] = array('title' => $goods_info['goods_name']);
-        Tpl::output('nav_link_list', $nav_link_list);
-
-        //评价信息
-        $goods_evaluate_info = Model('evaluate_goods')->getEvaluateGoodsInfoByGoodsID($goods_id);
-        Tpl::output('goods_evaluate_info', $goods_evaluate_info);
-
-        $seo_param = array();
-        $seo_param['name'] = $goods_info['goods_name'];
-        $seo_param['key'] = $goods_info['goods_keywords'];
-        $seo_param['description'] = $goods_info['goods_description'];
-        Model('seo')->type('product')->param($seo_param)->show();
-        Tpl::showpage('goods');
-    }
-
-    /**
-     * 商品列表接口
-     *
-     * 请求参数:
-     * key:
-     * order: 1-升序 2-降序
-     * page: 每页数量
-     * curpage: 当前页码
-     * gc_id: 分类编码
-     * keyword:搜索关键字
-     * brand_id: 品牌
-     * efficacy_id:功效查询
-     *
-     */
-    public function goods_listOp()
-    {
-        $page = trim($_GET['page']);
-        $curpage = trim($_GET['curpage']);
-        $this->initpage($page, $curpage);
-
-        $model_goods = Model('goods');
-        $condition = array();
-        if (!empty(trim($_GET['gc_id']))) {
-            $condition['gc_id'] = intval($_GET['gc_id']);
-        }
-        // 关键字
-        if (!empty(trim($_GET['keyword']))) {
-            $condition['goods_name|goods_jingle'] = array('like', '%' . urldecode($_GET['keyword']) . '%');
-        }
-        // 品牌查询
-        if (!empty(trim($_GET['brand_id']))) {
-            $condition['brand_id'] = intval($_GET['brand_id']);
-        }
-        // 功效查询
-        if (!empty(trim($_GET['efficacy_id']))) {
-            $condition['efficacy_id'] = intval($_GET['efficacy_id']);
-        }
-
-        //所需字段
-        $fieldstr = "goods_id,goods_commonid,store_id,brand_id,gc_id,goods_name,goods_price,goods_marketprice,goods_image,goods_salenum,evaluation_good_star,evaluation_count,goods_storage,goods_storage_alarm";
-
-        // 添加3个状态字段
-        $fieldstr .= ',is_virtual,is_presell,is_fcode,have_gift';
-
-        //排序方式
-        $order = $this->_goods_list_order($_GET['key'], $_GET['order']);
-
-        //优先从全文索引库里查找
-//        list($indexer_ids, $indexer_count) = $model_search->indexerSearch($_GET, $this->page);
-//        if (is_array($indexer_ids)) {
-//            //商品主键搜索
-//            $goods_list = $model_goods->getGoodsOnlineList(array('goods_id' => array('in', $indexer_ids)), $fieldstr, 0, $order, $this->page, null, false);
-//
-//            //如果有商品下架等情况,则删除下架商品的搜索索引信息
-//            if (count($goods_list) != count($indexer_ids)) {
-//                $model_search->delInvalidGoods($goods_list, $indexer_ids);
-//            }
-//            pagecmd('setEachNum', $this->page);
-//            pagecmd('setTotalNum', $indexer_count);
-//        } else {
-//          $goods_list = $model_goods->getGoodsListByColorDistinct($condition, $fieldstr, $order, $this->page);
-//        }
-
-        $goods_list = $model_goods->getGoodsListByColorDistinct($condition, $fieldstr, $order, $this->page_size);
-        $page_count = $model_goods->gettotalpage();
-        $model_goods->cls();
-
-        //处理商品列表(抢购、限时折扣、商品图片)
-        $goods_list = $this->_goods_list_extend($goods_list);
-
-        // 增加品牌两个图片字段
-        $extend = array();
-        if (!empty(trim($_GET['brand_id']))) {
-            $brand = Model()->table("brand")->find(intval($_GET['brand_id']));
-            if (!empty($brand)) {
-                $extend['brand_img_logo'] = image_helper::format_brand_img($brand['brand_img_logo']);
-                $extend['brand_img_bg'] = image_helper::format_brand_img($brand['brand_img_bg']);
-                $extend['brand_title'] = $brand['brand_name'];
-            }
-        }
-
-        joutput_data(array('goods_list' => $goods_list, 'mobile_page' => mobile_page($page_count), 'extend' => $extend));
-    }
-
-    /**
-     * 商品列表排序方式
-     */
-    private function _goods_list_order($key, $order)
-    {
-        $result = 'is_own_shop desc,goods_commonid desc';
-        if (!empty($key)) {
-
-            $sequence = 'desc';
-            if ($order == 1) {
-                $sequence = 'asc';
-            }
-
-            switch ($key) {
-                //销量
-                case '1' :
-                    $result = 'goods_salenum' . ' ' . $sequence;
-                    break;
-                //浏览量
-                case '2' :
-                    $result = 'goods_click' . ' ' . $sequence;
-                    break;
-                //价格
-                case '3' :
-                    $result = 'goods_price' . ' ' . $sequence;
-                    break;
-            }
-        }
-        return $result;
-    }
-
-    /**
-     * 处理商品列表(抢购、限时折扣、商品图片)
-     */
-    private function _goods_list_extend($goods_list)
-    {
-        $commonid_array = array();
-        $goodsid_array = array();
-        foreach ($goods_list as $key => $value) {
-            $commonid_array[] = $value['goods_commonid'];
-            $goodsid_array[] = $value['goods_id'];
-
-            // image 切换为goods_common 表中数据
-            $condition['goods_commonid'] = $value['goods_commonid'];
-            $goods_image = Model()->table('goods_common')->where($condition)->field('goods_image')->select();
-            $goods_list[$key]['goods_image'] = $goods_image[0]['goods_image'];
-        }
-
-        //促销
-        $groupbuy_list = Model('groupbuy')->getGroupbuyListByGoodsCommonIDString(implode(',', $commonid_array));
-        $xianshi_list = Model('p_xianshi_goods')->getXianshiGoodsListByGoodsString(implode(',', $goodsid_array));
-        foreach ($goods_list as $key => &$value) {
-            //抢购
-            if (isset($groupbuy_list[$value['goods_commonid']])) {
-                $goods_list[$key]['goods_price'] = $groupbuy_list[$value['goods_commonid']]['groupbuy_price'];
-                $goods_list[$key]['group_flag'] = true;
-            } else {
-                $goods_list[$key]['group_flag'] = false;
-            }
-
-            //限时折扣
-            if (isset($xianshi_list[$value['goods_id']]) && !$goods_list[$key]['group_flag']) {
-                $goods_list[$key]['goods_price'] = $xianshi_list[$value['goods_id']]['xianshi_price'];
-                $goods_list[$key]['xianshi_flag'] = true;
-            } else {
-                $goods_list[$key]['xianshi_flag'] = false;
-            }
-
-            //商品图片url
-            $goods_list[$key]['goods_image_url'] = cthumb($value['goods_image'], 360, $value['store_id']);
-
-            unset($goods_list[$key]['store_id']);
-            //unset($goods_list[$key]['goods_commonid']);
-            unset($goods_list[$key]['nc_distinct']);
-            unset($goods_list[$key]['gc_id']);
-            unset($goods_list[$key]['goods_marketprice']);
-            unset($goods_list[$key]['goods_image']);
-            unset($goods_list[$key]['goods_salenum']);
-            unset($goods_list[$key]['evaluation_good_star']);
-            unset($goods_list[$key]['evaluation_count']);
-            unset($goods_list[$key]['is_virtual']);
-            unset($goods_list[$key]['is_presell']);
-            unset($goods_list[$key]['is_fcode']);
-            unset($goods_list[$key]['have_gift']);
-            unset($goods_list[$key]['group_flag']);
-            unset($goods_list[$key]['xianshi_flag']);
-
-            // 品牌名
-            $brand = Model()->table("brand")->find($value['brand_id']);
-            if (!empty($brand)) {
-                $value['brand_name'] = $brand['brand_name'];
-            }
-
-            // 分类
-            $gc_info = Model()->table('goods_class')->find($value['gc_id']);
-            if (!empty($gc_info)) {
-                $value['gc_name'] = $gc_info['gc_name'];
-            }
-
-            // 功效列表
-            $goods_common = Model('goods');
-            $goods_common_info = $goods_common->getGoodeCommonInfoByID($value['goods_commonid']);
-            if (!empty($goods_common_info)) {
-                $value['goods_attr'] = $this->_parse_for_efficacy(unserialize($goods_common_info['goods_attr']));
-            }
-        }
-
-        return $goods_list;
-    }
-
-    /**
-     * 商品详细页扩展
-     *
-     * 输入参数:
-     * goods_id:商品id
-     *
-     */
-    public function goods_commonOp()
-    {
-        $goods_id = intval($_GET ['goods_id']);
-        if (empty($_GET ['goods_id']) || $goods_id < 0) {
-            return joutput_error(errcode::ErrParamter, "goods_id = {$goods_id} must be > 0.");
-        }
-        // 商品详细信息
-        $model_goods = Model('goods')->cls();
-        $goods_detail = $model_goods->getGoodsSku($goods_id);
-        if (empty($goods_detail)) {
-            return joutput_error(errcode::ErrGoodsNotExist);
-        }
-        //推荐商品
-        $model_store = Model('store')->cls();
-        $store_info = $model_store->getStoreInfoByID($goods_detail['goods_info']['store_id']);
-        $goods_detail['store_info']['store_id'] = $store_info['store_id'];
-        $goods_detail['store_info']['store_name'] = $store_info['store_name'];
-        $goods_detail['store_info']['member_id'] = $store_info['member_id'];
-        //显示QQ及旺旺 好商城V3
-        $goods_detail['store_info']['store_qq'] = $store_info['store_qq'];
-        $goods_detail['store_info']['store_ww'] = $store_info['store_ww'];
-        $goods_detail['store_info']['store_phone'] = $store_info['store_phone'];
-        $goods_detail['store_info']['member_name'] = $store_info['member_name'];
-        $goods_detail['store_info']['avatar'] = getMemberAvatarForID($store_info['member_id']);
-
-        //商品详细信息处理
-        $goods_detail = $this->_goods_common_extend($goods_detail);
-
-        joutput_data($goods_detail);
-    }
-
-    /**
-     * 商品详细信息处理
-     */
-    private function _goods_common_extend($goods_detail)
-    {
-        //商品链接
-        $goods_detail['goods_info']['goods_url'] = urlShop('goods', 'index', array('goods_id' => $goods_detail['request_goods_id']));
-
-        //整理数据
-        unset($goods_detail['goods_info']['goods_commonid']);
-        unset($goods_detail['goods_info']['gc_id']);
-        unset($goods_detail['goods_info']['gc_name']);
-        unset($goods_detail['goods_info']['store_name']);
-        unset($goods_detail['goods_info']['brand_id']);
-        unset($goods_detail['goods_info']['brand_name']);
-        unset($goods_detail['goods_info']['type_id']);
-        unset($goods_detail['goods_info']['goods_image']);
-        //unset($goods_detail['goods_info']['goods_body']);
-        unset($goods_detail['goods_info']['mobile_body']);
-        unset($goods_detail['goods_info']['goods_state']);
-        unset($goods_detail['goods_info']['goods_stateremark']);
-        unset($goods_detail['goods_info']['goods_verify']);
-        unset($goods_detail['goods_info']['goods_verifyremark']);
-        unset($goods_detail['goods_info']['goods_lock']);
-        unset($goods_detail['goods_info']['goods_addtime']);
-        unset($goods_detail['goods_info']['goods_edittime']);
-        unset($goods_detail['goods_info']['goods_selltime']);
-        unset($goods_detail['goods_info']['goods_show']);
-        unset($goods_detail['goods_info']['goods_commend']);
-        unset($goods_detail['goods_info']['explain']);
-        unset($goods_detail['goods_info']['cart']);
-        unset($goods_detail['goods_info']['buynow_text']);
-        unset($goods_detail['goods_info']['spec_value']);
-        unset($goods_detail['goods_info']['spec_name']);
-        unset($goods_detail['goods_info']['goods_spec']);
-        unset($goods_detail['groupbuy_info']);
-        unset($goods_detail['xianshi_info']);
-
-        return $goods_detail;
-    }
-
-    /**
-     * 商品详细页
-     *
-     * 输入参数:
-     * goods_id: 商品id
-     * from:目前说明是来自app还是h5
-     */
-    public function goods_detailOp()
-    {
-        $goods_id = intval($_GET ['goods_id']);
-        $from = $_GET['from'];
-
-        // 商品详细信息
-        $model_goods = Model('goods');
-        $goods_detail = $model_goods->getGoodsDetail($goods_id);
-        if (empty($goods_detail)) {
-            return joutput_error(errcode::ErrGoodsNotExist);
-        }
-
-        // 推荐商品
-        $model_store = Model('store');
-        $hot_sales = $model_store->getHotSalesList($goods_detail['goods_info']['store_id'], 6);
-        $goods_commend_list = array();
-        foreach ($hot_sales as $value) {
-            $goods_commend = array();
-            $goods_commend['goods_id'] = $value['goods_id'];
-            $goods_commend['goods_name'] = $value['goods_name'];
-            $goods_commend['goods_price'] = $value['goods_price'];
-            $goods_commend['goods_image_url'] = cthumb($value['goods_image'], 240);
-            $goods_commend_list[] = $goods_commend;
-        }
-        $goods_detail['goods_commend_list'] = $goods_commend_list;
-        $store_info = $model_store->getStoreInfoByID($goods_detail['goods_info']['store_id']);
-        $goods_detail['store_info']['store_id'] = $store_info['store_id'];
-        $goods_detail['store_info']['store_name'] = $store_info['store_name'];
-        $goods_detail['store_info']['member_id'] = $store_info['member_id'];
-        //显示QQ及旺旺 好商城V3
-        $goods_detail['store_info']['store_qq'] = $store_info['store_qq'];
-        $goods_detail['store_info']['store_ww'] = $store_info['store_ww'];
-        $goods_detail['store_info']['store_phone'] = $store_info['store_phone'];
-        $goods_detail['store_info']['member_name'] = $store_info['member_name'];
-        $goods_detail['store_info']['avatar'] = getMemberAvatarForID($store_info['member_id']);
-
-        //商品详细信息处理
-        $goods_detail = $this->_goods_detail_extend($goods_detail);
-
-        if ($from === 'app') {
-            $goods_detail['goods_info']['spec'] = $this->_parse_spec($goods_detail['goods_info']['spec_name'], $goods_detail['goods_info']['spec_value'], $goods_detail['spec_image'], $goods_detail['spec_list']);
-            $goods_detail['goods_info']['attributes'] = $this->_parse_attributes($goods_detail['goods_info']['goods_attr']);
-            $goods_detail['goods_info']['goods_spec_obj'] = $this->_parse_goods_spec($goods_detail['goods_info']['goods_spec']);
-            $goods_detail['UPLOAD_SITE_URL'] = $GLOBALS['setting_config']['upload_site_url'];
-        }
-        //v3-b11 抢购商品是否开始
-        $goods_info = $goods_detail['goods_info'];
-        //print_r($goods_info);
-        $IsHaveBuy = 0;
-        if (!empty($_COOKIE['username'])) {
-            $model_member = Model('member');
-            $member_info = $model_member->getMemberInfo(array('member_name' => $_COOKIE['username']));
-            $buyer_id = $member_info['member_id'];
-
-            $promotion_type = $goods_info["promotion_type"];
-
-            if ($promotion_type == 'groupbuy') {
-                //检测是否限购数量
-                $upper_limit = $goods_info["upper_limit"];
-                if ($upper_limit > 0) {
-                    //查询些会员的订单中,是否已买过了
-                    $model_order = Model('order');
-                    //取商品列表
-                    $order_goods_list = $model_order->getOrderGoodsList(array('goods_id' => $goods_id, 'buyer_id' => $buyer_id, 'goods_type' => 2));
-                    if ($order_goods_list) {
-                        //取得上次购买的活动编号(防一个商品参加多次团购活动的问题)
-                        $promotions_id = $order_goods_list[0]["promotions_id"];
-                        //用此编号取数据,检测是否这次活动的订单商品。
-                        $model_groupbuy = Model('groupbuy');
-                        $groupbuy_info = $model_groupbuy->getGroupbuyInfo(array('groupbuy_id' => $promotions_id));
-                        if ($groupbuy_info) {
-                            $IsHaveBuy = 1;
-                        } else {
-                            $IsHaveBuy = 0;
-                        }
-                    }
-                }
-            }
-        }
-        $goods_detail['IsHaveBuy'] = $IsHaveBuy;
-        //v3-b11 end
-        joutput_data($goods_detail);
-    }
-
-    /**
-     * 商品详细信息处理
-     */
-    private function _goods_detail_extend($goods_detail)
-    {
-        //整理商品规格
-        unset($goods_detail['spec_list']);
-        $goods_detail['spec_list'] = $goods_detail['spec_list_mobile'];
-        unset($goods_detail['spec_list_mobile']);
-
-        //整理商品图片
-        unset($goods_detail['goods_image']);
-        $goods_detail['goods_image'] = implode(',', $goods_detail['goods_image_mobile']);
-        unset($goods_detail['goods_image_mobile']);
-
-        //商品链接
-        $goods_detail['goods_info']['goods_url'] = urlShop('goods', 'index', array('goods_id' => $goods_detail['goods_info']['goods_id']));
-
-        //整理数据
-        unset($goods_detail['goods_info']['goods_commonid']);
-        unset($goods_detail['goods_info']['gc_id']);
-        unset($goods_detail['goods_info']['gc_name']);
-        unset($goods_detail['goods_info']['store_name']);
-        unset($goods_detail['goods_info']['brand_id']);
-        unset($goods_detail['goods_info']['brand_name']);
-        unset($goods_detail['goods_info']['type_id']);
-        unset($goods_detail['goods_info']['goods_image']);
-        unset($goods_detail['goods_info']['goods_body']);
-        unset($goods_detail['goods_info']['mobile_body']);
-        unset($goods_detail['goods_info']['goods_state']);
-        unset($goods_detail['goods_info']['goods_stateremark']);
-        unset($goods_detail['goods_info']['goods_verify']);
-        unset($goods_detail['goods_info']['goods_verifyremark']);
-        unset($goods_detail['goods_info']['goods_lock']);
-        unset($goods_detail['goods_info']['goods_addtime']);
-        unset($goods_detail['goods_info']['goods_edittime']);
-        unset($goods_detail['goods_info']['goods_selltime']);
-        unset($goods_detail['goods_info']['goods_show']);
-        unset($goods_detail['goods_info']['goods_commend']);
-        unset($goods_detail['goods_info']['explain']);
-        unset($goods_detail['goods_info']['cart']);
-        unset($goods_detail['goods_info']['buynow_text']);
-        unset($goods_detail['groupbuy_info']);
-        //unset($goods_detail['xianshi_info']);
-
-        return $goods_detail;
-    }
-
-    /**
-     * 解析spec字段
-     *
-     * @param $spec_name
-     * @param $spec_value
-     * @param array $spec_image
-     * @param array $spec_list
-     * @return array
-     */
-    private function _parse_spec($spec_name, $spec_value, $spec_image = [], $spec_list = [])
-    {
-        $spec = [];
-        foreach ($spec_name as $key => $value) {
-            $spec_item = [];
-            $spec_item['spec_id'] = $key;
-            $spec_item['spec_name'] = $value;
-            if (!empty($spec_value[$key])) {
-                $spec_item['value_list'] = [];
-                foreach ($spec_value[$key] as $v_key => $v) {
-                    $value_item = [];
-                    $value_item['value_id'] = $v_key;
-                    $value_item['value_name'] = $v;
-                    $value_item['value_image'] = empty($spec_image[$v_key]) ? '' : $spec_image[$v_key];
-                    $value_item['value'] = empty($spec_list[$v_key]) ? '' : $spec_list[$v_key];
-                    array_push($spec_item['value_list'], $value_item);
-                }
-            }
-            array_push($spec, $spec_item);
-        }
-        return $spec;
-    }
-
-    /**
-     * 解析商品属性字段
-     *
-     * @param $goods_attr
-     * @return array
-     */
-    private function _parse_attributes($goods_attr)
-    {
-        $attributes = [];
-        foreach ($goods_attr as $key => $value) {
-            $attribute_item = [];
-            $attribute_item['goods_attr_id'] = $key;
-            $attribute_item['goods_attr_value'] = [];
-            if (!empty($value)) {
-                foreach ($value as $v_key => $v) {
-                    $attribute_attr = [];
-                    if ($v_key === 'name') {
-                        $attribute_item['goods_attr_name'] = $v;
-                    } else {
-                        $attribute_attr['value_id'] = $v_key;
-                        $attribute_attr['value_name'] = $v;
-                        array_push($attribute_item['goods_attr_value'], $attribute_attr);
-                    }
-                }
-            }
-            array_push($attributes, $attribute_item);
-        }
-        return $attributes;
-    }
-
-    /**
-     * 解析功效
-     *
-     * @param $goods_attr
-     * @return mixed
-     */
-    private function _parse_for_efficacy($goods_attr)
-    {
-        foreach ($goods_attr as $key => $val) {
-            $attr_item['goods_attr_id'] = intval($key);
-            $attr_item['goods_attr_name'] = $val['name'];
-            if ($attr_item['goods_attr_name'] === '功效') {
-                $goods_attr_value = array();
-                foreach ($val as $id => $name) {
-                    if ($id !== 'name') {
-                        $val_item['value_id'] = intval($id);
-                        $val_item['value_name'] = $name;
-                        array_push($goods_attr_value, $val_item);
-                    }
-                }
-                $attr_item['goods_attr_value'] = $goods_attr_value;
-                break;
-            }
-        }
-        return $attr_item;
-    }
-
-    /**
-     * 商品规格序列化解析
-     *
-     * @param $goods_spec
-     * @return array
-     */
-    private function _parse_goods_spec($goods_spec)
-    {
-        $goods_spec_obj = [];
-        foreach ($goods_spec as $key => $value) {
-            $spec_item = [];
-            $spec_item['spec_value'] = $key;
-            $spec_item['spec_name'] = $value;
-            array_push($goods_spec_obj, $spec_item);
-        }
-        return $goods_spec_obj;
-    }
-
-    public function detailOp()
-    {
-        $commonid = 0;
-        $goods_id = intval($_GET['goods_id']);
-        if (empty($_GET['goods_id']) || $goods_id <= 0) {
-            if (!empty($_GET['goods_commonid'])) {
-                $commonid = intval($_GET['goods_commonid']);
-            }
-        } else {
-            $info = Model('goods')->getGoodsInfoByID($goods_id, 'goods_commonid');
-            $commonid = intval($info['goods_commonid']);
-        }
-
-        if ($commonid > 0) {
-            $items = Model()->table('goods_common')->field('goods_body')->where(array('goods_commonid' => $commonid))->select();
-            if (!empty($items) && count($items) > 0) {
-                Tpl::output('goods_body', $items[0]['goods_body']);
-            }
-        }
-        Tpl::showpage('goods_detail');
-    }
-}

+ 0 - 83
mobile/control/goods_class.php

@@ -1,83 +0,0 @@
-<?php
-/**
- * 商品分类
- *
- *
- *
- 
- */
-
-//use Shopnc\Tpl;
-
-defined('InShopNC') or exit('Access Invalid!');
-class goods_classControl extends mobileHomeControl
-{
-	public function __construct() {
-        parent::__construct();
-    }
-
-	public function indexOp() {
-        if(!empty($_GET['gc_id']) && intval($_GET['gc_id']) > 0) {
-            $this->_get_class_list($_GET['gc_id']);
-        } else {
-            $this->_get_root_class();
-        }
-	}
-
-    /**
-     * 返回一级分类列表
-     */
-    private function _get_root_class() {
-		$model_goods_class = Model('goods_class');
-        $model_mb_category = Model('mb_category');
-
-        $goods_class_array = Model('goods_class')->getGoodsClassForCacheModel();
-
-		$class_list = $model_goods_class->getGoodsClassListByParentId(0);
-        $mb_categroy = $model_mb_category->getLinkList(array());
-        $mb_categroy = array_under_reset($mb_categroy, 'gc_id');
-        foreach ($class_list as $key => $value) {
-            if(!empty($mb_categroy[$value['gc_id']])) {
-                $class_list[$key]['image'] = UPLOAD_SITE_URL.DS.ATTACH_MOBILE.DS.'category'.DS.$mb_categroy[$value['gc_id']]['gc_thumb'];
-            } else {
-                $class_list[$key]['image'] = '';
-            }
-
-            $class_list[$key]['text'] = '';
-            $child_class_string = $goods_class_array[$value['gc_id']]['child'];
-            $child_class_array = explode(',', $child_class_string);
-            foreach ($child_class_array as $child_class) {
-                $class_list[$key]['text'] .= $goods_class_array[$child_class]['gc_name'] . '/';
-            }
-            $class_list[$key]['text'] = rtrim($class_list[$key]['text'], '/');
-        }
-
-        output_data(array('class_list' => $class_list));
-    }
-
-    /**
-     * 根据分类编号返回下级分类列表
-     */
-    private function _get_class_list($gc_id) {
-        $goods_class_array = Model('goods_class')->getGoodsClassForCacheModel();
-
-        $goods_class = $goods_class_array[$gc_id];
-
-        if(empty($goods_class['child'])) {
-            //无下级分类返回0
-            output_data(array('class_list' => '0'));
-        } else {
-            //返回下级分类列表
-            $class_list = array();
-            $child_class_string = $goods_class_array[$gc_id]['child'];
-            $child_class_array = explode(',', $child_class_string);
-            foreach ($child_class_array as $child_class) {
-                $class_item = array();
-                $class_item['gc_id'] .= $goods_class_array[$child_class]['gc_id'];
-                $class_item['gc_name'] .= $goods_class_array[$child_class]['gc_name'];
-                $class_list[] = $class_item;
-            }
-            output_data(array('class_list' => $class_list));
-        }
-    }
-}

+ 0 - 47
mobile/control/guide.php

@@ -1,47 +0,0 @@
-<?php
-
-/**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 15/12/1
- * Time: 下午5:39
- */
-defined('InShopNC') or exit('Access Invalid!');
-
-require_once(BASE_CRONTAB_PATH . '/crawl/class_tree.php');
-
-class guideControl extends mobileHomeControl
-{
-    public function __construct() {
-        parent::__construct();
-    }
-
-    /**
-     * 首页
-     */
-    public function indexOp()
-    {
-        $brands = $this->brand_info();
-        $ret = array('brands' => array('所有品牌' => $brands));
-
-        joutput_data($ret);
-    }
-
-    private function brand_info()
-    {
-        $mod_brand = Model('brand');
-        $items = $mod_brand->field('brand_id,brand_name,brand_pic')->limit(false)->select();
-        return $items;
-    }
-
-    private function class_info()
-    {
-        $mod_class = Model('goods_class');
-    }
-
-    private function write_file()
-    {
-
-    }
-
-}

+ 4 - 1
mobile/control/member_buy.php

@@ -159,10 +159,13 @@ class member_buyControl extends mbMemberControl
         $param['order_from'] = 2; //从手机来
         $param['pay_name'] = "online";
 
+        $param['usebonus'] = $_POST['usebonus'];
+//        $param['room_id'] = $_POST['room_id'];
+        $param['room_id'] = 244;//todo for debug delete this line
         $usebonus = $_POST['usebonus'];
 
         $logic_buy = logic('buy');
-        $result = $logic_buy->buyStep2($param, $_SESSION['member_id'], $_SESSION['member_name'], $_SESSION['member_email'],$usebonus);
+        $result = $logic_buy->buyStep2($param, $_SESSION['member_id'], $_SESSION['member_name'], $_SESSION['member_email']);
         if (!$result['state']) {
             return self::outerr(errcode::ErrOrder, $result['msg']);
         }

+ 0 - 174
mobile/control/member_chat.php

@@ -1,174 +0,0 @@
-<?php
-/**
- * 会员聊天
- *
- *
- *
- *
-
- */
-defined('InShopNC') or exit('Access Invalid!');
-
-//use Shopnc\Tpl;
-class member_chatControl extends mbMemberControl
-{
-
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * 最近联系人
-     */
-    public function get_user_listOp()
-    {
-        $token = trim($_GET['key']);
-        if (false == $this->checkToken($token)) {
-            return joutput_error($this->err_code);
-        }
-
-        $member_list = array();
-        $model_chat = Model('web_chat');
-
-        $member_id = $this->member_info['member_id'];
-        $member_name = $this->member_info['member_name'];
-        $n = intval($_POST['n']);
-        if ($n < 1) $n = 50;
-        $member_list = $model_chat->getFriendList(array('friend_frommid' => $member_id), $n, $member_list);
-        $add_time = date("Y-m-d");
-        $add_time30 = strtotime($add_time) - 60 * 60 * 24 * 30;
-        $member_list = $model_chat->getRecentList(array('f_id' => $member_id, 'add_time' => array('egt', $add_time30)), 10, $member_list);
-        $member_list = $model_chat->getRecentFromList(array('t_id' => $member_id, 'add_time' => array('egt', $add_time30)), 10, $member_list);
-        $member_info = array();
-        $member_info = $model_chat->getMember($member_id);
-        $node_info = array();
-        $node_info['node_chat'] = C('node_chat');
-        $node_info['node_site_url'] = NODE_SITE_URL;
-        output_data(array('node_info' => $node_info, 'member_info' => $member_info, 'list' => $member_list));
-    }
-
-    /**
-     * 会员信息
-     *
-     */
-    public function get_infoOp()
-    {
-        $token = trim($_GET['key']);
-        if (false == $this->checkToken($token)) {
-            return joutput_error($this->err_code);
-        }
-
-        $val = '';
-        $member = array();
-        $model_chat = Model('web_chat');
-        $types = array('member_id', 'member_name', 'store_id', 'member');
-        $key = $_POST['t'];
-        $member_id = intval($_POST['u_id']);
-        if (trim($key) != '' && in_array($key, $types)) {
-            $member_info = $model_chat->getMember($member_id);
-            output_data(array('member_info' => $member_info));
-        }
-    }
-
-    /**
-     * 发消息
-     *
-     */
-    public function send_msgOp()
-    {
-        $token = trim($_GET['key']);
-        if (false == $this->checkToken($token)) {
-            return joutput_error($this->err_code);
-        }
-
-        $member = array();
-        $model_chat = Model('web_chat');
-        $member_id = $this->member_info['member_id'];
-        $member_name = $this->member_info['member_name'];
-        $t_id = intval($_POST['t_id']);
-        $t_name = trim($_POST['t_name']);
-        $member = $model_chat->getMember($t_id);
-        if ($t_name != $member['member_name']) output_error('接收消息会员账号错误');
-
-        $msg = array();
-        $msg['f_id'] = $member_id;
-        $msg['f_name'] = $member_name;
-        $msg['t_id'] = $t_id;
-        $msg['t_name'] = $t_name;
-        $msg['t_msg'] = trim($_POST['t_msg']);
-        if ($msg['t_msg'] != '') $chat_msg = $model_chat->addMsg($msg);
-        if ($chat_msg['m_id']) {
-            output_data(array('msg' => $chat_msg));
-        } else {
-            output_error('发送失败,请稍后重新发送');
-        }
-    }
-
-    /**
-     * 商品图片和名称
-     *
-     */
-    public function get_goods_infoOp()
-    {
-        $token = trim($_GET['key']);
-        if (false == $this->checkToken($token)) {
-            return joutput_error($this->err_code);
-        }
-
-        $model_chat = Model('web_chat');
-        $goods_id = intval($_POST['goods_id']);
-        $goods = $model_chat->getGoodsInfo($goods_id);
-        output_data(array('goods' => $goods));
-    }
-
-    /**
-     * 聊天记录查询
-     *
-     */
-    public function get_chat_logOp()
-    {
-        $token = trim($_GET['key']);
-        if (false == $this->checkToken($token)) {
-            return joutput_error($this->err_code);
-        }
-
-        $member_id = $this->member_info['member_id'];
-        $t_id = intval($_POST['t_id']);
-        $add_time_to = date("Y-m-d");
-        $time_from = array();
-        $time_from['7'] = strtotime($add_time_to) - 60 * 60 * 24 * 7;
-        $time_from['15'] = strtotime($add_time_to) - 60 * 60 * 24 * 15;
-        $time_from['30'] = strtotime($add_time_to) - 60 * 60 * 24 * 30;
-
-        $key = $_POST['t'];
-        if (trim($key) != '' && array_key_exists($key, $time_from)) {
-            $model_chat = Model('web_chat');
-            $list = array();
-            $condition_sql = " add_time >= '" . $time_from[$key] . "' ";
-            $condition_sql .= " and ((f_id = '" . $member_id . "' and t_id = '" . $t_id . "') or (f_id = '" . $t_id . "' and t_id = '" . $member_id . "'))";
-            $list = $model_chat->getLogList($condition_sql, $this->page_size);
-
-            $total_page = $model_chat->gettotalpage();
-            output_data(array('list' => $list), mobile_page($total_page));
-        }
-    }
-
-    /**
-     * node信息
-     *
-     */
-    public function get_node_infoOp()
-    {
-        $token = trim($_GET['key']);
-        if (false == $this->checkToken($token)) {
-            return joutput_error($this->err_code);
-        }
-
-        $member_id = $this->member_info['member_id'];
-        $model_chat = Model('web_chat');
-        $member_info = $model_chat->getMember($member_id);
-        Tpl::output('member_info', $member_info);
-        Tpl::showpage('node_info');
-    }
-}

+ 0 - 23
mobile/control/unused/article_class.php

@@ -1,23 +0,0 @@
-<?php
-/**
- * 文章 
- * 好商城V3 - 33HAO.COM
- * 
- **/
-
-defined('InShopNC') or exit('Access Invalid!');
-class article_classControl extends mobileHomeControl{
-
-	public function __construct() {
-        parent::__construct();
-    }
-    
-    public function indexOp() {
-			$article_class_model	= Model('article_class');
-			$article_model	= Model('article');
-			$condition	= array();
-			
-			$article_class = $article_class_model->getClassList($condition);
-			output_data(array('article_class' => $article_class));		
-    }
-}

+ 0 - 50
mobile/control/unused/attribute.php

@@ -1,50 +0,0 @@
-<?php
-/**
- * 前台品牌分类
- *
- *
- *
- ***/
-
-
-defined('InShopNC') or exit('Access Invalid!');
-
-class attributeControl extends mobileHomeControl
-{
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * 查询功效列表(已废)
-     */
-    public function effectOp()
-    {
-        $goods_attr_index_list = Model()->table('goods_attr_index')->field('attr_id')->distinct('attr_id')->where('1=1')->select();
-
-        $attr_filter_list = array();
-        foreach ($goods_attr_index_list as $value) {
-            array_push($attr_filter_list, $value['attr_id']);
-        }
-
-        $attr_list = Model()->table('attribute')->where(array('attr_name' => '功效', 'attr_show' => '1', 'attr_id' => array('in', $attr_filter_list)))->select();
-
-        $result = array();
-        foreach ($attr_list as $value) {
-            $type = Model()->table('type')->where(array('type_id' => $value['type_id']))->limit(1)->select();
-            if (!empty($type)) {
-
-                $fields = "attr_value_id,attr_value_name,attr_id,type_id";
-                $attr_value_list = Model()->table('attribute_value')->field($fields)->where(array('attr_id' => $value['attr_id']))->select();
-
-                $attr['type_name'] = $type[0]['type_name'];
-                $attr['data'] = $attr_value_list;
-                array_push($result, $attr);
-            }
-        }
-
-        $attribute_list = array("attribute" => $result);
-        joutput_data($attribute_list);
-    }
-}

+ 6 - 3
mobile/kdniao_notify.php

@@ -3,7 +3,6 @@
 //error_reporting(E_ALL);
 
 defined('BASE_ROOT_PATH') or define('BASE_ROOT_PATH',str_replace('/mobile','',dirname(__FILE__)));
-//require_once(BASE_MOBILE_PATH . '/control/app_pay.php');
 require_once (BASE_DATA_PATH . '/logic/delivery.logic.php');
 require_once(BASE_ROOT_PATH . '/helper/kdn_helper.php');
 
@@ -16,7 +15,8 @@ if (!empty($requestData))
 
     $success = true;
     $reson = '';
-//数据不正确, 记录并退出
+
+    //数据不正确, 记录并退出
     if ($deliver_info === false || empty($deliver_info))
     {
         $success = false;
@@ -39,6 +39,9 @@ if (!empty($requestData))
         }
     }
 
-    echo (json_encode(array('EBusinessID' => kdn_helper::cur_businessid(),'UpdateTime' => strftime("%Y-%m-%d %H:%M:%S",time()), 'Success' => $success,'Reason' => $reson)));
+    echo (json_encode(['EBusinessID' => kdn_helper::cur_businessid(),
+                       'UpdateTime' => strftime("%Y-%m-%d %H:%M:%S",time()),
+                       'Success' => $success,
+                       'Reason' => $reson]));
 }
 ?>