You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
264 lines
6.2 KiB
264 lines
6.2 KiB
package user
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"recook/internal/libs/bean"
|
|
"recook/internal/v2/lib/back"
|
|
"recook/internal/v2/lib/common"
|
|
"recook/internal/v2/logic/app/user"
|
|
"recook/tools"
|
|
)
|
|
|
|
type Info struct {
|
|
}
|
|
|
|
//
|
|
//// @Style 获取会员收益
|
|
//func (i *Info) Income(c *gin.Context) {
|
|
// userId, _ := common.GetAppUserId(c)
|
|
// income := user.IncomeLogic.Income(userId)
|
|
// back.Suc(c, "获取成功", income)
|
|
//}
|
|
|
|
func (i *Info) Balance(c *gin.Context) {
|
|
|
|
}
|
|
|
|
type argsUpdate struct {
|
|
TeacherWechatNo string `json:"teacherWechatNo" form:"teacherWechatNo"`
|
|
}
|
|
|
|
// @Style 会员信息修改
|
|
func (i *Info) Update(c *gin.Context) {
|
|
args := argsUpdate{}
|
|
if err := tools.ParseParams(&args, c); err != nil {
|
|
back.Fail(c, err.Error())
|
|
return
|
|
}
|
|
userId, _ := common.GetAppUserId(c)
|
|
if err := user.InfoLogic.Update(userId, map[string]interface{}{
|
|
"teacher_wechat_no": args.TeacherWechatNo,
|
|
}); err != nil {
|
|
back.Fail(c, err.Error())
|
|
return
|
|
}
|
|
|
|
back.Suc(c, "更新成功", nil)
|
|
}
|
|
|
|
type keyword struct {
|
|
Keyword string `json:"keyword" form:"keyword"`
|
|
}
|
|
|
|
//
|
|
//// @Style 我的团队
|
|
//func (i *Info) Team(c *gin.Context) {
|
|
// args := keyword{}
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
// back.Fail(c, err.Error())
|
|
// return
|
|
// }
|
|
// userId, _ := common.GetAppUserId(c)
|
|
// result := user.InfoLogic.Team(userId, args.Keyword)
|
|
//
|
|
// back.Suc(c, "操作成功", result)
|
|
//}
|
|
|
|
//// @Style 我的推荐
|
|
//func (i *Info) Recommend(c *gin.Context) {
|
|
// args := keyword{}
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
// back.Fail(c, err.Error())
|
|
// return
|
|
// }
|
|
// userId, _ := common.GetAppUserId(c)
|
|
// result := user.InfoLogic.Recommend(userId, args.Keyword)
|
|
//
|
|
// back.Suc(c, "操作成功", result)
|
|
//}
|
|
|
|
//// @Style 我的奖励
|
|
//func (i *Info) Reward(c *gin.Context) {
|
|
// args := keyword{}
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
// back.Fail(c, err.Error())
|
|
// return
|
|
// }
|
|
// userId, _ := common.GetAppUserId(c)
|
|
// result := user.InfoLogic.Reward(userId, args.Keyword)
|
|
//
|
|
// back.Suc(c, "操作成功", result)
|
|
//}
|
|
|
|
type argsRecommendDiamond struct {
|
|
UserId uint `json:"userId" form:"userId"`
|
|
}
|
|
|
|
//// @Style 推荐钻石
|
|
//func (i *Info) RecommendDiamond(c *gin.Context) {
|
|
// args := argsRecommendDiamond{}
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
// back.Fail(c, err.Error())
|
|
// return
|
|
// }
|
|
// if args.UserId == 0 {
|
|
// back.Fail(c, "参数错误")
|
|
// return
|
|
// }
|
|
// userId, _ := common.GetAppUserId(c)
|
|
// if err := user.InfoLogic.RecommendDiamond(userId, args.UserId); err != nil {
|
|
// back.Fail(c, err.Error())
|
|
// return
|
|
// }
|
|
//
|
|
// back.Suc(c, "操作成功", nil)
|
|
//}
|
|
|
|
// @Style 会员店铺变动信息
|
|
//func (i *Info) Lottery(c *gin.Context) {
|
|
// userId, _ := common.GetAppUserId(c)
|
|
// deviceType := cache.GetDeviceType(c)
|
|
// result := user.InfoLogic.Lottery(userId, deviceType)
|
|
//
|
|
// back.Suc(c, "操作成功", result)
|
|
//}
|
|
|
|
//// @Style 会员店铺变动信息
|
|
//func (i *Info) LotteryAgree(c *gin.Context) {
|
|
// userId, _ := common.GetAppUserId(c)
|
|
// user.InfoLogic.LotteryAgree(userId)
|
|
//
|
|
// back.Suc(c, "操作成功", nil)
|
|
//}
|
|
|
|
type argsCheck struct {
|
|
Month string `json:"month" form:"month"`
|
|
}
|
|
|
|
//// @Style 考核信息
|
|
//func (i *Info) Check(c *gin.Context) {
|
|
// args := argsCheck{}
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
// back.Fail(c, err.Error())
|
|
// return
|
|
// }
|
|
// if args.Month == "" {
|
|
// back.Fail(c, "参数错误")
|
|
// return
|
|
// }
|
|
// monthTime, err := time.ParseInLocation("2006-01", args.Month, time.Local)
|
|
// if err != nil {
|
|
// back.Fail(c, "参数错误")
|
|
// return
|
|
// }
|
|
// month, _ := strconv.Atoi(monthTime.Format("200601"))
|
|
// userId, _ := common.GetAppUserId(c)
|
|
// result, err := user.InfoLogic.Check(userId, month)
|
|
// if err != nil {
|
|
// back.Fail(c, err.Error())
|
|
// return
|
|
// }
|
|
// back.Suc(c, "操作成功", result)
|
|
//}
|
|
|
|
type argsMemberInfo struct {
|
|
MemberId uint `json:"memberId" form:"memberId"`
|
|
}
|
|
|
|
// @Style 会员详情
|
|
//func (i *Info) MemberInfo(c *gin.Context) {
|
|
// args := argsMemberInfo{}
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
// back.Fail(c, err.Error())
|
|
// return
|
|
// }
|
|
// if args.MemberId == 0 {
|
|
// back.Fail(c, "会员编号不能为空")
|
|
// return
|
|
// }
|
|
// userId, _ := common.GetAppUserId(c)
|
|
// result, err := user.InfoLogic.MemberInfo(userId, args.MemberId)
|
|
// if err != nil {
|
|
// back.Fail(c, err.Error())
|
|
// return
|
|
// }
|
|
// back.Suc(c, "操作成功", result)
|
|
//}
|
|
|
|
type argsMemberUpdate struct {
|
|
MemberId uint `json:"memberId" form:"memberId"`
|
|
RemarkName string `json:"remarkName" form:"remarkName"`
|
|
}
|
|
|
|
//// @Style 会员详情更新
|
|
//func (i *Info) MemberUpdate(c *gin.Context) {
|
|
// args := argsMemberUpdate{}
|
|
// if err := tools.ParseParams(&args, c); err != nil {
|
|
// back.Fail(c, err.Error())
|
|
// return
|
|
// }
|
|
// if args.MemberId == 0 {
|
|
// back.Fail(c, "会员编号不能为空")
|
|
// return
|
|
// }
|
|
// userId, _ := common.GetAppUserId(c)
|
|
// err := user.InfoLogic.MemberUpdate(userId, args.MemberId, args.RemarkName)
|
|
// if err != nil {
|
|
// back.Fail(c, err.Error())
|
|
// return
|
|
// }
|
|
// back.Suc(c, "操作成功", nil)
|
|
//}
|
|
|
|
// IncomeData @Style 会员收益数据
|
|
func (i *Info) IncomeData(c *gin.Context) {
|
|
userId, _ := common.GetAppUserId(c)
|
|
result := user.InfoLogic.IncomeData(userId)
|
|
back.Suc(c, "操作成功", result)
|
|
}
|
|
|
|
type argsSecret struct {
|
|
Secret uint `json:"secret" form:"secret"`
|
|
}
|
|
|
|
// Secret 会员隐私
|
|
func (i *Info) Secret(c *gin.Context) {
|
|
args := argsSecret{}
|
|
if err := tools.ParseParams(&args, c); err != nil {
|
|
back.Fail(c, err.Error())
|
|
return
|
|
}
|
|
userId, _ := common.GetAppUserId(c)
|
|
err := user.InfoLogic.Secret(userId, args.Secret)
|
|
if err != nil {
|
|
back.Fail(c, err.Error())
|
|
return
|
|
}
|
|
back.Suc(c, "操作成功", nil)
|
|
}
|
|
|
|
// @Style 会员隐私
|
|
func (i *Info) Sale(c *gin.Context) {
|
|
userId, _ := common.GetAppUserId(c)
|
|
sale := user.InfoLogic.Sale(userId)
|
|
back.Suc(c, "操作成功", sale)
|
|
}
|
|
|
|
type showAllRes struct {
|
|
UserId uint `json:"user_id"`
|
|
Page bean.Page `json:"page"`
|
|
}
|
|
|
|
//展示图文视频列表
|
|
//func (i *Info) ShowAll(c *gin.Context) {
|
|
// var p showAllRes
|
|
// if err := tools.ParseParams(&p, c); err != nil {
|
|
// back.Fail(c, err.Error())
|
|
// return
|
|
// }
|
|
// if p.UserId <= 0 {
|
|
// back.Fail(c, "请传入正确user_id")
|
|
// }
|
|
// list, total := user.InfoLogic.ShowAllImageAndShort(p.UserId, p.Page)
|
|
//}
|