Преглед изворни кода

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

seven пре 1 недеља
родитељ
комит
4471d7e793

+ 49 - 0
app/Http/Controllers/admin/Home.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace App\Http\Controllers\admin;
+
+use App\Constants\HttpStatus;
+use App\Http\Controllers\Controller;
+use App\Models\PaymentOrder;
+use App\Services\PaymentOrderService;
+use Illuminate\Validation\ValidationException;
+use Exception;
+
+class Home extends Controller
+{
+    public function index()
+    {
+
+        try {
+            request()->validate([
+                'start_date' => ['nullable', 'date_format:Y-m-d'],
+                'end_date' => ['nullable', 'date_format:Y-m-d', 'after:start_date'],
+            ]);
+            $start = request()->input('start_date', date('Y-m-d'));
+            $end = request()->input('end_date', date('Y-m-d'));
+            $query = PaymentOrder::query();
+            $params['type'] = 2;
+            $where = PaymentOrderService::getWhere($params);
+
+            $totalAmount = (float)$query->where($where)
+                ->whereDate('created_at', date('Y-m-d'))->sum('amount');
+            $totalSuccess = (float)$query->where($where)->whereDate('created_at', date('Y-m-d'))
+                ->whereIn('status', [1, 2])->sum('amount');
+            $totalFail = (float)$query->where($where)->whereDate('created_at', date('Y-m-d'))
+                ->where('status', 3)->sum('amount');
+            $result = [
+                'withdraw_rmb' => [
+                    'total_fail' => $totalFail,
+                    'total_success' => $totalSuccess,
+                    'total_amount' => $totalAmount,
+                ]
+
+            ];
+        } catch (ValidationException $e) {
+            return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
+        } catch (Exception $e) {
+            return $this->error($e->getCode(), $e->getmessage());
+        }
+        return $this->success($result);
+    }
+}

+ 10 - 2
app/Http/Controllers/admin/Withdraw.php

@@ -58,11 +58,19 @@ class Withdraw extends Controller
                 ->orderBy('status')
                 ->orderBy('status')
                 ->orderByDesc('created_at')
                 ->orderByDesc('created_at')
                 ->forpage($page, $limit)->get();
                 ->forpage($page, $limit)->get();
-            $result = ['total' => $count, 'data' => $list];
+
+
+            $result = [
+//                'total_fail' => $totalFail,
+//                'total_success' => $totalSuccess,
+//                'total_amount' => $totalAmount,
+                'total' => $count,
+                'data' => $list
+            ];
         } catch (ValidationException $e) {
         } catch (ValidationException $e) {
             return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
             return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
         } catch (Exception $e) {
         } catch (Exception $e) {
-            return $this->error(intval($e->getCode()));
+            return $this->error($e->getCode(), $e->getmessage());
         }
         }
         return $this->success($result);
         return $this->success($result);
     }
     }

+ 1 - 3
app/Models/Rebate.php

@@ -26,13 +26,11 @@ class Rebate extends BaseModel
         Log::error(json_encode($data));
         Log::error(json_encode($data));
         $rebate = static::where('date', $data['date'])
         $rebate = static::where('date', $data['date'])
             ->where('member_id', $data['member_id'])->first();
             ->where('member_id', $data['member_id'])->first();
-        if(!$rebate){
+        if($rebate){
             $profit = bcadd($rebate->profit, $data['profit'], 2);
             $profit = bcadd($rebate->profit, $data['profit'], 2);
             $rebate->profit = $profit;
             $rebate->profit = $profit;
             $rebate->save();
             $rebate->save();
         }
         }
-
-
         return $rebate;
         return $rebate;
     }
     }
 
 

+ 2 - 2
app/Services/IssueService.php

@@ -351,7 +351,7 @@ class IssueService extends BaseService
             $size = $size ? "大" : "小";
             $size = $size ? "大" : "小";
             $oddOrEven = in_array("双", $awards);
             $oddOrEven = in_array("双", $awards);
             $oddOrEven = $oddOrEven ? "双" : "单";
             $oddOrEven = $oddOrEven ? "双" : "单";
-//            Prediction::result($info->issue_no, $size, $oddOrEven, $info->winning_numbers);
+            Prediction::result($info->issue_no, $size, $oddOrEven, $info->winning_numbers);
             Cao::updateData($awards);
             Cao::updateData($awards);
             CaoHistory::updateData($awards);
             CaoHistory::updateData($awards);
 
 
@@ -924,7 +924,7 @@ class IssueService extends BaseService
                 ]);
                 ]);
 
 
 
 
-//                Prediction::prediction($new_issue_no);
+                Prediction::prediction($new_issue_no);
 
 
                 $id = $res['key'] ?? 0;
                 $id = $res['key'] ?? 0;
                 if ($id) {
                 if ($id) {

+ 20 - 1
app/Services/WithdrawService.php

@@ -340,7 +340,7 @@ class WithdrawService
         $wallet = Wallet::where('member_id', $chatId)->first();
         $wallet = Wallet::where('member_id', $chatId)->first();
         $temp = floatval($wallet->available_balance);
         $temp = floatval($wallet->available_balance);
         $text = "✅ " . lang('提现地址已设置') . "\n\n";
         $text = "✅ " . lang('提现地址已设置') . "\n\n";
-        $text .= lang("请发送提现金额") . "\n";
+        $text .= lang("请发送提现金额") . "(RMB) \n";
         $text .= "💰 " . lang("当前可用余额") . ":{$temp}\n";
         $text .= "💰 " . lang("当前可用余额") . ":{$temp}\n";
         $text .= "⚠️ " . lang('提现将收取') . "{$this->serviceCharge}" . lang("U作为手续费") . "\n";
         $text .= "⚠️ " . lang('提现将收取') . "{$this->serviceCharge}" . lang("U作为手续费") . "\n";
         $text .= "------------------------------------\n";
         $text .= "------------------------------------\n";
@@ -484,6 +484,24 @@ class WithdrawService
                 'reply_to_message_id' => $messageId
                 'reply_to_message_id' => $messageId
             ]];
             ]];
         }
         }
+
+        if($amount < 100){
+            return [[
+                'chat_id' => $chatId,
+                'text' => lang("提现不能少于100 RMB,请重试"),
+                'reply_to_message_id' => $messageId
+            ]];
+        }
+
+        if ($amount > 49999) {
+            return [
+                'chat_id' => $chatId,
+                'text' => lang("最多提现 49999 RMB,请重试"),
+                'reply_to_message_id' => $messageId
+            ];
+        }
+
+
         $wallet = Wallet::where('member_id', $chatId)->first();
         $wallet = Wallet::where('member_id', $chatId)->first();
         $temp = floatval($wallet->available_balance);
         $temp = floatval($wallet->available_balance);
         // 汇率
         // 汇率
@@ -555,6 +573,7 @@ class WithdrawService
         $amount = bcdiv($temp, $rate, 2);
         $amount = bcdiv($temp, $rate, 2);
         $serviceCharge = static::getServiceCharge();
         $serviceCharge = static::getServiceCharge();
         $text = lang("请发送提现金额");
         $text = lang("请发送提现金额");
+        $text .= " (RMB)";
         $text .= "\n💰 " . lang('当前余额') . ":{$temp} RMB\n";
         $text .= "\n💰 " . lang('当前余额') . ":{$temp} RMB\n";
         $text .= "⚠️" . lang('汇率') . ":1 USDT = {$rate} RMB\n";
         $text .= "⚠️" . lang('汇率') . ":1 USDT = {$rate} RMB\n";
         $text .= "💰 " . lang('当前可用USDT余额') . ":{$amount} USDT\n";
         $text .= "💰 " . lang('当前可用USDT余额') . ":{$amount} USDT\n";