-
Notifications
You must be signed in to change notification settings - Fork 0
/
path.go
61 lines (58 loc) · 1.85 KB
/
path.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package web
import (
"base"
"github.com/go-martini/martini"
"github.com/martini-contrib/binding"
"github.com/martini-contrib/render"
)
// 网址设置
func Path(m *martini.ClassicMartini, p string) {
// 手机、密码登录
m.Post(p+"login", binding.Bind(Captcha{}), CaptchaCheck,
UserLogin)
// 用户注册
m.Post(p+"register", binding.Bind(Captcha{}), CaptchaCheck,
UserRegister)
// 获取用户信息
m.Get(p+"login", AuthJson, UserGet)
// 用户登出
m.Get(p+"logout", Authorize, LogNew("登出"), UserLogout)
// 修改密码
m.Post(p+"password", AuthJson, LogNew("修改密码"),
binding.Bind(Password{}), UserPassword)
// 日志查询
m.Post(p+"logs", AuthJson, binding.Bind(base.Params{}), LogQuery)
// 验证码
m.Get(p+"captcha/img/:id", CaptchaImage)
// 刷新验证码
m.Get(p+"captcha/reload/:id", CaptchaReload)
// 用户反馈
m.Post(p+"post", AuthJson, binding.Bind(Post{}), PostNew)
// 历史反馈查询
m.Post(p+"postq", AuthJson, binding.Bind(base.Params{}), PostQuery2)
// 用户读取
m.Get(p+"post/:id", AuthJson, PostRead)
}
// 客服网址
func CsPath(m *martini.ClassicMartini, p string) {
// 客服
m.Get(p, func(r render.Render) {
r.HTML(200, "cs", PageNew("客户服务", true))
})
// 查询用户列表
m.Post(p+"/users", ManagerJson, binding.Bind(base.Params{}), UserQuery)
// 查询会话列表
m.Post(p+"/session", ManagerJson, binding.Bind(base.Params{}),
SessionQuery)
// 删除会话
m.Delete(p+"/session/:id", ManagerJson, LogNew("会话删除"),
SessionRemove)
// 查询用户反馈列表
m.Post(p+"/post", ManagerJson, binding.Bind(base.Params{}), PostQuery)
// 反馈修改
m.Put(p+"/post", ManagerJson, binding.Bind(Post{}), PostUpdate)
// 删除反馈
m.Delete(p+"/post/:id", ManagerJson, PostRemove)
// 日志列表
m.Post(p+"/logs/:oid", ManagerJson, binding.Bind(base.Params{}), LogList)
}