Kaynağa Gözat

Merge branch 'master' of http://47.76.126.2:3000/seven/bot-28

Your Name 1 hafta önce
ebeveyn
işleme
2941bce6c7

+ 2 - 2
app/Http/Controllers/admin/ActivityReward.php

@@ -52,8 +52,8 @@ class ActivityReward extends Controller
                 'id' => ['nullable', 'integer', 'min:1'],
                 'title' => ['required', 'string', 'min:1', 'max:140'],
                 'sub_title' => ['required', 'string', 'min:1', 'max:140'],
-                'start_time' => ['required', 'date', 'date_format:Y-m-d'],
-                'end_time' => ['required', 'date', 'date_format:Y-m-d', 'after_or_equal:start_time'],
+                'start_time' => ['required', 'date'],
+                'end_time' => ['required', 'date', 'after_or_equal:start_time'],
                 'detail_image' => ['required', 'url', 'regex:/\.(jpeg|jpg|png|webp)$/i'],
                 'pc_image' => ['required', 'url', 'regex:/\.(jpeg|jpg|png|webp)$/i'],
                 'status' => ['required', 'integer', 'min:0', 'max:1'],

+ 4 - 0
app/Http/Controllers/admin/Config.php

@@ -123,6 +123,10 @@ class Config extends Controller
                     case 'pc28_switch':
                         $validator['val'] = ['required', 'integer', 'in:0,1'];
                         break;
+                    case 'pc28_time':
+                        //格式如:09:00-21:00
+                        $validator['val'] = ['nullable', 'string', 'regex:/^\d{2}:\d{2}-\d{2}:\d{2}$/i'];
+                        break;
                 }
 
 

+ 61 - 0
app/Http/Controllers/admin/Wallet.php

@@ -20,10 +20,71 @@ use App\Models\Config;
 use App\Models\PaymentOrder;
 use App\Models\Order;
 use App\Models\LhcOrder;
+use App\Models\Bank;
+use App\Models\Address;
+use App\Services\Payment\QianBaoService;
 
 class Wallet extends Controller
 {
 
+    /**
+     * 获取提现通道
+     */
+    public function withdrawChannel()
+    {
+        $list = QianBaoService::withdrawChannel();
+        $data[] = ['label' => 'USDT', 'value' => 'USDT'];
+        foreach ($list as $key => $item) {
+            $data[] = ['label' => $item, 'value' => $key];
+        }
+        return $this->success($data);
+    }
+
+    //银行卡/支付宝列表
+    public function bankList()
+    {
+        try {
+            $params = request()->validate([
+                'channel' => 'nullable',
+                'member_id' => 'nullable',
+            ]);
+            $where = [];
+            if (!empty($params['channel'])) {
+                $where[] = ['channel', '=', $params['channel']];
+            }
+            if (!empty($params['member_id'])) {
+                $where[] = ['member_id', '=', $params['member_id']];
+            }
+            $list = Bank::where($where)->get()->toArray();
+
+            return $this->success([
+                'list' => $list,
+            ]);
+        } catch (\Exception $e) {
+            return $this->error($e->getMessage());
+        }
+    }
+
+    //地址列表
+    public function address()
+    {
+        try {
+            $params = request()->validate([
+                'member_id' => 'nullable',
+            ]);
+            $where = [];
+            if (!empty($params['member_id'])) {
+                $where[] = ['member_id', '=', $params['member_id']];
+            }
+            $list = Address::where($where)->get()->toArray();
+
+            return $this->success([
+                'list' => $list,
+            ]);
+        } catch (\Exception $e) {
+            return $this->error($e->getMessage());
+        }
+    }
 
     public function getChangeTypes()
     {

+ 10 - 9
app/Http/Controllers/api/Wallet.php

@@ -86,21 +86,22 @@ class Wallet extends BaseController
             $params = request()->validate([
                 'type' => ['required', 'string'],
             ]);
+
+            if (strtolower($params['type']) === "trc20") {
+                $address = Config::where('field', 'receiving_address')->first()->val;
+            } elseif (strtolower($params['type']) === "erc20") {
+                $address = Config::where('field', 'receiving_address_erc20')->first()->val;
+            } else {
+                return $this->error(lang('充值类型错误'));
+            }
+
             $receivingType = ConfigService::getVal("receiving_type");
             //自动充值
             if ($receivingType == 1) {
-                $res = WalletService::getRechargeImageAddress($member_id);
-                $address = $res['address'];
+                $res = WalletService::getRechargeImageAddress($member_id, $address);
                 $qrCode = $res['full_path'];
             } else {
                 //手动充值
-                if (strtolower($params['type']) === "trc20") {
-                    $address = Config::where('field', 'receiving_address')->first()->val;
-                } elseif (strtolower($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'];

+ 2 - 2
app/Services/ActivityRewardService.php

@@ -86,9 +86,9 @@ class ActivityRewardService extends BaseService
     public static function submit(array $params = []): bool
     {
         if (isset($params['start_time']))
-            $params['start_time'] = strtotime($params['start_time'] . " 00:00:00");
+            $params['start_time'] = strtotime($params['start_time']);
         if (isset($params['end_time']))
-            $params['end_time'] = strtotime($params['end_time'] . " 23:59:59");
+            $params['end_time'] = strtotime($params['end_time']);
         if (isset($params['detail_image']))
             $params['detail_image'] = Util::replacePartInUrl($params['detail_image']);
 

+ 6 - 5
app/Services/WalletService.php

@@ -263,21 +263,22 @@ class WalletService extends BaseService
      * @param {*} $memberId
      * @return {*}
      */
-    public static function getRechargeImageAddress($memberId)
+    public static function getRechargeImageAddress($memberId, $address = '')
     {
         self::getUserWallet($memberId);
-
         $info = self::findOne(['member_id' => $memberId]);
-        $path = self::rechargeQrCodeExists($info->address);
+        
+        $address = $address ?? $info->address;
+        $path = self::rechargeQrCodeExists($address);
         if (empty($path)) {
-            $path = self::createRechargeQrCode($info->address);
+            $path = self::createRechargeQrCode($address);
         }
 
         // $host = config('app.url'); // 通常在 .env 中配置 APP_URL
         return [
             'coin' => $info->coin,
             'net' => $info->net,
-            'address' => $info->address,
+            'address' => $address,
             'path' => $path,
             'full_path' => asset($path)
         ];

+ 3 - 0
routes/admin.php

@@ -193,6 +193,9 @@ Route::middleware(['admin.jwt'])->group(function () {
             Route::post('/orderDebiting', [Wallet::class, 'orderDebiting']);
             Route::post('/orderTopUp', [Wallet::class, 'orderTopUp']);
 
+            Route::get("/bankList", [Wallet::class, 'bankList']);
+            Route::get("/address", [Wallet::class, 'address']);
+            Route::get("/withdrawChannel", [Wallet::class, 'withdrawChannel']);
 
         });