bugfix
This commit is contained in:
parent
faa1912f7e
commit
64b0cf6696
|
@ -94,7 +94,8 @@ class CoinCalc extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the command.
|
||||||
|
* coin:calc
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
@ -255,7 +256,7 @@ class CoinCalc extends Command
|
||||||
$pd['participant'] += mt_rand(1, 20);
|
$pd['participant'] += mt_rand(1, 20);
|
||||||
$pd['userRevenue'] = $pd['totalOutput'] - $max;
|
$pd['userRevenue'] = $pd['totalOutput'] - $max;
|
||||||
|
|
||||||
Redis::set(json_encode($pd));
|
Redis::set(ApiV1Controller::K_POOLDATA, json_encode($pd));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _robots()
|
protected function _robots()
|
||||||
|
|
|
@ -2,9 +2,12 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Base;
|
||||||
use App\Http\Controllers\ApiV1Controller;
|
use App\Http\Controllers\ApiV1Controller;
|
||||||
|
use App\Tool\ThirdApi;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Redis;
|
||||||
|
|
||||||
class CoinInit extends Command
|
class CoinInit extends Command
|
||||||
{
|
{
|
||||||
|
@ -32,6 +35,20 @@ class CoinInit extends Command
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function refresh_eth_cache()
|
||||||
|
{
|
||||||
|
$price = ThirdApi::getETHPrice();
|
||||||
|
if (is_null($price) || $price <= 0) {
|
||||||
|
Log::error("get ETH price failed. price=$price");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$r = Redis::hSet(ApiV1Controller::K_COIN_PRICE, Base::ETH, $price);
|
||||||
|
if (is_null($r)) {
|
||||||
|
Log::error("redis error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
*
|
||||||
|
|
|
@ -81,7 +81,7 @@ class ApiV1Controller extends Controller
|
||||||
$protocol = $request->input('protocol');
|
$protocol = $request->input('protocol');
|
||||||
$ts = $request->input('ts');
|
$ts = $request->input('ts');
|
||||||
$s = $request->input('s');
|
$s = $request->input('s');
|
||||||
$referral = $request->input('referral');
|
$referral = $request->input('sh');
|
||||||
|
|
||||||
// check
|
// check
|
||||||
$expected_s = sha1($address . $protocol . $ts);
|
$expected_s = sha1($address . $protocol . $ts);
|
||||||
|
@ -128,9 +128,6 @@ class ApiV1Controller extends Controller
|
||||||
$id = $he->id;
|
$id = $he->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO async
|
|
||||||
$url = config('app.tg_url');
|
|
||||||
|
|
||||||
return json_encode([
|
return json_encode([
|
||||||
'code' => 0,
|
'code' => 0,
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
|
@ -226,9 +223,9 @@ class ApiV1Controller extends Controller
|
||||||
if (!$times || $times <= 0) {
|
if (!$times || $times <= 0) {
|
||||||
$reward = $this->_first_recharge_reward($amount);
|
$reward = $this->_first_recharge_reward($amount);
|
||||||
}
|
}
|
||||||
$amount += $reward;
|
$delta = $amount + $reward;
|
||||||
// insert into user
|
// insert into user
|
||||||
User::where('address', $address)->increment('balance', $amount);
|
User::where('address', $address)->increment('balance', $delta);
|
||||||
|
|
||||||
// records
|
// records
|
||||||
$newBlc = new Balance();
|
$newBlc = new Balance();
|
||||||
|
|
|
@ -6,4 +6,5 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Vault extends Model
|
class Vault extends Model
|
||||||
{
|
{
|
||||||
|
public $timestamps = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,5 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Vault2 extends Model
|
class Vault2 extends Model
|
||||||
{
|
{
|
||||||
|
public $timestamps = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,5 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Vault3 extends Model
|
class Vault3 extends Model
|
||||||
{
|
{
|
||||||
|
public $timestamps = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue