|
|
@@ -38,7 +38,6 @@ class Wallet extends BaseController
|
|
|
}
|
|
|
return $this->success([
|
|
|
'list' => $list,
|
|
|
- 'product' => $product,
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
@@ -49,7 +48,7 @@ class Wallet extends BaseController
|
|
|
{
|
|
|
try {
|
|
|
$params = request()->validate([
|
|
|
- 'amount' => ['required', 'float'],
|
|
|
+ 'amount' => ['required', 'numeric', 'min:0.01'],
|
|
|
'payment_type' => ['required', 'string'],
|
|
|
]);
|
|
|
$member_id = request()->user->member_id;
|
|
|
@@ -65,32 +64,39 @@ class Wallet extends BaseController
|
|
|
*/
|
|
|
public function scan()
|
|
|
{
|
|
|
- $member_id = request()->user->member_id;
|
|
|
- $type = 'TRC20';
|
|
|
- $receivingType = ConfigService::getVal("receiving_type");
|
|
|
- //自动充值
|
|
|
- if ($receivingType == 1) {
|
|
|
- $res = WalletService::getRechargeImageAddress($member_id);
|
|
|
- $address = $res['address'];
|
|
|
- $qrCode = $res['full_path'];
|
|
|
- } else {
|
|
|
- //手动充值
|
|
|
- if ($type === "TRC20") {
|
|
|
- $address = Config::where('field', 'receiving_address')->first()->val;
|
|
|
- } elseif ($type === "ERC20") {
|
|
|
- $address = Config::where('field', 'receiving_address_erc20')->first()->val;
|
|
|
+ try {
|
|
|
+ $member_id = request()->user->member_id;
|
|
|
+ $params = request()->validate([
|
|
|
+ 'amount' => ['required', 'numeric', 'min:0.01'],
|
|
|
+ 'type' => ['required', 'string'],
|
|
|
+ ]);
|
|
|
+ $receivingType = ConfigService::getVal("receiving_type");
|
|
|
+ //自动充值
|
|
|
+ if ($receivingType == 1) {
|
|
|
+ $res = WalletService::getRechargeImageAddress($member_id);
|
|
|
+ $address = $res['address'];
|
|
|
+ $qrCode = $res['full_path'];
|
|
|
} else {
|
|
|
- return $this->error(lang('充值类型错误'));
|
|
|
+ //手动充值
|
|
|
+ if ($params['type'] === "TRC20") {
|
|
|
+ $address = Config::where('field', 'receiving_address')->first()->val;
|
|
|
+ } elseif ($params['type'] === "ERC20") {
|
|
|
+ $address = Config::where('field', 'receiving_address_erc20')->first()->val;
|
|
|
+ } else {
|
|
|
+ return $this->error(lang('充值类型错误'));
|
|
|
+ }
|
|
|
+ $res = WalletService::getPlatformImageAddress($address);
|
|
|
+ $res['net'] = $params['type'];
|
|
|
+ $qrCode = $res['full_path'];
|
|
|
}
|
|
|
- $res = WalletService::getPlatformImageAddress($address);
|
|
|
- $res['net'] = $type;
|
|
|
- $qrCode = $res['full_path'];
|
|
|
+
|
|
|
+ return $this->success([
|
|
|
+ 'qrcode' => $qrCode,
|
|
|
+ // 'photo' => InputFile::create($qrCode),
|
|
|
+ ]);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ return $this->error($e->getMessage());
|
|
|
}
|
|
|
-
|
|
|
- return $this->success([
|
|
|
- 'qrcode' => $qrCode,
|
|
|
- // 'photo' => InputFile::create($qrCode),
|
|
|
- ]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -101,7 +107,7 @@ class Wallet extends BaseController
|
|
|
try {
|
|
|
$params = request()->validate([
|
|
|
'net' => ['required', 'string'],
|
|
|
- 'amount' => ['required', 'float'],
|
|
|
+ 'amount' => ['required', 'numeric', 'min:0.01'],
|
|
|
'toAddress' => ['required', 'string'],
|
|
|
'image' => ['required', 'url'],
|
|
|
]);
|