diff --git a/cv/invite_cv/invite_apply.go b/cv/invite_cv/invite_apply.go index 94afd60e412a80feb3f946e8ddefeeeb7302c815..4e37bd13db3258f7d4d6ab983234ad9c3ac417d3 100644 --- a/cv/invite_cv/invite_apply.go +++ b/cv/invite_cv/invite_apply.go @@ -31,3 +31,12 @@ type InviteApplyNumRes struct { Type int `json:"type"` // 1.已申请2.待审核3.已通过4.已拒绝" Num int `json:"num"` } + +type AgentPeriod struct { + Week []AgentPeriodWeek `json:"week"` +} + +type AgentPeriodWeek struct { + StartDate string `json:"startDate"` + EndDate string `json:"endDate"` +} diff --git a/route/invite_r/party_invite.go b/route/invite_r/party_invite.go index 5201452bfe278797e712f7cab339aca844f784bd..2eef8e61ec9f392c586272d5b4a757cc3ecc2dfb 100644 --- a/route/invite_r/party_invite.go +++ b/route/invite_r/party_invite.go @@ -5,6 +5,7 @@ import ( "git.hilo.cn/hilo-common/mycontext" "git.hilo.cn/hilo-common/utils" "github.com/gin-gonic/gin" + "github.com/jinzhu/now" "hilo-user/cv/invite_cv" "hilo-user/domain/cache/user_c" "hilo-user/domain/model/invite_m" @@ -215,7 +216,7 @@ func InviteApplyList(c *gin.Context) (*mycontext.MyContext, error) { return myCtx, nil } -// @tags 推广团队管理 +// @tags 新人邀请 // @Summary 平台列表 // @Success 200 {object} []string // @Router /v2/user/invite/platform [get] @@ -224,3 +225,22 @@ func PromotionPlatform(c *gin.Context) (*mycontext.MyContext, error) { resp.ResponseOk(c, []string{"Falla", "Yalla", "Whisper", "Ahlan", "Mashi", "YoYo", "Yoho", "Echo", "Hawa", "Yalla Ludo", "Hafla"}) return myCtx, nil } + +// @Tags 新人邀请 +// @Summary 查询周期 +// @Success 200 {object} invite_cv.AgentPeriod +// @Router /v2/user/invite/period [get] +func AgentPeriod(c *gin.Context) (*mycontext.MyContext, error) { + myCtx := mycontext.CreateMyContext(c.Keys) + var response invite_cv.AgentPeriod + week := now.BeginningOfWeek().AddDate(0, 0, 1) // 周一开始 + for i := 0; i < 12; i++ { + response.Week = append(response.Week, invite_cv.AgentPeriodWeek{ + StartDate: week.Format("2006-01-02"), + EndDate: week.AddDate(0, 0, 6).Format("2006-01-02"), + }) + week = week.AddDate(0, 0, -7) + } + resp.ResponseOk(c, response) + return myCtx, nil +} diff --git a/route/router.go b/route/router.go index 39cdfc150470193c924fa03fc571e7c87d0f3f10..040479a1fee2c729fbbd59581d4e985b89ed1c5d 100755 --- a/route/router.go +++ b/route/router.go @@ -58,6 +58,7 @@ func InitRouter() *gin.Engine { userV2.POST("/invite/apply", wrapper(invite_r.InviteApply)) userV2.GET("/invite/apply", wrapper(invite_r.InviteApplyList)) userV2.GET("/invite/platform", wrapper(invite_r.PromotionPlatform)) + userV2.GET("/invite/period", wrapper(invite_r.AgentPeriod)) } inner := r.Group("/inner") inner.Use(ExceptionHandle, LoggerHandle)