stanley-king пре 8 година
родитељ
комит
b56d9d6447

+ 4 - 5
helper/fcode/generator.php

@@ -16,7 +16,7 @@ class generator
     private $mNumber;
     private $mBatchCode;
     private $mUserKey;
-    private $mUsableTime;
+    private $mUsableDays;
 
     public function __construct($commonid, $num, $batch_code, $usable_days)
     {
@@ -34,7 +34,7 @@ class generator
         if(intval($usable_days) <= 0) {
             $usable_days = 60;
         }
-        $this->mUsableTime = time() + $usable_days * 24 * 3600;
+        $this->mUsableDays = $usable_days;
     }
 
     public function make()
@@ -49,11 +49,10 @@ class generator
             $data['user_key'] = $this->mUserKey;
             $data['goods_commonid'] = $this->mCommonId;
             $data['fc_code'] = $fc_code;
-            $data['usable_time'] = $this->mUsableTime;
-            $data['batch_code'] = $this->mBatchCode;
+            $data['usable_days'] = $this->mUsableDays;
+            $data['batch_code']  = $this->mBatchCode;
 
             $ret = $mod_fcode->insert($data);
-
             $affect_rows = $mod_fcode->affected_rows();
             Log::record("fcode make i={$i} ret={$ret} rows={$affect_rows}",Log::DEBUG);
             if($ret != false && $affect_rows > 0) {

+ 5 - 3
helper/fcode/operator.php

@@ -91,9 +91,10 @@ class operator
         $cond['session_id']     = $fcode['session_id'];
         $cond['mobile']         = $fcode['mobile'];
 
-        $datas = array( 'grab_state' => 2,
+        $datas = array('grab_state' => 2,
             'mobile' => $mobile,
-            'user_key' => mt_rand(1000, 9999));
+            'user_key' => mt_rand(1000, 9999),
+            'usable_time' => time() + ($fcode['usable_days'] * 24 * 3600));
 
         $this->mod_fcode->beginTransaction();
         $ret = $this->mod_fcode->where($cond)->update($datas);
@@ -132,7 +133,8 @@ class operator
                             'grab_time' => time(),
                             'session_id' => session_helper::session_id(),
                             'mobile' => session_helper::cur_mobile(),
-                            'user_key' => mt_rand(1000, 9999));
+                            'user_key' => mt_rand(1000, 9999),
+                            'usable_time' => time() + ($fcode['usable_days'] * 24 * 3600));
         }
         else {
             $datas = array( 'grab_state' => 1,

+ 0 - 2
helper/fcode/send_manager.php

@@ -15,8 +15,6 @@ require_once (BASE_ROOT_PATH . '/helper/special_helper.php');
 use StatesHelper;
 use Log;
 use special_manager;
-use special_formater;
-use Model;
 
 class send_manager
 {

+ 9 - 3
mobile/control/cart.php

@@ -55,10 +55,14 @@ class cartControl extends mobileControl
     const session_type = 'Session';
 
     private $mUserFcode;
+    private $mFcodeBannerID;
 
     public function __construct() {
         parent::__construct();
         $this->mUserFcode = null;
+
+        global $config;
+        $this->mFcodeBannerID = $config['cart_fcodes']['banner_id'];
     }
 
     public function rate_moneyOp()
@@ -173,7 +177,9 @@ class cartControl extends mobileControl
     public function exgoodsOp()
     {
         $mod_fcode = Model('goods_fcode');
-        $items = $mod_fcode->getFcodeList(array('mobile' => session_helper::cur_mobile(),'fc_state' => 0),'*','fc_state asc,fc_id asc',$this->page_size());
+        //,'usable_time' => array('elt',time())
+        $items = $mod_fcode->getFcodeList(array('mobile' => session_helper::cur_mobile(),'fc_state' => 0),
+            '*','fc_state asc,fc_id asc',$this->page_size());
         $page_count = $mod_fcode->gettotalpage();
 
         if($this->page_no() == 1)
@@ -205,9 +211,9 @@ class cartControl extends mobileControl
         }
         else
         {
-            if($this->page_no() == 1 && is_publish())
+            if($this->page_no() == 1 && $this->mFcodeBannerID > 0)
             {
-                $blocks = special_manager::instance()->special(343,$unused_gids);
+                $blocks = special_manager::instance()->special($this->mFcodeBannerID,$unused_gids);
                 $items = $this->format($fcodes);
                 $blocks = array_merge($blocks,$items);
             }

+ 0 - 1
mobile/control/member_buy.php

@@ -184,7 +184,6 @@ class member_buyControl extends mbMemberControl
     }
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
     /**
      * 购物车、直接购买第一步:选择收获地址和配置方式
      */