|
|
|
@ -1,9 +1,6 @@
|
|
|
|
|
package user
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
"github.com/golangkit/formatime"
|
|
|
|
|
"github.com/shopspring/decimal"
|
|
|
|
|
"recook/internal/dbc"
|
|
|
|
|
user3 "recook/internal/model/user"
|
|
|
|
|
"recook/internal/v2/lib/back"
|
|
|
|
@ -12,45 +9,19 @@ import (
|
|
|
|
|
"recook/internal/v2/model/http/profile"
|
|
|
|
|
"recook/tools"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
"github.com/golangkit/formatime"
|
|
|
|
|
"github.com/shopspring/decimal"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Income struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//// @Style 获取会员收益
|
|
|
|
|
//func (i *Income) Income(c *gin.Context) {
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// income := user.IncomeLogic.Income(userId)
|
|
|
|
|
// back.Suc(c, "获取成功", income)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
// @Style 累计收益
|
|
|
|
|
//func (i *Income) Accumulate(c *gin.Context) {
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// accumulate := user.IncomeLogic.Accumulate(userId)
|
|
|
|
|
// back.Suc(c, "获取成功", accumulate)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
type argsMonthIncome struct {
|
|
|
|
|
Year int `json:"year" form:"year"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//// @Style 年度月收益
|
|
|
|
|
//func (i *Income) MonthIncome(c *gin.Context) {
|
|
|
|
|
// args := argsMonthIncome{}
|
|
|
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
|
|
|
// back.Fail(c, err.Error())
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// if args.Year <= 0 {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// accumulate := user.IncomeLogic.MonthIncome(userId, args.Year)
|
|
|
|
|
// back.Suc(c, "获取成功", accumulate)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
// PurchaseAccumulate @Style 累计自购收益
|
|
|
|
|
func (i *Income) PurchaseAccumulate(c *gin.Context) {
|
|
|
|
|
userId, _ := common.GetAppUserId(c)
|
|
|
|
@ -86,259 +57,14 @@ type argsDayIncome struct {
|
|
|
|
|
Month string `json:"month" form:"month"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//// @Style 月份每日收益
|
|
|
|
|
//func (i *Income) DayIncome(c *gin.Context) {
|
|
|
|
|
// args := argsDayIncome{}
|
|
|
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
|
|
|
// back.Fail(c, err.Error())
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// if args.Month == "" {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// monthObj, err := time.ParseInLocation("2006-01", args.Month, time.Local)
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// month, _ := strconv.Atoi(monthObj.Format("200601"))
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// accumulate := user.IncomeLogic.DayIncome(userId, month)
|
|
|
|
|
// back.Suc(c, "获取成功", accumulate)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
//// @Style 团队收益
|
|
|
|
|
//func (i *Income) TeamIncome(c *gin.Context) {
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// teamIncome := user.IncomeLogic.TeamIncome(userId)
|
|
|
|
|
// back.Suc(c, "获取成功", teamIncome)
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//// @Style 推荐收益
|
|
|
|
|
//func (i *Income) RecommendIncome(c *gin.Context) {
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// recommendIncome := user.IncomeLogic.RecommendIncome(userId)
|
|
|
|
|
// back.Suc(c, "获取成功", recommendIncome)
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//// @Style 平台奖励收益
|
|
|
|
|
//func (i *Income) RewardIncome(c *gin.Context) {
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// rewardIncome := user.IncomeLogic.RewardIncome(userId)
|
|
|
|
|
// back.Suc(c, "获取成功", rewardIncome)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
type argsMonth struct {
|
|
|
|
|
Month string `json:"month" form:"month"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
//// @Style 团队月收益
|
|
|
|
|
//func (i *Income) TeamMonthIncome(c *gin.Context) {
|
|
|
|
|
// args := argsMonth{}
|
|
|
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
|
|
|
// back.Fail(c, err.Error())
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// if args.Month == "" {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// monthObj, err := time.ParseInLocation("2006-01", args.Month, time.Local)
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// month, _ := strconv.Atoi(monthObj.Format("200601"))
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// teamIncome := user.IncomeLogic.TeamMonthIncome(userId, month)
|
|
|
|
|
// back.Suc(c, "获取成功", teamIncome)
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//// @Style 月推荐收益
|
|
|
|
|
//func (i *Income) RecommendMonthIncome(c *gin.Context) {
|
|
|
|
|
// args := argsMonth{}
|
|
|
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
|
|
|
// back.Fail(c, err.Error())
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// if args.Month == "" {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// monthObj, err := time.ParseInLocation("2006-01", args.Month, time.Local)
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// month, _ := strconv.Atoi(monthObj.Format("200601"))
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// teamIncome := user.IncomeLogic.RecommendMonthIncome(userId, month)
|
|
|
|
|
// back.Suc(c, "获取成功", teamIncome)
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//// @Style 月平台奖励收益
|
|
|
|
|
//func (i *Income) RewardMonthIncome(c *gin.Context) {
|
|
|
|
|
// args := argsMonth{}
|
|
|
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
|
|
|
// back.Fail(c, err.Error())
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// if args.Month == "" {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// monthObj, err := time.ParseInLocation("2006-01", args.Month, time.Local)
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// month, _ := strconv.Atoi(monthObj.Format("200601"))
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// teamIncome := user.IncomeLogic.RewardMonthIncome(userId, month)
|
|
|
|
|
// back.Suc(c, "获取成功", teamIncome)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
type argsDayIncomes struct {
|
|
|
|
|
Day string `json:"day" form:"day"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
//// @Style 日收益详情
|
|
|
|
|
//func (i *Income) DayIncomes(c *gin.Context) {
|
|
|
|
|
// args := argsDayIncomes{}
|
|
|
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
|
|
|
// back.Fail(c, err.Error())
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// if args.Day == "" {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// dayObj, err := time.ParseInLocation("2006-01-02", args.Day, time.Local)
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// day, _ := strconv.Atoi(dayObj.Format("20060102"))
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// resule := user.IncomeLogic.DayIncomes(userId, day)
|
|
|
|
|
// back.Suc(c, "操作成功", resule)
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//// @Style 月收益详情
|
|
|
|
|
//func (i *Income) MonthIncomes(c *gin.Context) {
|
|
|
|
|
// args := argsMonth{}
|
|
|
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
|
|
|
// back.Fail(c, err.Error())
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// if args.Month == "" {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// monthObj, err := time.ParseInLocation("2006-01", args.Month, time.Local)
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// month, _ := strconv.Atoi(monthObj.Format("200601"))
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// resule := user.IncomeLogic.MonthIncomes(userId, month)
|
|
|
|
|
// back.Suc(c, "操作成功", resule)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//// @Style 日自购/导购预估收益
|
|
|
|
|
//func (i *Income) DayExpect(c *gin.Context) {
|
|
|
|
|
// args := argsDayIncomes{}
|
|
|
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
|
|
|
// back.Fail(c, err.Error())
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// if args.Day == "" {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// dayObj, err := time.ParseInLocation("2006-01-02", args.Day, time.Local)
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// day, _ := strconv.Atoi(dayObj.Format("20060102"))
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// resule := user.IncomeLogic.DayExpect(userId, day)
|
|
|
|
|
// back.Suc(c, "操作成功", resule)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
// @Style 月自购/导购预估收益
|
|
|
|
|
//func (i *Income) MonthExpect(c *gin.Context) {
|
|
|
|
|
// args := argsMonth{}
|
|
|
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
|
|
|
// back.Fail(c, err.Error())
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// if args.Month == "" {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// monthObj, err := time.ParseInLocation("2006-01", args.Month, time.Local)
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// month, _ := strconv.Atoi(monthObj.Format("200601"))
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// resule := user.IncomeLogic.MonthExpect(userId, month)
|
|
|
|
|
// back.Suc(c, "操作成功", resule)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
//// @Style 日团队预估收益
|
|
|
|
|
//func (i *Income) DayExpectTeam(c *gin.Context) {
|
|
|
|
|
// args := argsDayIncomes{}
|
|
|
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
|
|
|
// back.Fail(c, err.Error())
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// if args.Day == "" {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// dayObj, err := time.ParseInLocation("2006-01-02", args.Day, time.Local)
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// day, _ := strconv.Atoi(dayObj.Format("20060102"))
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// resule := user.IncomeLogic.DayExpectTeam(userId, day)
|
|
|
|
|
// back.Suc(c, "操作成功", resule)
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//// @Style 月团队预估收益
|
|
|
|
|
//func (i *Income) MonthExpectTeam(c *gin.Context) {
|
|
|
|
|
// args := argsMonth{}
|
|
|
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
|
|
|
// back.Fail(c, err.Error())
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// if args.Month == "" {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// monthObj, err := time.ParseInLocation("2006-01", args.Month, time.Local)
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// back.Fail(c, "参数错误")
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// month, _ := strconv.Atoi(monthObj.Format("200601"))
|
|
|
|
|
// userId, _ := common.GetAppUserId(c)
|
|
|
|
|
// resule := user.IncomeLogic.MonthExpectTeam(userId, month)
|
|
|
|
|
// back.Suc(c, "操作成功", resule)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
type respIncomeHistory struct {
|
|
|
|
|
Total decimal.Decimal `json:"total"`
|
|
|
|
|
Purchase decimal.Decimal `json:"purchase"`
|
|
|
|
@ -455,34 +181,3 @@ func (i *Income) IncomeDetail(c *gin.Context) {
|
|
|
|
|
}
|
|
|
|
|
back.Suc(c, "操作成功", result)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// IncomeTeamNotRecvDetail 团队月未到账详情.
|
|
|
|
|
//func (i *Income) IncomeTeamNotRecvDetail(c *gin.Context) {
|
|
|
|
|
//
|
|
|
|
|
// uid, _ := common.GetAppUserId(c)
|
|
|
|
|
//
|
|
|
|
|
// var args strict2.TeamDetailReq
|
|
|
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
|
|
|
// back.Fail(c, err.Error())
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// args.UID = uid
|
|
|
|
|
// result := user.IncomeLogic.TeamIncomeDetailOfMonth(&args)
|
|
|
|
|
//
|
|
|
|
|
// back.Suc(c, "操作成功", result)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
// IncomeTeamDetail 团队到账详情.
|
|
|
|
|
//func (i *Income) IncomeTeamDetail(c *gin.Context) {
|
|
|
|
|
//
|
|
|
|
|
// uid, _ := common.GetAppUserId(c)
|
|
|
|
|
// var args strict2.TeamDetailReq
|
|
|
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
|
|
|
// back.Fail(c, err.Error())
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// args.UID = uid
|
|
|
|
|
// result := user.IncomeLogic.TeamIncomeDetailOfYear(&args)
|
|
|
|
|
//
|
|
|
|
|
// back.Suc(c, "操作成功", result)
|
|
|
|
|
//}
|
|
|
|
|