IndexController.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Http\Controllers\Controller;
  4. use Illuminate\Support\Facades\App;
  5. use Illuminate\Support\Facades\DB;
  6. /**
  7. *
  8. */
  9. class IndexController extends Controller
  10. {
  11. function welcome()
  12. {
  13. $total = array(
  14. 'total_user' => $this->countTodayUser(),
  15. 'total_bet' => $this->countBet(),
  16. 'today_take' => $this->countTodayTake(),
  17. 'today_recharge' => $this->countTodayRecharge(),
  18. 'today_return' => $this->countTodayReturn(),
  19. 'today_rimit' => $this->countTodayRimt(),
  20. );
  21. if (\App\Models\Role::hasRoot('/enable/show/get_money_count') < 0) {
  22. $get_money_count = "*****";
  23. } else {
  24. $get_money_count = $total['today_recharge']['count'];
  25. }
  26. $notice = $this->getNotice();
  27. $message = $this->Message();
  28. return view('admin/welcome', ['total' => $total, 'notice' => $notice, 'message' => $message, 'get_money_count' => $get_money_count]);
  29. }
  30. //返回用户数量
  31. function countUser()
  32. {
  33. return \App\Models\Account_detailed::count();
  34. }
  35. //今日注册用户数量
  36. function countTodayUser()
  37. {
  38. $time1 = date('Y-m-d 00:00:00'); //今日0时
  39. $time2 = date('Y-m-d 23:59:59'); //
  40. $timearea = [$time1, $time2];
  41. if (\App\Models\Role::hasRoot('/enable/show/today_user') < 0) {
  42. $user_data['today_user'] = "*****";
  43. } else {
  44. $user_data['today_user'] = \App\Models\Account_detailed::whereBetween('register_time', $timearea)->join('account', 'account_detailed.account_identity', '=', 'account.identity')->where('status', '1')->count();
  45. }
  46. if (\App\Models\Role::hasRoot('/enable/show/last_online') < 0) {
  47. $user_data['last_online'] = "*****";
  48. } else {
  49. $user_data['last_online'] = \App\Models\Account_Token::whereBetween('last_time', $timearea)->count();
  50. }
  51. if (\App\Models\Role::hasRoot('/enable/show/user_count') < 0) {
  52. $user_data['user_count'] = "*****";
  53. } else {
  54. $user_data['user_count'] = \App\Models\Account_detailed::count();
  55. }
  56. return $user_data;
  57. }
  58. //注单总数量
  59. function countBet()
  60. {
  61. $time1 = date('Y-m-d 00:00:00'); //今日0时
  62. $time2 = date('Y-m-d 23:59:59'); //
  63. $timearea = [$time1, $time2];
  64. if (\App\Models\Role::hasRoot('/enable/show/bet_count') < 0) {
  65. $bet_count['count'] = "*****";
  66. } else {
  67. //串式投注
  68. $numstr = \App\Models\MoneyBuyStr::where('money_buy_str.status', '<>', 4)->join('account', 'money_buy_str.account_identity', '=', 'account.identity')->where('account.status', '<>', '4')->where('account.user_type', '1')->whereBetween('money_time', $timearea)->count();
  69. //单式投注
  70. $numsimplex = \App\Models\MoneyBuySimplex::where('money_buy_simplex.status', '<>', 4)->join('account', 'money_buy_simplex.account_identity', '=', 'account.identity')->where('account.status', '<>', '4')->where('account.user_type', '1')->whereBetween('money_buy_simplex.money_time', $timearea)->count();
  71. $bet_count['count'] = $numstr+$numsimplex;
  72. }
  73. if (\App\Models\Role::hasRoot('/enable/show/bet_money') < 0) {
  74. $bet_count['money_count'] = "*****";
  75. } else {
  76. //串式投注
  77. $str_bet_money = \App\Models\MoneyBuyStr::where('money_buy_str.status', '<>', 4)->join('account', 'money_buy_str.account_identity', '=', 'account.identity')->where('account.status', '<>', '4')->where('account.user_type', '1')->whereBetween('money_time', $timearea)->sum('money');
  78. //单式投注
  79. $simplex_bet_money = \App\Models\MoneyBuySimplex::where('money_buy_simplex.status', '<>', 4)->join('account', 'money_buy_simplex.account_identity', '=', 'account.identity')->where('account.status', '<>', '4')->where('account.user_type', '1')->whereBetween('money_time', $timearea)->sum('money');
  80. $bet_money = $str_bet_money+$simplex_bet_money;
  81. $bet_count['money_count'] = round($bet_money, 2);
  82. }
  83. // DB::connection()->enableQueryLog();
  84. if (\App\Models\Role::hasRoot('/enable/show/countBet') < 0) {
  85. $bet_count['user_count'] = "*****";
  86. } else {
  87. $db = new \App\Models\MoneyBuyStr;
  88. $db1 = new \App\Models\MoneyBuySimplex;
  89. //串式投注
  90. $str = $db->countUser($timearea);
  91. //单式投注
  92. $simplex = $db1->countUser($timearea);
  93. if($str && $simplex){
  94. for($i=0;$i<count($str);$i++){
  95. for($j=0;$j<count($simplex);$j++){
  96. if($str[$i]['account_identity'] == $simplex[$j]['account_identity']){
  97. unset($str[$i]);
  98. }
  99. }
  100. }
  101. }
  102. $bet_count['user_count'] = count($str)+count($simplex);
  103. }
  104. // $queries = DB::getQueryLog();
  105. // print_r($queries);
  106. return $bet_count;
  107. }
  108. //今日提现
  109. function countTodayTake()
  110. {
  111. $time1 = date('Y-m-d 00:00:00'); //今日0时
  112. $time2 = date('Y-m-d 23:59:59'); //
  113. $timearea = [$time1, $time2];
  114. if (\App\Models\Role::hasRoot('/enable/show/count') < 0) {
  115. $take_count['count'] = "*****";
  116. } else {
  117. $take_count['count'] = \App\Models\Money_take::whereBetween('apply_time', $timearea)->where('status', 1)->count();
  118. }
  119. if (\App\Models\Role::hasRoot('/enable/show/money_count') < 0) {
  120. $take_count['money_count'] = "*****";
  121. } else {
  122. $take_count['money_count'] = \App\Models\Money_take::whereBetween('apply_time', $timearea)->where('status', 1)->sum('money');
  123. }
  124. // DB::connection()->enableQueryLog();
  125. if (\App\Models\Role::hasRoot('/enable/show/user_count') < 0) {
  126. $db = new \App\Models\Money_take;
  127. $take_count['user_count'] = "*****";
  128. } else {
  129. $db = new \App\Models\Money_take;
  130. $take_count['user_count'] = $db->countUser($timearea);
  131. }
  132. // $queries = DB::getQueryLog();
  133. // dump($queries);
  134. // dump($take_count);
  135. return $take_count;
  136. }
  137. //今日充值笔数
  138. function countTodayRecharge()
  139. {
  140. $time1 = date('Y-m-d 00:00:00'); //今日0时
  141. $time2 = date('Y-m-d 23:59:59'); //
  142. $timearea = [$time1, $time2];
  143. // DB::connection()->enableQueryLog();
  144. if (\App\Models\Role::hasRoot('/enable/show/countTodayRecharge') < 0) {
  145. $rech_data['count'] = "*****";
  146. } else {
  147. $rech_data['count'] = \App\Models\Money_details::whereBetween('money_time', $timearea)->whereIn('trade_type', array(6, 11))->where('status', 1)->count();
  148. }
  149. // $queries = DB::getQueryLog();
  150. // print_r($queries);
  151. if (\App\Models\Role::hasRoot('/enable/show/countTodayRecharge_money') < 0) {
  152. $money_count = \App\Models\Money_details::whereBetween('money_time', $timearea)->whereIn('trade_type', array(6, 11))->where('status', 1)->sum('money');
  153. $rech_data['money_count'] = "*****";
  154. } else {
  155. $money_count = \App\Models\Money_details::whereBetween('money_time', $timearea)->whereIn('trade_type', array(6, 11))->where('status', 1)->sum('money');
  156. $rech_data['money_count'] = round($money_count, 2);
  157. }
  158. // DB::connection()->enableQueryLog();
  159. if (\App\Models\Role::hasRoot('/enable/show/countTodayRecharge_user') < 0) {
  160. $db = new \App\Models\Money_details;
  161. $count = $db->countUser($timearea, array(6, 11));
  162. $rech_data['user_count'] = "*****";
  163. } else {
  164. $db = new \App\Models\Money_details;
  165. $count = $db->countUser($timearea, array(6, 11));
  166. $rech_data['user_count'] = $count;
  167. }
  168. // $queries = DB::getQueryLog();
  169. // dump($queries);
  170. return $rech_data;
  171. }
  172. // 今日回水笔数
  173. function countTodayReturn()
  174. {
  175. $time1 = date('Y-m-d 00:00:00'); //今日0时
  176. $time2 = date('Y-m-d 23:59:59'); //
  177. $timearea = [$time1, $time2];
  178. if (\App\Models\Role::hasRoot('/enable/show/countTodayReturn') < 0) {
  179. $return['count'] = "*****";
  180. } else {
  181. $return['count'] = \App\Models\Money_return::whereBetween('processing_time', $timearea)->count();
  182. }
  183. if (\App\Models\Role::hasRoot('/enable/show/countTodayReturn_money') < 0) {
  184. $return['money_count'] = "*****";
  185. } else {
  186. $return['money_count'] = \App\Models\Money_return::whereBetween('processing_time', $timearea)->sum('money');
  187. }
  188. // $return['user_count'] = \App\Model\Money_return::whereBetween('processing_time', $timearea)->groupBy('account_identity')->count();
  189. if (\App\Models\Role::hasRoot('/enable/show/countTodayReturn_user') < 0) {
  190. $db = new \App\Models\Money_return;
  191. $return['user_count'] = "*****";
  192. } else {
  193. $db = new \App\Models\Money_return;
  194. $return['user_count'] = $db->countUser($timearea);
  195. }
  196. return $return;
  197. }
  198. // 今日反水笔数
  199. function countTodayBack()
  200. {
  201. $time1 = date('Y-m-d 00:00:00'); //今日0时
  202. $time2 = date('Y-m-d 23:59:59'); //
  203. $timearea = [$time1, $time2];
  204. if (\App\Models\Role::hasRoot('/enable/show/countTodayBack') < 0) {
  205. $return['count'] = "*****";
  206. } else {
  207. $return['count'] = \App\Models\Money_back::whereBetween('processing_time', $timearea)->count();
  208. }
  209. if (\App\Models\Role::hasRoot('/enable/show/countTodayBack_money') < 0) {
  210. $return['money_count'] = "*****";
  211. } else {
  212. $return['money_count'] = \App\Models\Money_back::whereBetween('processing_time', $timearea)->sum('money');
  213. }
  214. if (\App\Models\Role::hasRoot('/enable/show/countTodayBack_user') < 0) {
  215. $return['user_count'] = "*****";
  216. } else {
  217. $return['user_count'] = \App\Models\Money_back::whereBetween('processing_time', $timearea)->groupBy('account_identity')->count();
  218. }
  219. return $return;
  220. }
  221. //今日汇款
  222. function countTodayRimt()
  223. {
  224. $time1 = date('Y-m-d 00:00:00'); //今日0时
  225. $time2 = date('Y-m-d 23:59:59'); //
  226. $timearea = [$time1, $time2];
  227. if (\App\Models\Role::hasRoot('/enable/show/countTodayRimt') < 0) {
  228. $rimit['count'] = "*****";
  229. } else {
  230. $rimit['count'] = \App\Models\Money_recharge::whereBetween('apply_time', $timearea)->where('recharge_type', '汇款')->where('status', 1)->count();
  231. }
  232. if (\App\Models\Role::hasRoot('/enable/show/countTodayRimt_money') < 0) {
  233. $rimit['money_count'] = "*****";
  234. } else {
  235. $rimit['money_count'] = \App\Models\Money_recharge::whereBetween('apply_time', $timearea)->where('recharge_type', '汇款')->where('status', 1)->sum('money');
  236. }
  237. if (\App\Models\Role::hasRoot('/enable/show/countTodayRimt_user') < 0) {
  238. $db = new \App\Models\Money_recharge;
  239. $rimit['user_count'] = "*****";
  240. } else {
  241. $db = new \App\Models\Money_recharge;
  242. $rimit['user_count'] = $db->countRimitUser($timearea);
  243. }
  244. return $rimit;
  245. }
  246. //公告信息
  247. function getNotice()
  248. {
  249. $db = new \App\Models\Article();
  250. $data = $db->getMsg(2, 2);
  251. return $data;
  252. }
  253. //当前在线用户饼状图
  254. function onlineUser()
  255. {
  256. // $db = new \App\Model\Logfile;
  257. // $db=new \App\Model\Account_Token;
  258. $db = new \App\Models\Account_detailed;
  259. $data_log = $db->getOnlineUser();
  260. // $data_log = $db->getUser();
  261. $array['data'] = $data_log;
  262. if (empty($data_log)) {
  263. $array['data'][0]['name'] = '没有';
  264. $array['data'][0]['value'] = 0;
  265. }
  266. //组装标
  267. $count = 0;
  268. foreach ($array['data'] as $k => $v) {
  269. $array['title'][$k] = trim($v['name']);
  270. $array['data'][$k]['name'] = trim($v['name']);
  271. $count += $v['value'];
  272. }
  273. //总在线数量、
  274. $array['text'] = date('Y-m-d') . trans('common.today_user_num') . $count;
  275. return responseToJson($array);
  276. // dump($array);
  277. }
  278. //今日投注统计饼状图
  279. function getBetUrl()
  280. {
  281. // $db = new \App\Models\OrderUrl;
  282. // $data = $db->getUrlBet();
  283. $count = $this->countBet();
  284. //$array['data'] = $data;
  285. if ($count['count'] == 0) {
  286. $array['data'][0]['name'] = '没有';
  287. $array['data'][0]['value'] = 0;
  288. }
  289. else{
  290. $array['data'][0]['name'] = '今日注单数量';
  291. $array['data'][0]['value'] = $count['count'];
  292. }
  293. //组装标
  294. foreach ($array['data'] as $k => $v) {
  295. $array['title'][$k] = $v['name'];
  296. }
  297. //添加标题
  298. //总投注数量
  299. $count = $this->countBet();
  300. $count = $count['count'];
  301. $array['text'] = date('Y-m-d') . trans('common.today_bet_num') . $count;
  302. // dump($array);
  303. return responseToJson($array);
  304. }
  305. //时间区
  306. function getTime()
  307. {
  308. $time = array(
  309. 'addrss' => date_default_timezone_get(),
  310. 'time' => date("Y-m-d H:i:s", time() + 3600 * 8),
  311. );
  312. // print_r($time['time']);die;
  313. return responseToJson($time);
  314. }
  315. //最近7天会员注册情况
  316. function regUser()
  317. {
  318. /*
  319. $time2 = date('Y-m-d H:i:s', time() - 60 * 60 * 24 * 30);
  320. $time1 = date('Y-m-d H:i:s', time());
  321. $timearea = [$time2, $time1];
  322. $rech_data['money_with'] = DB::table('account_detailed')->join('account', 'account.identity', '=', 'money_details.account_identity')->select(DB::Raw('sum(money) as with'))->whereBetween('money_time', $timearea)->groupBy('account')->where('trade_type', 5)->get();
  323. $rimit = \App\Models\Account_list::where('account_status', 1)
  324. ->select(DB::Raw('date(register_time) as name, count(identity) as value'))
  325. ->whereBetween('register_time', $timearea)->orderBy(DB::Raw('date(register_time)'))->groupBy(DB::Raw('date(register_time)'))->get();
  326. $data = $rimit->toArray();
  327. */
  328. //统计七天内注册用户数量按天进行分组
  329. $start_time = date('Y-m-d', strtotime('-7 days'));
  330. $end_time = date('Y-m-d', time());
  331. $user = DB::select('select rtime as name ,count(rtime) as value from (SELECT to_char( "register_time",\'YYYY-MM-DD\') as rtime FROM "account_detailed" where "register_time">=CURRENT_DATE-7) as tmp group by rtime order by name asc');
  332. if (!empty($user)) {
  333. $userData = [];
  334. foreach ($user as $k => $v) {
  335. $userData[$k]['name'] = $v->name;
  336. $userData[$k]['value'] = $v->value;
  337. }
  338. }
  339. //计算日期内天数
  340. $stimestamp = strtotime($start_time);
  341. $etimestamp = strtotime($end_time);
  342. //计算日期段内有多少天
  343. $days = ($etimestamp - $stimestamp) / 86400;
  344. //保存每天日期
  345. $date = array();
  346. for ($i = 1; $i <= $days; $i++) {
  347. $date[] = date('Y-m-d', $stimestamp + (86400 * $i));
  348. }
  349. //循环补全日期
  350. foreach ($date as $key => $val) {
  351. $data[$key] = [
  352. 'name' => $val,
  353. 'value' => 0
  354. ];
  355. foreach ($userData as $item => $value) {
  356. if ($val == $value['name']) {
  357. $data[$key] = $value;
  358. }
  359. }
  360. }
  361. foreach ($data as $k => $v) {
  362. $array['title'][$k] = $v['name'];
  363. $array['data']['num'][$k] = $v['value'];
  364. }
  365. $array['legend'][] = '最近7天注册用户记录';
  366. return responseToJson($array);
  367. }
  368. //最近7天财务情况
  369. function money()
  370. {
  371. $res_array = array();
  372. for ($i = 6; $i >= 0; $i--) {
  373. $secondes = $i * 24 * 60 * 60;
  374. $res_array['title'][] = date('Y-m-d', (time() - $secondes));
  375. $res_array['data']['money_with'][] = 0;
  376. $res_array['data']['money_recharge'][] = 0;
  377. $res_array['data']['money_remittance'][] = 0;
  378. $res_array['data']['money_trans'][] = 0;
  379. $res_array['data']['profit'][] = 0;
  380. }
  381. $res_array['legend']['money_with'] = trans('user.money_with');
  382. $res_array['legend']['money_recharge'] = trans('user.money_recharge');
  383. $res_array['legend']['money_remittance'] = trans('user.money_remittance');
  384. $res_array['legend']['money_trans'] = trans('user.money_trans');
  385. $res_array['legend']['profit'] = '盈利';
  386. $db = new \App\Models\Money_details;
  387. $data = $db->getBet();
  388. if ($data < 0) {
  389. return responseToJson($res_array);
  390. }
  391. $trade_type = $this->getTradetype();
  392. foreach ($data as $k => $v) {
  393. foreach ($res_array['title'] as $tk => $tv) {
  394. if ($v['date'] == $tv) {
  395. $res_array['data'][$trade_type[$v['trade_type']]][$tk] += $v['value'];
  396. $res_array['data'][$trade_type[1]][$tk] += ($v['trade_type'] == 5) ? -$v['value'] : +$v['value'];
  397. break;
  398. }
  399. }
  400. }
  401. return responseToJson($res_array);
  402. /*print_r($data);exit;
  403. $i = 0;
  404. $array['title']=array();
  405. foreach ($data as $k => $v) {
  406. if (is_array($v) && count($v) > 0) {
  407. foreach ($v as $ka => $va) {
  408. $array['title'][$i] = $va['date'];
  409. $temp[$k][$va['date']] = $va['value'];
  410. $i++;
  411. }
  412. } else {
  413. $temp[$k] = array();
  414. }
  415. $array['legend'][$k] = trans('user.' . $k);
  416. }
  417. $array['title']=array_unique($array['title']);
  418. asort($array['title']);
  419. $tem=array();
  420. foreach($array['title'] as $v){
  421. $tem[]=$v;
  422. }
  423. $array['title']=$tem;
  424. $te = array();
  425. foreach ($array['title'] as $k => $v) {
  426. if (array_key_exists($v, $temp['money_with'])) {
  427. $te['money_with'][] = $temp['money_with'][$v];
  428. $money_with=$temp['money_with'][$v];
  429. } else {
  430. $te['money_with'][] = 0;
  431. $money_with=0;
  432. }
  433. if (array_key_exists($v, $temp['money_recharge'])) {
  434. $te['money_recharge'][] = $temp['money_recharge'][$v];
  435. $money_recharge=$temp['money_recharge'][$v];
  436. } else {
  437. $te['money_recharge'][] = 0;
  438. $money_recharge=0;
  439. }
  440. if (array_key_exists($v, $temp['money_remittance'])) {
  441. $te['money_remittance'][] = $temp['money_remittance'][$v];
  442. $money_remittance=$temp['money_remittance'][$v];
  443. } else {
  444. $te['money_remittance'][] = 0;
  445. $money_remittance=0;
  446. }
  447. if (array_key_exists($v, $temp['money_trans'])) {
  448. $te['money_trans'][] = $temp['money_trans'][$v];
  449. $money_trans=$temp['money_trans'][$v];
  450. } else {
  451. $te['money_trans'][] = 0;
  452. $money_trans=0;
  453. }
  454. $te['profit'][]=$money_trans+$money_remittance+$money_recharge-$money_with;
  455. }
  456. $array['legend']['profit']='盈利';
  457. $array['data'] = $te;
  458. return responseToJson($array);*/
  459. }
  460. private function getTradetype()
  461. {
  462. $tradetype = array(
  463. '5' => 'money_with',
  464. '6' => 'money_recharge',
  465. '11' => 'money_trans',
  466. '14' => 'money_remittance',
  467. '1' => 'profit',
  468. );
  469. return $tradetype;
  470. }
  471. //每天每个游戏注单数
  472. function TodayGameNote()
  473. {
  474. $time1 = date('Y-m-d 00:00:00');//今日零时
  475. $time2 = date('Y-m-d 23:59:59');//今日末时
  476. // $time1='2017-09-14 00:00:00';
  477. // $time2='2017-09-14 23:59:59';
  478. $timearea = [$time1, $time2];
  479. $data = \App\Models\MoneyBuy::select('game_name as name', DB::Raw('count(id) as value'))->whereBetween('money_time', $timearea)->groupBy('game_name')->get();
  480. $data = $data->toArray();
  481. if (count($data) == 0) {
  482. $data = array(array('name' => 'no_bet', 'value' => 0));
  483. }
  484. $array = array();
  485. foreach ($data as $k => $v) {
  486. $data[$k]['name'] = trans('common.' . $v['name']);
  487. $array['title'][$k] = trans('common.' . $v['name']);
  488. }
  489. $array['data'] = $data;
  490. $array['text'] = '今日游戏注单数量:' . date('Y-m-d');
  491. return responseToJson($array);
  492. }
  493. //拉时间
  494. function pullTime()
  495. {
  496. //获取前台域名
  497. $setInfo = new \App\Models\Setinfo();
  498. $info = $setInfo->getInfo(18);
  499. if ($info < 0) {
  500. return responseToJson($info);
  501. }
  502. //$a=file_get_contents($info['infocontent'].'api-common/getTime');
  503. $url = $info['infocontent'] . 'api-common/getTime';
  504. $timeout = 30;
  505. $ch = curl_init();
  506. curl_setopt($ch, CURLOPT_URL, $url);
  507. curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
  508. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout - 2);
  509. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  510. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  511. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); //避免data数据过长问题
  512. curl_setopt($ch, CURLOPT_POST, true);
  513. curl_setopt($ch, CURLOPT_POSTFIELDS, array());
  514. $a = curl_exec($ch);
  515. curl_close($ch);
  516. echo $a;
  517. }
  518. //通知消息
  519. function Message()
  520. {
  521. $admin_id = session('adminInfo.admin_id');
  522. $db = new \App\Models\MessageRead;
  523. $dbs = new \App\Models\Manager;
  524. $where = [
  525. 'type',
  526. '4'
  527. ];
  528. $datas = $dbs->getlistd($where);
  529. $data = $db->getlist($admin_id);
  530. if (!empty($data)) {
  531. foreach ($datas as $k => $v) {
  532. foreach ($data as $val) {
  533. if ($v['id'] == $val['message_id']) {
  534. $datas[$k]['status'] = '1';
  535. }
  536. }
  537. }
  538. }
  539. return $datas;
  540. }
  541. //刷新缓存
  542. public function refresh()
  543. {
  544. return view('admin.refresh');
  545. }
  546. }