fix
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
|
||||
"fusenapi/server/feishu-sync/internal/svc"
|
||||
"fusenapi/server/feishu-sync/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type SyncFeiShuGroupsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewSyncFeiShuGroupsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SyncFeiShuGroupsLogic {
|
||||
return &SyncFeiShuGroupsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
// 处理进入前逻辑w,r
|
||||
// func (l *SyncFeiShuGroupsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
||||
// }
|
||||
|
||||
func (l *SyncFeiShuGroupsLogic) SyncFeiShuGroups(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||
return resp.SetStatus(basic.CodeOK)
|
||||
}
|
||||
|
||||
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
||||
// func (l *SyncFeiShuGroupsLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
||||
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
// }
|
||||
@@ -1,5 +1,13 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fusenapi/model/gmodel"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type UserWebhookMsg struct {
|
||||
Schema string `json:"schema"`
|
||||
Header struct {
|
||||
@@ -76,12 +84,10 @@ type UserWebhookMsg struct {
|
||||
|
||||
// 员工增删改信息
|
||||
func (l *WebhookLogic) OnUserChange(data []byte) error {
|
||||
return nil
|
||||
/*var msg UserWebhookMsg
|
||||
var msg UserWebhookMsg
|
||||
if err := json.Unmarshal(data, &msg); err != nil {
|
||||
return err
|
||||
}
|
||||
avatar, _ := json.Marshal(msg.Event.Object.Avatar)
|
||||
isFrozen := int64(0)
|
||||
if msg.Event.Object.Status.IsFrozen {
|
||||
isFrozen = 1
|
||||
@@ -102,14 +108,16 @@ func (l *WebhookLogic) OnUserChange(data []byte) error {
|
||||
if msg.Event.Object.Status.IsUnjoin {
|
||||
isUnjoin = 1
|
||||
}
|
||||
departmentIds, _ := json.Marshal(msg.Event.Object.DepartmentIds)
|
||||
orders, _ := json.Marshal(msg.Event.Object.Orders)
|
||||
feiShuMsgCreateTimeInt64, err := strconv.ParseInt(msg.Header.CreateTime, 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
feiShuMsgCreateTime := time.UnixMilli(feiShuMsgCreateTimeInt64)
|
||||
return l.svcCtx.AllModels.FsFeishuUser.CreateOrUpdate(l.ctx, msg.Header.AppId, msg.Event.Object.OpenId, &gmodel.FsFeishuUser{
|
||||
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,
|
||||
OpenId: &msg.Event.Object.OpenId,
|
||||
UnionId: &msg.Event.Object.UnionId,
|
||||
@@ -121,18 +129,18 @@ func (l *WebhookLogic) OnUserChange(data []byte) error {
|
||||
JobTitle: &msg.Event.Object.JobTitle,
|
||||
Mobile: &msg.Event.Object.Mobile,
|
||||
Gender: &msg.Event.Object.Gender,
|
||||
Avatar: &avatar,
|
||||
Avatar: &msg.Event.Object.Avatar.AvatarOrigin,
|
||||
IsFrozen: &isFrozen,
|
||||
IsResigned: &isResigned,
|
||||
IsActivated: &isActivated,
|
||||
IsExited: &isExited,
|
||||
IsUnjoin: &isUnjoin,
|
||||
DepartmentIds: &departmentIds,
|
||||
Departmentids: &departmentIds,
|
||||
WorkStation: &msg.Event.Object.WorkStation,
|
||||
EmployeeNo: &msg.Event.Object.EmployeeNo,
|
||||
EmployeeType: &msg.Event.Object.EmployeeType,
|
||||
Orders: &orders,
|
||||
JoinTime: &joinTime,
|
||||
Ctime: &feiShuMsgCreateTime,
|
||||
Utime: &feiShuMsgCreateTime,
|
||||
})*/
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user