SoccerStringNoteListController.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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. $request['match_id'] = isset($req->match_id) ? trim($req->match_id) :null ;
  28. $dt = \App\Lib\DataTable\DataTable::init();
  29. $dt->setDataSource('/admin/SoccerStringNoteList/info');
  30. $dt->setLang('sportsnotelist');
  31. //$dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 80));
  32. $dt->addColsFields('order_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 200));
  33. $dt->addColsFields('model', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
  34. $dt->addColsFields('detail_content', array('templet' => '#userdetail', 'sort' => false, 'width' => 150));
  35. $dt->addColsFields('money', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  36. $dt->addColsFields('water_status', array('templet' => '#userdetail', 'sort' => false, 'width' => 70));
  37. $dt->addColsFields('prize_money', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  38. //$dt->addColsFields('settle_status', array('templet' => '#userdetail', 'sort' => false, 'width' => 70));
  39. $dt->addColsFields('money_match_time', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
  40. $dt->addColsFields('account', array('templet' => '#userdetail', 'sort' => false, 'width' => 120));
  41. //$dt->addColsFields('member_type', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  42. $dt->addColsFields('game_status', array('templet' => '#userdetail', 'sort' => false, 'width' => 70));
  43. //$arr[] = 'view';
  44. // if (checkRriv('/admin/SoccerNoteList/edit')) {
  45. // $arr[] = 'edit';
  46. // }
  47. // $dt->setToolBar($arr, array('width' => 70));
  48. $dt->enableCheckBox();
  49. return view('sports/sports_stringnotelist', $dt->render($request));
  50. }
  51. function info()
  52. {
  53. $type = '2';//串关注单
  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. $where = array();
  63. if (!empty($account)) {
  64. if (empty($sureblur) || $sureblur == 'off') {
  65. $where[] = array('st_zq_bet.account_name', 'like', '%' . $account . '%');
  66. } else {
  67. $where[] = array('st_zq_bet.account_name', '=', $account);
  68. }
  69. }
  70. if (!empty($star_time)) {
  71. if (!empty($end_time)){
  72. $where[] = array('st_zq_bet.money_time', '>', $star_time);
  73. $where[] = array('st_zq_bet.money_time', '<', $end_time);
  74. }else{
  75. $where[] = array('st_zq_bet.money_time', '>', $star_time);
  76. }
  77. }else if(empty($star_time)){
  78. if (!empty($end_time)){
  79. $where[] = array('st_zq_bet.money_time', '<', $end_time);
  80. }
  81. }
  82. if (!empty($order_id)){
  83. $where[] = array('st_zq_bet.order_id', $order_id);
  84. }
  85. if (!empty($match_id)){
  86. $where[] = array('st_zq_bet.match_id', $match_id);
  87. }
  88. $newapp = new \App\Models\SportsNoteList();
  89. $data = $newapp->getinfo($list, $page, $where,$type);
  90. return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total'], 0, $where);
  91. }
  92. /**
  93. *修改订单
  94. */
  95. function edit(Req $req) {
  96. $id = $req->id;
  97. if (intval($id) < 1) {
  98. return -1;
  99. }
  100. $lange = trans('sportssoccer');
  101. $data = \App\Models\SportsNoteList::where('id',$id)->first();
  102. $data->order_time = $data->order_id.' '.$data->money_time;
  103. //for($i=0;$i<count($data);$i++){
  104. $codes = json_decode($data->codes, true);
  105. $data->content = '';
  106. for($j=0;$j<count($codes);$j++){
  107. $odds_only = $data->odds_only;
  108. $res = DB::table('st_zq_odds_record')->where('odds_only',$odds_only)->first();
  109. $result = DB::table('st_odds_code')->where('odds_code',$res['odds_code'])->first();
  110. //$result = \App\Models\Matchcode::where('odds_code',$res->odds_code)->first();
  111. $game = DB::table('st_game_type')->where('game_code',$data->game_name)->first();
  112. $data->content = $data->content.$result['odds_name']. '¥'.$codes[$j]['bet_amount'];
  113. $data->game = $game->game_name;
  114. }
  115. //}
  116. if (!$req->isMethod('post')) {
  117. $data = $data->toArray();
  118. return view('sports/sports_notelist_form', $data);
  119. } else {
  120. $model = new \App\Models\SportsNoteList();
  121. $model->id = $req->input('id');
  122. $model = $model::find($model->id);
  123. $model->water_status = $req->input('water_status');
  124. $model->settle_status = $req->input('settle_status');
  125. $model->game_status = $req->input('game_status');
  126. //$model->utime = date('Y-m-d H:i:s',time());
  127. $model->save();
  128. return responseToJson(1);
  129. }
  130. }
  131. /**
  132. *订单审核
  133. */
  134. public function orderstatus(Req $req) {
  135. $id = $req->input('id');
  136. if (empty($id)) {
  137. return responseToJson(-2001); //id������
  138. }
  139. $ids = explode(',', $id);
  140. if (!is_array($ids) && intval($ids) < 0) {
  141. return responseToJson(-2002); //id����
  142. }
  143. if (is_array($ids) && count($ids) > 0) {
  144. foreach ($ids as $k => $v) {
  145. if (intval($v) < 1) {
  146. unset($ids[$k]);
  147. }
  148. }
  149. }
  150. $rows = \App\Models\SportsNoteList::whereIn('id', $ids)->delete();
  151. if (!$rows) {
  152. return responseToJson(-2003); //id����
  153. }
  154. return responseToJson(1, trans('menu.delete_success')); //id����
  155. }
  156. /**
  157. *删除订单
  158. */
  159. public function delete(Req $req) {
  160. $id = $req->input('id');
  161. if (empty($id)) {
  162. return responseToJson(-2001); //id������
  163. }
  164. $ids = explode(',', $id);
  165. if (!is_array($ids) && intval($ids) < 0) {
  166. return responseToJson(-2002); //id����
  167. }
  168. if (is_array($ids) && count($ids) > 0) {
  169. foreach ($ids as $k => $v) {
  170. if (intval($v) < 1) {
  171. unset($ids[$k]);
  172. }
  173. }
  174. }
  175. $rows = \App\Models\SportsNoteList::whereIn('id', $ids)->delete();
  176. if (!$rows) {
  177. return responseToJson(-2003); //id����
  178. }
  179. return responseToJson(1, trans('menu.delete_success')); //id����
  180. }
  181. /**
  182. * 投注金额统计
  183. */
  184. function moneycount()
  185. {
  186. $type = '2';//串关注单
  187. $where = Request::has('where') ? Request::get('where') : '';
  188. $db = new \App\Models\SportsNoteList;
  189. $data = $db->MoneyCount($where,$type);
  190. return responseToJson($data);
  191. }
  192. }