Commit 649e653deb72e2dc11ab3b7a0c2245dd142c96f7
1 parent
2d65771c
[留言板]后台留言登陆,列表,搜索,详情
Showing
7 changed files
with
289 additions
and
0 deletions
trunk/Message/message后台独立功能/del.php
0 → 100644
1 | +<?php | ||
2 | +require "function.php"; | ||
3 | + | ||
4 | +$url = "http://localhost.vchangyi.org/E92B06237F00000150F5A2266E14186D/Message/Apicp/Message/Message/del"; | ||
5 | +$message_id = $_GET['message_id']; | ||
6 | + | ||
7 | +$postData = [ | ||
8 | + 'message_id'=>$message_id, | ||
9 | +]; | ||
10 | + | ||
11 | + | ||
12 | +curlPost($url,$postData); | ||
13 | + | ||
14 | +header("Refresh:0;url=list"); | ||
0 | \ No newline at end of file | 15 | \ No newline at end of file |
trunk/Message/message后台独立功能/detail.php
0 → 100644
1 | +<?php | ||
2 | +require "function.php"; | ||
3 | + | ||
4 | +$url_img = "http://localhost/study-project/trunk/Message/attachment/"; | ||
5 | + | ||
6 | +$url = "http://localhost.vchangyi.org/E92B06237F00000150F5A2266E14186D/Message/Apicp/Message/Message/detail"; | ||
7 | +$message_id = $_GET['message_id']; | ||
8 | + | ||
9 | + | ||
10 | +$postData = [ | ||
11 | + 'message_id'=>$message_id, | ||
12 | +]; | ||
13 | + | ||
14 | +$message = curlPost($url,$postData); | ||
15 | + | ||
16 | +?> | ||
17 | + | ||
18 | +<!DOCTYPE html> | ||
19 | +<html lang="en"> | ||
20 | +<head> | ||
21 | + <meta charset="UTF-8"> | ||
22 | + <title>留言列表</title> | ||
23 | + <style type="text/css"> | ||
24 | + table{ | ||
25 | + width: 500px; | ||
26 | + margin: 50px auto; | ||
27 | + border-spacing: 0px; | ||
28 | + border-collapse: 0px; | ||
29 | + border: solid #fff 1px | ||
30 | + } | ||
31 | + table tr td{ | ||
32 | + border: solid #000 1px | ||
33 | + } | ||
34 | + | ||
35 | + </style> | ||
36 | +</head> | ||
37 | +<body> | ||
38 | + <h4 align="center">留言详情</h4> | ||
39 | + <table> | ||
40 | + <tbody> | ||
41 | + | ||
42 | + <thead> | ||
43 | + <tr> <td>ID</td> <td>标题</td><td>内容</td> <td>留言者</td><td>接收人</td> </tr> | ||
44 | + </thead> | ||
45 | + <?php | ||
46 | + echo "<tr> <td>{$message['message_id']}</td> <td>{$message['title']}</td> <td>{$message['message']}</td><td>{$message['from']}</td><td>{$message['to']}</td></tr>"; | ||
47 | + ?> | ||
48 | + </tbody> | ||
49 | + </table> | ||
50 | + | ||
51 | + <!-- <h4 align="center">留言附件信息</h4> --> | ||
52 | + <table> | ||
53 | + <thead> | ||
54 | + <tr> <td>留言附件</td> </tr> | ||
55 | + </thead> | ||
56 | + <tbody> | ||
57 | + | ||
58 | + <?php | ||
59 | + if (isset($message['attachment']) && $message['attachment']) { | ||
60 | + | ||
61 | + foreach ($message['attachment'] as $key => $img) { | ||
62 | + echo "<tr> <td><img src=\"" . $url_img . $img['path'] . "\"/></td></tr>"; | ||
63 | + } | ||
64 | + } | ||
65 | + ?> | ||
66 | + </tbody> | ||
67 | + </table> | ||
68 | + | ||
69 | + <!-- <h4 align="center">留言评论信息</h4> --> | ||
70 | + <table> | ||
71 | + <tbody> | ||
72 | + | ||
73 | + <thead> | ||
74 | + <tr> <td>评论内容</td><td>评论用户</td> <td>时 间</td></tr> | ||
75 | + </thead> | ||
76 | + <?php | ||
77 | + if (isset($message['comment']) && $message['comment']) { | ||
78 | + | ||
79 | + foreach ($message['comment'] as $key => $comment) { | ||
80 | + $create_time = $comment['created']/1000; | ||
81 | + $create_time_str = date("Y-m-d H:i:s"); | ||
82 | + | ||
83 | + echo "<td>{$comment['comment']}</td><td>{$comment['commenter']}</td><td>{$create_time_str}</td></tr>"; | ||
84 | + } | ||
85 | + } | ||
86 | + ?> | ||
87 | + </tbody> | ||
88 | + </table> | ||
89 | + | ||
90 | +</body> | ||
91 | +</html> | ||
92 | + |
trunk/Message/message后台独立功能/function.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +function curlPost($url,$postData = []) | ||
4 | +{ | ||
5 | + $ch = curl_init(); | ||
6 | + | ||
7 | + curl_setopt($ch, CURLOPT_URL, $url); | ||
8 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
9 | + // post数据 | ||
10 | + curl_setopt($ch, CURLOPT_POST, 1); | ||
11 | + // post的变量 | ||
12 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); | ||
13 | + $output = curl_exec($ch); | ||
14 | + curl_close($ch); | ||
15 | + //打印获得的数据 | ||
16 | + | ||
17 | + // return $output; | ||
18 | + // echo '--------' . $output; | ||
19 | + $data = json_decode($output,true); | ||
20 | + | ||
21 | + // print_r($data['result']); | ||
22 | + return isset($data['result']) ? $data['result'] : []; | ||
23 | +} | ||
0 | \ No newline at end of file | 24 | \ No newline at end of file |
trunk/Message/message后台独立功能/list.php
0 → 100644
1 | +<?php | ||
2 | + require "function.php"; | ||
3 | + | ||
4 | + $url = "http://localhost.vchangyi.org/E92B06237F00000150F5A2266E14186D/Message/Apicp/Message/Message/list"; | ||
5 | + | ||
6 | + $page = isset($_GET['page']) ? $_GET['page'] : 1; | ||
7 | + | ||
8 | + | ||
9 | + $postData = $_GET; | ||
10 | + $postData['page'] = $page; | ||
11 | + | ||
12 | + | ||
13 | + $message_list = curlPost($url,$postData); | ||
14 | +?> | ||
15 | + | ||
16 | +<!DOCTYPE html> | ||
17 | +<html lang="en"> | ||
18 | +<head> | ||
19 | + <meta charset="UTF-8"> | ||
20 | + <title>留言列表</title> | ||
21 | + <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script> | ||
22 | + | ||
23 | + <style type="text/css"> | ||
24 | + table{ | ||
25 | + width: 300px; | ||
26 | + margin: 30px auto; | ||
27 | + border-spacing: 0px; | ||
28 | + border-collapse: 0px; | ||
29 | + border: solid #fff 1px | ||
30 | + } | ||
31 | + table tr td{ | ||
32 | + border: solid #000 1px | ||
33 | + } | ||
34 | + form{ | ||
35 | + width: 300px; | ||
36 | + margin: 20px auto; | ||
37 | + } | ||
38 | + </style> | ||
39 | + | ||
40 | + <script type="text/javascript"> | ||
41 | + function search() | ||
42 | + { | ||
43 | + key = ''; | ||
44 | + key = $('#select_id option:selected').val(); | ||
45 | + | ||
46 | + value = $('#input_id').val(); | ||
47 | + | ||
48 | + url = "http://127.0.0.1/message/list" + "?" + key + "=" + value; | ||
49 | + // url = "http://127.0.0.1/message/listajax" + "?" + key + "=" + value; | ||
50 | + | ||
51 | + window.location.href=url; | ||
52 | + | ||
53 | + //location.reload(url) | ||
54 | + console.log(url); | ||
55 | + | ||
56 | + // $.ajax({ | ||
57 | + // url:url, | ||
58 | + // type:"get", | ||
59 | + // dataType:"text", | ||
60 | + // success:function(data){ | ||
61 | + | ||
62 | + // $('#tab > tbody').html(data); | ||
63 | + // console.log(data); | ||
64 | + // // console.log('ok'); | ||
65 | + // } | ||
66 | + // }) | ||
67 | + } | ||
68 | + </script> | ||
69 | +</head> | ||
70 | +<body> | ||
71 | + <h4 align="center">留言列表</h4> | ||
72 | + <form> | ||
73 | + <select id='select_id'> | ||
74 | + <option value="name">姓名</option> | ||
75 | + <option value="sex">性别</option> | ||
76 | + <option value="mobile">手机号</option> | ||
77 | + <option value="email">邮箱</option> | ||
78 | + <option value="title">标题</option> | ||
79 | + </select> | ||
80 | + <input id="input_id" type="text"> | ||
81 | + <input type="button" onclick="search()" name="" value="搜索"> | ||
82 | + </form> | ||
83 | + | ||
84 | + <table id="tab"> | ||
85 | + <thead> | ||
86 | + <tr> <td>ID</td> <td>标题</td> <td>留言</td><td>操作</td> </tr> | ||
87 | + </thead> | ||
88 | + <tbody> | ||
89 | + <?php | ||
90 | + if ($message_list) { | ||
91 | + foreach ($message_list as $key => $message) { | ||
92 | + echo "<tr> <td>{$message['message_id']}</td> <td>{$message['title']}</td> <td>{$message['message']}</td><td><a href= 'del?message_id={$message['message_id']}'>删除</a>|<a href= 'detail?message_id={$message['message_id']}'>详情</a></td></tr>"; | ||
93 | + } | ||
94 | + } | ||
95 | + ?> | ||
96 | + </tbody> | ||
97 | + </table> | ||
98 | +</body> | ||
99 | +</html> | ||
0 | \ No newline at end of file | 100 | \ No newline at end of file |
trunk/Message/message后台独立功能/listajax.php
0 → 100644
1 | +<?php | ||
2 | + require "function.php"; | ||
3 | + | ||
4 | + $url = "http://localhost.vchangyi.org/E92B06237F00000150F5A2266E14186D/Message/Apicp/Message/Message/search"; | ||
5 | + | ||
6 | + $conds = []; | ||
7 | + $conds = $_GET; | ||
8 | + | ||
9 | + $message_list = curlPost($url,$conds); | ||
10 | + | ||
11 | + | ||
12 | + $tbody = ''; | ||
13 | + | ||
14 | + if ($message_list) { | ||
15 | + foreach ($message_list as $key => $message) { | ||
16 | + $tbody .= "<tr> <td>{$message['message_id']}</td> <td>{$message['title']}</td> <td>{$message['message']}</td><td><a href= 'del?message_id={$message['message_id']}'>删除</a>|<a href= 'detail?message_id={$message['message_id']}'>详情</a></td></tr>"; | ||
17 | + } | ||
18 | + } | ||
19 | + | ||
20 | + return $tbody; | ||
21 | +?> | ||
0 | \ No newline at end of file | 22 | \ No newline at end of file |
trunk/Message/message后台独立功能/login.php
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html lang="en"> | ||
3 | +<head> | ||
4 | + <meta charset="UTF-8"> | ||
5 | + <title>登录</title> | ||
6 | + <style> | ||
7 | + #login_form{ | ||
8 | + width: 300px; | ||
9 | + height: 300px; | ||
10 | + margin: 200px auto ; | ||
11 | + } | ||
12 | + </style> | ||
13 | + | ||
14 | + <!-- 新 Bootstrap 核心 CSS 文件 --> | ||
15 | + <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> | ||
16 | + | ||
17 | + <!-- 可选的Bootstrap主题文件(一般不使用) --> | ||
18 | + <script src="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"></script> | ||
19 | + | ||
20 | + <!-- jQuery文件。务必在bootstrap.min.js 之前引入 --> | ||
21 | + <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script> | ||
22 | + | ||
23 | + <!-- 最新的 Bootstrap 核心 JavaScript 文件 --> | ||
24 | + <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | ||
25 | +</head> | ||
26 | +<body> | ||
27 | + <form id="login_form" action="http://localhost.vchangyi.org/E92B06237F00000150F5A2266E14186D/Message/Api/Person/Login/Login" method="post" > | ||
28 | + 用户名<input name="name" placeholder="用户名" required><br><br> | ||
29 | + 密 码<input name="pwd" placeholder="密码" type="password" required><br> | ||
30 | + | ||
31 | + <input type="submit" value="登录"> | ||
32 | + </form> | ||
33 | +</body> | ||
34 | +</html> | ||
0 | \ No newline at end of file | 35 | \ No newline at end of file |