analysis.provider_speed.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <style>
  2. #checkChannel {
  3. border-spacing: 0;
  4. border-collapse: collapse;
  5. }
  6. #checkChannel td {
  7. min-width: 110px;
  8. height: 20px;
  9. padding: 2px;
  10. background: #F3FBFE;
  11. border: 1px solid #fff;
  12. display: block;
  13. white-space: nowrap;
  14. font-size: 10px;
  15. }
  16. #checkChannel tr {
  17. height: 20px;
  18. }
  19. #checkChannel thead tr {
  20. table-layout: fixed;
  21. top: 0;
  22. left: 0;
  23. }
  24. #checkChannel tbody {
  25. height: calc(100vh - 150px);
  26. display: block;
  27. overflow-y: scroll;
  28. }
  29. .echartsContent {
  30. display: flex;
  31. height: calc(100vh - 150px);
  32. }
  33. #echart {
  34. flex: 1;
  35. margin-left: 5px;
  36. }
  37. #echart img {
  38. width: 100%;
  39. }
  40. </style>
  41. <div class="page">
  42. <div class="fixed-bar">
  43. <div class="item-title">
  44. <h3>成功率监控列表</h3>
  45. <ul class="tab-base">
  46. <li><a href="?index.php&act=refill_analysis&op=index&type=provider"><span>通道按时段成功率监控</span></a></li>
  47. <li><a href="JavaScript:void(0);" class="current"><span>通道单量与成功率监控</span></a></li>
  48. <li><a href="?index.php&act=refill_analysis&op=new_version&type=provider_succs"><span>通道按时段成功单量监控</span></a></li>
  49. <li><a href="?index.php&act=refill_analysis&op=new_version&type=provider"><span>通道累计成功率监控</span></a></li>
  50. <li><a href="?index.php&act=refill_analysis&op=index&type=network"><span>通道网络监控</span></a></li>
  51. <li><a href="?index.php&act=refill_analysis&op=index&type=system"><span>机构成功率监控</span></a></li>
  52. <li><a href="?index.php&act=refill_analysis&op=new_version&type=system"><span>机构累计成功率监控</span></a></li>
  53. <li><a href="?index.php&act=refill_analysis&op=merchant_ratios"><span>机构成功率统计</span></a></li>
  54. <li><a href="?index.php&act=refill_analysis&op=new_version&type=mch_order_send"><span>机构单量监控</span></a></li>
  55. </ul>
  56. </div>
  57. </div>
  58. <div class="fixed-empty"></div>
  59. <!-- <div style="margin-top: 10px;color: #e60d0d;">
  60. 请先选择时间
  61. </div> -->
  62. <form method="get" action="index.php" name="formSearch" id="formSearch" style="min-width: 1200px;">
  63. <table class="tb-type1 noborder search tableFixed">
  64. <tr>
  65. <th><label for="query_start_time">统计时间</label></th>
  66. <td>
  67. <input class="txt date" type="text" value="<?php echo $_GET['query_start_time']; ?>" id="startTime" name="query_start_time" autocomplete="off" style="width:120px" />
  68. <label for="query_start_time">~</label>
  69. <input class="txt date" type="text" value="<?php echo $_GET['query_end_time']; ?>" id="endTime" name="query_end_time" autocomplete="off" style="width:120px" />
  70. </td>
  71. <th><label>通道质量</label></th>
  72. <td>
  73. <select name="quality" class="querySelect">
  74. <option value=""><?php echo $lang['nc_please_choose']; ?></option>
  75. <option value="">全部</option>
  76. <option value="<?php echo refill\Quality::Normal; ?>">普充(无流水)
  77. </option>
  78. <option value="<?php echo refill\Quality::Quick; ?>">快充
  79. </option>
  80. <option value="<?php echo refill\Quality::CardKey; ?>">卡密
  81. </option>
  82. <option value="<?php echo refill\Quality::ThirdShop; ?>">三方
  83. </option>
  84. <option value="<?php echo refill\Quality::SlowTwentyFour; ?>">慢24(有流水)
  85. </option>
  86. <option value="<?php echo refill\Quality::SlowSix; ?>">慢6
  87. </option>
  88. <option value="<?php echo refill\Quality::SlowTwo; ?>">慢2
  89. </option>
  90. <option value="<?php echo refill\Quality::SlowFortyEight; ?>">慢48
  91. </option>
  92. <option value="<?php echo refill\Quality::SlowSeventyTwo; ?>">慢72
  93. </option>
  94. <option value="<?php echo refill\Quality::Fastest; ?>">速充
  95. </option>
  96. </select>
  97. </td>
  98. <th><label>卡类型</label></th>
  99. <td>
  100. <div id="select_cardtypes"></div>
  101. </td>
  102. <th><label>面额</label></th>
  103. <td>
  104. <select name="amount">
  105. <option value=""><?php echo $lang['nc_please_choose']; ?></option>
  106. <option value="10" <?php if ($_GET['refill_amount'] == '10') { ?>selected<?php } ?>>10</option>
  107. <option value="20" <?php if ($_GET['refill_amount'] == '20') { ?>selected<?php } ?>>20</option>
  108. <option value="30" <?php if ($_GET['refill_amount'] == '30') { ?>selected<?php } ?>>30</option>
  109. <option value="50" <?php if ($_GET['refill_amount'] == '50') { ?>selected<?php } ?>>50</option>
  110. <option value="100" <?php if ($_GET['refill_amount'] == '100') { ?>selected<?php } ?>>100</option>
  111. <option value="200" <?php if ($_GET['refill_amount'] == '200') { ?>selected<?php } ?>>200</option>
  112. <option value="300" <?php if ($_GET['refill_amount'] == '300') { ?>selected<?php } ?>>300</option>
  113. <option value="500" <?php if ($_GET['refill_amount'] == '500') { ?>selected<?php } ?>>500</option>
  114. <option value="1000" <?php if ($_GET['refill_amount'] == '1000') { ?>selected<?php } ?>>1000</option>
  115. <option value="2000" <?php if ($_GET['refill_amount'] == '2000') { ?>selected<?php } ?>>2000</option>
  116. </select>
  117. </td>
  118. <th><label>窗口时长</label></th>
  119. <td>
  120. <select name="filter_wave">
  121. <option value=""><?php echo $lang['nc_please_choose']; ?></option>
  122. <option value="900">15分钟</option>
  123. <option value="1800">半小时</option>
  124. <option value="3600">1小时</option>
  125. <option value="7200">2小时</option>
  126. <option value="0" selected>关闭</option>
  127. </select>
  128. </td>
  129. <td>
  130. <a href="javascript:void(0);" id="ncsubmit" class="btn-search" title="<?php echo $lang['nc_query']; ?>">&nbsp;
  131. </a>
  132. </td>
  133. </tr>
  134. </table>
  135. <div class="echartsContent">
  136. <table id="checkChannel">
  137. <thead>
  138. <tr>
  139. <td>
  140. <label>
  141. <input type="checkbox" id="checkAllChannel">
  142. 编号(通道列表)
  143. </label>
  144. </td>
  145. </tr>
  146. </thead>
  147. <tbody id="checkChannelContent">
  148. </tbody>
  149. </table>
  150. <div id="echart">
  151. </div>
  152. </div>
  153. </form>
  154. <div id="box">
  155. <!-- <iframe
  156. src="https://www.xyzshops.cn/plot/index?time_stamp=1621488600&interval=60" scrolling="no" id="Iframe" frameborder="0"></iframe> -->
  157. </div>
  158. </div>
  159. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/laydate/laydate.js"></script>
  160. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/jquery.ui.js"></script>
  161. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/i18n/zh-CN.js" charset="utf-8"></script>
  162. <script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL; ?>/js/xm-select.js"></script>
  163. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/refill/layer.js"></script>
  164. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/refill/moment-with-locales.js"></script>
  165. <link rel="stylesheet" type="text/css" href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css" />
  166. <script type="text/javascript">
  167. $(function() {
  168. var provider = <?php echo json_encode($output['providers']) ?>
  169. let ratios = [];
  170. let qualitys = [];
  171. const defaultChannelType = <?php echo refill\Quality::Normal; ?>;
  172. $.get(`index.php?act=refill_analysis&op=provider_data`, function(data) {
  173. data = JSON.parse(data)
  174. if (data.length > 0) {
  175. qualitys = data;
  176. formatChannelTable(data);
  177. }
  178. })
  179. function formatChannelTable(tableData) {
  180. $('#checkChannelContent').children().remove();
  181. let data;
  182. if (typeof tableData == 'object') {
  183. data = tableData;
  184. } else {
  185. data = JSON.parse(tableData)
  186. }
  187. let tableHTML = '';
  188. data.map(item => {
  189. tableHTML += `
  190. <tr>
  191. <td><label><input type="checkbox" name="channelValue" ${item.checked?'checked="checked"':''} value="${item.value}" />${item.name}${item.ratio?`<span style="color:red;">(${item.ratio})</span>`:''}</label></td>
  192. </tr>
  193. `;
  194. })
  195. $('#checkChannelContent').append(tableHTML);
  196. }
  197. laydate.render({
  198. elem: '#startTime',
  199. type: 'datetime'
  200. });
  201. laydate.render({
  202. elem: '#endTime',
  203. type: 'datetime'
  204. });
  205. let select_cardtypes
  206. $.get('index.php?act=refill_analysis&op=card_type_data', function(data) {
  207. data = JSON.parse(data)
  208. select_cardtypes = xmSelect.render({
  209. el: '#select_cardtypes',
  210. size: 'mini',
  211. filterable: true,
  212. style: {
  213. minHeight: '27px',
  214. lineHeight: '27px',
  215. marginLeft: '4px',
  216. width: '250px'
  217. },
  218. language: 'zn',
  219. data: data
  220. })
  221. })
  222. function select_set(selectArr) {
  223. let selectStr = ''
  224. for (let i = 0; i < selectArr.length; i++) {
  225. selectStr += selectArr[i].value + ','
  226. }
  227. selectStr = selectStr.substr(0, selectStr.length - 1)
  228. return selectStr
  229. }
  230. function updateQualityTable() {
  231. const allQualityList = JSON.parse(JSON.stringify(qualitys));
  232. allQualityList.map(item => {
  233. item.checked = false;
  234. })
  235. function findItem(value) {
  236. const item = allQualityList.filter(item => {
  237. return item.value == value;
  238. })
  239. if (item.length > 0) {
  240. return item[0].name
  241. }
  242. return false
  243. }
  244. const ratioList = ratios.map(item => {
  245. return {
  246. name: findItem(item.split(':')[0]) || item.split(':')[0],
  247. value: item.split(':')[0],
  248. ratio: item.split(':')[1],
  249. checked: parseFloat(item.split(':')[1]) == 0 ? false : true
  250. }
  251. });
  252. let mergeQualitys = [...ratioList, ...allQualityList];
  253. const newArr = [];
  254. const obj = {};
  255. for (let i = 0; i < mergeQualitys.length; i++) {
  256. if (!obj[mergeQualitys[i].value]) {
  257. newArr.push(mergeQualitys[i]);
  258. obj[mergeQualitys[i].value] = true;
  259. }
  260. }
  261. formatChannelTable(newArr);
  262. }
  263. $('#ncsubmit').click(function() {
  264. let query_start_time = $("input[name=query_start_time]").val()
  265. let start_time = parseInt((new Date(query_start_time)).getTime() / 1000);
  266. let query_end_time = $("input[name=query_end_time]").val()
  267. let end_time = parseInt((new Date(query_end_time)).getTime() / 1000);
  268. if (!start_time && !end_time) {
  269. start_time = Date.parse(new Date()) / 1000 - 7200;
  270. end_time = Date.parse(new Date()) / 1000;
  271. }
  272. let chnamesList = [];
  273. $('input[name="channelValue"]').each(function() {
  274. if ($(this).attr('checked')) {
  275. chnamesList.push($(this).attr('value'))
  276. }
  277. })
  278. let chnames = chnamesList.join(',');
  279. let card_types = select_cardtypes && select_set(select_cardtypes.getValue())
  280. let spec = $("select[name=amount]").val()
  281. let filter_wave = $("select[name=filter_wave]").val()
  282. let src = window.location.origin + "/plot/ch_speed_ratio?"
  283. if (start_time) {
  284. src += "&start_time=" + start_time;
  285. }
  286. if (end_time) {
  287. if (end_time < start_time || !start_time) {
  288. layer.msg('日期有误,结束日期需大于开始日期');
  289. return
  290. }
  291. src += "&end_time=" + end_time;
  292. }
  293. if (chnames) {
  294. src += "&chnames=" + chnames;
  295. }
  296. if (card_types) {
  297. src += "&card_types=" + card_types;
  298. }
  299. if (spec) {
  300. src += "&spec=" + spec;
  301. }
  302. if (filter_wave > 0) {
  303. src += '&filter_wave=' + filter_wave;
  304. }
  305. $.get(src, function(data) {
  306. if (data.state == 'success') {
  307. $('#echart').html(`<img src='data:image/png;base64,${data.img}'/>`)
  308. ratios = data.ratios;
  309. updateQualityTable()
  310. }
  311. });
  312. });
  313. $('#checkAllChannel').click(function() {
  314. if ($(this).get(0).checked) {
  315. $('input[name="channelValue"]').attr('checked', 'checked')
  316. } else {
  317. $('input[name="channelValue"]').removeAttr('checked')
  318. }
  319. })
  320. $('.querySelect').trigger('change');
  321. $('#ncsubmit').trigger('click');
  322. const fixedHeight = $('.fixed-bar').height();
  323. $('.fixed-empty').css('cssText', 'height:' + (parseFloat(fixedHeight) + 8) + 'px !important');
  324. })
  325. </script>