Commit 2af6df67 authored by chenweijian's avatar chenweijian

派对邀请

parent 5d5848dc
......@@ -13,6 +13,7 @@ type CvUserLevel struct {
type InviteApplyRes struct {
List []*InviteApply `json:"list"`
NumList []*InviteApplyNumRes `json:"numList"`
MyCode string `json:"myCode"`
}
type InviteApply struct {
......
......@@ -31,4 +31,6 @@ var (
CpHaveCancelNoDeal = myerr.NewBusinessCode(50121, "You have a cancel apply", myerr.BusinessData{}) // 有接触申请需要处理
InviteApplyNoPermission = myerr.NewBusinessCode(50122, "This user does not have invitation permission", myerr.BusinessData{}) // 该用户没有邀请权限
InviteApplyAlreadyInvited = myerr.NewBusinessCode(50123, "Already invited by someone else", myerr.BusinessData{}) // 已经被别人邀请了
InviteApplyCodeInvalid = myerr.NewBusinessCode(50124, "user id invalid", myerr.BusinessData{}) // 邀请人用户id错误
InviteApplyNewCodeInvalid = myerr.NewBusinessCode(50125, "user id invalid", myerr.BusinessData{}) // 被邀请人用户id错误
)
......@@ -65,12 +65,12 @@ func InviteApply(c *gin.Context) (*mycontext.MyContext, error) {
newUser, err := user_m.GetUserByCode(model, param.NewUserCode)
if err != nil {
model.Log.Errorf("InviteApply param:%v", param)
return myCtx, err
return myCtx, bizerr.InviteApplyNewCodeInvalid
}
user, err := user_m.GetUserByCode(model, param.UserCode)
if err != nil {
model.Log.Errorf("InviteApply param:%v", param)
return myCtx, err
return myCtx, bizerr.InviteApplyCodeInvalid
}
if newUser.ID == 0 || user.ID == 0 {
model.Log.Errorf("InviteApply param:%v", param)
......@@ -169,6 +169,11 @@ func InviteApplyList(c *gin.Context) (*mycontext.MyContext, error) {
}
if param.Type == 0 { // 返回所有Type类型有多少条数
user, err := user_c.GetUserTinyById(model, userId)
if err != nil {
model.Log.Errorf("GetApplyList param:%v, err:%v", param, err)
return myCtx, bizerr.InvalidParameter
}
numList := make([]*invite_cv.InviteApplyNumRes, 0, 4)
for _, gType := range []int{1, 2, 3, 4} { // 1.已申请2.待审核3.已通过4.已拒绝
num, err := invite_m.GetInviteApplyNumByType(model, gType, param.BeginTime, param.EndTime, agentIds)
......@@ -177,7 +182,7 @@ func InviteApplyList(c *gin.Context) (*mycontext.MyContext, error) {
}
numList = append(numList, &invite_cv.InviteApplyNumRes{Type: gType, Num: num})
}
resp.ResponsePageOk(c, &invite_cv.InviteApplyRes{NumList: numList}, 0, 0, 0)
resp.ResponsePageOk(c, &invite_cv.InviteApplyRes{NumList: numList, MyCode: user.Code}, 0, 0, 0)
return myCtx, nil
}
......
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