Browse Source

修改一些参数

master
torsenli 2 years ago
parent
commit
8a09ba0f24
  1. 2
      app/Http/Controllers/Api/V1/UdunWalletController.php
  2. 8
      app/Models/DataDsor.php
  3. 8
      app/Models/DataHoz.php
  4. 8
      app/Models/DataMot.php
  5. 124
      app/Models/DataMpob.php
  6. 8
      app/Models/DataNcr.php
  7. 124
      app/Models/DataRute.php
  8. 124
      app/Models/DataShip.php
  9. 124
      app/Models/DataSte.php
  10. 8
      app/Models/DataTer.php
  11. 124
      app/Models/DataTomb.php
  12. 2
      app/Services/UdunWalletService.php

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

@ -30,7 +30,7 @@ class UdunWalletController extends ApiController
}
// 先验签
$sign = md5($res['body'] . config('coin.api_key', '399f1b34c5f3cfa508b8951f5acb69') . $res['nonce'] . $res['timestamp']);
$sign = md5($res['body'] . config('coin.api_key', '29b9a2dd56250bef3d4f70cf6b183369') . $res['nonce'] . $res['timestamp']);
if ($res['sign'] != $sign) {
info('=====优盾钱包回调通知验签失败2======', $res);
}

8
app/Models/DataAeef.php → app/Models/DataDsor.php

@ -12,17 +12,17 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DataAeef extends Model
class DataDsor extends Model
{
protected $primaryKey = 'id';
protected $table = 'data_aeef';
protected $table = 'data_dsor';
protected $guarded = [];
public $timestamps = false;
public $attributes = [
'pid' => 0,
'Symbol' => 'AEEF',
'Name' => 'AEEF',
'Symbol' => 'DSOR',
'Name' => 'DSOR',
'Price2' => 0,
'Price3' => 0,
'Open_Int' => 0,

8
app/Models/DataNec.php → app/Models/DataHoz.php

@ -12,17 +12,17 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DataNec extends Model
class DataHoz extends Model
{
protected $primaryKey = 'id';
protected $table = 'data_nec';
protected $table = 'data_hoz';
protected $guarded = [];
public $timestamps = false;
public $attributes = [
'pid' => 0,
'Symbol' => 'NEC',
'Name' => 'NEC',
'Symbol' => 'HOZ',
'Name' => 'HOZ',
'Price2' => 0,
'Price3' => 0,
'Open_Int' => 0,

8
app/Models/DataBgv.php → app/Models/DataMot.php

@ -12,17 +12,17 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DataBgv extends Model
class DataMot extends Model
{
protected $primaryKey = 'id';
protected $table = 'data_bgv';
protected $table = 'data_mot';
protected $guarded = [];
public $timestamps = false;
public $attributes = [
'pid' => 0,
'Symbol' => 'BGV',
'Name' => 'BGV',
'Symbol' => 'MOT',
'Name' => 'MOT',
'Price2' => 0,
'Price3' => 0,
'Open_Int' => 0,

124
app/Models/DataMpob.php

@ -1,124 +0,0 @@
<?php
/*
* @Descripttion:
* @version:
* @Author: GuaPi
* @Date: 2021-07-29 10:40:49
* @LastEditors: GuaPi
* @LastEditTime: 2021-08-09 17:41:16
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DataMpob extends Model
{
protected $primaryKey = 'id';
protected $table = 'data_mpob';
protected $guarded = [];
public $timestamps = false;
public $attributes = [
'pid' => 0,
'Symbol' => 'MPOB',
'Name' => 'MPOB',
'Price2' => 0,
'Price3' => 0,
'Open_Int' => 0,
'is_1min' => 0,
'is_5min' => 0,
'is_15min' => 0,
'is_30min' => 0,
'is_1h' => 0,
'is_2h' => 0,
'is_4h' => 0,
'is_6h' => 0,
'is_12h' => 0,
'is_day' => 0,
'is_week' => 0,
'is_month' => 0,
];
public static function getKlineData($symbol, $period, $size)
{
$builder = self::query();
$wheres = [
'1min' => 'is_1min',
'5min' => 'is_5min',
'15min' => 'is_15min',
'30min' => 'is_30min',
'60min' => 'is_1h',
'4hour' => 'is_4hour',
'1day' => 'is_day',
'1week' => 'is_week',
'1mon' => 'is_month',
];
$where = $wheres[$period] ?? 'is_1min';
$builder->where($where, 1);
$data = $builder->where('Date', '<', time())->limit($size)->orderByDesc('Date')->get();
if (blank($data)) return [];
$data = $data->sortBy('Date')->values()->map(function ($kline) {
$item = [
"id" => $kline['Date'],
"amount" => $kline['Amount'],
"count" => $kline['Amount'],
"open" => $kline['Open'],
"close" => $kline['Close'],
"low" => $kline['Low'],
"high" => $kline['High'],
"vol" => $kline['Volume']
];
$item['price'] = $item['close'];
return $item;
})->toArray();
// 重设数组最后一组数据的值
$time = time();
$data = self::getlastData($data, $period, $time);
return $data;
}
/**
* @description: 获取最新5分钟线 十五分钟线 30分钟线 1小时线 4小时线 1天线 1周线 一月线
* @param {*}
* @return {*}
*/
public static function getlastData($data, $period, $time)
{
$periodMap = [
'1min' => ['column' => 'is_1min', 'seconds' => 60],
'5min' => ['column' => 'is_5min', 'seconds' => 300],
'15min' => ['column' => 'is_15min', 'seconds' => 900],
'30min' => ['column' => 'is_30min', 'seconds' => 1800],
'60min' => ['column' => 'is_1h', 'seconds' => 3600],
'4hour' => ['column' => 'is_4hour', 'seconds' => 14400],
'1day' => ['column' => 'is_day', 'seconds' => 86400],
'1week' => ['column' => 'is_week', 'seconds' => 604800],
'1mon' => ['column' => 'is_month', 'seconds' => 2592000],
];
$tmp = $data[array_key_last($data)];
if ($period == '1mon') {
$res = self::query()
->whereBetween('Date', [\Carbon\Carbon::now()->firstOfMonth()->timestamp, $time])
->where('is_1min', 1)
->get();
} else {
$res = self::query()
->whereBetween('Date', [$time - $time % $periodMap[$period]['seconds'], $time])
->where('is_1min', 1)
->get();
}
$data[array_key_last($data)] = [
"id" => $tmp['id'],
"amount" => $res->sum('Amount'),
"count" => $res->sum('Amount'),
"open" => $res->first()->Open,
"close" => $res->last()->Close, //最新价
"low" => $res->min('Low'),
"high" => $res->max('High'),
"vol" => $res->sum('Volume'),
"price" => $res->last()->Close
];
return $data;
}
}

8
app/Models/DataKye.php → app/Models/DataNcr.php

@ -12,17 +12,17 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DataKye extends Model
class DataNcr extends Model
{
protected $primaryKey = 'id';
protected $table = 'data_kye';
protected $table = 'data_ncr';
protected $guarded = [];
public $timestamps = false;
public $attributes = [
'pid' => 0,
'Symbol' => 'KYE',
'Name' => 'KYE',
'Symbol' => 'NCR',
'Name' => 'NCR',
'Price2' => 0,
'Price3' => 0,
'Open_Int' => 0,

124
app/Models/DataRute.php

@ -1,124 +0,0 @@
<?php
/*
* @Descripttion:
* @version:
* @Author: GuaPi
* @Date: 2021-07-29 10:40:49
* @LastEditors: GuaPi
* @LastEditTime: 2021-08-09 17:41:16
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DataRute extends Model
{
protected $primaryKey = 'id';
protected $table = 'data_rute';
protected $guarded = [];
public $timestamps = false;
public $attributes = [
'pid' => 0,
'Symbol' => 'RUTE',
'Name' => 'RUTE',
'Price2' => 0,
'Price3' => 0,
'Open_Int' => 0,
'is_1min' => 0,
'is_5min' => 0,
'is_15min' => 0,
'is_30min' => 0,
'is_1h' => 0,
'is_2h' => 0,
'is_4h' => 0,
'is_6h' => 0,
'is_12h' => 0,
'is_day' => 0,
'is_week' => 0,
'is_month' => 0,
];
public static function getKlineData($symbol, $period, $size)
{
$builder = self::query();
$wheres = [
'1min' => 'is_1min',
'5min' => 'is_5min',
'15min' => 'is_15min',
'30min' => 'is_30min',
'60min' => 'is_1h',
'4hour' => 'is_4hour',
'1day' => 'is_day',
'1week' => 'is_week',
'1mon' => 'is_month',
];
$where = $wheres[$period] ?? 'is_1min';
$builder->where($where, 1);
$data = $builder->where('Date', '<', time())->limit($size)->orderByDesc('Date')->get();
if (blank($data)) return [];
$data = $data->sortBy('Date')->values()->map(function ($kline) {
$item = [
"id" => $kline['Date'],
"amount" => $kline['Amount'],
"count" => $kline['Amount'],
"open" => $kline['Open'],
"close" => $kline['Close'],
"low" => $kline['Low'],
"high" => $kline['High'],
"vol" => $kline['Volume']
];
$item['price'] = $item['close'];
return $item;
})->toArray();
// 重设数组最后一组数据的值
$time = time();
$data = self::getlastData($data, $period, $time);
return $data;
}
/**
* @description: 获取最新5分钟线 十五分钟线 30分钟线 1小时线 4小时线 1天线 1周线 一月线
* @param {*}
* @return {*}
*/
public static function getlastData($data, $period, $time)
{
$periodMap = [
'1min' => ['column' => 'is_1min', 'seconds' => 60],
'5min' => ['column' => 'is_5min', 'seconds' => 300],
'15min' => ['column' => 'is_15min', 'seconds' => 900],
'30min' => ['column' => 'is_30min', 'seconds' => 1800],
'60min' => ['column' => 'is_1h', 'seconds' => 3600],
'4hour' => ['column' => 'is_4hour', 'seconds' => 14400],
'1day' => ['column' => 'is_day', 'seconds' => 86400],
'1week' => ['column' => 'is_week', 'seconds' => 604800],
'1mon' => ['column' => 'is_month', 'seconds' => 2592000],
];
$tmp = $data[array_key_last($data)];
if ($period == '1mon') {
$res = self::query()
->whereBetween('Date', [\Carbon\Carbon::now()->firstOfMonth()->timestamp, $time])
->where('is_1min', 1)
->get();
} else {
$res = self::query()
->whereBetween('Date', [$time - $time % $periodMap[$period]['seconds'], $time])
->where('is_1min', 1)
->get();
}
$data[array_key_last($data)] = [
"id" => $tmp['id'],
"amount" => $res->sum('Amount'),
"count" => $res->sum('Amount'),
"open" => $res->first()->Open,
"close" => $res->last()->Close, //最新价
"low" => $res->min('Low'),
"high" => $res->max('High'),
"vol" => $res->sum('Volume'),
"price" => $res->last()->Close
];
return $data;
}
}

124
app/Models/DataShip.php

@ -1,124 +0,0 @@
<?php
/*
* @Descripttion:
* @version:
* @Author: GuaPi
* @Date: 2021-07-29 10:40:49
* @LastEditors: GuaPi
* @LastEditTime: 2021-08-09 17:41:16
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DataShip extends Model
{
protected $primaryKey = 'id';
protected $table = 'data_ship';
protected $guarded = [];
public $timestamps = false;
public $attributes = [
'pid' => 0,
'Symbol' => 'SHIP',
'Name' => 'SHIP',
'Price2' => 0,
'Price3' => 0,
'Open_Int' => 0,
'is_1min' => 0,
'is_5min' => 0,
'is_15min' => 0,
'is_30min' => 0,
'is_1h' => 0,
'is_2h' => 0,
'is_4h' => 0,
'is_6h' => 0,
'is_12h' => 0,
'is_day' => 0,
'is_week' => 0,
'is_month' => 0,
];
public static function getKlineData($symbol, $period, $size)
{
$builder = self::query();
$wheres = [
'1min' => 'is_1min',
'5min' => 'is_5min',
'15min' => 'is_15min',
'30min' => 'is_30min',
'60min' => 'is_1h',
'4hour' => 'is_4hour',
'1day' => 'is_day',
'1week' => 'is_week',
'1mon' => 'is_month',
];
$where = $wheres[$period] ?? 'is_1min';
$builder->where($where, 1);
$data = $builder->where('Date', '<', time())->limit($size)->orderByDesc('Date')->get();
if (blank($data)) return [];
$data = $data->sortBy('Date')->values()->map(function ($kline) {
$item = [
"id" => $kline['Date'],
"amount" => $kline['Amount'],
"count" => $kline['Amount'],
"open" => $kline['Open'],
"close" => $kline['Close'],
"low" => $kline['Low'],
"high" => $kline['High'],
"vol" => $kline['Volume']
];
$item['price'] = $item['close'];
return $item;
})->toArray();
// 重设数组最后一组数据的值
$time = time();
$data = self::getlastData($data, $period, $time);
return $data;
}
/**
* @description: 获取最新5分钟线 十五分钟线 30分钟线 1小时线 4小时线 1天线 1周线 一月线
* @param {*}
* @return {*}
*/
public static function getlastData($data, $period, $time)
{
$periodMap = [
'1min' => ['column' => 'is_1min', 'seconds' => 60],
'5min' => ['column' => 'is_5min', 'seconds' => 300],
'15min' => ['column' => 'is_15min', 'seconds' => 900],
'30min' => ['column' => 'is_30min', 'seconds' => 1800],
'60min' => ['column' => 'is_1h', 'seconds' => 3600],
'4hour' => ['column' => 'is_4hour', 'seconds' => 14400],
'1day' => ['column' => 'is_day', 'seconds' => 86400],
'1week' => ['column' => 'is_week', 'seconds' => 604800],
'1mon' => ['column' => 'is_month', 'seconds' => 2592000],
];
$tmp = $data[array_key_last($data)];
if ($period == '1mon') {
$res = self::query()
->whereBetween('Date', [\Carbon\Carbon::now()->firstOfMonth()->timestamp, $time])
->where('is_1min', 1)
->get();
} else {
$res = self::query()
->whereBetween('Date', [$time - $time % $periodMap[$period]['seconds'], $time])
->where('is_1min', 1)
->get();
}
$data[array_key_last($data)] = [
"id" => $tmp['id'],
"amount" => $res->sum('Amount'),
"count" => $res->sum('Amount'),
"open" => $res->first()->Open,
"close" => $res->last()->Close, //最新价
"low" => $res->min('Low'),
"high" => $res->max('High'),
"vol" => $res->sum('Volume'),
"price" => $res->last()->Close
];
return $data;
}
}

124
app/Models/DataSte.php

@ -1,124 +0,0 @@
<?php
/*
* @Descripttion:
* @version:
* @Author: GuaPi
* @Date: 2021-07-29 10:40:49
* @LastEditors: GuaPi
* @LastEditTime: 2021-08-09 17:41:16
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DataSte extends Model
{
protected $primaryKey = 'id';
protected $table = 'data_ste';
protected $guarded = [];
public $timestamps = false;
public $attributes = [
'pid' => 0,
'Symbol' => 'STE',
'Name' => 'STE',
'Price2' => 0,
'Price3' => 0,
'Open_Int' => 0,
'is_1min' => 0,
'is_5min' => 0,
'is_15min' => 0,
'is_30min' => 0,
'is_1h' => 0,
'is_2h' => 0,
'is_4h' => 0,
'is_6h' => 0,
'is_12h' => 0,
'is_day' => 0,
'is_week' => 0,
'is_month' => 0,
];
public static function getKlineData($symbol, $period, $size)
{
$builder = self::query();
$wheres = [
'1min' => 'is_1min',
'5min' => 'is_5min',
'15min' => 'is_15min',
'30min' => 'is_30min',
'60min' => 'is_1h',
'4hour' => 'is_4hour',
'1day' => 'is_day',
'1week' => 'is_week',
'1mon' => 'is_month',
];
$where = $wheres[$period] ?? 'is_1min';
$builder->where($where, 1);
$data = $builder->where('Date', '<', time())->limit($size)->orderByDesc('Date')->get();
if (blank($data)) return [];
$data = $data->sortBy('Date')->values()->map(function ($kline) {
$item = [
"id" => $kline['Date'],
"amount" => $kline['Amount'],
"count" => $kline['Amount'],
"open" => $kline['Open'],
"close" => $kline['Close'],
"low" => $kline['Low'],
"high" => $kline['High'],
"vol" => $kline['Volume']
];
$item['price'] = $item['close'];
return $item;
})->toArray();
// 重设数组最后一组数据的值
$time = time();
$data = self::getlastData($data, $period, $time);
return $data;
}
/**
* @description: 获取最新5分钟线 十五分钟线 30分钟线 1小时线 4小时线 1天线 1周线 一月线
* @param {*}
* @return {*}
*/
public static function getlastData($data, $period, $time)
{
$periodMap = [
'1min' => ['column' => 'is_1min', 'seconds' => 60],
'5min' => ['column' => 'is_5min', 'seconds' => 300],
'15min' => ['column' => 'is_15min', 'seconds' => 900],
'30min' => ['column' => 'is_30min', 'seconds' => 1800],
'60min' => ['column' => 'is_1h', 'seconds' => 3600],
'4hour' => ['column' => 'is_4hour', 'seconds' => 14400],
'1day' => ['column' => 'is_day', 'seconds' => 86400],
'1week' => ['column' => 'is_week', 'seconds' => 604800],
'1mon' => ['column' => 'is_month', 'seconds' => 2592000],
];
$tmp = $data[array_key_last($data)];
if ($period == '1mon') {
$res = self::query()
->whereBetween('Date', [\Carbon\Carbon::now()->firstOfMonth()->timestamp, $time])
->where('is_1min', 1)
->get();
} else {
$res = self::query()
->whereBetween('Date', [$time - $time % $periodMap[$period]['seconds'], $time])
->where('is_1min', 1)
->get();
}
$data[array_key_last($data)] = [
"id" => $tmp['id'],
"amount" => $res->sum('Amount'),
"count" => $res->sum('Amount'),
"open" => $res->first()->Open,
"close" => $res->last()->Close, //最新价
"low" => $res->min('Low'),
"high" => $res->max('High'),
"vol" => $res->sum('Volume'),
"price" => $res->last()->Close
];
return $data;
}
}

8
app/Models/DataRvm.php → app/Models/DataTer.php

@ -12,17 +12,17 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DataRvm extends Model
class DataTer extends Model
{
protected $primaryKey = 'id';
protected $table = 'data_rvm';
protected $table = 'data_ter';
protected $guarded = [];
public $timestamps = false;
public $attributes = [
'pid' => 0,
'Symbol' => 'RVM',
'Name' => 'RVM',
'Symbol' => 'TER',
'Name' => 'TER',
'Price2' => 0,
'Price3' => 0,
'Open_Int' => 0,

124
app/Models/DataTomb.php

@ -1,124 +0,0 @@
<?php
/*
* @Descripttion:
* @version:
* @Author: GuaPi
* @Date: 2021-07-29 10:40:49
* @LastEditors: GuaPi
* @LastEditTime: 2021-08-09 17:41:16
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DataTomb extends Model
{
protected $primaryKey = 'id';
protected $table = 'data_tomb';
protected $guarded = [];
public $timestamps = false;
public $attributes = [
'pid' => 0,
'Symbol' => 'TOMB',
'Name' => 'TOMB',
'Price2' => 0,
'Price3' => 0,
'Open_Int' => 0,
'is_1min' => 0,
'is_5min' => 0,
'is_15min' => 0,
'is_30min' => 0,
'is_1h' => 0,
'is_2h' => 0,
'is_4h' => 0,
'is_6h' => 0,
'is_12h' => 0,
'is_day' => 0,
'is_week' => 0,
'is_month' => 0,
];
public static function getKlineData($symbol, $period, $size)
{
$builder = self::query();
$wheres = [
'1min' => 'is_1min',
'5min' => 'is_5min',
'15min' => 'is_15min',
'30min' => 'is_30min',
'60min' => 'is_1h',
'4hour' => 'is_4hour',
'1day' => 'is_day',
'1week' => 'is_week',
'1mon' => 'is_month',
];
$where = $wheres[$period] ?? 'is_1min';
$builder->where($where, 1);
$data = $builder->where('Date', '<', time())->limit($size)->orderByDesc('Date')->get();
if (blank($data)) return [];
$data = $data->sortBy('Date')->values()->map(function ($kline) {
$item = [
"id" => $kline['Date'],
"amount" => $kline['Amount'],
"count" => $kline['Amount'],
"open" => $kline['Open'],
"close" => $kline['Close'],
"low" => $kline['Low'],
"high" => $kline['High'],
"vol" => $kline['Volume']
];
$item['price'] = $item['close'];
return $item;
})->toArray();
// 重设数组最后一组数据的值
$time = time();
$data = self::getlastData($data, $period, $time);
return $data;
}
/**
* @description: 获取最新5分钟线 十五分钟线 30分钟线 1小时线 4小时线 1天线 1周线 一月线
* @param {*}
* @return {*}
*/
public static function getlastData($data, $period, $time)
{
$periodMap = [
'1min' => ['column' => 'is_1min', 'seconds' => 60],
'5min' => ['column' => 'is_5min', 'seconds' => 300],
'15min' => ['column' => 'is_15min', 'seconds' => 900],
'30min' => ['column' => 'is_30min', 'seconds' => 1800],
'60min' => ['column' => 'is_1h', 'seconds' => 3600],
'4hour' => ['column' => 'is_4hour', 'seconds' => 14400],
'1day' => ['column' => 'is_day', 'seconds' => 86400],
'1week' => ['column' => 'is_week', 'seconds' => 604800],
'1mon' => ['column' => 'is_month', 'seconds' => 2592000],
];
$tmp = $data[array_key_last($data)];
if ($period == '1mon') {
$res = self::query()
->whereBetween('Date', [\Carbon\Carbon::now()->firstOfMonth()->timestamp, $time])
->where('is_1min', 1)
->get();
} else {
$res = self::query()
->whereBetween('Date', [$time - $time % $periodMap[$period]['seconds'], $time])
->where('is_1min', 1)
->get();
}
$data[array_key_last($data)] = [
"id" => $tmp['id'],
"amount" => $res->sum('Amount'),
"count" => $res->sum('Amount'),
"open" => $res->first()->Open,
"close" => $res->last()->Close, //最新价
"low" => $res->min('Low'),
"high" => $res->max('High'),
"vol" => $res->sum('Volume'),
"price" => $res->last()->Close
];
return $data;
}
}

2
app/Services/UdunWalletService.php

@ -53,7 +53,7 @@ class UdunWalletService
// 回调
//$callUrl = config('app.url') . '/api/udun/notify';
// $callUrl = env('NOTIFY_URL') . '/api/udun/notify';
$callUrl = 'https://xmg.xusexchange.com/api/udun/notify';
$callUrl = 'https://pe.pnecoin.com/api/udun/notify';
$body = array(
'merchantId' => $this->merchantId,

Loading…
Cancel
Save