SoccerNoteListController.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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' => 150));
  37. $dt->addColsFields('money', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  38. $dt->addColsFields('water_status', 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('member_type', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  44. $dt->addColsFields('game_status', array('templet' => '#userdetail', 'sort' => false, 'width' => 70));
  45. //$arr[] = 'view';
  46. // if (checkRriv('/admin/SoccerNoteList/edit')) {
  47. // $arr[] = 'edit';
  48. // }
  49. // $dt->setToolBar($arr, array('width' => 70));
  50. $dt->enableCheckBox();
  51. return view('sports/sports_notelist', $dt->render($request));
  52. }
  53. function info()
  54. {
  55. $page = Request::has('page') ? Request::get('page') : '';
  56. $list = Request::has('limit') ? Request::get('limit') : 10;
  57. $account = Request::get('account') ? Request::get('account') : '';
  58. $star_time = Request::get('star_time') ? Request::get('star_time').' 00:00:00' : '';
  59. $end_time = Request::get('end_time') ? Request::get('end_time').' 23:59:59' : '';
  60. $order_id = Request::get('order_id') ? Request::get('order_id') : '';
  61. $match_id = Request::get('match_id') ? Request::get('match_id') : '';
  62. $sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
  63. $type = Request::has('type') ? Request::get('type') : 'zq';
  64. $where = array();
  65. if (!empty($account)) {
  66. if (empty($sureblur) || $sureblur == 'off') {
  67. $where[] = array('money_buy.account_name', 'like', '%' . $account . '%');
  68. } else {
  69. $where[] = array('money_buy.account_name', '=', $account);
  70. }
  71. }
  72. if (!empty($star_time)) {
  73. if (!empty($end_time)){
  74. $where[] = array('money_buy.money_time', '>', $star_time);
  75. $where[] = array('money_buy.money_time', '<', $end_time);
  76. }else{
  77. $where[] = array('money_buy.money_time', '>', $star_time);
  78. }
  79. }else if(empty($star_time)){
  80. if (!empty($end_time)){
  81. $where[] = array('money_buy.money_time', '<', $end_time);
  82. }
  83. }
  84. if (!empty($order_id)){
  85. $where[] = array('money_buy.order_id', $order_id);
  86. }
  87. if (!empty($match_id)){
  88. $where[] = array('money_buy.match_id', $match_id);
  89. }
  90. if (!empty($type)){
  91. $where[] = array('money_buy.game_name', $type);
  92. }
  93. $newapp = new \App\Models\SportsNoteList();
  94. $data = $newapp->getinfo($list, $page, $where,$type);
  95. return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total'], 0, $where);
  96. }
  97. /**
  98. *订单审核
  99. */
  100. public function orderstatus(Req $req) {
  101. $id = $req->input('id');
  102. if (empty($id)) {
  103. return responseToJson(-2001); //id������
  104. }
  105. $ids = explode(',', $id);
  106. if (!is_array($ids) && intval($ids) < 0) {
  107. return responseToJson(-2002); //id����
  108. }
  109. if (is_array($ids) && count($ids) > 0) {
  110. foreach ($ids as $k => $v) {
  111. if (intval($v) < 1) {
  112. unset($ids[$k]);
  113. }
  114. }
  115. }
  116. $rows = \App\Models\SportsNoteList::whereIn('id', $ids)->delete();
  117. if (!$rows) {
  118. return responseToJson(-2003); //id����
  119. }
  120. return responseToJson(1, trans('menu.delete_success')); //id����
  121. }
  122. /**
  123. *删除订单
  124. */
  125. public function delete(Req $req) {
  126. $id = $req->input('id');
  127. if (empty($id)) {
  128. return responseToJson(-2001); //id������
  129. }
  130. $ids = explode(',', $id);
  131. if (!is_array($ids) && intval($ids) < 0) {
  132. return responseToJson(-2002); //id����
  133. }
  134. if (is_array($ids) && count($ids) > 0) {
  135. foreach ($ids as $k => $v) {
  136. if (intval($v) < 1) {
  137. unset($ids[$k]);
  138. }
  139. }
  140. }
  141. $rows = \App\Models\SportsNoteList::whereIn('id', $ids)->delete();
  142. if (!$rows) {
  143. return responseToJson(-2003); //id����
  144. }
  145. return responseToJson(1, trans('menu.delete_success')); //id����
  146. }
  147. /**
  148. * 投注金额统计
  149. */
  150. function moneycount()
  151. {
  152. $where = Request::has('where') ? Request::get('where') : '';
  153. $db = new \App\Models\SportsNoteList;
  154. $data = $db->MoneyCount($where);
  155. return responseToJson($data);
  156. }
  157. }