IndexController.php 22 KB

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