Merge branch 'admin-push-notification-supplier' into develop

This commit is contained in:
Sinh 2022-11-24 09:40:11 +07:00
commit 9d7ebe2ef0
2 changed files with 43 additions and 0 deletions

41
client/segmnet.go Normal file
View File

@ -0,0 +1,41 @@
package client
import (
"encoding/json"
"errors"
"git.selly.red/Selly-Modules/natsio"
"git.selly.red/Selly-Modules/natsio/model"
"git.selly.red/Selly-Modules/natsio/subject"
)
// Segment ...
type Segment struct{}
// GetSegment ...
func GetSegment() Segment {
return Segment{}
}
// GetListSegmentInfoByIds ...
func (s Segment) GetListSegmentInfoByIds(p model.GetListSegmentRequest) (*model.ResponseListSegmentInfo, error) {
msg, err := natsio.GetServer().Request(subject.Segment.GetListSegmentInfo, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Data *model.ResponseListSegmentInfo `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
}

View File

@ -54,9 +54,11 @@ type SupplierFindAllReq struct {
Limit int64 `json:"limit"` Limit int64 `json:"limit"`
Segment string `json:"segment"` Segment string `json:"segment"`
IDs []string `json:"ids"` IDs []string `json:"ids"`
Status string `json:"status"` // active,inactive
} }
type SupplierCountReq struct { type SupplierCountReq struct {
Segment string `json:"segment"` Segment string `json:"segment"`
IDs []string `json:"ids"` IDs []string `json:"ids"`
Status string `json:"status"` // active,inactive
} }