Browse Source

update

master
dengbiao 3 months ago
parent
commit
5fc5d98aa3
2 changed files with 14 additions and 13 deletions
  1. +8
    -8
      rule/service_award_dividend/index.go
  2. +6
    -5
      rule/service_award_dividend/md/service_award_dividend.go

+ 8
- 8
rule/service_award_dividend/index.go View File

@@ -64,14 +64,14 @@ func JoinServiceAwardDividendRelation(eg *xorm.Engine, req md.JoinServiceAwardDi
if levelMap[user.Level].LevelWeight >= levelMap[parentUser.Level].LevelWeight {
for _, vv := range vipAllocationSetStruct {
if zhios_order_relate_utils.StrToInt(vv.FromVipId) == user.Level {
err = AutoAddVip(eg, user, req.ParentUid, vv, req.RegionId, req.CreateAt)
err = AutoAddVip(eg, user, req.ParentUid, vv, req.RegionId, req.CreateAt, req.AllocationNums)
if err != nil {
return err
}
}
}
} else {
err = AddVipToParent(eg, user, req.ParentUid, req.RegionId, req.CreateAt)
err = AddVipToParent(eg, user, req.ParentUid, req.RegionId, req.CreateAt, req.AllocationNums)
if err != nil {
return err
}
@@ -79,7 +79,7 @@ func JoinServiceAwardDividendRelation(eg *xorm.Engine, req md.JoinServiceAwardDi
} else {
for _, vv := range vipAllocationSetStruct {
if zhios_order_relate_utils.StrToInt(vv.FromVipId) == user.Level {
err = AutoAddVip(eg, user, req.ParentUid, vv, req.RegionId, req.CreateAt)
err = AutoAddVip(eg, user, req.ParentUid, vv, req.RegionId, req.CreateAt, req.AllocationNums)
if err != nil {
return err
}
@@ -91,7 +91,7 @@ func JoinServiceAwardDividendRelation(eg *xorm.Engine, req md.JoinServiceAwardDi
}

// AutoAddVip 自动添加会员
func AutoAddVip(engine *xorm.Engine, user *model.User, parentUid int, vipAllocationSetStruct md.VipAllocationSetStruct, regionId int, createAt string) (err error) {
func AutoAddVip(engine *xorm.Engine, user *model.User, parentUid int, vipAllocationSetStruct md.VipAllocationSetStruct, regionId int, createAt string, allocationNums int) (err error) {
//1、查询出当前应该分配给哪个上级会员
var serviceAwardDividendRelation models.ServiceAwardDividendRelation
var hasServiceAwardDividendRelation bool
@@ -128,7 +128,7 @@ func AutoAddVip(engine *xorm.Engine, user *model.User, parentUid int, vipAllocat
ParentUid: parentUid,
BindUid: 0,
VipLevel: user.Level,
AllocationNums: 0,
AllocationNums: allocationNums,
RegionId: regionId,
CreateAt: createAt,
UpdateAt: now.Format("2006-01-02 15:04:05"),
@@ -146,7 +146,7 @@ func AutoAddVip(engine *xorm.Engine, user *model.User, parentUid int, vipAllocat
ParentUid: parentUid,
BindUid: serviceAwardDividendRelation.Uid,
VipLevel: user.Level,
AllocationNums: 0,
AllocationNums: allocationNums,
RegionId: regionId,
CreateAt: createAt,
UpdateAt: now.Format("2006-01-02 15:04:05"),
@@ -171,7 +171,7 @@ func AutoAddVip(engine *xorm.Engine, user *model.User, parentUid int, vipAllocat
}

// AddVipToParent 添加会员至父级
func AddVipToParent(engine *xorm.Engine, user *model.User, parentUid int, regionId int, createAt string) (err error) {
func AddVipToParent(engine *xorm.Engine, user *model.User, parentUid int, regionId int, createAt string, allocationNums int) (err error) {
//1、查询出当前应该分配给哪个上级会员
var serviceAwardDividendRelation models.ServiceAwardDividendRelation
has, err := engine.Where("uid =?", parentUid).Get(&serviceAwardDividendRelation)
@@ -200,7 +200,7 @@ func AddVipToParent(engine *xorm.Engine, user *model.User, parentUid int, region
ParentUid: parentUid,
BindUid: serviceAwardDividendRelation.Uid,
VipLevel: user.Level,
AllocationNums: 0,
AllocationNums: allocationNums,
RegionId: regionId,
CreateAt: createAt,
UpdateAt: now.Format("2006-01-02 15:04:05"),


+ 6
- 5
rule/service_award_dividend/md/service_award_dividend.go View File

@@ -6,9 +6,10 @@ type VipAllocationSetStruct struct {
}

type JoinServiceAwardDividendRelationReq struct {
MasterId string `json:"master_id"` //站长ID
Uid int `json:"uid"` //用户id
ParentUid int `json:"parent_uid"` //父级id
RegionId int `json:"region_id"` //用户区域id
CreateAt string `json:"create_at"` //创建时间
MasterId string `json:"master_id"` //站长ID
Uid int `json:"uid"` //用户id
ParentUid int `json:"parent_uid"` //父级id
RegionId int `json:"region_id"` //用户区域id
CreateAt string `json:"create_at"` //创建时间
AllocationNums int `json:"allocation_nums"` //分配次数
}

Loading…
Cancel
Save