IndexController.php 23 KB

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