SoccerStringNoteListController.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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 SoccerStringNoteListController 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. $dt = \App\Lib\DataTable\DataTable::init();
  28. $dt->setDataSource('/admin/SoccerStringNoteList/info');
  29. $dt->setLang('sportsnotelist');
  30. //$dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 80));
  31. $dt->addColsFields('order_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 200));
  32. $dt->addColsFields('game_name', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
  33. $dt->addColsFields('detail_content', array('sort' => false, 'width' => 150));
  34. $dt->addColsFields('money', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  35. $dt->addColsFields('water_status', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  36. $dt->addColsFields('prize_money', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  37. $dt->addColsFields('result', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  38. $dt->addColsFields('money_match_time', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
  39. $dt->addColsFields('account', array('templet' => '#userdetail', 'sort' => false, 'width' => 240));
  40. //$dt->addColsFields('member_type', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  41. $dt->addColsFields('settle_status', array('sort' => false, 'width' => 100));
  42. //$arr[] = 'view';
  43. // if (checkRriv('/admin/SoccerStringNoteList/edit')) {
  44. // $arr[] ='edit';
  45. // }
  46. // $dt->setToolBar($arr, array('width' => 100));
  47. $dt->enableCheckBox();
  48. return view('sports/sports_stringnotelist', $dt->render($request));
  49. }
  50. function info()
  51. {
  52. $page = Request::has('page') ? Request::get('page') : '';
  53. $list = Request::has('limit') ? Request::get('limit') : 10;
  54. $account = Request::get('account') ? Request::get('account') : '';
  55. $star_time = Request::get('star_time') ? Request::get('star_time').' 00:00:00' : '';
  56. $end_time = Request::get('end_time') ? Request::get('end_time').' 23:59:59' : '';
  57. $order_id = Request::get('order_id') ? Request::get('order_id') : '';
  58. $sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
  59. $where = array();
  60. if (!empty($account)) {
  61. if (empty($sureblur) || $sureblur == 'off') {
  62. $where[] = array('money_buy_str.account_name', 'like', '%' . $account . '%');
  63. } else {
  64. $where[] = array('money_buy_str.account_name', '=', $account);
  65. }
  66. }
  67. if (!empty($star_time)) {
  68. if (!empty($end_time)){
  69. $where[] = array('money_buy_str.money_time', '>', $star_time);
  70. $where[] = array('money_buy_str.money_time', '<', $end_time);
  71. }else{
  72. $where[] = array('money_buy_str.money_time', '>', $star_time);
  73. }
  74. }else if(empty($star_time)){
  75. if (!empty($end_time)){
  76. $where[] = array('money_buy_str.money_time', '<', $end_time);
  77. }
  78. }
  79. if (!empty($order_id)){
  80. $where[] = array('money_buy_str.order_id', $order_id);
  81. }
  82. $newapp = new \App\Models\MoneyBuyStr();
  83. $data = $newapp->getinfo($list, $page, $where);
  84. return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total'], 0, $where);
  85. }
  86. /**
  87. *串关注单详情
  88. */
  89. function detail(Req $req) {
  90. $id = $req->id;
  91. $request['name_chinese'] = isset($req->name_chinese) ? trim($req->name_chinese) : null;
  92. $request['sureblurs'] = isset($req->sureblurs) ? $req->sureblurs : 'on';
  93. $request['account'] = isset($req->account) ? trim($req->account) :null ;
  94. $request['match_id'] = isset($req->match_id) ? trim($req->match_id) :null ;
  95. $dt = \App\Lib\DataTable\DataTable::init();
  96. $dt->setDataSource('/admin/SoccerStringNoteList/detailinfo?id='.$id.'');
  97. $dt->setLang('sportsnotelist');
  98. $dt->addColsFields('match_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 80));
  99. $dt->addColsFields('home_guest', array('templet' => '#userdetail', 'sort' => false, 'width' => 180));
  100. $dt->addColsFields('game_type', array('templet' => '#userdetail', 'sort' => false, 'width' => 90));
  101. $dt->addColsFields('odds_code', array('templet' => '#userdetail', 'sort' => false, 'width' => 180));
  102. $dt->addColsFields('condition', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  103. $dt->addColsFields('odds', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  104. $dt->enableCheckBox();
  105. return view('sports/sports_notelistdetail', $dt->render($request));
  106. }
  107. function detailinfo(Req $req) {
  108. $id = $req->id;
  109. //$match_id = Request::get('match_id') ? Request::get('match_id') : '';
  110. $newapp = new \App\Models\MoneyBuyStr();
  111. $data = $newapp->getdetailinfo($id);
  112. return \App\Lib\DataTable\DataTable::init()->toJson($data);
  113. }
  114. /**
  115. *串关注单重新结算
  116. */
  117. public function resettlement(Req $req) {
  118. $id = $req->id;
  119. if (intval($id) < 1) {
  120. return -1;
  121. }
  122. $order = DB::table('money_buy_str')->where('id',$id)->first();
  123. $money = $order->money;
  124. $codes = DB::table('st_bet_str')->where('id',$order->bet_str_id)->first();
  125. $bet_str_all = json_decode($codes->bet_str_all, true);
  126. for($i=0;$i<count($bet_str_all);$i++){
  127. $match_id = $bet_str_all[$i]['match_id'];
  128. $odds_code = $bet_str_all[$i]['odds_code'];
  129. $result = DB::table('st_zq_result')->where('match_id',$match_id)->get();
  130. $odds = $bet_str_all[$i]['odds'];
  131. $money = $money*$odds;
  132. }
  133. $money = $money-$order->money;
  134. return $money;
  135. }
  136. /**
  137. *删除串关注单
  138. */
  139. public function delete(Req $req) {
  140. $id = $req->input('id');
  141. if (empty($id)) {
  142. return responseToJson(-2001); //id������
  143. }
  144. $ids = explode(',', $id);
  145. if (!is_array($ids) && intval($ids) < 0) {
  146. return responseToJson(-2002); //id����
  147. }
  148. if (is_array($ids) && count($ids) > 0) {
  149. foreach ($ids as $k => $v) {
  150. if (intval($v) < 1) {
  151. unset($ids[$k]);
  152. }
  153. }
  154. }
  155. $rows = \App\Models\MoneyBuyStr::whereIn('id', $ids)->delete();
  156. if (!$rows) {
  157. return responseToJson(-2003); //id����
  158. }
  159. return responseToJson(1, trans('menu.delete_success')); //id����
  160. }
  161. /**
  162. * 投注金额统计
  163. */
  164. function moneycount()
  165. {
  166. $where = Request::has('where') ? Request::get('where') : '';
  167. $db = new \App\Models\MoneyBuyStr;
  168. $data = $db->MoneyCount($where);
  169. return responseToJson($data);
  170. }
  171. }