-
Notifications
You must be signed in to change notification settings - Fork 30
/
base.go
57 lines (44 loc) · 1.25 KB
/
base.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
package gkuser
import (
"crypto/md5"
"strconv"
"time"
"encoding/hex"
"github.com/ecdiy/itgeek/gk/ws"
)
func Token(id int64) string {
h := md5.New()
ids := strconv.FormatInt(id, 10)
h.Write([]byte(ids + ";" + strconv.FormatInt(time.Now().UnixNano(), 16)))
tk := hex.EncodeToString(h.Sum(nil))
return ids + "_" + tk
}
func InitWeb() {
post := func(url string, fun func(web *ws.Web)) {
ws.WebPost("/api/gk-user"+url, func(web *ws.Web) {
ws.Verify(web.Context)
fun(web)
})
}
auth := func(url string, fun func(auth *ws.Web)) {
ws.WebAuth("/api/gk-user"+url, fun)
}
//xgin.SpAjax(base.IsDevEnv(), "/sp", db, web, UserFilter, "Sp")
post("/site", WebSite)
ws.WebGin.GET("/api/gk-user/Captcha", Captcha)
post("/CaptchaNew", CaptchaNew)
post("/Register", WebUserRegister)
post("/Login", WebUserLogin)
post("/CountInfo", CountInfo)
post("/memberInfo", WebMemberInfo)
auth("/setting/save", WebSettingSave)
auth("/setting/get", WebSettingGet)
auth("/setting/upPass", WebSettingUpPass)
auth("/LoginAwardStatus", WebScoreLoginAwardStatus)
auth("/LoginAwardDo", WebScoreLoginAwardDo)
auth("/scoreLogList", WebScoreLogList)
auth("/msgList", WebMsgList)
auth("/msgDel", WebMsgDel)
auth("/msgRead", WebMsgRead)
post("/topDau", WebTopDau)
}