Browse Source

异常处理

彭俊 6 years ago
parent
commit
2289e20c6a

+ 30 - 7
app/Http/Controllers/Admin/IndexController.php

@@ -71,22 +71,40 @@ class IndexController extends Controller
         if (\App\Models\Role::hasRoot('/enable/show/bet_count') < 0) {
             $bet_count['count'] = "*****";
         } else {
-            $bet_count['count'] = \App\Models\MoneyBuy::where('money_buy.status', '<>', 4)->join('account', 'money_buy.account_identity', '=', 'account.identity')->where('account.status', '<>', '4')->where('account.user_type', '1')->whereBetween('money_time', $timearea)->count();
+            $numstr = \App\Models\MoneyBuyStr::where('money_buy_str.status', '<>', 4)->join('account', 'money_buy_str.account_identity', '=', 'account.identity')->where('account.status', '<>', '4')->where('account.user_type', '1')->whereBetween('money_time', $timearea)->count();
+            $numsimplex = \App\Models\MoneyBuySimplex::where('money_buy_simplex.status', '<>', 4)->join('account', 'money_buy_simplex.account_identity', '=', 'account.identity')->where('account.status', '<>', '4')->where('account.user_type', '1')->whereBetween('money_buy_simplex.money_time', $timearea)->count();
+            $bet_count['count'] = $numstr+$numsimplex;
         }
         if (\App\Models\Role::hasRoot('/enable/show/bet_money') < 0) {
-            $bet_money = \App\Models\MoneyBuy::where('money_buy.status', '<>', 4)->join('account', 'money_buy.account_identity', '=', 'account.identity')->where('account.status', '<>', '4')->where('account.user_type', '1')->whereBetween('money_time', $timearea)->sum('money');
             $bet_count['money_count'] = "*****";
         } else {
-            $bet_money = \App\Models\MoneyBuy::where('money_buy.status', '<>', 4)->join('account', 'money_buy.account_identity', '=', 'account.identity')->where('account.status', '<>', '4')->where('account.user_type', '1')->whereBetween('money_time', $timearea)->sum('money');
+            $str_bet_money = \App\Models\MoneyBuyStr::where('money_buy_str.status', '<>', 4)->join('account', 'money_buy_str.account_identity', '=', 'account.identity')->where('account.status', '<>', '4')->where('account.user_type', '1')->whereBetween('money_time', $timearea)->sum('money');
+            $simplex_bet_money = \App\Models\MoneyBuySimplex::where('money_buy_simplex.status', '<>', 4)->join('account', 'money_buy_simplex.account_identity', '=', 'account.identity')->where('account.status', '<>', '4')->where('account.user_type', '1')->whereBetween('money_time', $timearea)->sum('money');
+            $bet_money = $str_bet_money+$simplex_bet_money;
             $bet_count['money_count'] = round($bet_money, 2);
         }
         // DB::connection()->enableQueryLog();
         if (\App\Models\Role::hasRoot('/enable/show/countBet') < 0) {
-            $db = new \App\Models\MoneyBuy;
             $bet_count['user_count'] = "*****";
         } else {
-            $db = new \App\Models\MoneyBuy;
-            $bet_count['user_count'] = $db->countUser($timearea);
+            $db = new \App\Models\MoneyBuyStr;
+            $db1 = new \App\Models\MoneyBuySimplex;
+            $str = $db->countUser($timearea);
+            $simplex = $db1->countUser($timearea);
+            if($str && $simplex){
+                for($i=0;$i<count($str);$i++){
+                    for($j=0;$j<count($simplex);$j++){
+                        if($str[$i]['account_identity'] == $simplex[$j]['account_identity']){
+                            unset($str[$i]);
+                        }
+
+                    }
+                }
+            }
+            $bet_count['user_count'] = count($str)+count($simplex);
+//            $usernumstr = \App\Models\MoneyBuyStr::select('account_name')->where('money_buy_str.status', '<>', 4)->join('account', 'money_buy_str.account_identity', '=', 'account.identity')->where('account.status', '<>', '4')->where('account.user_type', '1')->whereBetween('money_time', $timearea)->groupBy('account_name')->count();
+//            $usernumsimplex = \App\Models\MoneyBuySimplex::select('account_name')->where('money_buy_simplex.status', '<>', 4)->join('account', 'money_buy_simplex.account_identity', '=', 'account.identity')->where('account.status', '<>', '4')->where('account.user_type', '1')->whereBetween('money_time', $timearea)->groupBy('account_name')->count();
+//            $bet_count['user_count'] = $usernumstr+$usernumsimplex;
         }
         // $queries = DB::getQueryLog();
         // print_r($queries);
@@ -328,6 +346,7 @@ class IndexController extends Controller
         $end_time = date('Y-m-d', time());
 
         $user = DB::select('select  rtime as name ,count(rtime) as value   from  (SELECT  to_char( "register_time",\'YYYY-MM-DD\') as rtime FROM "account_detailed" where "register_time">=CURRENT_DATE-7) as tmp  group by rtime order by name asc');
+        //var_dump($user);exit;
         // if (!empty($user)) {
             $userData = [];
             foreach ($user as $k => $v) {
@@ -342,9 +361,13 @@ class IndexController extends Controller
         $days = ($etimestamp - $stimestamp) / 86400;
         //保存每天日期
         $date = array();
-        for ($i = 0; $i < $days; $i++) {
+        for ($i = 1; $i <= $days; $i++) {
             $date[] = date('Y-m-d', $stimestamp + (86400 * $i));
         }
+       // $time = [$date[0], $date[$days-1].' 23:59:59'];
+       // $num = \App\Models\Account_detailed::whereBetween('register_time', $time)->get()->toArray();
+       // var_dump($num);exit;
+
         //循环补全日期
         foreach ($date as $key => $val) {
             $data[$key] = [

+ 3 - 1
app/Models/Comendnotice.php

@@ -43,7 +43,9 @@ class Comendnotice extends BaseModel
         $lastDay = date("Y-m-d H:i:s", time() - 86400 * 30);
         $now = date("Y-m-d H:i:s", time() - 5 * 3600);
 
-        $model = $this->where([['game_start_time', '<=', $now], ['game_start_time', '>=', $lastDay], ['pcount', '=', 0]])->orderBy('game_start_time', 'desc')->first();
+        $now_2 = date('Y-m-d H:i:s', time() - 60);
+        // $model = $this->where([['game_start_time', '<=', $now], ['game_start_time', '>=', $lastDay], ['pcount', '=', 0]])->orderBy('game_start_time', 'desc')->first();
+        $model = $this->where([['ctime', '<=', $now_2], ['ctime', '>=', $lastDay], ['pcount', '=', 0]])->orderBy('ctime', 'desc')->first();
         return $model;
     }
 

+ 9 - 0
app/Models/MoneyBuySimplex.php

@@ -49,4 +49,13 @@ class MoneyBuySimplex extends BaseModel
 
     }
 
+    //一段时间内的提现人数
+    public function countUser($timearea)
+    {
+        $data = $this->select('account_identity')->where('money_buy_simplex.status', '<>', 4)->join('account','money_buy_simplex.account_identity', '=', 'account.identity')->where('account.status','<>','4')->where('account.user_type','1')->whereBetween('money_time', $timearea)->groupBy('account_identity')->get();
+
+        $data = $data->toArray();
+        return $data;
+    }
+
 }

+ 10 - 0
app/Models/MoneyBuyStr.php

@@ -319,4 +319,14 @@ class MoneyBuyStr extends BaseModel {
     }
 
 
+    //一段时间内的提现人数
+    public function countUser($timearea)
+    {
+        $data = $this->select('account_identity')->where('money_buy_str.status', '<>', 4)->join('account','money_buy_str.account_identity', '=', 'account.identity')->where('account.status','<>','4')->where('account.user_type','1')->whereBetween('money_time', $timearea)->groupBy('account_identity')->get();
+
+        $data = $data->toArray();
+        return $data;
+    }
+
+
 }