Explorar el Código

修复添加用户时岗位为时报错bug

ygf@cnhonker.com hace 5 años
padre
commit
beb7b0ec82
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      app/service/admin/auth_service/auth_rule.go

+ 4 - 0
app/service/admin/auth_service/auth_rule.go

@@ -232,6 +232,10 @@ func AddUserPost(postIds []int64, userId int64) (err error) {
 		g.Log().Error(err)
 		err = gerror.New("设置用户岗位信息失败")
 	}
+	//岗位为空
+	if len(postIds) < 1 {
+		return
+	}
 	//添加用户岗位信息
 	err = user_post.AddUserPost(postIds, userId)
 	if err != nil {