36 lines
597 B
Go
36 lines
597 B
Go
package dingtalk
|
|
|
|
import (
|
|
"ai_scheduler/internal/data/impl"
|
|
"ai_scheduler/internal/entitys"
|
|
"database/sql"
|
|
"errors"
|
|
)
|
|
|
|
type Dept struct {
|
|
dingUserImpl *impl.BotUserImpl
|
|
}
|
|
|
|
func NewDept(dingUserImpl *impl.BotUserImpl) *User {
|
|
return &User{
|
|
dingUserImpl: dingUserImpl,
|
|
}
|
|
}
|
|
|
|
func (u *User) GetDeptInfo(userId string) (userInfo *entitys.DingTalkUserInfo, err error) {
|
|
if len(userId) == 0 {
|
|
return
|
|
}
|
|
user, err := u.dingUserImpl.GetByStaffId(userId)
|
|
if err != nil {
|
|
if !errors.Is(err, sql.ErrNoRows) {
|
|
return
|
|
}
|
|
}
|
|
//如果没有找到,则新增
|
|
if user == nil {
|
|
|
|
}
|
|
return
|
|
}
|