stanley-king před 7 roky
rodič
revize
048785f9d7

+ 7 - 7
crontab/control/command.php

@@ -36,13 +36,13 @@ class commandControl extends BaseCronControl
     #犯了一个低级错误,把时间2017年,写成了2016年
     public function refund0928BonusOp()
     {
-        $items = Model()->query('SELECT * FROM lrlz_order WHERE pd_amount=0 AND LENGTH(bonus_rate) > 0 AND add_time > UNIX_TIMESTAMP(DATE (\'2017-09-28 00:00:00\')) AND order_state = 0');
-        if(empty($items)) return;
-        foreach ($items as $item) {
-            $order_sn = $item['order_sn'];
-            $member_id = intval($item['buyer_id']);
-            account_helper::order_cancel($order_sn,$member_id,true);
-        }
+//        $items = Model()->query('SELECT * FROM lrlz_order WHERE pd_amount=0 AND LENGTH(bonus_rate) > 0 AND add_time > UNIX_TIMESTAMP(DATE (\'2017-09-28 00:00:00\')) AND order_state = 0');
+//        if(empty($items)) return;
+//        foreach ($items as $item) {
+//            $order_sn = $item['order_sn'];
+//            $member_id = intval($item['buyer_id']);
+//            account_helper::order_cancel($order_sn,$member_id,true);
+//        }
     }
     public function init_commentsOp()
     {

+ 27 - 2
data/logic/queue.logic.php

@@ -629,13 +629,22 @@ class queueLogic
         return callback(true);
     }
 
-    public function onAsyncPaySuccess($param)
+    public function onAsyncOrderPaied($param)
     {
         $pay_sn = $param['pay_sn'];
-        account_helper::onAsyncPaySuccess($pay_sn);
+        account_helper::onAsyncOrderPaied($pay_sn);
         return callback(true);
     }
 
+    public function onAsyncOrderSended($param)
+    {
+        $pay_sn = $param['pay_sn'];
+        $logistics_no = $param['logistics_no'];
+        $logistics_company = $param['logistics_company'];
+
+        account_helper::onAsyncOrderSended($pay_sn,$logistics_no,$logistics_company);
+        return callback(true);
+    }
     public function onAsyncOrderComplete($param)
     {
         $pay_sn = $param['pay_sn'];
@@ -644,6 +653,22 @@ class queueLogic
         }
         return callback(true);
     }
+    public function onAsyncOrderCancel($param)
+    {
+        $pay_sn = $param['pay_sn'];
+        if(!empty($pay_sn)) {
+            account_helper::onAsyncOrderCancel($pay_sn);
+        }
+        return callback(true);
+    }
+    public function onAsyncOrderEvaluate($param)
+    {
+        $pay_sn = $param['pay_sn'];
+        if(!empty($pay_sn)) {
+            account_helper::onAsyncOrderEvaluate($pay_sn);
+        }
+        return callback(true);
+    }
 
     public function reset_fcode($param)
     {

+ 72 - 108
helper/account_helper.php

@@ -55,21 +55,6 @@ class account_helper
         }
     }
 
-    private static function evaluate_bonus($member_id,&$money)
-    {
-        $param = bonus\parameters::evaluate();
-        $type = bonus_helper::create_type_input($param);
-        $money = $type->getTotal_amount();
-        $ret = bonus_helper::make_bonus($param,$param['rate_money']);
-        if($ret != false) {
-            $type_sn = $ret['type_sn'];
-            bonus_helper::send($type_sn,[$member_id]);
-            return $type_sn;
-        } else {
-            return false;
-        }
-    }
-
     public static function gain_system($to_id, $amount)
     {
         if(self::$stSysBonus == null) {
@@ -178,44 +163,6 @@ class account_helper
         $pred->pay_bonus($bonus_rate);
     }
 
-    public static function order_cancel($order_sn,$member_id,$ignore = false)
-    {
-        $mod_order = Model('order');
-        $order = $mod_order->getOrderInfo(['order_sn' => $order_sn]);
-
-        $pd_amount = $order['pd_amount'];
-        $bonus_rate = $order['bonus_rate'];
-        if(empty($bonus_rate)) {
-            $bonus_rate = [30 => $pd_amount];
-        } else {
-            $bonus_rate = unserialize($bonus_rate);
-        }
-
-        if($ignore == false)
-        {
-            if(intval($pd_amount * 100 + 0.5) <= 0) {
-                return;
-            }
-        }
-
-        $params = \bonus\parameters::order_cancel($bonus_rate);
-        foreach ($params as $param)
-        {
-            $rate_money = $param['rate_money'];
-            $ret = bonus_helper::make_bonus($param,$rate_money);
-            $rate = $rate_money[0]['rate'];
-            $amount = $rate_money[0]['amount'];
-            if($ret != false) {
-                bonus_helper::send($ret['type_sn'],[$member_id]);
-                push_helper::order_cancel_bonus($member_id,$rate,$amount);
-            } else {
-                Log::record("给用户{$member_id} 退款{$amount}失败.");
-            }
-        }
-
-        Model()->table('order')->where(['order_sn' => $order_sn])->update(['pd_amount' => 0,'bonus_rate' => '']);
-    }
-
     public static function bonus_refund($type_sn,$member_id)
     {
         $type = bonus\type::create_by_sn($type_sn);
@@ -273,6 +220,7 @@ class account_helper
             return false;
         }
     }
+
     public static function appreciate($sender_id,$rate,$amount,$toid,$bless)
     {
         $param = \bonus\parameters::appreciate($sender_id,intval($rate),$amount,$bless);
@@ -304,24 +252,7 @@ class account_helper
         return $ret;
     }
 
-    static public function paysuccess_bonus($buyer_id, $total_amount)
-    {
-        $params = \bonus\parameters::order_complete($total_amount);
-
-        $val = 0.00;
-        foreach ($params as $param)
-        {
-            $ret = bonus_helper::make_bonus($param,$param['rate_money']);
-            if($ret != false) {
-                $type_sn = $ret['type_sn'];
-                $bonus = bonus_helper::send($type_sn,[$buyer_id]);
-                $val  += $bonus[0]['bonus_value'];
-            }
-        }
-
-        return $val;
-    }
-
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     public static function onPredRefund($change_type,$member_id,$sn,$refund_id)
     {
 //        $order_sn = $sn;
@@ -335,11 +266,19 @@ class account_helper
 
     public static function onPredeposit($change_type,$member_id,$sn)
     {
-        if($change_type == 'order_pay' || $change_type == 'order_freeze') {
+        if($change_type == 'order_pay' || $change_type == 'order_freeze')
+        {
             self::use_bonus($sn,$member_id);
         }
-        elseif($change_type == 'order_cancel') { //发送给该用户一个同等额度的红包
-            self::order_cancel($sn,$member_id);
+        elseif($change_type == 'order_cancel')
+        {
+            //发送给该用户一个同等额度的红包
+            $mod_order = Model('order');
+            $order = $mod_order->getOrderInfo(['order_sn' => $sn,'buyer_id' => $member_id]);
+            if(!empty($order)) {
+                $pay_sn = $order['pay_sn'];
+                QueueClient::push('onAsyncOrderCancel',['pay_sn' => $pay_sn]);
+            }
         }
         elseif($change_type == 'refund') { //发送给该用户一个同等额度的红包
 
@@ -349,27 +288,6 @@ class account_helper
         }
     }
 
-    public static function onEvaluate($member_id)
-    {
-        if(self::evaluate_bonus($member_id,$money) != false) {
-            push_helper::evaluation_bonus($member_id,$money);
-        }
-    }
-
-    //在发货之后,可以提醒用户留意收货,在订单中查看物流,短信通知
-    public static function onOrderSend($order_sn,$logistics_company,$logistics)
-    {
-        Log::record("account_helper::onOrderSend order_sn={$order_sn} company={$logistics_company} no={$logistics}",Log::DEBUG);
-        $mod = Model('order');
-        $info = $mod->getOrderInfo(['order_sn' => $order_sn]);
-        $buyer_id = intval($info['buyer_id']);
-        if($buyer_id <= 0) return;
-
-        $mem_info = new member_info($buyer_id);
-        $mobile = $mem_info->mobile();
-        sms_helper::send_nostore_message($mobile,Sms::order_sended,['company'=> $logistics_company,'logistics'=>$logistics,'time'=>'5']);
-    }
-
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     public static function onLogin($member_id)
     {
@@ -384,6 +302,7 @@ class account_helper
         $fcode = new user_session\fcode();
         $fcode->onStatus();
     }
+
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     public static function onStatus($member_id)
     {
@@ -411,8 +330,13 @@ class account_helper
 
     public static function onAsyncStatus($member_id)
     {
-        $iPusher = new async_push\status($member_id);
-        $iPusher->run();
+        try
+        {
+            $iPusher = new async_push\status($member_id);
+            $iPusher->run();
+        } catch (Exception $ex) {
+            Log::record($ex->getMessage(),Log::ERR);
+        }
     }
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     public static function onRegister($member_id,$relay_id)
@@ -433,28 +357,68 @@ class account_helper
 
     public static function onAsyncRegister($user,$inviter)
     {
-        $iPusher = new async_push\register($user,$inviter);
-        $iPusher->run();
+        try
+        {
+            $iPusher = new async_push\register($user,$inviter);
+            $iPusher->run();
+        } catch (Exception $ex) {
+            Log::record($ex->getMessage(),Log::ERR);
+        }
     }
-
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    //在支付成功之后,可以提醒用户收到货后,可以收到红包奖励。
-    public static function onAsyncPaySuccess($pay_sn)
+    public static function onAsyncOrderPaied($pay_sn)
+    {
+        try
+        {
+            $iPusher = new async_push\order($pay_sn);
+            $iPusher->onPaied();
+        } catch (Exception $ex) {
+            Log::record($ex->getMessage(),Log::ERR);
+        }
+    }
+
+    public static function onAsyncOrderSended($pay_sn,$logistics_no,$logistics_company)
     {
-        $iPusher = new async_push\order($pay_sn);
-        $iPusher->onPaySuccess();
+        try
+        {
+            $iPusher = new async_push\order($pay_sn);
+            $iPusher->onSended($logistics_no,$logistics_company);
+        } catch (Exception $ex) {
+            Log::record($ex->getMessage(),Log::ERR);
+        }
     }
 
     public static function onAsyncOrderComplete($pay_sn)
     {
-        $iPusher = new async_push\order($pay_sn);
-        $iPusher->onOrderComplete();
+        try
+        {
+            $iPusher = new async_push\order($pay_sn);
+            $iPusher->onComplete();
+        } catch (Exception $ex) {
+            Log::record($ex->getMessage(),Log::ERR);
+        }
     }
 
-    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    public static function onAsyncEvaluate($member_id)
+    public static function onAsyncOrderCancel($pay_sn)
     {
+        try
+        {
+            $iPusher = new async_push\order($pay_sn);
+            $iPusher->onCancel();
+        } catch (Exception $ex) {
+            Log::record($ex->getMessage(),Log::ERR);
+        }
+    }
 
+    public static function onAsyncOrderEvaluate($pay_sn)
+    {
+        try
+        {
+            $iPusher = new async_push\order($pay_sn);
+            $iPusher->onEvaluate();
+        } catch (Exception $ex) {
+            Log::record($ex->getMessage(),Log::ERR);
+        }
     }
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     public static function onAsyncGoodsDiscount($gid)

+ 122 - 18
helper/async_push/order.php

@@ -17,26 +17,35 @@ use bonus;
 use bonus_helper;
 use sms_helper;
 use Sms;
+use fcode;
+use Log;
 
 class simple_order
 {
-    private $order_info;
-    public function __construct($order_info)
-    {
-        $this->order_info = $order_info;
+    private $info;
+    public function __construct($order_info) {
+        $this->info = $order_info;
     }
-
     public function user() {
-        return $this->order_info['order_info']['buyer_id'];
+        return $this->info['order_info']['buyer_id'];
     }
     public function discount() {
-        return $this->order_info['order_info']['pd_amount'];
+        return $this->info['order_info']['pd_amount'];
     }
-    public function goods() {
-        return $this->order_info['order_goods'][0];
+    public function recommend_goods() {
+        return $this->info['order_goods'][0];
     }
     public function total() {
-        return $this->order_info['order_info']['order_amount'];
+        return $this->info['order_info']['order_amount'];
+    }
+    public function bonus_rates() {
+        return $this->info['order_info']['bonus_rates'];
+    }
+    public function pd_amount() {
+        return $this->info['order_info']['pd_amount'];
+    }
+    public function order_sn() {
+        return $this->info['order_info']['order_sn'];
     }
 }
 
@@ -57,11 +66,11 @@ class order extends IPusher
         $this->user_info = new member_info($user);
     }
 
-    public function run()
-    {
+    public function run() {
     }
 
-    public function onPaySuccess()
+    //支付成功
+    public function onPaied()
     {
         push_helper::user_order_paied($this->user_info->member_id(),$this->paysn);
         $inviters = search\relation_client::instance()->fetch_inviters(['user_id' => $this->user_info->member_id()]);
@@ -72,7 +81,7 @@ class order extends IPusher
     {
         if(empty($inviters)) return false;
 
-        $goods = $this->simple_order->goods();
+        $goods = $this->simple_order->recommend_goods();
         $level = 0;
         $ex_invitee = $this->user_info->member_id();
         foreach ($inviters as $inviter)
@@ -98,9 +107,50 @@ class order extends IPusher
         }
     }
 
-    public function onOrderComplete()
+    //发货
+    public function onSended($logistics_no,$logistics_company)
+    {
+        $mobile = $this->user_info->mobile();
+        sms_helper::send_nostore_message($mobile,Sms::order_sended,['company'=> $logistics_company,'logistics'=>$logistics_no,'time'=>'5']);
+    }
+
+    //取消订单
+    public function onCancel()
+    {
+        $pd_amount = $this->simple_order->pd_amount();
+        $bonus_rates = $this->simple_order->bonus_rates();
+        if(empty($bonus_rate)) {
+            $bonus_rates = [30 => $pd_amount];
+        } else {
+            $bonus_rates = unserialize($bonus_rates);
+        }
+
+        $params = bonus\parameters::order_cancel($bonus_rates);
+        foreach ($params as $param)
+        {
+            $rate_money = $param['rate_money'];
+            $ret = bonus_helper::make_bonus($param,$rate_money);
+            $rate = $rate_money[0]['rate'];
+            $amount = $rate_money[0]['amount'];
+            $user = $this->user_info->member_id();
+            $order_sn = $this->simple_order->order_sn();
+
+            if($ret != false) {
+                $type_sn = $ret['type_sn'];
+                bonus_helper::send($ret['type_sn'],[$user]);
+                push_helper::order_cancel_bonus($user,$amount,$rate,$order_sn,$type_sn);
+            } else {
+                Log::record("给用户{$user}:order_sn={$order_sn},退款rate={$rate} amount={$amount}失败.");
+            }
+        }
+
+        Model()->table('order')->where(['order_sn' => $this->simple_order->order_sn()])->update(['pd_amount' => 0,'bonus_rate' => '']);
+    }
+
+    //确认收货
+    public function onComplete()
     {
-        $num = \fcode\operator::unlock($this->paysn);
+        $num = fcode\operator::unlock($this->paysn);
         if($num > 0) {
             push_helper::fcode_unlock($this->user_info->member_id(),$num);
         }
@@ -147,15 +197,15 @@ class order extends IPusher
                 return false;
             }
         }
+        return true;
     }
 
     private function reward_invitees($inviter, $invitees, $level)
     {
         if(empty($invitees)) return false;
-        $inviter_info = new member_info($inviter);
 
         $num = count($invitees);
-        $params = bonus\parameters::order_complete_invitee($inviter_info->nickname(),$level,$num);
+        $params = bonus\parameters::order_complete_invitee($this->user_info->nickname(),$level,$num);
         foreach ($params as $param)
         {
             $type = bonus_helper::create_type_input($param);
@@ -173,6 +223,7 @@ class order extends IPusher
                 return false;
             }
         }
+        return true;
     }
 
     private function send_complete_bonus()
@@ -204,6 +255,59 @@ class order extends IPusher
         }
     }
 
+    //评论
+    public function onEvaluate()
+    {
+        $this->send_evaluate_bonus();
+        $inviters = search\relation_client::instance()->fetch_inviters(['user_id' => $this->user_info->member_id()]);
+        $this->notify_inviter_evaluate($inviters);
+    }
+
+    private function send_evaluate_bonus()
+    {
+        $fixed_params = bonus\parameters::order_evaluate_fixed();
+        foreach ($fixed_params as $param)
+        {
+            $ret = bonus_helper::make_bonus($param,$param['rate_money']);
+            if($ret != false) {
+                $type_sn = $ret['type_sn'];
+                $bonus = bonus_helper::send($type_sn, [$this->user_info->member_id()]);
+                $bonus_value = $bonus[0]['bonus_value'];
+                $bonus_rate = $bonus[0]['bonus_rate'];
+                push_helper::order_evaluate_bonus($this->user_info->member_id(),$bonus_value,$bonus_rate,$type_sn);
+            }
+        }
+    }
+
+    private function notify_inviter_evaluate($inviters)
+    {
+        if(empty($inviters)) return false;
+
+        $goods = $this->simple_order->recommend_goods();
+        $level = 0;
+        $ex_invitee = $this->user_info->member_id();
+        foreach ($inviters as $inviter)
+        {
+            $this->nofity_evaluate_inviter($inviter,$level,$goods);
+            $invitees = search\relation_client::instance()->fetch_invitees(['user_id' => $inviter]);
+            $invitees = $this->ex_user($invitees,$ex_invitee);
+            $this->nofity_evaluate_invitees($inviter,$invitees,$level,$goods);
+            $ex_invitee = $inviter;
+            $level += 1;
+        }
+        return true;
+    }
+    private function nofity_evaluate_inviter($inviter,$level,$goods)
+    {
+        push_helper::inviter_order_evaluated($inviter,$this->user_info->member_id(),$level + 1,$goods);
+    }
+    private function nofity_evaluate_invitees($inviter,$invitees,$level,$goods)
+    {
+        foreach ($invitees as $invitee) {
+            push_helper::invitee_order_evaluated($invitee,$this->user_info->member_id(),$goods);
+        }
+    }
+
     private function order($condition)
     {
         $model_order = Model('order');

+ 27 - 19
helper/bonus/parameters.php

@@ -7,8 +7,9 @@
  */
 namespace bonus;
 
-use \Exception;
-use \member_info;
+use Exception;
+use member_info;
+use bonus;
 
 class parameters
 {
@@ -45,19 +46,6 @@ class parameters
         return $param;
     }
 
-    public static function evaluate()
-    {
-        $param['make_type'] = type::MakeEvaluateType;
-        $param['type_name'] = "订单评论奖励红包";
-        $param['send_type'] = type::SendType_Fixed;
-        $param['grab_type'] = type::GrabType_All;
-        $param['sender_id']   = self::admin_member_id;
-        $param['sender_name'] = self::admin_name;
-        $param['usable_days'] = self::usable_days;
-        $param['rate_money'][] = ['amount' => 10,'num' => 1, 'rate' => 50];
-        return $param;
-    }
-
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     public static function user_reigster_fixed()
     {
@@ -227,8 +215,9 @@ class parameters
     public static function order_complete_inviter($nickname,$level)
     {
         $rate_moneys = [
+            ['amount' => 3,'num' => 1, 'rate' => 100],
             ['amount' => 2,'num' => 1, 'rate' => 100],
-            ['amount' => 1,'num' => 1, 'rate' => 100]
+            ['amount' => 1,'num' => 1, 'rate' => 100],
         ];
 
         $count = count($rate_moneys);
@@ -256,6 +245,7 @@ class parameters
         $rate_moneys = [
             ['amount' => 2,  'num' => $num, 'rate' => 100],
             ['amount' => 1,  'num' => $num, 'rate' => 100],
+            ['amount' => 0.5,'num' => $num, 'rate' => 100],
         ];
 
         $count = count($rate_moneys);
@@ -276,6 +266,22 @@ class parameters
 
         return $params;
     }
+
+    public static function order_evaluate_fixed()
+    {
+        $params = [];
+        $param['make_type'] = type::MakeEvaluateType;
+        $param['type_name'] = "订单评论奖励红包";
+        $param['send_type'] = type::SendType_Fixed;
+        $param['grab_type'] = type::GrabType_All;
+        $param['sender_id']   = self::admin_member_id;
+        $param['sender_name'] = self::admin_name;
+        $param['usable_days'] = self::usable_days;
+        $param['rate_money'][] = ['amount' => 5,'num' => 1, 'rate' => 50];
+        $params[] = $param;
+
+        return $param;
+    }
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     public static function admin_fixed($rate,$amount,$num,$type_name)
     {
@@ -405,12 +411,13 @@ class parameters
         return $params;
     }
 
-    public static function order_cancel($bonus_rate)
+    public static function order_cancel($bonus_rates)
     {
         $params = [];
-        foreach ($bonus_rate as $rate => $amount) {
+        foreach ($bonus_rates as $rate => $amount)
+        {
             $param = [];
-            $param['make_type'] = \bonus\type::MakeOrderCancelType;
+            $param['make_type'] = bonus\type::MakeOrderCancelType;
             $param['type_name'] = '订单退款';
             $param['sender_id'] = self::admin_member_id;
             $param['sender_name'] = self::admin_name;
@@ -422,6 +429,7 @@ class parameters
         }
         return $params;
     }
+
     public static function bonus_refund($rate,$amount)
     {
         $param['make_type'] = \bonus\type::MakeBonusRefundType;

+ 8 - 2
helper/pay_helper.php

@@ -167,7 +167,7 @@ class pay_helper
         return false;
     }
 
-    public function OnOmsNotify($order_sn, $express_id, $logistics_no)
+    public function OnOmsNotify($order_sn, $express_id, $logistics_no,$logistics_company)
     {
         $model_order = Model('order');
         $order_info = $model_order->getOrderInfo(array('order_sn' => $order_sn),array('order_common','order_goods'));
@@ -182,6 +182,12 @@ class pay_helper
 
         $logic_order = Logic('order');
         $result = $logic_order->changeOrderSend($order_info, 'system', $order_info['buyer_name'], $data);
+
+        QueueClient::push('onAsyncOrderSended',
+            ['pay_sn' => $order_info['pay_sn'],
+             'logistics_company' => $logistics_company,
+             'logistics_no' => $logistics_no]);
+
         return $result['state'];
     }
 
@@ -247,7 +253,7 @@ class pay_helper
         if($result['state'] != true) {
             return false;
         } else {
-            QueueClient::push('onAsyncPaySuccess',['pay_sn' => $pay_sn]);
+            QueueClient::push('onAsyncOrderPaied',['pay_sn' => $pay_sn]);
             return true;
         }
     }

+ 88 - 38
helper/push_helper.php

@@ -79,25 +79,6 @@ class push_helper
         QueueClient::push('upushSendMsg',$push_param);
     }
 
-    public static function order_cancel_bonus($member_id,$rate,$amount)
-    {
-        $minfo = new member_info($member_id);
-        $text = "取消订单退款通知:抵扣率{$rate}%,金额{$amount}元红包已退还到您的账户.";
-        
-        $push_param['alias'] = $member_id;
-        $push_param['title'] = "取消订单";
-        $push_param['text']  = $text;
-
-        $push_param['extra']['go_type']   = 'bonus';
-        $push_param['extra']['title']     = "取消订单";
-        $push_param['extra']['text']      = $text;
-        $push_param['extra']['show_type'] = 'pop';
-        $push_param['extra']['url']       = 'xmmz://p.lrlz.com/main/index?index=2';
-        $push_param['extra']['image']     = $minfo->avatar();
-
-        QueueClient::push('upushSendMsg',$push_param);
-    }
-
     public static function send_bonus($member_id,$to_ids)
     {
         $sender = new member_info($member_id);
@@ -161,25 +142,6 @@ class push_helper
         QueueClient::push('upushSendMsg',$push_param);
     }
 
-    public static function evaluation_bonus($member_id,$money)
-    {
-        $text = "感谢您的评价,熊猫美妆送给您{$money}元红包,请查收~.";
-        $minfo = new member_info($member_id);
-
-        $push_param['alias'] = $member_id;
-        $push_param['title'] = "评价奖励";
-        $push_param['text']  = $text;
-
-        $push_param['extra']['go_type']  = 'bonus';
-        $push_param['extra']['title']    = "评价奖励";
-        $push_param['extra']['text']     = $text;
-        $push_param['extra']['show_type'] = 'pop';
-        $push_param['extra']['url']       = 'xmmz://p.lrlz.com/main/index?index=2';
-        $push_param['extra']['image']    = $minfo->avatar();
-
-        QueueClient::push('upushSendMsg',$push_param);
-    }
-
     public static function invite_bonus($member_id,$money)
     {
         $minfo = new member_info($member_id);
@@ -452,6 +414,94 @@ class push_helper
         QueueClient::push('upushSendMsg',$push_param);
     }
 
+    public static function order_cancel_bonus($member_id,$amount,$rate,$order_sn,$type_sn)
+    {
+        $desc = self::money_rate_desc($amount,$rate);
+        $text = "订单{$order_sn}取消成功,退还{$desc}元红包.";
+
+        $push_param['alias'] = $member_id;
+        $push_param['title'] = "取消订单";
+        $push_param['text']  = $text;
+
+        $push_param['extra']['go_type']   = 'bonus';
+        $push_param['extra']['title']     = "取消订单";
+        $push_param['extra']['text']      = $text;
+        $push_param['extra']['show_type'] = 'pop';
+        $push_param['extra']['url']       = schema_helper::bonus_detail($type_sn);
+        $push_param['extra']['image']     = self::admin_avatar();
+
+        QueueClient::push('upushSendMsg',$push_param);
+    }
+
+
+    public static function order_evaluate_bonus($user, $money,$rate,$type_sn)
+    {
+        $desc = self::money_rate_desc($money, $rate);
+        $text = "感谢您的订单评价,熊猫美妆送给您{$desc}元红包,请查收~.";
+
+        $push_param['alias'] = $user;
+        $push_param['title'] = "评价奖励";
+        $push_param['text']  = $text;
+
+        $push_param['extra']['go_type']   = 'bonus';
+        $push_param['extra']['title']     = "评价奖励";
+        $push_param['extra']['text']      = $text;
+        $push_param['extra']['show_type'] = 'pop';
+        $push_param['extra']['url']       = schema_helper::bonus_detail($type_sn);
+        $push_param['extra']['image']     = self::admin_avatar();
+
+        QueueClient::push('upushSendMsg',$push_param);
+    }
+
+    private static function inviter_evaluated_text(member_info $user, $level, $goods_name)
+    {
+        $text = "您的{$level}度粉丝 {$user->nickname()},刚刚评论了《{$goods_name}》.";
+        return $text;
+    }
+    public static function inviter_order_evaluated($inviter, $user, $level, $goods_info)
+    {
+        $user_info = new member_info($user);
+        $text = self::inviter_evaluated_text($user_info,$level,$goods_info['goods_name']);
+
+        $push_param['alias'] = $inviter;
+        $push_param['title'] = "粉丝正在评论";
+        $push_param['text']  = $text;
+
+        $push_param['extra']['go_type']  = 'bonus';
+        $push_param['extra']['title']    = "粉丝正在评论";
+        $push_param['extra']['text']     = $text;
+        $push_param['extra']['show_type']= 'pop';
+
+        $push_param['extra']['url']      = schema_helper::goods($goods_info['goods_id']);
+        $push_param['extra']['image']    = $goods_info['goods_image'];
+
+        QueueClient::push('upushSendMsg',$push_param);
+    }
+
+    private static function invitee_evaluated_text(member_info $user, $goods_name)
+    {
+        $text = "您的朋友 {$user->nickname()},刚刚评论了《{$goods_name}》.";
+        return $text;
+    }
+    public static function invitee_order_evaluated($invitee, $user, $goods_info)
+    {
+        $user_info = new member_info($user);
+        $text = self::invitee_evaluated_text($user_info,$goods_info['goods_name']);
+
+        $push_param['alias'] = $invitee;
+        $push_param['title'] = "好友正在评论";
+        $push_param['text']  = $text;
+
+        $push_param['extra']['go_type']  = 'bonus';
+        $push_param['extra']['title']    = "好友正在评论";
+        $push_param['extra']['text']     = $text;
+        $push_param['extra']['show_type']= 'pop';
+
+        $push_param['extra']['url']      = schema_helper::goods($goods_info['goods_id']);
+        $push_param['extra']['image']    = $goods_info['goods_image'];
+
+        QueueClient::push('upushSendMsg',$push_param);
+    }
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
     public static function fcode_unlock($member_id,$num)

+ 7 - 3
helper/special_helper.php

@@ -382,9 +382,13 @@ class special_formater
     private function read_cache()
     {
         $mod_special = Model('mb_special');
-        $special = $mod_special->getMbSpecialByID($this->special_id);
-        if(empty($special)) {
-            return false;
+
+        if($this->special_id > 0)
+        {
+            $special = $mod_special->getMbSpecialByID($this->special_id);
+            if(empty($special)) {
+                return false;
+            }
         }
 
         $sp_items = $mod_special->getMbSpecialItemUsableListByID($this->special_id);

+ 1 - 1
mobile/control/member_evaluate.php

@@ -271,7 +271,7 @@ class member_evaluateControl extends mbMemberControl
             $data['log_role'] = 'buyer';
             $data['log_msg'] = L('order_log_eval');
             $model_order->addOrderLog($data);
-            account_helper::onEvaluate($_SESSION['member_id']);
+            QueueClient::push('onAsyncOrderEvaluate',['pay_sn' => $order_info['pay_sn']]);
         }
 
         //添加会员积分

+ 3 - 5
mobile/dispatch_notify.php

@@ -35,13 +35,11 @@ try
     {
         if ($status == 1)
         {
-            Log::record("push oms order_sn={$order_sn},express={$express_id},no={$logistics_no}",Log::DEBUG);
-            account_helper::onOrderSend($order_sn,$logistics_company,$logistics_no);
             $helper = new pay_helper();
-            $ret = $helper->OnOmsNotify($order_sn,$express_id,$logistics_no);
+            $ret = $helper->OnOmsNotify($order_sn,$express_id,$logistics_no,$logistics_company);
 
             if ($ret) {
-                QueueClient::push('subscribeKDN',array('order_sn'=>$order_sn));
+                QueueClient::push('subscribeKDN',['order_sn'=>$order_sn]);
                 Log::record("push oms success",Log::DEBUG);
                 echo 'SUCCESS';
             } else {
@@ -51,7 +49,7 @@ try
         }
         else
         {
-            QueueClient::push('subscribeKDN',array('order_sn'=>$order_sn));
+            QueueClient::push('subscribeKDN',['order_sn'=>$order_sn]);
             echo 'SUCCESS';
         }
     } else {

+ 1 - 1
test/TestPush.php

@@ -40,7 +40,7 @@ class TestPush extends PHPUnit_Framework_TestCase
 
     public function testPaysuccess()
     {
-        account_helper::onAsyncPaySuccess('270563196360813623');
+        account_helper::onAsyncOrderPaied('270563196360813623');
     }
     public function testOrderComplete()
     {

+ 2 - 6
test/account_helperTest.php

@@ -27,7 +27,7 @@ class account_helperTest extends PHPUnit_Framework_TestCase
     }
     public function testEvaluate()
     {
-        account_helper::onEvaluate(36490);
+        account_helper::onAsyncOrderEvaluate();
     }
     public function testGainSystem()
     {
@@ -46,10 +46,6 @@ class account_helperTest extends PHPUnit_Framework_TestCase
         account_helper::onRegister(36490,session_helper::relay_id());
     }
 
-    public function testPaysuccess_bonus()
-    {
-        account_helper::paysuccess_bonus(36490,500);
-    }
     public function testOrderCancel()
     {
         account_helper::order_cancel('8000000000001603',36490);
@@ -61,7 +57,7 @@ class account_helperTest extends PHPUnit_Framework_TestCase
     public function testPaysuccess()
     {
         $pay_sn = '910510761110261481';
-        account_helper::onAsyncPaySuccess($pay_sn);
+        account_helper::onAsyncOrderPaied($pay_sn);
     }
     public function testOrderSuccessSys()
     {

+ 0 - 4
test/queueTest.php

@@ -44,10 +44,6 @@ class queueTest extends PHPUnit_Framework_TestCase
         $result = $logic_order->changeOrderStateReceive($order_info,'system','系统','超期未收货系统自动完成订单');
 
     }
-    public function testEvaluate()
-    {
-        account_helper::onEvaluate(36490);
-    }
 
     public static function tearDownAfterClass()
     {