Kaynağa Gözat

modify bonus titile

stanley-king 8 yıl önce
ebeveyn
işleme
e546b9da95
3 değiştirilmiş dosya ile 33 ekleme ve 32 silme
  1. 28 31
      mobile/control/member_bonus.php
  2. 1 1
      mobile/control/search.php
  3. 4 0
      test/DBTest.php

+ 28 - 31
mobile/control/member_bonus.php

@@ -94,7 +94,6 @@ class member_bonusControl extends mbMemberControl
         }
 
         $rate_moneys = [];
-
         if($type->isFixedAmount()) {
             $item['amount'] = $type->fixed_money();
         } else {
@@ -114,24 +113,30 @@ class member_bonusControl extends mbMemberControl
             $type_sn = $ret['type_sn'];
             $relay_id = $_SESSION['member_id'];
             $url = BASE_SITE_URL . "/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn={$type_sn}&relay_id={$relay_id}";
-            $share = bonus_helper::get_share($type->share_id());
 
             $title = $type->bless();
-            if(empty($title) || $title == '特权红包,内购正品行货美妆') {
-                $title = $share['title'];
-            }
-
-            $sub_title = $share['sub_title'];
-            $img_url = $share['img_url'];
+            $this->share_info($type->share_id(),$title,$sub_title,$img_url);
 
             return self::outsuccess(array('type_sn' => $ret,
                 'url' => "{$url}",
                 'title' => $title,
-                'sub_title' => $sub_title . "\n\n点击领取",
+                'sub_title' => $sub_title,
                 'img_url' => $img_url));
         }
     }
 
+    private function share_info($share_id,&$title,&$sub_title,&$img_url)
+    {
+        $share = bonus_helper::get_share($share_id);
+
+        if(empty($title) || $title == '特权红包,内购正品行货美妆') {
+            $title = $share['title'];
+        }
+
+        $sub_title = $share['sub_title'] . "\n\n点击领取";
+        $img_url = $share['img_url'];
+    }
+
     public function match_goodsOp()
     {
         $bonus_rate = $this->mPred->bonus_rate();
@@ -155,7 +160,7 @@ class member_bonusControl extends mbMemberControl
             $cids = $result['cids'];
             $model_goods = Model('goods');
             $items = $model_goods->getGoodsListByColorDistinct(array('goods_commonid' => array('in',$cids)),goods_helper::fieldstr,'','');
-            $page_count = $result['page_count'];
+            $page_count = intval($result['page_count']);
 
             if(empty($items))
             {
@@ -247,19 +252,14 @@ class member_bonusControl extends mbMemberControl
             $type_sn = $ret['type_sn'];
             $relay_id = $_SESSION['member_id'];
             $url = BASE_SITE_URL . "/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn={$type_sn}&relay_id={$relay_id}";
-            $share = bonus_helper::get_share($type->share_id());
 
             $title = $type->bless();
-            if(empty($title) || $title == '特权红包,内购正品行货美妆') {
-                $title = $share['title'];
-            }
-            $sub_title = $share['sub_title'];
-            $img_url = $share['img_url'];
+            $this->share_info($type->share_id(),$title,$sub_title,$img_url);
 
             return self::outsuccess(array('type_sn' => $ret,
                 'url' => "{$url}",
                 'title' => $title,
-                'sub_title' => $sub_title . "\n\n点击领取",
+                'sub_title' => $sub_title,
                 'img_url' => $img_url));
         }
     }
@@ -275,19 +275,19 @@ class member_bonusControl extends mbMemberControl
             $relay_id = $_SESSION['member_id'];
             $url = BASE_SITE_URL . "/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn={$type_sn}&relay_id={$relay_id}";
             $type = bonus_helper::create_type_sn($type_sn);
+            $title = $type->bless();
+            $this->share_info($type->share_id(),$title,$sub_title,$img_url);
 
-            $share = bonus_helper::get_share($type->share_id());
-            $sub_title = $share['sub_title'];
-            $img_url = $share['img_url'];
-
-            return self::outsuccess(array('type_sn' => $type_sn, 'url' => "{$url}",
-                'title' => $type->bless(),'sub_title' => $sub_title,'img_url' => $img_url));
+            return self::outsuccess(array('type_sn' => $type_sn,
+                'url' => "{$url}",
+                'title' => $title,
+                'sub_title' => $sub_title,
+                'img_url' => $img_url));
         }
     }
     public function invite_pageOp()
     {
         $mem_no = $this->member_no();
-
         return self::outsuccess(array('member_no' => $mem_no),"bonus/invite",'wap');
     }
 
@@ -317,19 +317,16 @@ class member_bonusControl extends mbMemberControl
         }
         $type_sn = $_GET['type_sn'];
         $type = \bonus\type::create_by_sn($type_sn);
-        $share = bonus_helper::get_share($type->share_id());
         $relay_id = $_SESSION['member_id'];
 
         $title = $type->bless();
-        if(empty($title) || $title == '特权红包,内购正品行货美妆') {
-            $title = $share['title'];
-        }
-        $sub_title = $share['sub_title'] ."\n\n点击领取";
-        $img_url = $share['img_url'];
+        $this->share_info($type->share_id(),$title,$sub_title,$img_url);
 
         $url = BASE_SITE_URL . "/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn={$type_sn}&relay_id={$relay_id}";
         return self::outsuccess(array('type_sn' => $type_sn, 'url' => "{$url}",
-            'title' => $title,'sub_title' => $sub_title,'img_url' => $img_url));
+            'title' => $title,
+            'sub_title' => $sub_title,
+            'img_url' => $img_url));
     }
 
     public function send_listexOp()

+ 1 - 1
mobile/control/search.php

@@ -54,7 +54,7 @@ class searchControl extends mobileHomeControl
         $cids = $result['cids'];
         $model_goods = Model('goods');
         $items = $model_goods->getGoodsListByColorDistinct(array('goods_commonid' => array('in',$cids)),goods_helper::fieldstr,'','');
-        $page_count = $result['page_count'];
+        $page_count = intval($result['page_count']);
 
         if(empty($items))
         {

+ 4 - 0
test/DBTest.php

@@ -94,6 +94,10 @@ class DBTest extends PHPUnit_Framework_TestCase
         $iterm = $mod_member->tableInfo('memble');
 
     }
+    public function testNull()
+    {
+        $x = intval(null);
+    }
 
     public function testUpdate()
     {