get seller info support chat #28
|
@ -63,3 +63,26 @@ func (s Seller) GetListSellerInfoByIDs(p model.GetListSellerByIDsRequest) (*mode
|
|||
}
|
||||
return r.Data, nil
|
||||
}
|
||||
|
||||
// GetListSellerInfoSupportChatByIDs ...
|
||||
func (s Seller) GetListSellerInfoSupportChatByIDs(p model.GetListSellerSupportChatByIDsRequest) (*model.ResponseListSellerInfoSupportChat, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.Seller.GetListSellerInfoSupportChatByIDs, toBytes(p))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r struct {
|
||||
Data *model.ResponseListSellerInfoSupportChat `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
|
||||
}
|
||||
|
|
|
@ -11,3 +11,8 @@ type GetSellerByIDRequest struct {
|
|||
type GetListSellerByIDsRequest struct {
|
||||
SellerIDs []primitive.ObjectID `json:"sellerIds"`
|
||||
}
|
||||
|
||||
// GetListSellerSupportChatByIDsRequest ...
|
||||
type GetListSellerSupportChatByIDsRequest struct {
|
||||
SellerIDs []primitive.ObjectID `json:"sellerIds"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
// ResponseSellerInfo ...
|
||||
type ResponseSellerInfo struct {
|
||||
ID string `json:"_id"`
|
||||
|
@ -11,3 +13,69 @@ type ResponseSellerInfo struct {
|
|||
type ResponseListSellerInfo struct {
|
||||
Sellers []ResponseSellerInfo `json:"sellers"`
|
||||
}
|
||||
|
||||
// ResponseListSellerInfoSupportChat ...
|
||||
type ResponseListSellerInfoSupportChat struct {
|
||||
Sellers []ResponseSellerInfoSupportChat `json:"sellers"`
|
||||
}
|
||||
|
||||
// ResponseSellerInfoSupportChat ...
|
||||
type ResponseSellerInfoSupportChat struct {
|
||||
ID string `json:"_id"`
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
Membership SellerMembershipInfo `json:"membership"`
|
||||
Info SellerContactInfo `json:"info"`
|
||||
Team *TeamInfo `json:"team,omitempty"`
|
||||
Statistic SellerStatistic `json:"statistic"`
|
||||
TrackingTime *SellerTrackingTime `json:"trackingTime"`
|
||||
Invitee *InviteeInfo `json:"invitee"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
// SellerTrackingTime ...
|
||||
type SellerTrackingTime struct {
|
||||
FirstOrderDeliveredAt time.Time `json:"firstOrderDeliveredAt,omitempty"`
|
||||
ThirdOrderDeliveredAt time.Time `json:"thirdOrderDeliveredAt,omitempty"`
|
||||
}
|
||||
|
||||
// SellerStatistic ...
|
||||
type SellerStatistic struct {
|
||||
ThisMonthSale float64 `bson:"thisMonthSale" json:"thisMonthSale"`
|
||||
LastMonthSale float64 `bson:"lastMonthSale" json:"lastMonthSale"`
|
||||
Sale float64 `bson:"sale" json:"sale"`
|
||||
TransactionTotal int `json:"transactionTotal"`
|
||||
TransactionPaymentProcessing int `json:"transactionPaymentProcessing"`
|
||||
TransactionWaitingApprove int `json:"transactionWaitingApprove"`
|
||||
TransactionPending int `json:"transactionPending"`
|
||||
TransactionSuccess int `json:"transactionSuccess"`
|
||||
TransactionRejected int `json:"transactionRejected"`
|
||||
TransactionDelivering int `json:"transactionDelivering"`
|
||||
TransactionDelivered int `json:"transactionDelivered"`
|
||||
}
|
||||
|
||||
// TeamInfo ...
|
||||
type TeamInfo struct {
|
||||
ID string `json:"_id"`
|
||||
Name string `json:"name"`
|
||||
Role string `json:"role"`
|
||||
}
|
||||
|
||||
// InviteeInfo ...
|
||||
type InviteeInfo struct {
|
||||
ID string `json:"_id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// SellerContactInfo ...
|
||||
type SellerContactInfo struct {
|
||||
City int `json:"cityCode"`
|
||||
CityName string `json:"cityName"`
|
||||
Gender string `json:"gender"`
|
||||
}
|
||||
|
||||
// SellerMembershipInfo ...
|
||||
type SellerMembershipInfo struct {
|
||||
Level int `json:"level"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
|
|
@ -10,7 +10,9 @@ func getSellerValue(val string) string {
|
|||
var Seller = struct {
|
||||
GetSellerInfoByID string
|
||||
GetListSellerInfoByIDs string
|
||||
GetListSellerInfoSupportChatByIDs string
|
||||
}{
|
||||
GetSellerInfoByID: getSellerValue("get_seller_info_by_id"),
|
||||
GetListSellerInfoByIDs: getSellerValue("get_list_seller_info_by_ids"),
|
||||
GetListSellerInfoSupportChatByIDs: getSellerValue("get_list_seller_info_support_chat_by_ids"),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue