|
@@ -41,24 +41,31 @@ func (l *GetEmployeeSearchLogic) GetEmployeeSearch(req *types.EmployeeListReq, t
|
|
|
isLogin = false
|
|
|
}
|
|
|
|
|
|
- userId := claims["userId"].(string)
|
|
|
- departmentId := claims["deptId"].(float64)
|
|
|
- organizationID := uint64(departmentId)
|
|
|
- isLogin = true
|
|
|
+ var userId string
|
|
|
+ var departmentId float64
|
|
|
+ var organizationID uint64
|
|
|
+ if _, ok := claims["userId"]; ok {
|
|
|
+ userId = claims["userId"].(string)
|
|
|
+ departmentId = claims["deptId"].(float64)
|
|
|
+ organizationID = uint64(departmentId)
|
|
|
+ isLogin = true
|
|
|
+ }
|
|
|
|
|
|
employeeIds := make([]uint64, 0)
|
|
|
- allocagent, err := l.svcCtx.DB.AllocAgent.Query().Where(
|
|
|
- allocagent.Or(
|
|
|
- allocagent.UserIDEQ(userId),
|
|
|
- allocagent.OrganizationID(organizationID),
|
|
|
- ),
|
|
|
- ).Only(l.ctx)
|
|
|
- if err != nil {
|
|
|
- if !ent.IsNotFound(err) {
|
|
|
- return nil, errorx.NewApiInternalError("获取智能体信息失败")
|
|
|
+ if isLogin {
|
|
|
+ allocagent, err := l.svcCtx.DB.AllocAgent.Query().Where(
|
|
|
+ allocagent.Or(
|
|
|
+ allocagent.UserIDEQ(userId),
|
|
|
+ allocagent.OrganizationID(organizationID),
|
|
|
+ ),
|
|
|
+ ).Only(l.ctx)
|
|
|
+ if err != nil {
|
|
|
+ if !ent.IsNotFound(err) {
|
|
|
+ return nil, errorx.NewApiInternalError("获取智能体信息失败")
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ employeeIds = append(employeeIds, allocagent.Agents...)
|
|
|
}
|
|
|
- } else {
|
|
|
- employeeIds = append(employeeIds, allocagent.Agents...)
|
|
|
}
|
|
|
|
|
|
var data *ent.EmployeePageList
|