analysis.cov.provider.php 14 KB

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