|
|
@@ -53,7 +53,7 @@ func init() { |
|
|
|
func main() { |
|
|
|
var users []model.UserRelate |
|
|
|
//db.Db.Where("level=1 and id>= 79725").Asc("id").Find(&users) |
|
|
|
db.Db.Where("level=1").Asc("invite_time").Find(&users) |
|
|
|
db.Db.Where("level=1").Asc("id").Find(&users) |
|
|
|
for _, v := range users { |
|
|
|
fmt.Println("ID<<<<<<<", v.Id) |
|
|
|
fmt.Println("user>>>>>", v.Uid) |
|
|
@@ -65,19 +65,41 @@ func main() { |
|
|
|
}) |
|
|
|
_, err := rule.AddPublicPlatoonUserRelationCommission(db.Db, req) |
|
|
|
if err != nil { |
|
|
|
var user model.User |
|
|
|
db.Db.Where("`id`=?", v.ParentUid).Get(&user) |
|
|
|
if user.Nickname != "注销用户" { |
|
|
|
fmt.Println("err >>>>>>>", err.Error()) |
|
|
|
return |
|
|
|
} else { |
|
|
|
if err.Error() == "当前用户已加入公排" { |
|
|
|
continue |
|
|
|
} |
|
|
|
if err.Error() == "未查询到推荐人记录" { |
|
|
|
var user model.User |
|
|
|
db.Db.Where("`id`=?", v.ParentUid).Get(&user) |
|
|
|
var newreq []*md.AddPublicPlatoonUserRelationCommissionReq |
|
|
|
newreq = append(newreq, &md.AddPublicPlatoonUserRelationCommissionReq{ |
|
|
|
Uid: utils.Int64ToStr(v.Uid), |
|
|
|
RecommendUid: utils.Int64ToStr(1), |
|
|
|
Uid: utils.Int64ToStr(user.Id), |
|
|
|
RecommendUid: utils.Int64ToStr(user.ParentUid), |
|
|
|
}) |
|
|
|
_, err := rule.AddPublicPlatoonUserRelationCommission(db.Db, newreq) |
|
|
|
fmt.Println("err>>>>>>", err) |
|
|
|
_, err = rule.AddPublicPlatoonUserRelationCommission(db.Db, newreq) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("err1>>>>>>", err) |
|
|
|
} |
|
|
|
_, err = rule.AddPublicPlatoonUserRelationCommission(db.Db, req) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("err2>>>>>>", err) |
|
|
|
} |
|
|
|
return |
|
|
|
} else { |
|
|
|
var user model.User |
|
|
|
db.Db.Where("`id`=?", v.ParentUid).Get(&user) |
|
|
|
if user.Nickname != "注销用户" { |
|
|
|
fmt.Println("err >>>>>>>", err.Error()) |
|
|
|
return |
|
|
|
} else { |
|
|
|
var newreq []*md.AddPublicPlatoonUserRelationCommissionReq |
|
|
|
newreq = append(newreq, &md.AddPublicPlatoonUserRelationCommissionReq{ |
|
|
|
Uid: utils.Int64ToStr(v.Uid), |
|
|
|
RecommendUid: utils.Int64ToStr(1), |
|
|
|
}) |
|
|
|
_, err := rule.AddPublicPlatoonUserRelationCommission(db.Db, newreq) |
|
|
|
fmt.Println("err>>>>>>", err) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|