(c *candy.CandyClient, reader *bufio.Reader)
| 42 | } |
| 43 | |
| 44 | func register(c *candy.CandyClient, reader *bufio.Reader) { |
| 45 | fmt.Println("----------------用户注册-----------------------") |
| 46 | defer endSection() |
| 47 | |
| 48 | fmt.Println("请输入用户名:") |
| 49 | data, _, _ := reader.ReadLine() |
| 50 | userName := string(data) |
| 51 | fmt.Println("请输入密码:") |
| 52 | data, _, _ = reader.ReadLine() |
| 53 | userPassword := string(data) |
| 54 | |
| 55 | id, err := c.Register(userName, userPassword) |
| 56 | if err != nil { |
| 57 | e := candy.ErrorParse(err.Error()) |
| 58 | log.Errorf("Register code:%v error:%v", e.Code, e.Msg) |
| 59 | return |
| 60 | } |
| 61 | |
| 62 | log.Debugf("Register success, userID:%v userName:%v userPassword:%v", id, userName, userPassword) |
| 63 | } |
| 64 | |
| 65 | func login(c *candy.CandyClient, reader *bufio.Reader) { |
| 66 | fmt.Println("----------------用户登陆-----------------------") |
no test coverage detected