change password
This commit is contained in:
parent
8bb537ff6a
commit
5f84186a64
|
|
@ -29,6 +29,13 @@ type LoginRsp struct {
|
||||||
Realname string `json:"realname"`
|
Realname string `json:"realname"`
|
||||||
Phone string `json:"phone"`
|
Phone string `json:"phone"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ChangePasswordReq struct {
|
||||||
|
Username string `json:"username"`
|
||||||
|
OldPassword string `json:"old_password"`
|
||||||
|
NewPassword string `json:"new_password"`
|
||||||
|
}
|
||||||
|
|
||||||
type StaffUser struct {
|
type StaffUser struct {
|
||||||
Erp
|
Erp
|
||||||
}
|
}
|
||||||
|
|
@ -85,3 +92,21 @@ func (e *StaffUser) Login(req *LoginReq) (*LoginRsp, error) {
|
||||||
|
|
||||||
return r, nil
|
return r, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (e *StaffUser) ChangePassword(req *ChangePasswordReq) error {
|
||||||
|
var reqBody string
|
||||||
|
|
||||||
|
reqBody = goutil.EncodeJSON(req)
|
||||||
|
|
||||||
|
reqUrl := e.GetBaseUrl() + "/ext/staff/user/password"
|
||||||
|
body, err := goutil.HttpPost(reqUrl, e.GetHeader(), []byte(reqBody))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
g := gjson.ParseBytes(body)
|
||||||
|
if g.Get("code").Int() != 0 {
|
||||||
|
return errors.New(string(body))
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue