stanley-king пре 7 година
родитељ
комит
80aa1f8b2e

+ 3 - 0
helper/account_helper.php

@@ -25,6 +25,9 @@ require_once(BASE_ROOT_PATH . '/helper/async/status.php');
 require_once(BASE_ROOT_PATH . '/helper/async/register.php');
 require_once(BASE_ROOT_PATH . '/helper/async/order.php');
 require_once(BASE_ROOT_PATH . '/helper/async/qugc.php');
+require_once(BASE_ROOT_PATH . '/helper/async/bargain.php');
+require_once(BASE_ROOT_PATH . '/helper/room_helper.php');
+
 require_once(BASE_ROOT_PATH . '/helper/async/broadcast_order.php');
 require_once(BASE_ROOT_PATH . '/helper/async/broadcast.php');
 require_once(BASE_ROOT_PATH . '/helper/async/broadcast/filter.php');

+ 17 - 14
helper/async/bargain.php

@@ -84,19 +84,22 @@ class bargain
 
     private function send_bonus($discount,$userid)
     {
-//        $params = bonus\parameters::user_reigster_fixed();
-//        foreach ($params as $param) {
-//            $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, [$this->cur_user]);
-//                push_helper::register_bonus($this->cur_user, $money, $type_sn);
-//            } else {
-//                return false;
-//            }
-//        }
+        $cent = intval($discount * 100 + 0.5);
+        if($cent <= 0) return false;
+
+        $params = bonus\parameters::bargain_fixed(100,$discount);
+        foreach ($params as $param) {
+            $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, [$userid]);
+                push_helper::register_bonus($userid, $discount, $type_sn);
+            } else {
+                return false;
+            }
+        }
     }
 }

+ 4 - 2
helper/bonus/parameters.php

@@ -364,8 +364,9 @@ class parameters
         return $param;
     }
 
-    public static function bargain_fixed($rate,$amount,$type_name,$can_share = 0)
+    public static function bargain_fixed($rate,$amount,$type_name='',$can_share = 0)
     {
+        $params = [];
         $param['make_type'] = type::MakeSendType;
         $param['type_name'] = empty($type_name) ? "砍价红包" : $type_name;
         $param['send_type'] = type::SendType_Fixed;
@@ -376,7 +377,8 @@ class parameters
         $param['can_share']   = $can_share;
         $param['rate_money'][] = ['amount' => $amount,'num' => 1, 'rate' => $rate];
 
-        return $param;
+        $params[] = $param;
+        return $params;
     }
 
     public static function appreciate($sender_id,$rate,$amount,$bless)

+ 20 - 1
helper/push_helper.php

@@ -834,7 +834,7 @@ class push_helper
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     public static function poor_user_bonus($user, $money, $rate, $type_sn, $fQueue=false)
     {
-//        $url = self::pushurl() . "&op=bonus&type_sn={$type_sn}";
+//      $url = self::pushurl() . "&op=bonus&type_sn={$type_sn}";
         $desc = self::money_rate_desc($money,$rate);
         $text = "您的红包余额不足,好心人紧急为您充值{$desc}红包~";
 
@@ -907,6 +907,25 @@ class push_helper
 
         return $push_param;
     }
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    public static function bargain_bonus($user, $money,$type_sn,$fQueue=false)
+    {
+        $text = "您获得{$money}元的砍价红包,请查收~";
+
+        $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);
+    }
 }
 
 class push_event

+ 1 - 1
helper/url_helper.php

@@ -139,7 +139,7 @@ class author_url
     public static function bargain_url($bargain_id)
     {
         $relay_id = session_helper::relay_id();
-        $url = BASE_SITE_URL . "/mobile/index.php?act=bargain&op=open_bargain&client_type=wap&bargain_id={$bargain_id}&relay_id={$relay_id}";
+        $url = BASE_SITE_URL . "/mobile/index.php?act=bargain&op=open&client_type=wap&bargain_id={$bargain_id}&relay_id={$relay_id}";
         return $url;
     }
 }

+ 6 - 0
mobile/control/bargain.php

@@ -419,14 +419,20 @@ class tpl_bargain
 
     public function share_url()
     {
+        return url_helper::bargain_open_url($this->mBargain->bargain_id());
     }
     public function share_title()
     {
+        return $this->mSummary['goods_mobile_name'];
     }
     public function share_image()
     {
+        return $this->mSummary['goods_image_url'];
     }
     public function share_subtitle()
     {
+        $price = $this->mBargain->lowest_price();
+        return "帮我砍个价,{$price}元得商品~";
+
     }
 }

+ 2 - 0
mobile/wxauthor.php

@@ -15,6 +15,8 @@ error_reporting(E_ERROR);
 $code  = $_GET['code'];
 $state = $_GET['state'];
 
+Log::record("state:{$state}",Log::DEBUG);
+
 if(empty($code)) {
     Log::record("没有同意授权");
 }

+ 2 - 0
test/TestTime.php

@@ -22,6 +22,8 @@ class TestTime extends PHPUnit_Framework_TestCase
 
     public function testS()
     {
+        $date = date('Y-m-d H:i:S',1517399862);
+
         $tm = strtotime('2017-08-01 3:43:00');
         $tm1 = strtotime('2017-8-01 3:43:00');
         $tm2 = strtotime('2017-08-1 3:43:00');