Browse Source

异常处理

彭俊 6 years ago
parent
commit
5867492d4b

+ 58 - 7
Application/Api/Model/MoneyBuy.php

@@ -75,9 +75,37 @@ class MoneyBuy extends Model {
         if (empty($userInfo['identity'])) {
         if (empty($userInfo['identity'])) {
             Render([], '2001', lang('Common','Api') -> get('user does login'));
             Render([], '2001', lang('Common','Api') -> get('user does login'));
         }
         }
+         
+        //===追加结算状态===
+        //拼接条件
+        $moneyBuySpxWhere = [];
+         // 用户ID
+         $moneyBuySpxWhere[] = ['account_identity','=',$userInfo['identity']];
+         // 输赢
+         if (!empty($_POST['result'])) {
+            $moneyBuySpxWhere[] = ['game_status','=',$_POST['result']];
+         }
+         // 结算状态 默认0 所有 1未结算 2已结算 -1无效
+        $set_status = $_POST['set_status']?:0;
+        if($set_status == 1){//未结算注单
+            $moneyBuySpxWhere[] = ['settle_status','=',1];
+            $moneyBuySpxWhere[] = ['roll_ratify','>',-1];
+            $moneyBuySpxWhere[] = ['roll_ratify','<',2];
+        }
+        if($set_status == 2){//已结算注单
+            $moneyBuySpxWhere[] = ['settle_status','>',1];
+            $moneyBuySpxWhere[] = ['roll_ratify','>',-1];
+            $moneyBuySpxWhere[] = ['roll_ratify','<',2];
+        }
+        if($set_status == -1){//无效注单
+            $moneyBuySpxWhere[] = ['status','>',1];
+            $moneyBuySpxWhere[] = ['roll_ratify','=',-1];
+        }
+
+        //===end===
         
         
         // 用户ID
         // 用户ID
-        $moneyBuySpxWhere['account_identity'] = $userInfo['identity'];
+        // $moneyBuySpxWhere['account_identity'] = $userInfo['identity'];
         // 时间区间
         // 时间区间
         $startTime = isset($_POST['startTime'])? $_POST['startTime'] : '1900-01-01 00:00:00';
         $startTime = isset($_POST['startTime'])? $_POST['startTime'] : '1900-01-01 00:00:00';
         $endTime = isset($_POST['endTime'])? $_POST['endTime'] : '3000-12-12 00:00:00';
         $endTime = isset($_POST['endTime'])? $_POST['endTime'] : '3000-12-12 00:00:00';
@@ -88,8 +116,8 @@ class MoneyBuy extends Model {
         /*
         /*
         状态:1 投注 2作废 3撤单
         状态:1 投注 2作废 3撤单
         */
         */
-        $status = $_POST['status']?$_POST['status']:1;
-        $moneyBuySpxWhere['status'] = $status;
+        // $status = $_POST['status']?$_POST['status']:1;
+        // $moneyBuySpxWhere['status'] = $status;
 
 
         //===end===
         //===end===
         
         
@@ -271,12 +299,35 @@ class MoneyBuy extends Model {
         if (empty($userInfo['identity'])) {
         if (empty($userInfo['identity'])) {
             Render([], '2001', lang('Common','Api') -> get('user does login'));
             Render([], '2001', lang('Common','Api') -> get('user does login'));
         }
         }
+
+        //===追加结算状态===
+        //拼接条件
+        $moneyBuyStrWhere = [];
+         // 用户ID
+         $moneyBuyStrWhere[] = ['account_identity','=',$userInfo['identity']];
+         // 输赢
+         if (!empty($_POST['result'])) {
+            $moneyBuyStrWhere[] = ['game_status','=',$_POST['result']];
+         }
+         // 结算状态 默认0 所有 1未结算 2已结算 -1无效
+        $set_status = $_POST['set_status']?:0;
+        if($set_status == 1){//未结算注单
+            $moneyBuyStrWhere[] = ['settle_status','=',1];
+        }
+        if($set_status == 2){//已结算注单
+            $moneyBuyStrWhere[] = ['settle_status','>',1];
+        }
+        if($set_status == -1){//无效注单
+            $moneyBuyStrWhere[] = ['status','>',1];
+        }
+        //===end===
+
         // 用户ID
         // 用户ID
-        $moneyBuyStrWhere['account_identity'] = $userInfo['identity'];
+        // $moneyBuyStrWhere['account_identity'] = $userInfo['identity'];
         // 输赢
         // 输赢
-        if (!empty($_POST['result'])) {
-            $moneyBuyStrWhere['game_status'] = $_POST['result'];
-        }
+        // if (!empty($_POST['result'])) {
+        //     $moneyBuyStrWhere['game_status'] = $_POST['result'];
+        // }
         // 时间区间
         // 时间区间
         $startTime = isset($_POST['startTime'])? $_POST['startTime'] : '1900-01-01 00:00:00';
         $startTime = isset($_POST['startTime'])? $_POST['startTime'] : '1900-01-01 00:00:00';
         $endTime = isset($_POST['endTime'])? $_POST['endTime'] : '3000-12-12 00:00:00';
         $endTime = isset($_POST['endTime'])? $_POST['endTime'] : '3000-12-12 00:00:00';

+ 2 - 0
Application/Commons/Model/Money_buy_match.php

@@ -31,10 +31,12 @@ class Money_buy_match extends Model {
         ->join('st_odds_code', function ($join) {
         ->join('st_odds_code', function ($join) {
             $join->on('money_buy_match.odds_code', '=','st_odds_code.odds_code')->on('money_buy_match.game_code', '=','st_odds_code.game_code');
             $join->on('money_buy_match.odds_code', '=','st_odds_code.odds_code')->on('money_buy_match.game_code', '=','st_odds_code.game_code');
         });
         });
+
         // 查询条件
         // 查询条件
         if (!empty($where)) {
         if (!empty($where)) {
             $result = $result -> where($where);
             $result = $result -> where($where);
         }
         }
+
         // 循环获取or查询
         // 循环获取or查询
         if (!empty($orWhere)) {
         if (!empty($orWhere)) {
             foreach ($orWhere as $value) {
             foreach ($orWhere as $value) {

+ 1 - 0
Application/Commons/Model/Money_buy_str.php

@@ -30,6 +30,7 @@ class Money_buy_str extends Model {
      * @return array JsonString
      * @return array JsonString
      */
      */
     public function moneyBuyStr($select, $where = '', $between = '', $begin = '', $pageSize = '', $toArray = 0, $orderBy = ['money_time' => 'desc'], $join = '') {
     public function moneyBuyStr($select, $where = '', $between = '', $begin = '', $pageSize = '', $toArray = 0, $orderBy = ['money_time' => 'desc'], $join = '') {
+        
         // 查询字段
         // 查询字段
         $result = $this -> select($select);
         $result = $this -> select($select);
         // 循环关联
         // 循环关联