|
@@ -55,7 +55,14 @@ class UserMiningMachine extends BaseModel
|
|
|
|
|
|
public static function dayMining()
|
|
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();
|
|
BaseModel::beginTrans();
|
|
self::dayMiningStatusEnd();
|
|
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);
|
|
$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')
|
|
if ($v['get_money_type'] == 'XCH')
|
|
$day_get = bcmul($day_get, 0.84, 8);
|
|
$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);
|
|
$send_stand = bcdiv($v['stand_money'], $machine['third_step_time'], 8);
|
|
$day_unlock = 0;
|
|
$day_unlock = 0;
|
|
$locks = UserMining::where('umid', $v['id'])->where('add_date', '<>', strtotime('Y-m-d'))->where('lock_money', '>', 0)->select();
|
|
$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);
|
|
$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')
|
|
if ($v['get_money_type'] == 'XCH')
|
|
$day_get = bcmul($day_get, 0.84, 8);
|
|
$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 = $machine['service_ratio'];
|
|
$service_ratio = UserMiningService::where('uid', $v['uid'])->where('mid', $machine['id'])->value('ratio') ?: $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);
|
|
$service_ratio = bcsub(1, bcdiv($service_ratio, 100, 4), 4);
|
|
@@ -178,11 +181,8 @@ class UserMiningMachine extends BaseModel
|
|
// var_dump($day_get);
|
|
// var_dump($day_get);
|
|
if ($v['get_money_type'] == 'XCH')
|
|
if ($v['get_money_type'] == 'XCH')
|
|
$day_get = bcmul($day_get, 0.84, 8);
|
|
$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 = $machine['service_ratio'];
|
|
$service_ratio = UserMiningService::where('uid', $v['uid'])->where('mid', $machine['id'])->value('ratio') ?: $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);
|
|
$service_ratio = bcsub(1, bcdiv($service_ratio, 100, 4), 4);
|
|
@@ -214,7 +214,6 @@ class UserMiningMachine extends BaseModel
|
|
}
|
|
}
|
|
// var_dump($res);
|
|
// var_dump($res);
|
|
if ($res) {
|
|
if ($res) {
|
|
- file_put_contents('day.txt', $p + 1);
|
|
|
|
BaseModel::commitTrans();
|
|
BaseModel::commitTrans();
|
|
return true;
|
|
return true;
|
|
} else
|
|
} else
|