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