2019-04-22 02:59:20 +00:00

32 lines
876 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package service
import (
"go-common/app/admin/ep/melloi/model"
"go-common/library/log"
)
// QueryUser query user info
func (s *Service) QueryUser(userName string) (user *model.User, err error) {
return s.CreateUser(userName)
}
// CreateUser create user
func (s *Service) CreateUser(userName string) (userData *model.User, err error) {
//此处因为业务因素出现错误需要继续执行不能retrun !!!
if userData, err = s.dao.QueryUserByUserName(userName); err != nil {
log.Error("s.dao.QueryUserByUserName err :(%v)", err)
}
if userData.ID == 0 {
user := model.User{Name: userName, Email: userName + "@bilibili.com", Active: "1", Accept: -1}
s.dao.AddUser(&user)
userData, err = s.dao.QueryUserByUserName(userName)
}
return
}
// UpdateUser update user
func (s *Service) UpdateUser(user *model.User) error {
return s.dao.UpdateUser(user)
}