(c *candy.CandyClient, reader *bufio.Reader)
| 119 | } |
| 120 | |
| 121 | func getUserInfoByName(c *candy.CandyClient, reader *bufio.Reader) { |
| 122 | fmt.Println("----------------获取用户信息-------------------") |
| 123 | defer endSection() |
| 124 | |
| 125 | fmt.Println("请输入用户名:") |
| 126 | d, _, _ := reader.ReadLine() |
| 127 | userName := string(d) |
| 128 | |
| 129 | data, err := c.GetUserInfoByName(userName) |
| 130 | if err != nil { |
| 131 | e := candy.ErrorParse(err.Error()) |
| 132 | log.Errorf("getUserInfo code:%v error:%v", e.Code, e.Msg) |
| 133 | return |
| 134 | } |
| 135 | |
| 136 | user, err := candy.DecodeUserInfo([]byte(data)) |
| 137 | if err != nil { |
| 138 | e := candy.ErrorParse(err.Error()) |
| 139 | log.Errorf("Decode UserInfo code:%v error:%v", e.Code, e.Msg) |
| 140 | return |
| 141 | } |
| 142 | |
| 143 | log.Debugf("getUserInfo success, userName:%v", userName) |
| 144 | log.Debugf("user detail, ID:%v Name:%v NickName:%v Avatar:%v", user.ID, user.Name, user.NickName, user.Avatar) |
| 145 | } |
| 146 | |
| 147 | func getUserInfoByID(c *candy.CandyClient, reader *bufio.Reader) { |
| 148 | fmt.Println("----------------获取用户信息-------------------") |
no test coverage detected