analysis.provider.php 14 KB

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