Browse Source

fix invite bonus,recv bonus name,send bonus name

stanley-king 8 years ago
parent
commit
8002721252

+ 3 - 1
data/resource/mobile/bonus/js/tel.js

@@ -159,6 +159,7 @@ $(function(){
                         var tel = $("#tel_number").val();
                         var alink = $("#url").val();
                         var bonus_sn = $("#mine_bonus").val();
+                        var relay_id = $("#relay_id").val();
                         var url_host=window.location.hostname;
 
 
@@ -169,7 +170,8 @@ $(function(){
                             data:{
                                 mobile: tel,
                                 code: yanzVal,
-                                bonus_sn:bonus_sn
+                                bonus_sn:bonus_sn,
+                                relay_id:relay_id
                             },
                             success:function(data)
                             {

+ 15 - 6
helper/account_helper.php

@@ -70,7 +70,6 @@ class account_helper
     const period_hour = 5 * 24;
     const total_number = 10;
     const send_type = 1;
-    const def_bless = '熊猫美妆与你分享美丽的秘密~';
 
     static private $stSysBonus = null;
 
@@ -85,8 +84,18 @@ class account_helper
     }
     private static function invite_param($relay_id,&$rate_moneys)
     {
+        try
+        {
+            $info = new member_info($relay_id);
+            $nickname = $info->nickname();
+            $type_name = "您的好友{$nickname},邀请您使用熊猫美妆";
+        }
+        catch (Exception $ex) {
+            $type_name = "好友邀请红包";
+        }
+
         $param['make_type'] = \bonus\type::MakeInviteType;
-        $param['type_name'] = "邀请好友红包";
+        $param['type_name'] = $type_name;
         $param['fixed_money'] = 20;
         $param['total_num']   = 10;
         $param['send_type'] = \bonus\type::SendType_Fixed;
@@ -108,7 +117,7 @@ class account_helper
     private static function evaluate_param(&$rate_moneys)
     {
         $param['make_type'] = \bonus\type::MakeSendType;
-        $param['type_name'] = "评论奖励红包";
+        $param['type_name'] = "订单评论奖励红包";
         $param['fixed_money'] = 10;
         $param['total_num']   = 1;
         $param['send_type'] = \bonus\type::SendType_Fixed;
@@ -143,8 +152,8 @@ class account_helper
 
     private static function guide_param(&$rate_moneys)
     {
-        $param['make_type'] = \bonus\type::MakeSendType;
-        $param['type_name'] = "评论奖励红包";
+        $param['make_type'] = \bonus\type::MakePayType;
+        $param['type_name'] = "邀请好友,奖励红包";
         $param['fixed_money'] = 10;
         $param['total_num']   = 1;
         $param['send_type'] = \bonus\type::SendType_Fixed;
@@ -616,7 +625,7 @@ class account_helper
         Log::record("account_helper::onOrderSuccess {$member_id}",Log::DEBUG);
     }
 
-    //在发货之后,可以提醒用户留意收货,在订单中查看物流
+    //在发货之后,可以提醒用户留意收货,在订单中查看物流,短信通知
     public static function onOrderSend($member_id)
     {
         Log::record("account_helper::onOrderSend {$member_id}",Log::DEBUG);

+ 3 - 0
helper/bonus/type.php

@@ -249,6 +249,9 @@ class type
     public function bless() {
         return $this->mParam['type_bless'];
     }
+    public function name() {
+        return $this->mParam['type_name'];
+    }
     public function sender_name() {
         return $this->mParam['sender_name'];
     }

+ 0 - 1
helper/sms_helper.php

@@ -68,7 +68,6 @@ class sms_helper
 
     static public function send_nostore_message($mobile,$type,$datas)
     {
-        //Logic('queue')->sendSMS(array('mobile' => $mobile,'type' => $type, 'datas' => $datas));
         QueueClient::push('sendSMS', array('mobile' => $mobile,'type' => $type, 'datas' => $datas));
     }
 

+ 22 - 10
mobile/control/bonusex.php

@@ -51,7 +51,8 @@ class bonusexControl extends mobileControl
         if(!isset($_GET['type_sn']) || empty($_GET['type_sn'])) {
             return self::outerr(errcode::ErrParamter,"需要红包 type_sn 参数.");
         }
-        $type_sn = $_GET['type_sn'];
+        $type_sn  = $_GET['type_sn'];
+        $relay_id = $_GET['relay_id'];
 
         $type_infos = bonus_helper::get_typeinfo($type_sn);
         if(empty($type_infos)) {
@@ -83,7 +84,7 @@ class bonusexControl extends mobileControl
                     $mine_bonus = bonus_helper::get_mine_by_bonussn($new_sn);
                 }
             }
-            $data = array('type_info' => $type_info, 'mine_bonus' => $mine_bonus,'binded_info' => $binded_info,'avatars' => $avatars);
+            $data = array('type_info' => $type_info, 'mine_bonus' => $mine_bonus,'binded_info' => $binded_info,'avatars' => $avatars,'relay_id' =>$relay_id);
             if($bonus->isBinded() || $isMineType) {
                 return self::outsuccess($data,"bonus/content");
             }
@@ -110,7 +111,7 @@ class bonusexControl extends mobileControl
                 else if($type->binded_over()) {
                     return self::outsuccess(array('type_info' => $type_info,'msg' => "手慢了,红包派完了"),"bonus/over");
                 } else {
-                    return self::outsuccess(array('type_info' => $type_info),"bonus/open");
+                    return self::outsuccess(array('type_info' => $type_info,'relay_id' =>$relay_id),"bonus/open");
                 }
             }
             else
@@ -122,7 +123,7 @@ class bonusexControl extends mobileControl
                         'bonus/detail');
                 }
                 else {
-                    return self::outsuccess(array('type_info' => $type_info),"bonus/open");
+                    return self::outsuccess(array('type_info' => $type_info,'relay_id' =>$relay_id),"bonus/open");
                 }
             }
         }
@@ -163,6 +164,7 @@ class bonusexControl extends mobileControl
             return self::outerr(errcode::ErrParamter,"需要红包 type_sn 参数.");
         }
         $type_sn = $_GET['type_sn'];
+        $relay_id = $_GET['relay_id'];
 
         $type_infos = bonus_helper::get_typeinfo($type_sn);
         if(empty($type_infos)) {
@@ -210,10 +212,13 @@ class bonusexControl extends mobileControl
                             'avatars' => $avatars),
                             "bonus/content");
                     } else {
-                        return self::outsuccess(array('type_info' => $type_info, 'mine_bonus' => $mine_bonus,'binded_info' => $binded_info,'avatars' => $avatars),"bonus/bind");
+                        return self::outsuccess(array('type_info' => $type_info,
+                            'mine_bonus' => $mine_bonus,'binded_info' => $binded_info,
+                            'avatars' => $avatars,'relay_id' =>$relay_id),"bonus/bind");
                     }
                 } else {
-                    return self::outsuccess(array('type_info' => $type_info, 'mine_bonus' => $mine_bonus,'binded_info' => $binded_info,'avatars' => $avatars),"bonus/bind");
+                    return self::outsuccess(array('type_info' => $type_info, 'mine_bonus' => $mine_bonus,'binded_info' => $binded_info,
+                        'avatars' => $avatars,'relay_id' =>$relay_id),"bonus/bind");
                 }
             }
         }
@@ -248,10 +253,10 @@ class bonusexControl extends mobileControl
                         $data = array('type_info' => $type_info,
                             'mine_bonus' => $mine_bonus,
                             'binded_info' => $binded_info,
-                            'avatars' => $avatars);
+                            'avatars' => $avatars,'relay_id' =>$relay_id);
                         return self::outsuccess($data,"bonus/content");
                     } else {
-                        $data = array('type_info' => $type_info, 'mine_bonus' => $mine_bonus,'binded_info' => $binded_info,'avatars' => $avatars);
+                        $data = array('type_info' => $type_info, 'mine_bonus' => $mine_bonus,'binded_info' => $binded_info,'avatars' => $avatars,'relay_id' =>$relay_id);
                         return self::outsuccess($data,"bonus/bind");
                     }
                 }
@@ -541,7 +546,12 @@ function bonus_output_graburl($output)
     $type_info = $output['type_info'];
     $type = \bonus\type::create_by_paramer($type_info);
     $type_sn = $type->getType_sn();
-    $url = BASE_SITE_URL . "/mobile/index.php?act=bonusex&op=grab&client_type=wap&type_sn={$type_sn}";
+    $relay_id = intval($output['relay_id']);
+    if($relay_id > 0) {
+        $url = BASE_SITE_URL . "/mobile/index.php?act=bonusex&op=grab&client_type=wap&type_sn={$type_sn}&relay_id={$relay_id}";
+    } else {
+        $url = BASE_SITE_URL . "/mobile/index.php?act=bonusex&op=grab&client_type=wap&type_sn={$type_sn}";
+    }
     return $url;
 }
 
@@ -551,7 +561,7 @@ function bonus_output_type($output)
     echo '<p class="p p_name" style="color:#454545">';
     $type_info = $output['type_info'];
     $type = \bonus\type::create_by_paramer($type_info);
-    echo($type_info['sender_name'] . "的红包");
+    echo($type->name());
     if($type->isRandomAmount()) {
         echo '<s class="icon_pin"></s>';
     }
@@ -567,6 +577,7 @@ function bonus_output_mine($output)
     } else {
         $show_down = true;
     }
+    $relay_id = intval($output['relay_id']);
 
     $mine_bonus = $output['mine_bonus'];
     if(!empty($mine_bonus)) {
@@ -575,6 +586,7 @@ function bonus_output_mine($output)
         echo('<p><span>' . $bonus->bonus_value() . '</span>元</p>');
         echo('</div>');
         echo('<input type="hidden" id="mine_bonus" value=' ."{$bonus->bonus_sn()}>");
+        echo('<input type="hidden" id="relay_id" value=' ."{$relay_id}>");
         $mobile = $bonus->user_mobile();
         $show_down = $bonus->isBinded() && $show_down;
     } else {

+ 1 - 1
mobile/control/control.php

@@ -253,7 +253,7 @@ class mbMemberControl extends mobileControl
 
 function bonus_version()
 {
-    return "v=20161222";
+    return "v=20161223";
 }
 function shop_version()
 {

+ 40 - 2
mobile/control/member_bonus.php

@@ -281,7 +281,20 @@ class member_bonusControl extends mbMemberControl
             $item["type_sn"] = $type->getType_sn();
             $item["type_bless"] = $type->bless();
             $item["send_type"] = $type->send_type();
-            $item["sender_name"] = $type->sender_name();
+
+            if($type->make_type() == bonus\type::MakeInviteType) {
+                $item["sender_name"] = "邀请好友红包";
+            }
+            else
+            {
+                if($type->isFixedAmount()) {
+                    $item["sender_name"] = "普通红包";
+                } else {
+                    $item["sender_name"] = "拼手气红包";
+                }
+            }
+            //$item["sender_name"] = $type->sender_name();
+
             $item["total_amount"] = $type->getTotal_amount();
             $item["total_num"] = $type->getTotal_num();
             $item["remain_amount"] = $type->remain_amount();
@@ -552,7 +565,9 @@ class member_bonusControl extends mbMemberControl
             $item['bonus_rate'] = empty($bonus_rate)  ? 30 : $bonus_rate;
 
             $type = $types[$user_bonus->type_id()];
-            $item['sender_name'] = $type->sender_name();
+
+            $item['sender_name'] = $this->show_name($type);//$type->sender_name();
+
             $item['rand_type']  = $type->isRandomAmount();
             $item['total_num']  = $type->getTotal_num();
             $item['binded_num'] = $type->binded_num();
@@ -592,6 +607,29 @@ class member_bonusControl extends mbMemberControl
         }
     }
 
+    private function show_name(bonus\type $type)
+    {
+        $make_type = $type->make_type();
+
+        switch ($make_type) {
+            case bonus\type::MakeSendType: //抢
+            case bonus\type::MakeShakeGainType: //摇
+            return $type->sender_name();
+
+            case bonus\type::MakeInviteType:
+            case bonus\type::MakeBonusRefundType: //退
+            case bonus\type::MakePayRefundType:
+            case bonus\type::MakeOrderCancelType:
+            case bonus\type::MakeShakeLostType:
+            case bonus\type::MakePayType:   //赠
+            case bonus\type::MakeRegisterType:
+                return $type->name();
+
+            default:
+                return 0;   //什么都不显示
+        }
+    }
+
     //预存款收支记录
     public function pdlogOp()
     {

File diff suppressed because it is too large
+ 6 - 0
test/redisTest.php