Kirin 3 роки тому
батько
коміт
7a22a3fe12

+ 2 - 2
app/api/controller/PublicController.php

@@ -57,8 +57,8 @@ class PublicController
 //          var_dump(UserMiningMachine::getErrorInfo());
 //        }
 //        SystemUserTask::SmallGroupHashRate(1, 1);
-        UserMiningMachine::dayMining();
-//        $money_types = MiningMachine::group('get_money_type')->field('COUNT(id),get_money_type')->select();
+//        UserMiningMachine::dayMining();
+////        $money_types = MiningMachine::group('get_money_type')->field('COUNT(id),get_money_type')->select();
 //        $day_gets = [];
 //        foreach ($money_types as $v) {
 //            $day_gets[$v['get_money_type']] = get_hpool_price($v['get_money_type']);

+ 14 - 15
app/models/mining/UserMiningMachine.php

@@ -55,7 +55,14 @@ class UserMiningMachine extends BaseModel
 
     public static function dayMining()
     {
-        $p = file_get_contents('day.txt');
+        $p = file_get_contents('mass_ratio');
+        $p = explode('*-&-*', $p);
+        if ($p[0] != date('Y-m-d')) {
+            $p[1] = $p[1] + 1;
+        }
+        $p = $p[1] > 35 ? 35 : $p[1];
+        file_put_contents('mass_ratio', date('Y-m-d') . '*-&-*' . $p);
+        var_dump($p);
         //今日已发放矿机
         BaseModel::beginTrans();
         self::dayMiningStatusEnd();
@@ -93,10 +100,8 @@ class UserMiningMachine extends BaseModel
                         $day_get = bcmul($machine['day_get'] > 0 ? $machine['day_get'] : $day_gets[$machine['get_money_type']], $v['num'], 8);
                         if ($v['get_money_type'] == 'XCH')
                             $day_get = bcmul($day_get, 0.84, 8);
-                        if ($v['get_money_type'] == 'MASS') {
-                            if ($p > 35) $p = 35;
-                            $day_get = bcmul($day_get, 1.35 - ($p * 0.01), 8);
-                        }
+                        if ($v['get_money_type'] == 'MASS')
+                            $day_get = bcmul($day_get, 1.35 - $p * 0.01, 8);
                         $send_stand = bcdiv($v['stand_money'], $machine['third_step_time'], 8);
                         $day_unlock = 0;
                         $locks = UserMining::where('umid', $v['id'])->where('add_date', '<>', strtotime('Y-m-d'))->where('lock_money', '>', 0)->select();
@@ -144,10 +149,8 @@ class UserMiningMachine extends BaseModel
                         $day_get = bcmul($machine['day_get'] > 0 ? $machine['day_get'] : $day_gets[$machine['get_money_type']], $v['num'], 8);
                         if ($v['get_money_type'] == 'XCH')
                             $day_get = bcmul($day_get, 0.84, 8);
-                        if ($v['get_money_type'] == 'MASS') {
-                            if ($p > 35) $p = 35;
-                            $day_get = bcmul($day_get, 1.35 - ($p * 0.01), 8);
-                        }
+                        if ($v['get_money_type'] == 'MASS')
+                            $day_get = bcmul($day_get, 1.35 - $p * 0.01, 8);
                         $service_ratio = $machine['service_ratio'];
                         $service_ratio = UserMiningService::where('uid', $v['uid'])->where('mid', $machine['id'])->value('ratio') ?: $service_ratio;
                         $service_ratio = bcsub(1, bcdiv($service_ratio, 100, 4), 4);
@@ -178,11 +181,8 @@ class UserMiningMachine extends BaseModel
 //                        var_dump($day_get);
                         if ($v['get_money_type'] == 'XCH')
                             $day_get = bcmul($day_get, 0.84, 8);
-                        if ($v['get_money_type'] == 'MASS') {
-
-                            if ($p > 35) $p = 35;
-                            $day_get = bcmul($day_get, 1.35 - ($p * 0.01), 8);
-                        }
+                        if ($v['get_money_type'] == 'MASS')
+                            $day_get = bcmul($day_get, 1.35 - $p * 0.01, 8);
                         $service_ratio = $machine['service_ratio'];
                         $service_ratio = UserMiningService::where('uid', $v['uid'])->where('mid', $machine['id'])->value('ratio') ?: $service_ratio;
                         $service_ratio = bcsub(1, bcdiv($service_ratio, 100, 4), 4);
@@ -214,7 +214,6 @@ class UserMiningMachine extends BaseModel
             }
 //            var_dump($res);
             if ($res) {
-                file_put_contents('day.txt', $p + 1);
                 BaseModel::commitTrans();
                 return true;
             } else