stanley-king 7 anni fa
parent
commit
4e2778f994

+ 1 - 0
admin/control/mb_special.php

@@ -88,6 +88,7 @@ class mb_specialControl extends SystemControl
         } else {
             $cond = [];
         }
+        $cond['from_user'] = 0;
 
         $model_mb_special = Model('mb_special');
         $mb_special_list = $model_mb_special->getMbSpecialList($cond, 50);

+ 20 - 0
data/logic/delivery.logic.php

@@ -15,6 +15,8 @@ require_once (BASE_CORE_PATH . '/framework/function/http.php');
 class deliveryLogic
 {
     const oms_url = 'http://oapi.lrlz.com/lrlzApiRest/router/rest';
+    //const oms_url = 'http://oapitest.lrlz.com/lrlzApiRest/router/rest';
+
 
     private static $appkey = '2015panda';
     private static $appPassWord = 'nEs5vu86JSjh89WPW4de2d3e87rwli3e8rw';
@@ -166,6 +168,24 @@ class deliveryLogic
         return $result;
     }
 
+    public function cancel_oms($order_sn)
+    {
+        $param = array('type' => 'TRADE_INTERCEPT','data' => array('tids' => $order_sn,'remark' => '用户退款'));
+        $body = json_encode($param,JSON_UNESCAPED_UNICODE);
+        $sign = $this->sign($body);
+        $headers = array('v_appkey: '.self::$appkey, 'v_sign: '.$sign, 'Content-Type: application/json');
+        $resp = http_post_data(self::oms_url,urlencode($body),$headers);
+        if($resp === false) {
+            Log::record(__METHOD__ . " NET Error",Log::ERR);
+            return false;
+        }
+        else {
+            Log::record($resp,Log::DEBUG);
+        }
+
+        return true;
+    }
+
     /**
      * @param $pay_sn
      * @param $trade_no

+ 4 - 0
helper/account_helper.php

@@ -315,6 +315,10 @@ class account_helper
         $pred->inc_rate_version();
         $type_sn = $ret['type_sn'];
         $ret = bonus_helper::send($type_sn,[$toid]);
+        if($ret != false) {
+            push_helper::appreciate_bonus($sender_id,$toid);
+        }
+
         return ($ret != false);
     }
 

+ 14 - 0
helper/push_helper.php

@@ -70,6 +70,20 @@ class push_helper
         }
     }
 
+    public static function appreciate_bonus($member_id,$to_id)
+    {
+        $sender = new member_info($member_id);
+        $name = $sender->nickname();
+
+        $push_param = [];
+        $push_param['member_id'] = $to_id;
+        $push_param['text']      = "您的好友{$name}给您文章赞赏一个红包,快去查看吧.";
+        $push_param['go_type']   = 'bonus';
+        $push_param['url']       = 'xmmz://p.lrlz.com/main/index?index=2';
+
+        QueueClient::push('upushSendMsg',$push_param);
+    }
+
     public static function bonus_refund($member_id,$amount)
     {
         $push_param = array();

+ 1 - 1
helper/ugc_helper.php

@@ -140,7 +140,7 @@ class ugc_helper
         }
 
         $rule = $special->submit_rule();
-        if($rule != false) {
+        if($rule != false && $num > 0) {
             $type_sn = $rule->make_bonus($num);
         } else {
             $type_sn = "";

+ 1 - 0
mobile/control/member_refund.php

@@ -73,6 +73,7 @@ class member_refundControl extends mbMemberControl
             if($order == false) {
                 return self::outerr(errcode::ErrParamter,"查不到该订单");
             } else {
+                Logic('delivery')->cancel_oms($order_sn);
                 return self::outsuccess(array('order' => $order));
             }
         }

+ 9 - 2
mobile/control/special.php

@@ -258,6 +258,8 @@ class tpl_ugc
         if(!$submitor->submited())
         {
             $special = $this->special;
+            $rule = $special->submit_rule();
+
             if($special->has_vote() || $special->has_question())
             {
                 if($special->has_vote() && $special->has_question()) {
@@ -267,12 +269,14 @@ class tpl_ugc
                     $content = "投票";
                 }
                 else{
-                    $content = "答题";
+                    $content = "提交";
+                }
+                if($rule != false) {
+                    $content .= " (领红包)";
                 }
             }
             else
             {
-                $rule = $special->submit_rule();
                 if($rule == false) {
                     return;
                 } else {
@@ -286,6 +290,9 @@ class tpl_ugc
                 $str = "<button class=\"button_vote\" id=\"submit_btn\">{$content}</button>";
             }
         }
+        else  {
+            $str = "<button class=\"button_vote button_null\" id=\"submit_btn\" disabled>您已经提交过</button>";
+        }
         echo $str;
     }
 

+ 5 - 0
test/orderTest.php

@@ -21,6 +21,11 @@ class orderTest extends PHPUnit_Framework_TestCase
     public static function tearDownAfterClass()
     {
     }
+    public function testCancelOms()
+    {
+        $oms = Logic('delivery');
+        $oms->cancel_oms('9000000000683201');
+    }
 
     public static function testSuccess()
     {