diff --git a/app/Http/Controllers/Api/V1/UdunWalletController.php b/app/Http/Controllers/Api/V1/UdunWalletController.php index 2ef86ae..7ca0895 100644 --- a/app/Http/Controllers/Api/V1/UdunWalletController.php +++ b/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); } diff --git a/app/Models/DataAeef.php b/app/Models/DataDsor.php similarity index 97% rename from app/Models/DataAeef.php rename to app/Models/DataDsor.php index c10595b..a32bb71 100644 --- a/app/Models/DataAeef.php +++ b/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, diff --git a/app/Models/DataNec.php b/app/Models/DataHoz.php similarity index 97% rename from app/Models/DataNec.php rename to app/Models/DataHoz.php index a8bcf8b..09d79fa 100644 --- a/app/Models/DataNec.php +++ b/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, diff --git a/app/Models/DataBgv.php b/app/Models/DataMot.php similarity index 97% rename from app/Models/DataBgv.php rename to app/Models/DataMot.php index e410fee..f7a11c5 100644 --- a/app/Models/DataBgv.php +++ b/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, diff --git a/app/Models/DataMpob.php b/app/Models/DataMpob.php deleted file mode 100644 index e7d93d8..0000000 --- a/app/Models/DataMpob.php +++ /dev/null @@ -1,124 +0,0 @@ - 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; - } -} diff --git a/app/Models/DataKye.php b/app/Models/DataNcr.php similarity index 97% rename from app/Models/DataKye.php rename to app/Models/DataNcr.php index a40ddc4..060ca5b 100644 --- a/app/Models/DataKye.php +++ b/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, diff --git a/app/Models/DataRute.php b/app/Models/DataRute.php deleted file mode 100644 index 3720ad5..0000000 --- a/app/Models/DataRute.php +++ /dev/null @@ -1,124 +0,0 @@ - 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; - } -} diff --git a/app/Models/DataShip.php b/app/Models/DataShip.php deleted file mode 100644 index 74187e7..0000000 --- a/app/Models/DataShip.php +++ /dev/null @@ -1,124 +0,0 @@ - 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; - } -} diff --git a/app/Models/DataSte.php b/app/Models/DataSte.php deleted file mode 100644 index c3b150a..0000000 --- a/app/Models/DataSte.php +++ /dev/null @@ -1,124 +0,0 @@ - 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; - } -} diff --git a/app/Models/DataRvm.php b/app/Models/DataTer.php similarity index 97% rename from app/Models/DataRvm.php rename to app/Models/DataTer.php index e4e20ae..2e2acea 100644 --- a/app/Models/DataRvm.php +++ b/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, diff --git a/app/Models/DataTomb.php b/app/Models/DataTomb.php deleted file mode 100644 index dc24002..0000000 --- a/app/Models/DataTomb.php +++ /dev/null @@ -1,124 +0,0 @@ - 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; - } -} diff --git a/app/Services/UdunWalletService.php b/app/Services/UdunWalletService.php index 009265d..d33ee26 100644 --- a/app/Services/UdunWalletService.php +++ b/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,