BasketNoteListController.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 BasketNoteListController 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['money_time'] = isset($req->money_time) ? trim($req->money_time) : null;
  24. $dt = \App\Lib\DataTable\DataTable::init();
  25. $dt->setDataSource('/admin/BasketNoteList/info');
  26. $dt->setLang('sportsnotelist');
  27. $dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 70));
  28. $dt->addColsFields('order_time', array('templet' => '#userdetail', 'sort' => true, 'width' => 160));
  29. $dt->addColsFields('game', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  30. $dt->addColsFields('game_no', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  31. $dt->addColsFields('prize_note', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  32. $dt->addColsFields('money', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  33. $dt->addColsFields('prize_money', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  34. $dt->addColsFields('status', array('templet' => '#userdetail', 'sort' => false, 'width' => 70));
  35. $dt->addColsFields('content', array('templet' => '#userdetail', 'sort' => false, 'width' => 160));
  36. $dt->addColsFields('water_status', array('templet' => '#userdetail', 'sort' => false, 'width' => 70));
  37. //$dt->addColsFields('prize', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  38. $dt->addColsFields('settle_status', array('templet' => '#userdetail', 'sort' => false, 'width' => 70));
  39. $dt->addColsFields('game_status', array('templet' => '#userdetail', 'sort' => false, 'width' => 70));
  40. $dt->addColsFields('account_name', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
  41. $dt->addColsFields('member_type', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  42. //$arr[] = 'view';
  43. if (checkRriv('/admin/BasketNoteList/edit')) {
  44. $arr[] = 'edit';
  45. }
  46. $dt->setToolBar($arr, array('width' => 80));
  47. $dt->enableCheckBox();
  48. return view('sports/sports_notelist', $dt->render($request));
  49. }
  50. function info()
  51. {
  52. $type = 'lq';
  53. $page = Request::has('page') ? Request::get('page') : '';
  54. $list = Request::has('limit') ? Request::get('limit') : 10;
  55. // $money_time = Request::has('money_time') ? Request::get('money_time') : '';
  56. // $sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
  57. $where = array();
  58. //$where[] = array('money_buy.game_name', '=', $type);
  59. // if (!empty($money_time)) {
  60. // $where[] = array('money_buy.money_time', 'like', '%' .$money_time . '%');
  61. // //$where[] = array('money_buy.money_time', 'like', '%2019-04-12%');
  62. // }
  63. $newapp = new \App\Models\SportsNoteList();
  64. $data = $newapp->getinfo($list, $page, $where,$type);
  65. return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
  66. }
  67. /**
  68. *修改订单
  69. */
  70. function edit(Req $req) {
  71. $id = $req->id;
  72. if (intval($id) < 1) {
  73. return -1;
  74. }
  75. $lange = trans('sportssoccer');
  76. $data = \App\Models\SportsNoteList::where('id',$id)->first();
  77. $data->order_time = $data->order_id.' '.$data->money_time;
  78. //for($i=0;$i<count($data);$i++){
  79. $codes = json_decode($data->codes, true);
  80. $data->content = '';
  81. for($j=0;$j<count($codes);$j++){
  82. $odds_only = $data->odds_only;
  83. $res = DB::table('st_zq_odds_record')->where('odds_only',$odds_only)->first();
  84. $result = DB::table('st_odds_code')->where('odds_code',$res['odds_code'])->first();
  85. //$result = \App\Models\Matchcode::where('odds_code',$res->odds_code)->first();
  86. $game = DB::table('st_game_type')->where('game_code',$data->game_name)->first();
  87. $data->content = $data->content.$result['odds_name']. '¥'.$codes[$j]['bet_amount'];
  88. $data->game = $game->game_name;
  89. }
  90. //}
  91. if (!$req->isMethod('post')) {
  92. $data = $data->toArray();
  93. return view('sports/sports_notelist_form', $data);
  94. } else {
  95. $model = new \App\Models\SportsNoteList();
  96. $model->id = $req->input('id');
  97. $model = $model::find($model->id);
  98. $model->water_status = $req->input('water_status');
  99. $model->settle_status = $req->input('settle_status');
  100. $model->game_status = $req->input('game_status');
  101. //$model->utime = date('Y-m-d H:i:s',time());
  102. $model->save();
  103. return responseToJson(1);
  104. }
  105. }
  106. /**
  107. *订单审核
  108. */
  109. public function orderstatus(Req $req) {
  110. $id = $req->input('id');
  111. if (empty($id)) {
  112. return responseToJson(-2001); //id������
  113. }
  114. $ids = explode(',', $id);
  115. if (!is_array($ids) && intval($ids) < 0) {
  116. return responseToJson(-2002); //id����
  117. }
  118. if (is_array($ids) && count($ids) > 0) {
  119. foreach ($ids as $k => $v) {
  120. if (intval($v) < 1) {
  121. unset($ids[$k]);
  122. }
  123. }
  124. }
  125. $rows = \App\Models\SportsNoteList::whereIn('id', $ids)->delete();
  126. if (!$rows) {
  127. return responseToJson(-2003); //id����
  128. }
  129. return responseToJson(1, trans('menu.delete_success')); //id����
  130. }
  131. /**
  132. *删除订单
  133. */
  134. public function delete(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\BasketNoteList::whereIn('id', $ids)->delete();
  151. if (!$rows) {
  152. return responseToJson(-2003); //id����
  153. }
  154. return responseToJson(1, trans('menu.delete_success')); //id����
  155. }
  156. }