| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Helpers\Jwt;
- use App\Http\Validator\MemberValidator;
- use App\Services\Api\AdService;
- use App\Services\Api\MemberService;
- use App\Services\ConfigService;
- use App\Services\EmailService;
- use App\Services\RedisService;
- use App\Services\SmsService;
- use App\Services\UsdtWalletService;
- /**
- * 会员控制器基类
- * Class IndexController
- * @package App\Http\Controllers
- */
- class IndexController extends webApp
- {
- /**
- * IndexController constructor.
- */
- public function __construct()
- {
- }
- /**
- * 首页数据
- * @return array
- */
- public function index(int $userId=0)
- {
- // 广告幻灯片
- $banners = [
- 'top'=> AdService::make()->getList(1, 6),
- 'middle'=> AdService::make()->getList(2, 1),
- ];
- // 交易参数
- $trade = ConfigService::make()->getConfigByGroup(5);
- $trade = [
- 'buy_price'=> isset($trade['usdt_buy_price']['value'])? floatval($trade['usdt_buy_price']['value']) : '0.00',
- 'sell_price'=> isset($trade['usdt_sell_price']['value'])? floatval($trade['usdt_sell_price']['value']) : '0.00',
- 'total'=> rand(100000,999999)+(rand(10,50)/100),
- 'count'=> rand(1000,9999),
- 'rate'=> rand(10,90)+(rand(10,50)/100),
- ];
- $notices = [];
- return message(1010, true, compact('banners','trade','notices'));
- }
- /**
- * 获取实时交易数据
- * @return array
- */
- public function trade()
- {
- // 交易参数
- $trade = ConfigService::make()->getConfigByGroup(5);
- $trade = [
- 'buy_price'=> isset($trade['usdt_buy_price']['value'])? floatval($trade['usdt_buy_price']['value']) : '0.00',
- 'sell_price'=> isset($trade['usdt_sell_price']['value'])? floatval($trade['usdt_sell_price']['value']) : '0.00',
- 'total'=> rand(100000,999999)+(rand(10,50)/100),
- 'count'=> rand(1000,9999),
- 'rate'=> rand(10,90)+(rand(10,50)/100),
- ];
- return message(1010, true, compact('trade'));
- }
- /**
- * 获取平台交易配置
- * @return array
- */
- public function config()
- {
- // 交易参数
- $trade = ConfigService::make()->getConfigOptionByGroup(5);
- return message(1010, true, compact('trade'));
- }
- public function address(){
- $address = request()->post('address','');
- $result = UsdtWalletService::make()->getWalletAddress();
- var_dump($result);
- }
- public function transfer(){
- $address1 = request()->post('payAddress','');
- $address = request()->post('address','');
- $num = request()->post('num',0);
- $result = UsdtWalletService::make()->createTrade($address1, $address, $num);
- var_dump($result);
- }
- }
|