Browse Source

追加推送 5/27

彭俊 6 years ago
parent
commit
8cc1bcd793

+ 3 - 3
Application/Api/Controller/UserBuy.php

@@ -175,7 +175,7 @@ class UserBuy extends BaseController {
     public function index() {
         $code = 0;
         $msg = lang('Common','Api') -> get('error');
-        try{
+        /*try{*/
             $MoneyBuyModel = new MoneyBuy();
             // 数据获取
             $result = $MoneyBuyModel -> monthRecord();
@@ -183,9 +183,9 @@ class UserBuy extends BaseController {
             $msg = lang('Index','Api') -> get('success');
 
             Render($result, $code, $msg);
-        } catch (Exception $e) {
+        /*} catch (Exception $e) {
             Render([], $code, $msg);
             //Render([], $code, $e->getMessage());
-        }
+        }*/
     }
 }

+ 35 - 4
Application/Api/Model/MoneyBuy.php

@@ -116,6 +116,9 @@ class MoneyBuy extends Model {
             $moneyBuyMthOr[1][0][1] = -1;
             $moneyBuyMthOr[1][1][0] = 'result';
             $moneyBuyMthOr[1][1][1] = 4;
+        } elseif ($_POST['result'] === '0') {
+            $moneyBuyMthOr[1][0][0] = 'result';
+            $moneyBuyMthOr[1][0][1] = 0;
         }
         // 当前页
         $currentPage = isset($_POST['currentPage']) ? $_POST['currentPage'] : "1";
@@ -125,7 +128,7 @@ class MoneyBuy extends Model {
         $begin = ($currentPage - 1) * $pageSize;
         // 获取注单
         $moneyBuyMthMdl = lm('Money_buy_match', "commons");
-        $moneyBuyMthSlt = ['status', 'bet_money', 'home_team', 'guest_team', 'condition', 'odds', 'odds_name', 'match_id', 'money_buy_match.game_code', 'money_buy_match.odds_code'];
+        $moneyBuyMthSlt = ['status', 'bet_money', 'matchResult', 'result', 'home_team',  'batch_id', 'guest_team', 'condition', 'ctime', 'odds', 'odds_name', 'match_id', 'money_buy_match.game_code', 'money_buy_match.odds_code'];
         $getMoneyBuyMth = $moneyBuyMthMdl -> moneyBuyMatch($moneyBuyMthSlt, $moneyBuyMthWhere, $moneyBuyMthOr, $begin, $pageSize);
         $allCount = $moneyBuyMthMdl -> moneyBuyMatchTotal($moneyBuyMthWhere, $moneyBuyMthOr);
         // 获取可加注所需要的查询条件
@@ -156,6 +159,28 @@ class MoneyBuy extends Model {
         }
         // 循环添加玩法和判断玩法是否可加注
         foreach ($getMoneyBuyMth as $key => $value) {
+            $getMoneyBuyMth[$key]->willMoney = $value->bet_money * $value->odds;
+            if ($value->result) {
+                switch (intval($value->result)) {
+                    case 1:
+                        $oddsDiscount = 1 + $value->odds;
+                        break;
+                    case 2:
+                        $oddsDiscount = 1;
+                        break;
+                    case 3:
+                        $oddsDiscount = 1 + $value->odds * 0.5;
+                        break;
+                    case 4:
+                        $oddsDiscount = 0.5;
+                        break;
+                    default:
+                        $oddsDiscount = 0;
+                }
+                $getMoneyBuyMth[$key]->winMoney = $value->bet_money * ($oddsDiscount - 1);
+            } else {
+                $getMoneyBuyMth[$key]->winMoney = 0;
+            }
             $typeSstOdds = $getSstOdds[$value -> game_code];
             $thisSstOdds = [
                 'match_id' => $value -> match_id,
@@ -210,7 +235,7 @@ class MoneyBuy extends Model {
         // 起始查询位置
         $begin = ($currentPage - 1) * $pageSize;
         // 获取订单记录
-        $moneyBuyStrSlt = ['batch_id', 'money'];
+        $moneyBuyStrSlt = ['batch_id', 'gain_money', 'game_status', 'money', 'prize_money', 'money_time'];
         $getMoneyBuyStr = $moneyBuyStrMdl -> moneyBuyStr($moneyBuyStrSlt, $moneyBuyStrWhere, $moneyBuyStrBetween, $begin, $pageSize, 1);
         $allCount = $moneyBuyStrMdl -> moneyBuyStrTotal($moneyBuyStrWhere, $moneyBuyStrBetween);
         // 获取全部订单id
@@ -233,7 +258,7 @@ class MoneyBuy extends Model {
         $moneyBuyMthWhere['bet_type'] = 2;
         // 获取注单
         $moneyBuyMthMdl = lm('Money_buy_match', "commons");
-        $moneyBuyMthSlt = ['status', 'bet_money', 'home_team', 'guest_team', 'condition', 'odds', 'odds_name', 'match_id', 'batch_id', 'money_buy_match.game_code', 'money_buy_match.odds_code'];
+        $moneyBuyMthSlt = ['status', 'matchResult', 'bet_money', 'home_team', 'guest_team', 'condition', 'odds', 'odds_name', 'match_id', 'batch_id', 'money_buy_match.game_code', 'money_buy_match.odds_code'];
         $getMoneyBuyMth = $moneyBuyMthMdl -> moneyBuyMatch($moneyBuyMthSlt, $moneyBuyMthWhere, $moneyBuyMthOr, $begin, $pageSize);
         // 获取可加注所需要的查询条件
         $commonFunction = C() -> get('commonFunction');
@@ -276,6 +301,12 @@ class MoneyBuy extends Model {
             }
         }
         foreach ($getMoneyBuyStr as $key => $value) {
+            // 计算所赢金额.
+            if ($value->gain_money) {
+                $getMoneyBuyStr[$key]->winMoney = $value->gain_money - $value->money;
+            } else {
+                $getMoneyBuyStr[$key]->winMoney = 0;
+            }
             foreach ($getMoneyBuyMth as $k => $v) {
                 if ($value['batch_id'] == $v['batch_id']) {
                     $getMoneyBuyStr[$key]['money_buy'][$k] = $v;
@@ -349,7 +380,7 @@ class MoneyBuy extends Model {
             Render([], '2001', lang('Common','Api') -> get('user does login'));
         }
         // 用户ID
-        $moneyBuyWhere['account_identity'] =$userInfo['identity'];
+        $moneyBuyWhere['account_identity'] = $userInfo['identity'];
         // 时间区间
         $endTime = date('Y-m-d H:i:s');
         if ($userInfo['statisticsTime']) {

+ 2 - 1
Application/Sports/Controller/MatchListWeb.php

@@ -87,7 +87,8 @@ class MatchListWeb extends Controller{
             }
         }
         $gameData['all_num'] = array_sum($gameData);
-        Render($gameData, '1', lang('Tips','Sports')->get('success'));
+        $data[] = $gameData;
+        Render($data, '1', lang('Tips','Sports')->get('success'));
     }
     //获取非滚球数据
     public function Other($type,$game_code,$p_code){