proxylist.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  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. <div class="col-lg-12">
  11. <div class="card">
  12. <div class="card-toolbar clearfix">
  13. <form class="pull-right search-bar" method="get" action="" role="form">
  14. <div class="input-group">
  15. <div class="input-group-btn">
  16. <input type="hidden" name="search" id="search" value="proxy_acc">
  17. <button class="btn btn-default dropdown-toggle" id="search-btn" data-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">
  18. 代理账号 <span class="caret"></span>
  19. </button>
  20. <ul class="dropdown-menu">
  21. <li> <a tabindex="-1" href="javascript:void(0)" data-field="proxy_acc">代理账号</a> </li>
  22. <li> <a tabindex="-1" href="javascript:void(0)" data-field="proxy_phone">代理手机</a> </li>
  23. </ul>
  24. </div>
  25. <input type="text" class="form-control" value="" name="keyword" placeholder="请输入搜索信息">
  26. </div>
  27. </form>
  28. <div class="toolbar-btn-action">
  29. <!--弹窗开始-->
  30. <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@mdo"><i class="mdi mdi-plus"></i>添加代理</button>
  31. <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
  32. <div class="modal-dialog" role="document">
  33. <div class="modal-content">
  34. <div class="modal-header">
  35. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  36. <h4 class="modal-title" id="exampleModalLabel">添加代理</h4>
  37. </div>
  38. <div class="modal-body">
  39. <!--查询代理组-->
  40. <?php
  41. include_once("../untils/conn.php");
  42. mysqli_query($con, "set names utf8");
  43. $sql = "SELECT group_id, group_name FROM proxy_group";
  44. $result = mysqli_query($con, $sql);
  45. ?>
  46. <form action="controller/Doinproxy.php" method="post">
  47. <div class="form-group">
  48. <label for="proxy_acc" class="control-label">登录账号:</label>
  49. <input type="text" class="form-control" id="proxy_acc" name="proxy_acc">
  50. </div>
  51. <div class="form-group">
  52. <label for="proxy_password" class="control-label">登录密码:</label>
  53. <input type="text" class="form-control" id="proxy_password" name="proxy_password">
  54. </div>
  55. <div class="form-group">
  56. <label for="proxy_phone" class="control-label">手机号码:</label>
  57. <input type="text" class="form-control" id="proxy_phone" name="proxy_phone">
  58. </div>
  59. <div class="form-group">
  60. <label for="proxy_name" class="control-label">代理昵称:</label>
  61. <input type="text" class="form-control" id="proxy_name" name="proxy_name">
  62. </div>
  63. <div class="form-group">
  64. <label for="proxy_rename" class="control-label">代理真实姓名:</label>
  65. <input type="text" class="form-control" id="proxy_rename" name="proxy_rename">
  66. </div>
  67. <div class="form-group">
  68. <label for="proxy_uid" class="control-label">代理身份证号:</label>
  69. <input type="text" class="form-control" id="proxy_uid" name="proxy_uid">
  70. </div>
  71. <div class="form-group">
  72. <label for="proxy_type">代理类型</label>
  73. <div >
  74. <select class="form-control" id="proxy_type" name="proxy_type" size="1">
  75. <option value="0">个人</option>
  76. <option value="1">个体/企业</option>
  77. </select>
  78. </div>
  79. </div>
  80. <div class="form-group">
  81. <label for="group_id">代理等级</label>
  82. <select class="form-control" id="group_id" name="group_id" size="1">
  83. <?php while($row = mysqli_fetch_assoc($result)): ?>
  84. <option value="<?php echo $row['group_id']; ?>"><?php echo $row['group_name']; ?></option>
  85. <?php endwhile; ?>
  86. </select>
  87. </div>
  88. <!--时间戳-->
  89. <input type="hidden" name="cr_time" value="<?php echo time(); ?>">
  90. </div>
  91. <div class="modal-footer">
  92. <button type="submit" class="btn btn-primary">提交</button>
  93. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  94. </div>
  95. </form>
  96. </div>
  97. </div>
  98. </div>
  99. <!--这是弹窗结束-->
  100. </div>
  101. </div>
  102. <div class="card-body">
  103. <div class="table-responsive">
  104. <form name="form1" id="form1" method="post" action="controller/deleteall.php">
  105. <table class="table table-bordered">
  106. <?php
  107. include_once("../untils/conn.php");
  108. mysqli_query($con, "set names utf8");
  109. if ($con) {
  110. if ($db) {
  111. // 获取搜索关键词和字段
  112. $keyword = $_GET['keyword'];
  113. $field = $_GET['search'];
  114. // 构建查询语句
  115. $sql = "SELECT * FROM proxy";
  116. if ($keyword != "") {
  117. $sql .= " WHERE $field LIKE '%$keyword%'";
  118. }
  119. // 获取数据总行数
  120. $data = mysqli_query($con, $sql);
  121. $maxrows = mysqli_num_rows($data);
  122. // 计算总页数
  123. $page_size = 10; // 每页显示数
  124. if ($maxrows % $page_size == 0) {
  125. $maxpage = (int)($maxrows / $page_size);
  126. } else {
  127. $maxpage = (int)($maxrows / $page_size) + 1;
  128. }
  129. // 获取当前页
  130. if (isset($_GET['curpage'])) {
  131. $page = $_GET['curpage'];
  132. } else {
  133. $page = 1;
  134. }
  135. // 分段取出数据
  136. $start = $page_size * ($page - 1);
  137. $get_sql = "$sql ORDER BY proxy_id DESC LIMIT $start, $page_size";
  138. // 获取数据显示
  139. $data = mysqli_query($con, $get_sql);
  140. ?>
  141. <?php
  142. $proxy_upid = $row["proxy_upid"]
  143. ?>
  144. <thead>
  145. <tr>
  146. <th>代理ID</th>
  147. <th>代理账号</th>
  148. <th>手机号</th>
  149. <th>名称</th>
  150. <th>余额</th>
  151. <th>实名</th>
  152. <th>身份证号</th>
  153. <th>上级代理</th>
  154. <th>支付宝</th>
  155. <th>支付宝账号</th>
  156. <th>代理等级</th>
  157. <th>账号状态</th>
  158. <th>封禁原因</th>
  159. <th>实名状态</th>
  160. <th>类型</th>
  161. <th>创建时间</th>
  162. <th>操作</th>
  163. </tr>
  164. </thead>
  165. <tbody>
  166. <?php
  167. $proxy_id = null; // 定义变量
  168. while ($row = mysqli_fetch_array($data)) {
  169. // 获取上级代理名称
  170. $proxy_upid = $row["proxy_upid"];
  171. if ($proxy_upid != "") {
  172. $get_up_proxy_name_sql = "SELECT proxy_name FROM proxy WHERE proxy_id = $proxy_upid";
  173. $get_up_proxy_name_result = mysqli_query($con, $get_up_proxy_name_sql);
  174. $up_proxy_name = mysqli_fetch_array($get_up_proxy_name_result)["proxy_name"];
  175. } else {
  176. $up_proxy_name = "直属平台";
  177. }
  178. ?>
  179. <tr>
  180. <td style="width:2%;">
  181. <?php echo $proxy_id = $row["proxy_id"] ?>
  182. </td>
  183. <td style="width:3%;">
  184. <?php echo $row["proxy_acc"] ?>
  185. </td>
  186. <td style="width:3%;">
  187. <?php echo $row["proxy_phone"] ?>
  188. </td>
  189. <td style="width:7.5%;">
  190. <?php echo $row["proxy_name"] ?>
  191. </td>
  192. <td style="width:5%;">
  193. ¥<?php echo $row["proxy_balance"] ?>
  194. </td>
  195. <td style="width:5%;">
  196. <?php echo $row["proxy_rename"] ?>
  197. </td>
  198. <td style="width:5%;">
  199. <?php echo $row["proxy_uid"] ?>
  200. </td>
  201. <td style="width:6.5%;">
  202. <?php echo $up_proxy_name ?>
  203. </td>
  204. <td style="width:5%;">
  205. <?php echo $row["proxy_alipay"] ?>
  206. </td>
  207. <td style="width:5%;">
  208. <?php echo $row["proxy_alipay_acc"] ?>
  209. </td>
  210. <td style="width:7%;">
  211. <?php
  212. echo $row["group_id"];
  213. ?>
  214. </td>
  215. <td style="width:5%;">
  216. <?php
  217. if ($row["proxy_sta"] == 1) {
  218. echo '<span class="label label-success">账号正常</span>';
  219. } else {
  220. echo '<span class="label label-danger">封禁状态</span>';
  221. }
  222. ?>
  223. </td>
  224. <td style="width:10%;">
  225. <?php echo $row["state_ban"];?>
  226. </td>
  227. <td style="width:5%;">
  228. <?php
  229. if ($row["proxy_rename_sta"] == 1) {
  230. echo '<span class="label label-info">已实名</span>';
  231. } else {
  232. echo '<span class="label label-info">未实名</span>';
  233. }
  234. ?>
  235. </td>
  236. <td style="width:5%;">
  237. <?php
  238. if ($row["proxy_type"] == 0) {
  239. echo '<span class="label label-info">个人</span>';
  240. } else {
  241. echo '<span class="label label-info">企业</span>';
  242. }
  243. ?>
  244. </td>
  245. <td style="width:7%;">
  246. <?php echo $date = date('Y-m-d H:i:s', $row["cr_time"]); ?>
  247. </td>
  248. <td style="width:15%;">
  249. <?php if($row["proxy_sta"] == 1) {?>
  250. <button type="button" class="btn btn-danger btn-sm ban-btn" data-toggle="modal" data-target="#banModal" data-proxyid="<?php echo $row["proxy_id"] ?>" data-whatever="@mdo">封禁账号</button>
  251. <?php } else { ?>
  252. <button type="button" class="btn btn-success btn-sm ban-btn" data-toggle="modal" data-target="#banModal" data-proxyid="<?php echo $row["proxy_id"] ?>" data-whatever="@mdo">解封账号</button>
  253. <?php } ?>
  254. <a href="dwproxy.php?proxy_id=<?php echo $row["proxy_id"] ?>" class="btn btn-warning btn-sm">下级代理</a>
  255. <button type="button" class="btn btn-success btn-sm yue-btn" data-toggle="modal" data-target="#yueModal" data-proxyid="<?php echo $row["proxy_id"] ?>" data-whatever="@mdo">余额变更</button>
  256. </td>
  257. </tr>
  258. <?php
  259. }
  260. ?>
  261. </tbody>
  262. <tfoot>
  263. <tr>
  264. <td colspan="12" style="text-align: right;">
  265. <?php
  266. echo "<p>共 $maxpage 页&nbsp;&nbsp;";
  267. echo "每页 $page_size 项&nbsp;&nbsp;";
  268. //设置上一页
  269. if ($page > 1) {
  270. $prepage = $page - 1;
  271. echo "<a href='?curpage=$prepage'>上一页</a>&nbsp;&nbsp;";
  272. }
  273. //设置下一页
  274. if ($page < $maxpage) {
  275. $nextpage = $page + 1;
  276. echo "<a href='?curpage=$nextpage'>下一页</a>&nbsp;&nbsp;";
  277. }
  278. echo "&nbsp;&nbsp;第 $page 页</p>";
  279. }
  280. }
  281. ?>
  282. </td>
  283. </tr>
  284. </tfoot>
  285. </table>
  286. </form>
  287. </div>
  288. </div>
  289. </div>
  290. </div>
  291. </div>
  292. </div>
  293. </div>
  294. </main>
  295. <!--这是提交封号-->
  296. <div class="modal fade" id="banModal" tabindex="-1" role="dialog" aria-labelledby="banModalLabel">
  297. <div class="modal-dialog" role="document">
  298. <div class="modal-content">
  299. <div class="modal-header">
  300. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  301. <h4 class="modal-title" id="banModalLabel">封号/解号</h4>
  302. </div>
  303. <div class="modal-body">
  304. <form action="controller/Doproxy_sta.php" method="POST">
  305. <div class="form-group">
  306. <label for="message-text" class="control-label">封禁原因:</label>
  307. <textarea class="form-control" id="message-text" name="state_ban" placeholder="解封账号时,可为空,封号时请输入原因,代理在登录是会提示!" ></textarea>
  308. </div>
  309. <!--id-->
  310. <input type="hidden" name="proxy_id" value="<?php echo $proxy_id ?>">
  311. </div>
  312. <div class="modal-footer">
  313. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  314. <button type="submit" class="btn btn-primary">确认提交</button>
  315. </div>
  316. </form>
  317. </div>
  318. </div>
  319. </div>
  320. <!--这里结束封号了-->
  321. <!--这是变更余额-->
  322. <div class="modal fade" id="yueModal" tabindex="-1" role="dialog" aria-labelledby="yueModalLabel">
  323. <div class="modal-dialog" role="document">
  324. <div class="modal-content">
  325. <div class="modal-header">
  326. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  327. <h4 class="modal-title" id="yueModalLabel">加额/减额</h4>
  328. </div>
  329. <div class="modal-body">
  330. <form action="controller/proxyyue.php" method="POST">
  331. <div class="form-group">
  332. <label for="price" class="control-label">订单号:</label>
  333. <input type="text" class="form-control" id="oderid" name="oderid" placeholder="如果需要变更某个订单的金额,则填写此处,如果,没有则为空!" >
  334. </div>
  335. <div class="form-group">
  336. <label for="price" class="control-label">变更金额:</label>
  337. <input type="text" class="form-control" id="price" name="price" placeholder="填写了金额后,选择扣费是扣掉代理的余额,返佣是加余额,不可撤回!">
  338. </div>
  339. <div class="form-group">
  340. <label for="type">金额类型</label>
  341. <div >
  342. <select class="form-control" id="type" name="type" size="1">
  343. <option value="0">返佣</option>
  344. <option value="1">扣费</option>
  345. </select>
  346. </div>
  347. </div>
  348. <!-- <div class="form-group">-->
  349. <!-- <label for="type_model">操作模式<p style="color:red">请注意,月月返需要准确填写订单号且需要所属代理,否则可能会导致数据不生产!</p></label>-->
  350. <!-- <div >-->
  351. <!-- <select class="form-control" id="type_model" name="type_model" size="1">-->
  352. <!-- <option value="0">普通变更金额</option>-->
  353. <!-- <option value="1">月月返现</option>-->
  354. <!-- </select>-->
  355. <!-- </div>-->
  356. <!--</div>-->
  357. <div class="form-group">
  358. <label for="message-text" class="control-label">金额说明:</label>
  359. <textarea class="form-control" id="message-text" name="notes" placeholder="列如某产品月月返佣,则填写订单号KJKJ2023……,平台手动结算!" ></textarea>
  360. </div>
  361. <!--id-->
  362. <input type="hidden" name="proxy_id" value="<?php echo $proxy_id ?>">
  363. </div>
  364. <div class="modal-footer">
  365. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  366. <button type="submit" class="btn btn-primary">确认提交</button>
  367. </div>
  368. </form>
  369. </div>
  370. </div>
  371. </div>
  372. <!--这里变更结束了-->
  373. <script src="../merchant/assets/js/jquery.min.js"></script>
  374. <script>
  375. $(document).ready(function() {
  376. $('.dropdown-menu a').click(function(e) {
  377. e.preventDefault();
  378. var field = $(this).data('field');
  379. var buttonText = $(this).text();
  380. $('#search').val(field);
  381. $('#search-btn').html(buttonText + ' <span class="caret"></span>');
  382. });
  383. });
  384. // 监听封禁账号按钮的点击事件
  385. $('.ban-btn').click(function() {
  386. var proxyId = $(this).data('proxyid');
  387. // 将proxyId设置到模态框中的input元素中
  388. $('#banModal input[name="proxy_id"]').val(proxyId);
  389. });
  390. // 监听余额变更按钮的点击事件
  391. $('.yue-btn').click(function() {
  392. var proxyId = $(this).data('proxyid');
  393. // 将proxyId设置到模态框中的input元素中
  394. $('#yueModal input[name="proxy_id"]').val(proxyId);
  395. });
  396. </script>
  397. <!--End 页面主要内容-->
  398. <?php require_once('common/footer.php'); ?>
  399. <?php
  400. } else {
  401. echo "<script>alert('您尚未登录,没有权限访问该页面');location.href='login.php';</script>";
  402. }