useronline.blade.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  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. <a href="{{ url('/admin/stock-mode#snapshot-tab') }}" class="btn-sm btn btn-gradient-info" style="margin-left: 10px;">库存快照历史</a>
  51. <div id="main" style="width: 100%;height:600px;"></div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. <script src="/assets/js/echarts.min.js"></script>
  59. <script type="text/javascript">
  60. let lastUpdate=0
  61. function update(type){
  62. lastUpdate=type;
  63. var start_date= document.getElementById('start_date').value;
  64. var game_id= document.getElementById('game_id').value;
  65. myRequest("/admin/game/user/onlines","get",{start_date:start_date,game_id:game_id,type:type},function(data){
  66. var myChart = echarts.init(document.getElementById('main'));
  67. if(type == 0){
  68. myChart.setOption({
  69. tooltip: {
  70. trigger: 'axis',
  71. axisPointer: {
  72. type:'cross'
  73. },
  74. textStyle: {
  75. fontSize: 16
  76. }
  77. },
  78. legend: {
  79. data:['{{ __('auto.今日在线') }}','{{ __('auto.昨日在线') }}'],
  80. // orient: 'vertical' ,
  81. align: 'auto' ,
  82. top:'2%',
  83. // right:'0%',
  84. // bottom:'50%',
  85. textStyle:{
  86. fontSize: 16 ,
  87. }
  88. },
  89. xAxis: {
  90. data: data.created_at,
  91. },
  92. yAxis: [
  93. { type: 'value',show: true},
  94. { type: 'value',show: true}
  95. ],
  96. series: [
  97. {
  98. // 根据名字对应到相应的系列
  99. name: '{{ __('auto.今日在线') }}',
  100. type: 'line',
  101. data: data.online
  102. },{
  103. // 根据名字对应到相应的系列
  104. name: '{{ __('auto.昨日在线') }}',
  105. type: 'line',
  106. data: data.yonline
  107. }
  108. ]
  109. },true);
  110. }
  111. if(type == 1){
  112. // myChart.setOption({
  113. // xAxis: {
  114. // data: data.created_at
  115. // },
  116. // series: [
  117. // {
  118. // // 根据名字对应到相应的系列
  119. // name: '今日注册',
  120. // data: data.reg
  121. // },{
  122. // // 根据名字对应到相应的系列
  123. // name: '昨日注册',
  124. // data: data.yreg
  125. // }
  126. // ]
  127. // },true);
  128. myChart.setOption({
  129. tooltip: {
  130. trigger: 'axis',
  131. axisPointer: {
  132. type:'cross'
  133. },
  134. textStyle: {
  135. fontSize: 16
  136. }
  137. },
  138. legend: {
  139. data:['{{ __('auto.今日注册') }}','{{ __('auto.昨日注册') }}'],
  140. // orient: 'vertical' ,
  141. align: 'auto' ,
  142. top:'2%',
  143. // right:'0%',
  144. // bottom:'50%',
  145. textStyle:{
  146. fontSize: 16 ,
  147. }
  148. },
  149. xAxis: {
  150. data: data.created_at,
  151. },
  152. yAxis: [
  153. { type: 'value',show: true},
  154. { type: 'value',show: true}
  155. ],
  156. series: [
  157. {
  158. // 根据名字对应到相应的系列
  159. name: '{{ __('auto.今日注册') }}',
  160. type: 'line',
  161. data: data.reg
  162. },{
  163. // 根据名字对应到相应的系列
  164. name: '{{ __('auto.昨日注册') }}',
  165. type: 'line',
  166. data: data.yreg
  167. }
  168. ]
  169. },true);
  170. }
  171. if(type == 2){
  172. myChart.setOption({
  173. tooltip: {
  174. trigger: 'axis',
  175. axisPointer: {
  176. type:'cross'
  177. },
  178. textStyle: {
  179. fontSize: 16
  180. }
  181. },
  182. legend: {
  183. data:['{{ __('auto.今日活跃') }}','{{ __('auto.昨日活跃') }}'],
  184. // orient: 'vertical' ,
  185. align: 'auto' ,
  186. top:'2%',
  187. // right:'0%',
  188. // bottom:'50%',
  189. textStyle:{
  190. fontSize: 16 ,
  191. }
  192. },
  193. yAxis: [
  194. { type: 'value',show: true},
  195. { type: 'value',show: true}
  196. ],
  197. xAxis: {
  198. data: data.created_at
  199. },
  200. series: [
  201. {
  202. // 根据名字对应到相应的系列
  203. name: '{{ __('auto.今日活跃') }}',
  204. type: 'line',
  205. data: data.active
  206. },{
  207. // 根据名字对应到相应的系列
  208. name: '{{ __('auto.昨日活跃') }}',
  209. type: 'line',
  210. data: data.yactive
  211. }
  212. ]
  213. },true);
  214. }
  215. if(type == 3){
  216. myChart.setOption({
  217. tooltip: {
  218. trigger: 'axis',
  219. axisPointer: {
  220. type:'cross'
  221. },
  222. textStyle: {
  223. fontSize: 16
  224. }
  225. },
  226. legend: {
  227. data:['{{ __('auto.今日充值') }}','{{ __('auto.昨日充值') }}'],
  228. // orient: 'vertical' ,
  229. align: 'auto' ,
  230. top:'2%',
  231. // right:'0%',
  232. // bottom:'50%',
  233. textStyle:{
  234. fontSize: 16 ,
  235. }
  236. },
  237. yAxis: [
  238. { type: 'value',show: true},
  239. { type: 'value',show: true}
  240. ],
  241. xAxis: {
  242. data: data.created_at
  243. },
  244. series: [
  245. {
  246. // 根据名字对应到相应的系列
  247. name: '{{ __('auto.今日充值') }}',
  248. type: 'line',
  249. data: data.recharge
  250. },{
  251. // 根据名字对应到相应的系列
  252. name: '{{ __('auto.昨日充值') }}',
  253. type: 'line',
  254. data: data.yrecharge
  255. }
  256. ]
  257. },true);
  258. }
  259. if(type == 4){
  260. myChart.setOption({
  261. tooltip: {
  262. trigger: 'axis',
  263. axisPointer: {
  264. type:'cross'
  265. },
  266. textStyle: {
  267. fontSize: 16
  268. }
  269. },
  270. legend: {
  271. data:['{{ __('auto.今日提现') }}','{{ __('auto.昨日提现') }}'],
  272. // orient: 'vertical' ,
  273. align: 'auto' ,
  274. top:'2%',
  275. // right:'0%',
  276. // bottom:'50%',
  277. textStyle:{
  278. fontSize: 16 ,
  279. }
  280. },
  281. yAxis: [
  282. { type: 'value',show: true},
  283. { type: 'value',show: true}
  284. ],
  285. xAxis: {
  286. data: data.created_at
  287. },
  288. series: [
  289. {
  290. // 根据名字对应到相应的系列
  291. name: '{{ __('auto.今日提现') }}',
  292. type: 'line',
  293. data: data.withdraw
  294. },{
  295. // 根据名字对应到相应的系列
  296. name: '{{ __('auto.昨日提现') }}',
  297. type: 'line',
  298. data: data.ywithdraw
  299. }
  300. ]
  301. },true);
  302. }
  303. if(type == 5){
  304. myChart.setOption({
  305. tooltip: {
  306. trigger: 'axis',
  307. axisPointer: {
  308. type:'cross'
  309. },
  310. textStyle: {
  311. fontSize: 16
  312. }
  313. },
  314. legend: {
  315. data:['{{ __('auto.今日充减提') }}','{{ __('auto.昨日充减提') }}'],
  316. // orient: 'vertical' ,
  317. align: 'auto' ,
  318. top:'2%',
  319. // right:'0%',
  320. // bottom:'50%',
  321. textStyle:{
  322. fontSize: 16 ,
  323. }
  324. },
  325. yAxis: [
  326. { type: 'value',show: true},
  327. { type: 'value',show: true}
  328. ],
  329. xAxis: {
  330. data: data.created_at
  331. },
  332. series: [
  333. {
  334. // 根据名字对应到相应的系列
  335. name: '{{ __('auto.今日充减提') }}',
  336. type: 'line',
  337. data: data.profit
  338. },{
  339. // 根据名字对应到相应的系列
  340. name: '{{ __('auto.昨日充减提') }}',
  341. type: 'line',
  342. data: data.yprofit
  343. }
  344. ]
  345. },true);
  346. }
  347. });
  348. }
  349. var myChart = echarts.init(document.getElementById('main'));
  350. setTimeout(function (){
  351. $.get('/admin/game/user/onlines').done(function (data) {
  352. // 填入数据
  353. myChart.setOption({
  354. tooltip: {
  355. trigger: 'axis',
  356. axisPointer: {
  357. type:'cross'
  358. },
  359. textStyle: {
  360. fontSize: 16
  361. }
  362. },
  363. legend: {
  364. data:['{{ __('auto.今日在线') }}','{{ __('auto.昨日在线') }}'],
  365. // orient: 'vertical' ,
  366. align: 'auto' ,
  367. top:'2%',
  368. // right:'0%',
  369. // bottom:'50%',
  370. textStyle:{
  371. fontSize: 16 ,
  372. }
  373. },
  374. yAxis: [
  375. { type: 'value',show: true},
  376. { type: 'value',show: true}
  377. ],
  378. xAxis: {
  379. data: data.created_at
  380. },
  381. series: [
  382. {
  383. // 根据名字对应到相应的系列
  384. name: '{{ __('auto.今日在线') }}',
  385. type: 'line',
  386. data: data.online
  387. },{
  388. // 根据名字对应到相应的系列
  389. name: '{{ __('auto.昨日在线') }}',
  390. type: 'line',
  391. data: data.yonline
  392. }
  393. ]
  394. },true);
  395. });
  396. },1000)
  397. setInterval(()=>{
  398. update(lastUpdate);
  399. },300000)
  400. </script>
  401. @endsection