IndexController.php 23 KB

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