useronline.blade.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. @extends('base.base')
  2. @section('base')
  3. <!-- 内容区域 -->
  4. <div class="main-panel">
  5. <div class="content-wrapper">
  6. <div class="page-header">
  7. <h3 class="page-title">
  8. <span class="page-title-icon bg-gradient-primary text-white mr-2">
  9. <i class="mdi mdi-settings"></i>
  10. </span>
  11. {{ __('auto.实时数据') }}
  12. </h3>
  13. <nav aria-label="breadcrumb">
  14. <ol class="breadcrumb">
  15. <li class="breadcrumb-item"><a href="#">{{ __('auto.游戏数据') }}</a></li>
  16. <li class="breadcrumb-item active" aria-current="page">{{ __('auto.实时数据') }}</li>
  17. </ol>
  18. </nav>
  19. </div>
  20. <div class="row">
  21. <div class="col-lg-12 grid-margin stretch-card">
  22. <div class="card">
  23. <div class="card-body">
  24. <h4 class="card-title">{{ __('auto.实时数据') }}</h4>
  25. <form class="well form-inline margin-top-20" method="get" action='/admin/game/user/online'>
  26. <span style="padding-left: 5px" >{{ __('auto.游戏:') }}</span >
  27. <select class="form-control" name="game_id" id="game_id" value="" style="color: black">
  28. <option value="">{{ __('auto.请选择游戏') }}</option>
  29. @foreach($game_name as $k=>$v)
  30. <option value="{{$k}}">{{$v}}</option>
  31. @endforeach
  32. </select>
  33. <spen style="padding-left: 10px" >{{ __('auto.选择时间:') }}</spen>
  34. <input type="date" step="01" id="start_date" name="start_date" class="form-control" value="{{$start_date}}" />&nbsp;&nbsp;
  35. <button type="button" class="btn btn-sm btn-gradient-dark btn-icon-text" onclick="update(0)">
  36. {{ __('auto.搜索') }}
  37. </button>
  38. <!-- <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="搜索"/>&nbsp;&nbsp; -->
  39. <a href="/admin/game/user/online" class="btn btn-sm btn-gradient-warning btn-icon-text">{{ __('auto.清空') }}</a>&nbsp;&nbsp;
  40. </form>
  41. <br>
  42. <button onclick="update(0)" class="btn-sm btn btn-gradient-dark">{{ __('auto.在线') }}</button>
  43. <button onclick="update(1)" class="btn-sm btn btn-gradient-dark">{{ __('auto.注册') }}</button>
  44. <button onclick="update(2)" class="btn-sm btn btn-gradient-dark">{{ __('auto.活跃') }}</button>
  45. @if (hidden() != 'service')
  46. <button onclick="update(3)" class="btn-sm btn btn-gradient-dark">{{ __('auto.充值') }}</button>
  47. <button onclick="update(4)" class="btn-sm btn btn-gradient-dark">{{ __('auto.提现') }}</button>
  48. <button onclick="update(5)" class="btn-sm btn btn-gradient-dark">{{ __('auto.充减提') }}</button>
  49. @endif
  50. <div id="main" style="width: 100%;height:600px;"></div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. <script src="/assets/js/echarts.min.js"></script>
  58. <script type="text/javascript">
  59. let lastUpdate=0
  60. function update(type){
  61. lastUpdate=type;
  62. var start_date= document.getElementById('start_date').value;
  63. var game_id= document.getElementById('game_id').value;
  64. myRequest("/admin/game/user/onlines","get",{start_date:start_date,game_id:game_id,type:type},function(data){
  65. var myChart = echarts.init(document.getElementById('main'));
  66. if(type == 0){
  67. myChart.setOption({
  68. tooltip: {
  69. trigger: 'axis',
  70. axisPointer: {
  71. type:'cross'
  72. },
  73. textStyle: {
  74. fontSize: 16
  75. }
  76. },
  77. legend: {
  78. data:['{{ __('auto.今日在线') }}','{{ __('auto.昨日在线') }}'],
  79. // orient: 'vertical' ,
  80. align: 'auto' ,
  81. top:'2%',
  82. // right:'0%',
  83. // bottom:'50%',
  84. textStyle:{
  85. fontSize: 16 ,
  86. }
  87. },
  88. xAxis: {
  89. data: data.created_at,
  90. },
  91. yAxis: [
  92. { type: 'value',show: true},
  93. { type: 'value',show: true}
  94. ],
  95. series: [
  96. {
  97. // 根据名字对应到相应的系列
  98. name: '{{ __('auto.今日在线') }}',
  99. type: 'line',
  100. data: data.online
  101. },{
  102. // 根据名字对应到相应的系列
  103. name: '{{ __('auto.昨日在线') }}',
  104. type: 'line',
  105. data: data.yonline
  106. }
  107. ]
  108. },true);
  109. }
  110. if(type == 1){
  111. // myChart.setOption({
  112. // xAxis: {
  113. // data: data.created_at
  114. // },
  115. // series: [
  116. // {
  117. // // 根据名字对应到相应的系列
  118. // name: '今日注册',
  119. // data: data.reg
  120. // },{
  121. // // 根据名字对应到相应的系列
  122. // name: '昨日注册',
  123. // data: data.yreg
  124. // }
  125. // ]
  126. // },true);
  127. myChart.setOption({
  128. tooltip: {
  129. trigger: 'axis',
  130. axisPointer: {
  131. type:'cross'
  132. },
  133. textStyle: {
  134. fontSize: 16
  135. }
  136. },
  137. legend: {
  138. data:['{{ __('auto.今日注册') }}','{{ __('auto.昨日注册') }}'],
  139. // orient: 'vertical' ,
  140. align: 'auto' ,
  141. top:'2%',
  142. // right:'0%',
  143. // bottom:'50%',
  144. textStyle:{
  145. fontSize: 16 ,
  146. }
  147. },
  148. xAxis: {
  149. data: data.created_at,
  150. },
  151. yAxis: [
  152. { type: 'value',show: true},
  153. { type: 'value',show: true}
  154. ],
  155. series: [
  156. {
  157. // 根据名字对应到相应的系列
  158. name: '{{ __('auto.今日注册') }}',
  159. type: 'line',
  160. data: data.reg
  161. },{
  162. // 根据名字对应到相应的系列
  163. name: '{{ __('auto.昨日注册') }}',
  164. type: 'line',
  165. data: data.yreg
  166. }
  167. ]
  168. },true);
  169. }
  170. if(type == 2){
  171. myChart.setOption({
  172. tooltip: {
  173. trigger: 'axis',
  174. axisPointer: {
  175. type:'cross'
  176. },
  177. textStyle: {
  178. fontSize: 16
  179. }
  180. },
  181. legend: {
  182. data:['{{ __('auto.今日活跃') }}','{{ __('auto.昨日活跃') }}'],
  183. // orient: 'vertical' ,
  184. align: 'auto' ,
  185. top:'2%',
  186. // right:'0%',
  187. // bottom:'50%',
  188. textStyle:{
  189. fontSize: 16 ,
  190. }
  191. },
  192. yAxis: [
  193. { type: 'value',show: true},
  194. { type: 'value',show: true}
  195. ],
  196. xAxis: {
  197. data: data.created_at
  198. },
  199. series: [
  200. {
  201. // 根据名字对应到相应的系列
  202. name: '{{ __('auto.今日活跃') }}',
  203. type: 'line',
  204. data: data.active
  205. },{
  206. // 根据名字对应到相应的系列
  207. name: '{{ __('auto.昨日活跃') }}',
  208. type: 'line',
  209. data: data.yactive
  210. }
  211. ]
  212. },true);
  213. }
  214. if(type == 3){
  215. myChart.setOption({
  216. tooltip: {
  217. trigger: 'axis',
  218. axisPointer: {
  219. type:'cross'
  220. },
  221. textStyle: {
  222. fontSize: 16
  223. }
  224. },
  225. legend: {
  226. data:['{{ __('auto.今日充值') }}','{{ __('auto.昨日充值') }}'],
  227. // orient: 'vertical' ,
  228. align: 'auto' ,
  229. top:'2%',
  230. // right:'0%',
  231. // bottom:'50%',
  232. textStyle:{
  233. fontSize: 16 ,
  234. }
  235. },
  236. yAxis: [
  237. { type: 'value',show: true},
  238. { type: 'value',show: true}
  239. ],
  240. xAxis: {
  241. data: data.created_at
  242. },
  243. series: [
  244. {
  245. // 根据名字对应到相应的系列
  246. name: '{{ __('auto.今日充值') }}',
  247. type: 'line',
  248. data: data.recharge
  249. },{
  250. // 根据名字对应到相应的系列
  251. name: '{{ __('auto.昨日充值') }}',
  252. type: 'line',
  253. data: data.yrecharge
  254. }
  255. ]
  256. },true);
  257. }
  258. if(type == 4){
  259. myChart.setOption({
  260. tooltip: {
  261. trigger: 'axis',
  262. axisPointer: {
  263. type:'cross'
  264. },
  265. textStyle: {
  266. fontSize: 16
  267. }
  268. },
  269. legend: {
  270. data:['{{ __('auto.今日提现') }}','{{ __('auto.昨日提现') }}'],
  271. // orient: 'vertical' ,
  272. align: 'auto' ,
  273. top:'2%',
  274. // right:'0%',
  275. // bottom:'50%',
  276. textStyle:{
  277. fontSize: 16 ,
  278. }
  279. },
  280. yAxis: [
  281. { type: 'value',show: true},
  282. { type: 'value',show: true}
  283. ],
  284. xAxis: {
  285. data: data.created_at
  286. },
  287. series: [
  288. {
  289. // 根据名字对应到相应的系列
  290. name: '{{ __('auto.今日提现') }}',
  291. type: 'line',
  292. data: data.withdraw
  293. },{
  294. // 根据名字对应到相应的系列
  295. name: '{{ __('auto.昨日提现') }}',
  296. type: 'line',
  297. data: data.ywithdraw
  298. }
  299. ]
  300. },true);
  301. }
  302. if(type == 5){
  303. myChart.setOption({
  304. tooltip: {
  305. trigger: 'axis',
  306. axisPointer: {
  307. type:'cross'
  308. },
  309. textStyle: {
  310. fontSize: 16
  311. }
  312. },
  313. legend: {
  314. data:['{{ __('auto.今日充减提') }}','{{ __('auto.昨日充减提') }}'],
  315. // orient: 'vertical' ,
  316. align: 'auto' ,
  317. top:'2%',
  318. // right:'0%',
  319. // bottom:'50%',
  320. textStyle:{
  321. fontSize: 16 ,
  322. }
  323. },
  324. yAxis: [
  325. { type: 'value',show: true},
  326. { type: 'value',show: true}
  327. ],
  328. xAxis: {
  329. data: data.created_at
  330. },
  331. series: [
  332. {
  333. // 根据名字对应到相应的系列
  334. name: '{{ __('auto.今日充减提') }}',
  335. type: 'line',
  336. data: data.profit
  337. },{
  338. // 根据名字对应到相应的系列
  339. name: '{{ __('auto.昨日充减提') }}',
  340. type: 'line',
  341. data: data.yprofit
  342. }
  343. ]
  344. },true);
  345. }
  346. });
  347. }
  348. var myChart = echarts.init(document.getElementById('main'));
  349. setTimeout(function (){
  350. $.get('/admin/game/user/onlines').done(function (data) {
  351. // 填入数据
  352. myChart.setOption({
  353. tooltip: {
  354. trigger: 'axis',
  355. axisPointer: {
  356. type:'cross'
  357. },
  358. textStyle: {
  359. fontSize: 16
  360. }
  361. },
  362. legend: {
  363. data:['{{ __('auto.今日在线') }}','{{ __('auto.昨日在线') }}'],
  364. // orient: 'vertical' ,
  365. align: 'auto' ,
  366. top:'2%',
  367. // right:'0%',
  368. // bottom:'50%',
  369. textStyle:{
  370. fontSize: 16 ,
  371. }
  372. },
  373. yAxis: [
  374. { type: 'value',show: true},
  375. { type: 'value',show: true}
  376. ],
  377. xAxis: {
  378. data: data.created_at
  379. },
  380. series: [
  381. {
  382. // 根据名字对应到相应的系列
  383. name: '{{ __('auto.今日在线') }}',
  384. type: 'line',
  385. data: data.online
  386. },{
  387. // 根据名字对应到相应的系列
  388. name: '{{ __('auto.昨日在线') }}',
  389. type: 'line',
  390. data: data.yonline
  391. }
  392. ]
  393. },true);
  394. });
  395. },1000)
  396. setInterval(()=>{
  397. update(lastUpdate);
  398. },300000)
  399. </script>
  400. @endsection