SoccerNoteListController.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Jonlin
  5. * Date: 2019/4/9
  6. * Time: 9:11
  7. */
  8. namespace App\Http\Controllers\Admin;
  9. use App\Http\Controllers\Controller;
  10. use Illuminate\Http\Request as Req;
  11. use Illuminate\Support\Facades\DB;
  12. use App\Models;
  13. use Request;
  14. /**
  15. *
  16. */
  17. class SoccerNoteListController extends Controller
  18. {
  19. public function notelist(Req $req)
  20. {
  21. $request['name_chinese'] = isset($req->name_chinese) ? trim($req->name_chinese) : null;
  22. $request['sureblurs'] = isset($req->sureblurs) ? $req->sureblurs : 'on';
  23. $request['account'] = isset($req->account) ? trim($req->account) :null ;
  24. $request['star_time'] = isset($req->star_time) ? trim($req->star_time) :null ;
  25. $request['end_time'] = isset($req->end_time) ? trim($req->end_time) :null ;
  26. $request['order_id'] = isset($req->order_id) ? trim($req->order_id) :null ;
  27. $request['match_id'] = isset($req->match_id) ? trim($req->match_id) :null ;
  28. $request['type'] = isset($req->type) ? trim($req->type) : 'zq';
  29. $dt = \App\Lib\DataTable\DataTable::init();
  30. $dt->setDataSource('/admin/SoccerNoteList/info');
  31. $dt->setLang('sportsnotelist');
  32. //$dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 80));
  33. $dt->addColsFields('match_id_order', array('templet' => '#userdetail', 'sort' => true, 'width' => 200));
  34. $dt->addColsFields('league', array('templet' => '#userdetail', 'sort' => false, 'width' => 150));
  35. $dt->addColsFields('home_guest', array('templet' => '#userdetail', 'sort' => false, 'width' => 150));
  36. $dt->addColsFields('content', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
  37. $dt->addColsFields('money', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  38. $dt->addColsFields('water_return', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  39. $dt->addColsFields('prize_money', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  40. $dt->addColsFields('result', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  41. $dt->addColsFields('money_match_time', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
  42. $dt->addColsFields('account', array('templet' => '#userdetail', 'sort' => false, 'width' => 120));
  43. $dt->addColsFields('game_status', array('templet' => '#userdetail', 'sort' => false, 'width' => 70));
  44. //$arr[] = 'view';
  45. // if (checkRriv('/admin/SoccerNoteList/edit')) {
  46. // $arr[] = 'edit';
  47. // }
  48. // $dt->setToolBar($arr, array('width' => 70));
  49. $dt->enableCheckBox();
  50. return view('sports/sports_notelist', $dt->render($request));
  51. }
  52. function info()
  53. {
  54. $page = Request::has('page') ? Request::get('page') : '';
  55. $list = Request::has('limit') ? Request::get('limit') : 10;
  56. $account = Request::get('account') ? Request::get('account') : '';
  57. $star_time = Request::get('star_time') ? Request::get('star_time').' 00:00:00' : '';
  58. $end_time = Request::get('end_time') ? Request::get('end_time').' 23:59:59' : '';
  59. $order_id = Request::get('order_id') ? Request::get('order_id') : '';
  60. $match_id = Request::get('match_id') ? Request::get('match_id') : '';
  61. $sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
  62. $type = Request::has('type') ? Request::get('type') : 'zq';
  63. $where = array();
  64. if (!empty($account)) {
  65. if (empty($sureblur) || $sureblur == 'off') {
  66. $where[] = array('money_buy_simplex.account_name', 'like', '%' . $account . '%');
  67. } else {
  68. $where[] = array('money_buy_simplex.account_name', '=', $account);
  69. }
  70. }
  71. if (!empty($star_time)) {
  72. if (!empty($end_time)){
  73. $where[] = array('money_buy_simplex.money_time', '>', $star_time);
  74. $where[] = array('money_buy_simplex.money_time', '<', $end_time);
  75. }else{
  76. $where[] = array('money_buy_simplex.money_time', '>', $star_time);
  77. }
  78. }else if(empty($star_time)){
  79. if (!empty($end_time)){
  80. $where[] = array('money_buy_simplex.money_time', '<', $end_time);
  81. }
  82. }
  83. if (!empty($order_id)){
  84. $where[] = array('money_buy_simplex.order_id', $order_id);
  85. }
  86. if (!empty($match_id)){
  87. $where[] = array('money_buy_simplex.match_id', $match_id);
  88. }
  89. $where[] = array('money_buy_simplex.game_code', $type);
  90. $newapp = new \App\Models\SportsNoteList();
  91. $data = $newapp->getinfo($list, $page, $where,$type);
  92. return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total'], 0, $where);
  93. }
  94. /**
  95. *订单审核
  96. */
  97. public function orderstatus(Req $req) {
  98. $id = $req->input('id');
  99. if (empty($id)) {
  100. return responseToJson(-2001); //id������
  101. }
  102. $ids = explode(',', $id);
  103. if (!is_array($ids) && intval($ids) < 0) {
  104. return responseToJson(-2002); //id����
  105. }
  106. if (is_array($ids) && count($ids) > 0) {
  107. foreach ($ids as $k => $v) {
  108. if (intval($v) < 1) {
  109. unset($ids[$k]);
  110. }
  111. }
  112. }
  113. $rows = \App\Models\SportsNoteList::whereIn('id', $ids)->delete();
  114. if (!$rows) {
  115. return responseToJson(-2003); //id����
  116. }
  117. return responseToJson(1, trans('menu.delete_success')); //id����
  118. }
  119. /**
  120. *删除订单
  121. */
  122. public function delete(Req $req) {
  123. $id = $req->input('id');
  124. if (empty($id)) {
  125. return responseToJson(-2001); //id������
  126. }
  127. $ids = explode(',', $id);
  128. if (!is_array($ids) && intval($ids) < 0) {
  129. return responseToJson(-2002); //id����
  130. }
  131. if (is_array($ids) && count($ids) > 0) {
  132. foreach ($ids as $k => $v) {
  133. if (intval($v) < 1) {
  134. unset($ids[$k]);
  135. }
  136. }
  137. }
  138. $rows = \App\Models\SportsNoteList::whereIn('id', $ids)->delete();
  139. if (!$rows) {
  140. return responseToJson(-2003); //id����
  141. }
  142. return responseToJson(1, trans('menu.delete_success')); //id����
  143. }
  144. /**
  145. * 投注金额统计
  146. */
  147. function moneycount()
  148. {
  149. $where = Request::has('where') ? Request::get('where') : '';
  150. $db = new \App\Models\SportsNoteList;
  151. $data = $db->MoneyCount($where);
  152. return responseToJson($data);
  153. }
  154. }