| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- package models
- // "errors"
- // "strconv"
- // "time"
- var (
- UserList map[string]*User
- )
- func init() {
- // UserList = make(map[string]*User)
- // u := User{"user_11111", "astaxie", Profile{"male", 20, "Singapore", "astaxie@gmail.com"}}
- // UserList["user_11111"] = &u
- }
- //type UserResult struct {
- // UserInfo User `json:"user"`
- //}
- type User struct {
- Id string
- Username string `json:"name"`
- Profile Profile
- }
- type Profile struct {
- Gender string
- Age int
- Address string
- Email string
- Realname string
- Roleid int
- Mobile string
- Telephone string
- CompanyCode string
- Photo string
- Manager string //联系人
- Description string //备注
- Host string //域名
- AccCode string //客户企业编号
- DepartmentId string
- IsCompanyUser int
- Id int
- }
- //func AddUser(u User) string {
- // u.Id = "user_" + strconv.FormatInt(time.Now().UnixNano(), 10)
- // UserList[u.Id] = &u
- // return u.Id
- //}
- //func GetUser(uid string) (u *User, err error) {
- // if u, ok := UserList[uid]; ok {
- // return u, nil
- // }
- // return nil, errors.New("User not exists")
- //}
- //func GetAllUsers() map[string]*User {
- // return UserList
- //}
- //func UpdateUser(uid string, uu *User) (a *User, err error) {
- // if u, ok := UserList[uid]; ok {
- // if uu.Username != "" {
- // u.Username = uu.Username
- // }
- // if uu.Password != "" {
- // u.Password = uu.Password
- // }
- // if uu.Profile.Age != 0 {
- // u.Profile.Age = uu.Profile.Age
- // }
- // if uu.Profile.Address != "" {
- // u.Profile.Address = uu.Profile.Address
- // }
- // if uu.Profile.Gender != "" {
- // u.Profile.Gender = uu.Profile.Gender
- // }
- // if uu.Profile.Email != "" {
- // u.Profile.Email = uu.Profile.Email
- // }
- // return u, nil
- // }
- // return nil, errors.New("User Not Exist")
- //}
- //func Login(username, password string) bool {
- // for _, u := range UserList {
- // if u.Username == username && u.Password == password {
- // return true
- // }
- // }
- // return false
- //}
- //func DeleteUser(uid string) {
- // delete(UserList, uid)
- //}
|