build auth sms
This commit is contained in:
parent
88931f9c53
commit
283974d869
|
@ -58,6 +58,27 @@ func (s SupplierUser) GetListUser(p model.GetListUserRequest) (*model.GetListUse
|
|||
return r.Data, nil
|
||||
}
|
||||
|
||||
func (s SupplierUser) DetailUser(p model.DetailUserRequest) (*model.SupplierUserBrief, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.SupplierUser.DetailUser, toBytes(p))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r struct {
|
||||
Data *model.SupplierUserBrief `json:"data"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(msg.Data, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if r.Error != "" {
|
||||
return nil, errors.New(r.Error)
|
||||
}
|
||||
|
||||
return r.Data, nil
|
||||
}
|
||||
|
||||
func (s SupplierUser) CreateSupplierOwnerUsers(p model.CreateOwnerRequest) (*model.CreateOwnerResponse, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateOwner, toBytes(p))
|
||||
if err != nil {
|
||||
|
|
|
@ -25,6 +25,10 @@ type GetListUserRequest struct {
|
|||
SupplierID string `json:"supplierId"`
|
||||
}
|
||||
|
||||
type DetailUserRequest struct {
|
||||
ID string `json:"_id"`
|
||||
}
|
||||
|
||||
type CreateOwnerRequest struct {
|
||||
Name string `json:"name"`
|
||||
Phone string `json:"phone"`
|
||||
|
|
|
@ -10,6 +10,7 @@ var SupplierUser = struct {
|
|||
// Users
|
||||
LoginUser string
|
||||
GetListUser string
|
||||
DetailUser string
|
||||
CreateOwner string
|
||||
UpdateOwner string
|
||||
CreateStaff string
|
||||
|
@ -20,6 +21,7 @@ var SupplierUser = struct {
|
|||
// Users
|
||||
LoginUser: getSupplierUserValue("login_user"),
|
||||
GetListUser: getSupplierUserValue("get_list_user"),
|
||||
DetailUser: getSupplierUserValue("detail_user"),
|
||||
CreateOwner: getSupplierUserValue("create_owner"),
|
||||
UpdateOwner: getSupplierUserValue("update_owner"),
|
||||
CreateStaff: getSupplierUserValue("create_staff"),
|
||||
|
|
Loading…
Reference in New Issue