index.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. session_start();
  3. if (isset($_SESSION["username"])) {
  4. ?>
  5. <?php require_once('common/header.php'); ?>
  6. <!--页面主要内容-->
  7. <main class="lyear-layout-content">
  8. <div class="container-fluid">
  9. <div class="row">
  10. <?php
  11. include_once("../untils/conn.php");
  12. mysqli_query($con, "set names utf8");
  13. if ($con) {
  14. if ($db) {
  15. // 获取每周订单数据
  16. $weeklyQuery = "SELECT COUNT(*) AS count FROM oder WHERE WEEKDAY(FROM_UNIXTIME(`time`)) BETWEEN 0 AND 6 GROUP BY WEEKDAY(FROM_UNIXTIME(`time`))";
  17. $weeklyResult = mysqli_query($con, $weeklyQuery);
  18. $weeklyData = array();
  19. while ($row = mysqli_fetch_assoc($weeklyResult)) {
  20. $weeklyData[] = $row['count'];
  21. // echo $weeklyData;
  22. }
  23. // 获取每月订单数据
  24. $monthlyQuery = "SELECT COUNT(*) AS count FROM oder WHERE MONTH(FROM_UNIXTIME(`time`)) BETWEEN 1 AND 12 GROUP BY MONTH(FROM_UNIXTIME(`time`))";
  25. $monthlyResult = mysqli_query($con, $monthlyQuery);
  26. $monthlyData = array();
  27. while ($row = mysqli_fetch_assoc($monthlyResult)) {
  28. $monthlyData[] = $row['count'];
  29. }
  30. // 其他查询代码保持不变
  31. $sortsql = "select count(*) from oder";
  32. $sortdata = mysqli_query($con, $sortsql);
  33. $sortresult = mysqli_fetch_row($sortdata);
  34. $listsql = "select count(*) from list";
  35. $listdata = mysqli_query($con, $listsql);
  36. $listresult = mysqli_fetch_row($listdata);
  37. $sql = "select * from list limit 0,8";
  38. $data = mysqli_query($con, $sql);
  39. $totalPrice = "SELECT SUM(price) AS total FROM oder WHERE card_sta = 1";
  40. $totalData = mysqli_query($con, $totalPrice);
  41. $totalResult = mysqli_fetch_assoc($totalData);
  42. $sum = $totalResult['total'];
  43. //返佣金额
  44. $proxy_price_sql = "SELECT SUM(proxy_prices) AS total FROM revenue WHERE type = 0 AND state = 2";
  45. $proxy_price_data = mysqli_query($con, $proxy_price_sql);
  46. $proxy_price_result = mysqli_fetch_assoc($proxy_price_data);
  47. $proxy_price_sum = $proxy_price_result['total'];
  48. }
  49. }
  50. ?>
  51. <div class="col-sm-6 col-lg-3">
  52. <div class="card bg-primary">
  53. <div class="card-body clearfix">
  54. <div class="pull-right">
  55. <p class="h6 text-white m-t-0">平台收益</p>
  56. <p class="h3 text-white m-b-0 fa-1-5x">¥<?php echo $sum ?></p>
  57. </div>
  58. <div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-currency-cny fa-1-5x"></i></span> </div>
  59. </div>
  60. </div>
  61. </div>
  62. <div class="col-sm-6 col-lg-3">
  63. <div class="card bg-danger">
  64. <div class="card-body clearfix">
  65. <div class="pull-right">
  66. <p class="h6 text-white m-t-0">订单总数</p>
  67. <p class="h3 text-white m-b-0 fa-1-5x"><?php echo $sortresult[0] ?></p>
  68. </div>
  69. <div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi mdi-cube fa-1-5x"></i></span> </div>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="col-sm-6 col-lg-3">
  74. <div class="card bg-success">
  75. <div class="card-body clearfix">
  76. <div class="pull-right">
  77. <p class="h6 text-white m-t-0">产品总数</p>
  78. <p class="h3 text-white m-b-0 fa-1-5x"><?php echo $listresult[0] ?></p>
  79. </div>
  80. <div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-dns fa-1-5x"></i></span> </div>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="col-sm-6 col-lg-3">
  85. <div class="card bg-info">
  86. <div class="card-body clearfix">
  87. <div class="pull-right">
  88. <p class="h6 text-white m-t-0">已返佣金</p>
  89. <p class="h3 text-white m-b-0 fa-1-5x"><?php echo $proxy_price_sum ?></p>
  90. </div>
  91. <div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-coin fa-1-5x"></i></span> </div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. <div class="row">
  97. <div class="col-lg-6">
  98. <div class="card">
  99. <div class="card-header">
  100. <h4>每周订单</h4>
  101. </div>
  102. <div class="card-body">
  103. <canvas class="js-chartjs-bars"></canvas>
  104. </div>
  105. </div>
  106. </div>
  107. <div class="col-lg-6">
  108. <div class="card">
  109. <div class="card-header">
  110. <h4>成交记录</h4>
  111. </div>
  112. <div class="card-body">
  113. <canvas class="js-chartjs-lines"></canvas>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <div class="row">
  119. <div class="col-lg-12">
  120. <div class="card">
  121. <div class="card-header">
  122. <h4>产品列表</h4>
  123. </div>
  124. <div class="card-body">
  125. <div class="table-responsive">
  126. <table class="table table-hover">
  127. <thead>
  128. <tr>
  129. <th>#</th>
  130. <th>产品名称</th>
  131. <th>包邮方式</th>
  132. <th>优惠时长</th>
  133. <th>产品分类</th>
  134. <th>产品标签</th>
  135. </tr>
  136. </thead>
  137. <tbody>
  138. <?php
  139. while ($row = mysqli_fetch_array($data)) {
  140. ?>
  141. <tr>
  142. <td><?php echo $row["id"] ?></td>
  143. <td><?php echo $row["name"] ?></td>
  144. <td><?php echo $row["baoyou"] ?></td>
  145. <td><?php echo $row["ltime"] ?></td>
  146. <td><?php echo $row["yys"] ?></td>
  147. <td>
  148. <?php echo $row["gsd"] ?>
  149. </td>
  150. </tr>
  151. <?php
  152. }
  153. ?>
  154. </tbody>
  155. </table>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. </main>
  163. </main>
  164. <!--End 页面主要内容-->
  165. <?php require_once('common/footer.php'); ?>
  166. <?php
  167. } else {
  168. echo "<script>alert('您尚未登录,没有权限访问该页面');location.href='login.php';</script>";
  169. }
  170. ?>