Bläddra i källkod

小调整活动匹配

joe 4 år sedan
förälder
incheckning
92474b1e1a
2 ändrade filer med 4 tillägg och 9 borttagningar
  1. 2 0
      app/admin/controller/Test.php
  2. 2 9
      tw/async/activities/ActivityCalc.php

+ 2 - 0
app/admin/controller/Test.php

@@ -128,10 +128,12 @@ class Test
 
     public function test()
     {
+        // $this->test_board();
         // $this->get_rsa_key();
         // $this->test_enterprise_pay();
         // echo $this->test_async_func();
         // $this->test_redis();
+        // $this->test_calc();
         // echo UserSearch::InsertHistory(1, "good");
         // print_r(UserSearch::getList(1, 20));
         // return $this->test_routine_reg();

+ 2 - 9
tw/async/activities/ActivityCalc.php

@@ -45,12 +45,6 @@ abstract class ActivityCalc {
         $products = $products ? $products->toArray() : [];
         return $products;
     }
-
-    protected function getPoolKey()
-    {
-        $KEY = 'activity:pool:';
-        return $KEY . $this->getName();
-    }
     
     /**
      * 用统一的架构来计算输赢
@@ -160,12 +154,11 @@ abstract class ActivityCalc {
         }
         // 如果只有 1 件商品
         if ($pNum == 1) {
-            $KEY = 'activity:pool';
             // 此时,订单必为 loser
             // 47% 概率胜
             $itWin = false; // 这单胜了 ?
             $dice = mt_rand(0, 100); 
-            if ( $dice < 47) {
+            if ( $dice < 60) {
                 $itWin = true;
             }
 
@@ -183,7 +176,7 @@ abstract class ActivityCalc {
             }
             (new ActivityPool)->hincr_by_float('', $this->getName(), floatval($profit));
 
-            infolog($this->getName() . ": single order[product]. dice:$dice, remain:$poolBalance, pay_count:" . $products[0]['pay_count']);
+            warnlog($this->getName() . ": single order[product]. dice:$dice, remain:$poolBalance, pay_count:" . $products[0]['pay_count']);
         }
 
         $result = $this->getResult($winners == $left);