123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- package http
- import (
- "strconv"
- "go-common/app/admin/main/spy/model"
- "go-common/library/ecode"
- "go-common/library/log"
- bm "go-common/library/net/http/blademaster"
- )
- func userInfo(c *bm.Context) {
- var (
- params = c.Request.Form
- mid int64
- err error
- )
- mid, err = strconv.ParseInt(params.Get("mid"), 10, 64)
- if err != nil {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- data, err := spySrv.UserInfo(c, mid)
- if err != nil {
- log.Error("spySrv.UserInfo error(%v)", err)
- c.JSON(nil, err)
- return
- }
- c.JSON(data, err)
- }
- func historyPage(c *bm.Context) {
- var (
- params = c.Request.Form
- mid int64
- pn, ps int
- err error
- data *model.HistoryPage
- )
- mid, err = strconv.ParseInt(params.Get("mid"), 10, 64)
- if err != nil {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- if ps, err = strconv.Atoi(params.Get("ps")); err != nil {
- ps = model.DefPs
- }
- if pn, err = strconv.Atoi(params.Get("pn")); err != nil {
- pn = model.DefPn
- }
- q := &model.HisParamReq{Mid: mid, Pn: pn, Ps: ps}
- data, err = spySrv.HisoryPage(c, q)
- if err != nil {
- log.Error("spySrv.HisoryPage error(%v)", err)
- c.JSON(nil, err)
- return
- }
- c.JSON(data, err)
- }
- func resetBase(c *bm.Context) {
- var (
- params = c.Request.Form
- name = params.Get("name")
- mid int64
- err error
- )
- if name == "" {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- mid, err = strconv.ParseInt(params.Get("mid"), 10, 64)
- if err != nil {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- err = spySrv.ResetBase(c, mid, name)
- if err != nil {
- log.Error("spySrv.ResetBase error(%v)", err)
- c.JSON(nil, err)
- return
- }
- c.JSON(nil, err)
- }
- func refreshBase(c *bm.Context) {
- var (
- params = c.Request.Form
- name = params.Get("name")
- mid int64
- err error
- )
- if name == "" {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- mid, err = strconv.ParseInt(params.Get("mid"), 10, 64)
- if err != nil {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- err = spySrv.RefreshBase(c, mid, name)
- if err != nil {
- log.Error("spySrv.RefreshBase error(%v)", err)
- c.JSON(nil, err)
- return
- }
- c.JSON(nil, err)
- }
- func resetEvent(c *bm.Context) {
- var (
- params = c.Request.Form
- name = params.Get("name")
- mid int64
- err error
- )
- if name == "" {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- mid, err = strconv.ParseInt(params.Get("mid"), 10, 64)
- if err != nil {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- err = spySrv.ResetEvent(c, mid, name)
- if err != nil {
- log.Error("spySrv.ResetEvent error(%v)", err)
- c.JSON(nil, err)
- return
- }
- c.JSON(nil, err)
- }
- func clearCount(c *bm.Context) {
- var (
- params = c.Request.Form
- name = params.Get("name")
- mid int64
- err error
- )
- if name == "" {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- mid, err = strconv.ParseInt(params.Get("mid"), 10, 64)
- if err != nil {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- err = spySrv.ClearCount(c, mid, name)
- if err != nil {
- log.Error("spySrv.ClearCount error(%v)", err)
- c.JSON(nil, err)
- return
- }
- c.JSON(nil, err)
- }
|