proxy.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <?php
  2. session_start();
  3. if (isset($_SESSION["account"])) {
  4. ?>
  5. <?php require_once('common/header.php'); ?>
  6. <?php require_once('common/sidebar.php'); ?>
  7. <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  8. <div class="main-content app-content mt-0">
  9. <div class="side-app">
  10. <!--占位-->
  11. <div class="card"> </div>
  12. <!--占位-->
  13. <!--查询代理组-->
  14. <?php
  15. include_once("../untils/conn.php");
  16. mysqli_query($con, "set names utf8");
  17. $sql = "SELECT group_id, group_name FROM proxy_group";
  18. $result = mysqli_query($con, $sql);
  19. ?>
  20. <!-- CONTAINER -->
  21. <div class="main-container container-fluid">
  22. <!-- PAGE-HEADER -->
  23. <div class="row row-sm">
  24. <div class="col-lg-12">
  25. <div class="card">
  26. <div class="card-header">
  27. <button type="button" class="btn btn-info-light me-3 mt-2" data-bs-toggle="modal" data-bs-target="#input-modal" data-bs-whatever="@mdo">添加代理</button>
  28. <a href="javascript:void(0)" class="btn btn-info-light me-3 mt-2" onclick="copyLink()">邀请代理</a>
  29. <h3 class="card-title">我的邀请码:<span id="puid"></span></h3>
  30. </div>
  31. <div class="card-body">
  32. <div class="table-responsive">
  33. <table class="table table-bordered text-nowrap border-bottom" id="responsive-datatable">
  34. <thead>
  35. <tr>
  36. <th class="wd-10p border-bottom-0">代理账号</th>
  37. <th class="wd-10p border-bottom-0">联系人</th>
  38. <th class="wd-10p border-bottom-0">手机号码</th>
  39. <th class="wd-10p border-bottom-0">上级代理</th>
  40. <th class="wd-10p border-bottom-0">是否实名</th>
  41. <th class="wd-10p border-bottom-0">余额</th>
  42. <th class="wd-10p border-bottom-0">状态</th>
  43. <th class="wd-10p border-bottom-0">操作</th>
  44. </tr>
  45. </thead>
  46. <tbody id="table-body">
  47. </tbody>
  48. </table>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <!-- CONTAINER CLOSED -->
  56. </div>
  57. </div>
  58. <!-- Inout modal -->
  59. <div class="modal fade" id="input-modal">
  60. <div class="modal-dialog" role="document">
  61. <div class="modal-content modal-content-demo">
  62. <div class="modal-header">
  63. <h6 class="modal-title">添加代理(暂不可用)</h6>
  64. <button class="btn-close" data-bs-dismiss="modal" aria-label="Close">
  65. <span aria-hidden="true">×</span>
  66. </button>
  67. </div>
  68. <div class="modal-body">
  69. <form>
  70. <div class="mb-3">
  71. <label for="recipient-name" class="col-form-label">登录账号:</label>
  72. <input type="text" class="form-control" id="recipient-name">
  73. </div>
  74. <div class="mb-3">
  75. <label for="recipient-name" class="col-form-label">登录密码:</label>
  76. <input type="text" class="form-control" id="recipient-name">
  77. </div>
  78. <div class="mb-3">
  79. <label for="recipient-name" class="col-form-label">手机号:</label>
  80. <input type="text" class="form-control" id="recipient-name">
  81. </div>
  82. <div class="mb-3">
  83. <label for="recipient-name" class="col-form-label">代理昵称:</label>
  84. <input type="text" class="form-control" id="recipient-name">
  85. </div>
  86. <div class="mb-3">
  87. <label for="recipient-name" class="col-form-label">代理实名:</label>
  88. <input type="text" class="form-control" id="recipient-name">
  89. </div>
  90. <div class="mb-3">
  91. <label for="recipient-name" class="col-form-label">代理身份证号:</label>
  92. <input type="text" class="form-control" id="recipient-name">
  93. </div>
  94. <div class="mb-3">
  95. <label for="recipient-name" class="col-form-label">代理类型:</label>
  96. <select class="form-control" id="proxy_type" name="proxy_type" size="1">
  97. <option value="0">个人</option>
  98. <option value="1">个体/企业</option>
  99. </select>
  100. </div>
  101. <div class="mb-3">
  102. <label for="recipient-name" class="col-form-label">代理等级:</label>
  103. <select class="form-control" id="group_id" name="group_id" size="1">
  104. <?php while($row = mysqli_fetch_assoc($result)): ?>
  105. <option value="<?php echo $row['group_id']; ?>"><?php echo $row['group_name']; ?></option>
  106. <?php endwhile; ?>
  107. </select>
  108. </div>
  109. </form>
  110. </div>
  111. <div class="modal-footer">
  112. <button class="btn ripple btn-success" type="button">提交</button>
  113. <button class="btn ripple btn-danger" data-bs-dismiss="modal" type="button">取消</button>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <!-- End Datepicker modal -->
  119. <?php
  120. session_start();
  121. include_once("../untils/conn.php");
  122. mysqli_query($con, "set names utf8");
  123. // 获取当前正在登录的账号信息的代理
  124. $proxy_acc = $_SESSION["account"];
  125. // 查询proxy表中的数据
  126. $query = "SELECT proxy_rename_sta FROM proxy WHERE proxy_acc = '$proxy_acc'";
  127. $result = mysqli_query($con, $query);
  128. $row = mysqli_fetch_assoc($result);
  129. if ($row) {
  130. $proxy_rename_sta = $row['proxy_rename_sta'];
  131. ?>
  132. <div class="modal fade" id="modaldemo5" data-bs-backdrop="static" data-bs-keyboard="false">
  133. <div class="modal-dialog modal-dialog-centered text-center" role="document">
  134. <div class="modal-content tx-size-sm">
  135. <div class="modal-body text-center p-4 pb-5">
  136. <i class="icon icon-close fs-70 text-danger lh-1 my-5 d-inline-block"></i>
  137. <h4 class="text-danger">警告: 您的账号未实名!</h4>
  138. <p class="mg-b-20 mg-x-20">平台要求所有代理商必须实名!否则无法使用平台功能!</p>
  139. <a href="profile.php" class="btn btn-primary pd-x-25">去实名</a>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. <!--/div-->
  145. <script src="assets/js/jquery.min.js"></script>
  146. <script>
  147. $(document).ready(function() {
  148. // 发送Ajax请求获取代理数据
  149. $.ajax({
  150. url: "controller/Proxylist.php",
  151. dataType: "json",
  152. success: function(data) {
  153. if (data && data.length > 0) {
  154. // 清空表格内容
  155. $('#table-body').html('');
  156. // 渲染代理数据
  157. $.each(data, function(index, item) {
  158. var tr = '<tr>' +
  159. '<td>' + item.account + '</td>' +
  160. '<td>' + item.rename + '</td>' +
  161. '<td>' + item.phone + '</td>' +
  162. '<td>' + item.puid + '</td>' +
  163. '<td>' + (item.rename_sta == '1' ? '已实名' : '未实名') + '</td>' +
  164. '<td>¥' + item.balance + '</td>' +
  165. '<td>' + (item.status == '1' ? '正常' : '冻结') + '</td>' +
  166. '<td>'+
  167. '<a href="javascript:void(0)" class="btn btn-primary">佣金设置</a>'+
  168. '<a href="javascript:void(0)" class="btn btn-info">重置密码</a>'+
  169. '</td>'+
  170. '</tr>';
  171. $('#table-body').append(tr);
  172. });
  173. }
  174. },
  175. error: function(error) {
  176. console.log(error.responseText);
  177. }
  178. });
  179. });
  180. function copyLink() {
  181. var link = window.location.protocol + "//" + window.location.hostname + "/merchant/register.html?puid=" + puid;
  182. var tempInput = document.createElement("input");
  183. tempInput.setAttribute("value", link);
  184. document.body.appendChild(tempInput);
  185. tempInput.select();
  186. document.execCommand("copy");
  187. document.body.removeChild(tempInput);
  188. alert("复制成功!");
  189. }
  190. var puid = ''; // 定义全局变量puid
  191. $(document).ready(function() {
  192. $.ajax({
  193. url: "controller/public/GetPuid.php",
  194. type: "POST",
  195. dataType: "json",
  196. success: function(res) {
  197. puid = res.puid; // 将获取到的puid保存到全局变量中
  198. $("#puid").text(puid); // 将puid显示在页面上
  199. },
  200. error: function() {
  201. alert("获取puid失败");
  202. }
  203. });
  204. });
  205. </script>
  206. <script>
  207. $(document).ready(function() {
  208. <?php
  209. if ($proxy_rename_sta == 0) {
  210. // 未实名认证
  211. echo '$("#modaldemo5").modal("show");';
  212. echo '$("#modaldemo5").modal({backdrop: "static", keyboard: false});';
  213. } elseif ($proxy_rename_sta == 1) {
  214. // 已实名认证
  215. echo '$("#modaldemo5").modal("hide");';
  216. }
  217. ?>
  218. });
  219. </script>
  220. <?php
  221. } else {
  222. // 未找到相关数据
  223. // echo '数据不存在';
  224. }
  225. ?>
  226. <?php require_once('common/footer.php'); ?>
  227. <?php
  228. } else {
  229. echo "<script>alert('登录过过期,没有权限访问该页面');location.href='login.html';</script>";
  230. }