feat:完善项目

This commit is contained in:
henry
2022-01-15 11:54:05 +08:00
parent 048d116b05
commit c5fb6023f3
18 changed files with 191 additions and 129 deletions

View File

@ -184,24 +184,18 @@ func (c *Examine) Launch(id uint64, identity, status int) error {
users := make([]*model2.UserInstance, 0)
if err = model2.ScanFields(mUserInstance.UserInstance, &users, []string{"id", "uuid", "identity"},
&model2.ModelWhereOrder{
Where: model2.NewWhereIn("uuid", data.UIDs),
}); err != nil {
&model2.ModelWhereOrder{Where: model2.NewWhereIn("uuid", data.UIDs)}); err != nil {
return err
}
mUserIdentity := model.NewUserIdentity()
identitys := make([]*model2.UserIdentity, 0)
userIdentitys := make([]*model2.UserIdentity, 0)
now := time.Now()
for _, v := range users {
identitys = append(identitys, &model2.UserIdentity{
userIdentitys = append(userIdentitys, &model2.UserIdentity{
UID: v.UUID,
Identity: identity,
ModelAt: model2.ModelAt{
CreatedAt: now, UpdatedAt: now,
},
ModelAt: model2.ModelAt{CreatedAt: now, UpdatedAt: now},
})
if err = model2.UpdatesWhere(mUserInstance.UserInstance, map[string]interface{}{
"identity": mUserInstance.Identity | identity, "updated_at": now,
@ -211,8 +205,8 @@ func (c *Examine) Launch(id uint64, identity, status int) error {
return err
}
}
if len(identitys) > 0 {
if err = model2.Creates(mUserIdentity.UserIdentity, identity, tx); err != nil {
if len(userIdentitys) > 0 {
if err = model2.Creates(model.NewUserIdentity().UserIdentity, userIdentitys, tx); err != nil {
return err
}
}