123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- package http
- import (
- "time"
- "go-common/library/ecode"
- "go-common/library/log"
- bm "go-common/library/net/http/blademaster"
- )
- func archiveIncome(c *bm.Context) {
- v := new(struct {
- Type int `form:"type"`
- Page int `form:"page" default:"1" validate:"min=1"`
- Size int `form:"size" default:"20" validate:"min=1"`
- All int `form:"all" default:"0"`
- })
- if err := c.Bind(v); err != nil {
- return
- }
- midI, ok := c.Get("mid")
- if !ok {
- c.JSON(nil, ecode.NoLogin)
- return
- }
- mid, _ := midI.(int64)
- data, err := svc.ArchiveIncome(c, mid, v.Type, v.Page, v.Size, v.All)
- if err != nil {
- log.Error("growup svc.ArchiveIncome error(%v)", err)
- c.JSON(nil, err)
- return
- }
- c.JSON(data, nil)
- }
- func upSummary(c *bm.Context) {
- midI, ok := c.Get("mid")
- if !ok {
- c.JSON(nil, ecode.NoLogin)
- return
- }
- mid, _ := midI.(int64)
- data, err := svc.UpSummary(c, mid)
- if err != nil {
- log.Error("growup svc.UpSummary error(%v)", err)
- c.JSON(nil, err)
- return
- }
- c.JSON(data, nil)
- }
- func archiveSummary(c *bm.Context) {
- v := new(struct {
- Type int `form:"type"`
- })
- if err := c.Bind(v); err != nil {
- return
- }
- midI, ok := c.Get("mid")
- if !ok {
- c.JSON(nil, ecode.NoLogin)
- return
- }
- mid, _ := midI.(int64)
- data, err := svc.ArchiveSummary(c, v.Type, mid)
- if err != nil {
- log.Error("growup svc.ArchiveSummary error(%v)", err)
- c.JSON(nil, err)
- return
- }
- c.JSON(data, nil)
- }
- func archiveDetail(c *bm.Context) {
- v := new(struct {
- Type int `form:"type"`
- ArchiveID int64 `form:"archive_id" validate:"required"`
- })
- if err := c.Bind(v); err != nil {
- return
- }
- data, err := svc.ArchiveDetail(c, v.Type, v.ArchiveID)
- if err != nil {
- log.Error("growup svc.ArchiveDetail error(%v)", err)
- c.JSON(nil, err)
- return
- }
- c.JSON(data, nil)
- }
- func archiveBreach(c *bm.Context) {
- v := new(struct {
- Type int `form:"type"`
- Page int `form:"page" default:"1" validate:"min=1"`
- Size int `form:"size" default:"20" validate:"min=1"`
- All int `form:"all" default:"0"`
- })
- if err := c.Bind(v); err != nil {
- return
- }
- midI, ok := c.Get("mid")
- if !ok {
- c.JSON(nil, ecode.NoLogin)
- return
- }
- mid, _ := midI.(int64)
- data, err := svc.ArchiveBreach(c, mid, v.Type, v.Page, v.Size, v.All)
- if err != nil {
- log.Error("growup svc.ArchiveBreach error(%v)", err)
- c.JSON(nil, err)
- return
- }
- c.JSON(data, nil)
- }
- func upIncomeStat(c *bm.Context) {
- v := new(struct {
- Type int `form:"type"`
- })
- if err := c.Bind(v); err != nil {
- return
- }
- midI, ok := c.Get("mid")
- if !ok {
- c.JSON(nil, ecode.NoLogin)
- return
- }
- mid, _ := midI.(int64)
- data, err := svc.UpIncomeStat(c, v.Type, mid, time.Now())
- if err != nil {
- log.Error("growup svc.UpIncomeStat error(%v)", err)
- c.JSON(nil, err)
- return
- }
- c.JSON(data, nil)
- }
|