From ca6f0c51e5929616eaeeb14ec006b5e4d8e5acee Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Fri, 10 Nov 2023 15:43:46 +0800 Subject: [PATCH] fix --- model/gmodel/ldap_groups_gen.go | 27 +++++++++---------- model/gmodel/ldap_users_gen.go | 3 +-- .../internal/logic/user_webhook.go | 4 +-- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/model/gmodel/ldap_groups_gen.go b/model/gmodel/ldap_groups_gen.go index b0874791..80ff12f1 100644 --- a/model/gmodel/ldap_groups_gen.go +++ b/model/gmodel/ldap_groups_gen.go @@ -7,20 +7,19 @@ import ( // ldap_groups type LdapGroups struct { - Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // - GroupName *string `gorm:"default:'';" json:"group_name"` // - Remark *string `gorm:"default:'';" json:"remark"` // - Creator *string `gorm:"default:'';" json:"creator"` // - GroupType *string `gorm:"default:'';" json:"group_type"` // - ParentId *int64 `gorm:"default:0;" json:"parent_id"` // - SourceDeptId *string `gorm:"default:'';" json:"source_dept_id"` // - Source *string `gorm:"default:'';" json:"source"` // - SourceDeptParentId *string `gorm:"default:'';" json:"source_dept_parent_id"` // - GroupDn *string `gorm:"default:'';" json:"group_dn"` // - SyncState *int64 `gorm:"default:0;" json:"sync_state"` // - Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` // - Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` // - Dtime *time.Time `gorm:"index;default:'0000-00-00 00:00:00';" json:"dtime"` // + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // + GroupName *string `gorm:"default:'';" json:"group_name"` // + Remark *string `gorm:"default:'';" json:"remark"` // + Creator *string `gorm:"default:'';" json:"creator"` // + GroupType *string `gorm:"default:'';" json:"group_type"` // + ParentId *int64 `gorm:"default:0;" json:"parent_id"` // + DeptId *string `gorm:"default:'';" json:"dept_id"` // + DeptParentId *string `gorm:"default:'';" json:"dept_parent_id"` // + GroupDn *string `gorm:"default:'';" json:"group_dn"` // + SyncState *int64 `gorm:"default:0;" json:"sync_state"` // + Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` // + Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` // + Dtime *time.Time `gorm:"index;default:'0000-00-00 00:00:00';" json:"dtime"` // } type LdapGroupsModel struct { db *gorm.DB diff --git a/model/gmodel/ldap_users_gen.go b/model/gmodel/ldap_users_gen.go index ded0104d..628c907c 100644 --- a/model/gmodel/ldap_users_gen.go +++ b/model/gmodel/ldap_users_gen.go @@ -8,8 +8,7 @@ import ( // ldap_users type LdapUsers struct { Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // - Source *int64 `gorm:"default:0;" json:"source"` // 来源 1飞书 - AppId *string `gorm:"default:'';" json:"app_id"` // + UserId *string `gorm:"default:'';" json:"user_id"` // OpenId *string `gorm:"default:'';" json:"open_id"` // UnionId *string `gorm:"default:'';" json:"union_id"` // Name *string `gorm:"default:'';" json:"name"` // diff --git a/server/feishu-sync/internal/logic/user_webhook.go b/server/feishu-sync/internal/logic/user_webhook.go index 96647ea3..04263265 100644 --- a/server/feishu-sync/internal/logic/user_webhook.go +++ b/server/feishu-sync/internal/logic/user_webhook.go @@ -115,10 +115,8 @@ func (l *WebhookLogic) OnUserChange(data []byte) error { feiShuMsgCreateTime := time.UnixMilli(feiShuMsgCreateTimeInt64) departmentIds := strings.Join(msg.Event.Object.DepartmentIds, ",") joinTime := time.Unix(msg.Event.Object.Joint64ime, 0) - source := int64(1) return l.svcCtx.AllModels.LdapUsers.CreateOrUpdate(l.ctx, msg.Header.AppId, msg.Event.Object.OpenId, &gmodel.LdapUsers{ - Source: &source, - AppId: &msg.Header.AppId, + UserId: &msg.Event.Object.UserId, OpenId: &msg.Event.Object.OpenId, UnionId: &msg.Event.Object.UnionId, Name: &msg.Event.Object.Name,