Commit c3d71b31 authored by chenweijian's avatar chenweijian

派对邀请

parent 8194b74c
......@@ -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"`
}
......@@ -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
}
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment