PageRenderTime 44ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/web/admin/module/festival/shop_of_discount.php

https://gitlab.com/xusasuke6/Slg_php
PHP | 151 lines | 111 code | 36 blank | 4 comment | 8 complexity | dc92a4d2924ff51d2dcbe4115c5edbfa MD5 | raw file
  1. <?php
  2. define('IN_DATANG_SYSTEM', true);
  3. include "../../../config/config.php";
  4. include SYSDIR_ADMIN."/include/global.php";
  5. include SYSDIR_ADMIN."/class/log_gold_class.php";
  6. global $smarty, $db;
  7. if ( isset($_REQUEST['dStartDate'])){
  8. $dateStart = $_REQUEST['dStartDate'];
  9. }
  10. else
  11. {
  12. $dateStart = strftime ("%Y-%m-%d", time()-(60*60*24)*5 );
  13. }
  14. if ( isset($_REQUEST['dEndDate']))
  15. {
  16. $dateEnd = $_REQUEST['dEndDate'];
  17. }
  18. else
  19. {
  20. $dateEnd= strftime ("%Y-%m-%d",time());
  21. }
  22. $u_start = strtotime($dateStart.' 00:00:00');
  23. $u_end = strtotime($dateEnd.' 23:59:59');
  24. $item_name = array(
  25. 10800183=>'九折锻造小礼包',
  26. 10800187=>'九折锻造大礼包',
  27. 10800207=>'坐骑进阶折扣包',
  28. 10800195=>'洗炼折扣包',
  29. 10800203=>'镶嵌折扣小礼包',
  30. 10800199=>'镶嵌折扣大礼包',
  31. 10800191=>'宠物折扣包'
  32. );
  33. $item_list = '10800183,10800187,10800191,10800195,10800199,10800203,10800207';
  34. $expend_type = LogGoldClass::getSpendTypeList();
  35. $flag=0;
  36. foreach($expend_type as $k=>$v){
  37. if($flag) $expend_list .=',';
  38. $expend_list .= $k;
  39. $flag=1;
  40. }
  41. $sql_all = "select sum(gold_unbind) as money from t_log_use_gold where mtype in($expend_list) and `mtime`>={$u_start} and `mtime`<={$u_end} ";
  42. $all_gold = $db->fetchOne($sql_all);
  43. $all_gold = $all_gold['money'];
  44. $sql = "select count(*) as operate_times,count(distinct user_id) as role_times,sum(gold_unbind) as gold,itemid
  45. from t_log_use_gold where itemid in($item_list) and `mtime`>={$u_start} and `mtime`<={$u_end} group by itemid order by itemid asc";
  46. $result = $db->fetchAll($sql);
  47. foreach( $result as $k=>$v){
  48. $tmp['operate_times'] = $v['operate_times'];
  49. $tmp['role_times'] = $v['role_times'];
  50. $tmp['gold'] = $v['gold'];
  51. $tmp['item_name'] = $item_name[$v['itemid']];
  52. $tmp['total'] = $all_gold;
  53. $tmp['percent'] = round($v['gold']/$all_gold*100,2);
  54. $total['operate_times'] += $v['operate_times'];
  55. $total['role_times'] += $v['role_times'];
  56. $total['gold'] += $v['gold'];
  57. $total['percent'] += $tmp['percent'];
  58. $tmp['percent'] .= '%';
  59. $format[] = $tmp;
  60. }
  61. $total['total'] = $all_gold;
  62. $total['item_name'] ='<font color="red">Total</font>';
  63. $total['percent'] .= '%';
  64. if($total['percent']>0)
  65. $format[] = $total;
  66. $acname = trim(SS($_REQUEST['acname']));
  67. $nickname = trim(SS($_REQUEST['nickname']));
  68. $userid = trim(SS($_REQUEST['userid']));
  69. $acname = trim(SS($acname));
  70. $nickname = trim(SS($nickname));
  71. $userid = trim(SS($userid));
  72. $pageno = getUrlParam('page');
  73. $where = '1';
  74. if(!empty($userid))
  75. {
  76. $where .= " AND `user_id` = '{$userid}'";
  77. }
  78. if (!empty($acname))
  79. {
  80. $where .= " AND `account_name` = '{$acname}'";
  81. }
  82. if (!empty($nickname))
  83. {
  84. $where .= " AND `user_name` = '{$nickname}'";
  85. }
  86. $where .= " AND itemid in($item_list) ";
  87. $search_sort = 'mtime desc ';
  88. $tablename = "t_log_use_gold";
  89. // if(count($balance) <1 ){
  90. // $smarty->assign("warning","抱歉,查询不到该玩家的领取");
  91. // }
  92. $count_result = 0;
  93. $keywordlist2 = getList($tablename, $where, $pageno, $search_sort, LIST_PER_PAGE_RECORDS, $count_result);
  94. if(!empty($keywordlist2))
  95. {
  96. foreach($keywordlist2 as $kPay => $vPay)
  97. {
  98. $keywordlist2[$kPay]['item_name'] = $item_name[$vPay['itemid']];
  99. }
  100. }
  101. //$excel = getExcel($tablename, $where, $search_sort, $typename,$buf_lang);
  102. $pagelist = getPages($pageno, $count_result);
  103. $smarty->assign("total", $format);
  104. $smarty->assign("output", $output);
  105. $smarty->assign("time_start", $dateStart);
  106. $smarty->assign("time_end", $dateEnd);
  107. $smarty->assign("search_keyword1", $acname);
  108. $smarty->assign("search_keyword2", $nickname);
  109. $smarty->assign("search_keyword3", $userid);
  110. $smarty->assign("record_count", $count_result);
  111. $smarty->assign("keywordlist2", $keywordlist2);
  112. $smarty->assign("page_list", $pagelist);
  113. $smarty->assign("page_count", ceil($count_result/LIST_PER_PAGE_RECORDS));
  114. $smarty->assign("warning","抱歉,查询不到该玩家的领取");
  115. $smarty->display("module/festival/shop_of_discount.html");