get seller info support chat

This commit is contained in:
Nguyen Minh 2022-09-21 10:19:17 +07:00
parent 99eacb44a8
commit 583f2abda5
4 changed files with 102 additions and 4 deletions

View File

@ -63,3 +63,26 @@ func (s Seller) GetListSellerInfoByIDs(p model.GetListSellerByIDsRequest) (*mode
} }
return r.Data, nil 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
}

View File

@ -11,3 +11,8 @@ type GetSellerByIDRequest struct {
type GetListSellerByIDsRequest struct { type GetListSellerByIDsRequest struct {
SellerIDs []primitive.ObjectID `json:"sellerIds"` SellerIDs []primitive.ObjectID `json:"sellerIds"`
} }
// GetListSellerSupportChatByIDsRequest ...
type GetListSellerSupportChatByIDsRequest struct {
SellerIDs []primitive.ObjectID `json:"sellerIds"`
}

View File

@ -1,5 +1,7 @@
package model package model
import "time"
// ResponseSellerInfo ... // ResponseSellerInfo ...
type ResponseSellerInfo struct { type ResponseSellerInfo struct {
ID string `json:"_id"` ID string `json:"_id"`
@ -11,3 +13,69 @@ type ResponseSellerInfo struct {
type ResponseListSellerInfo struct { type ResponseListSellerInfo struct {
Sellers []ResponseSellerInfo `json:"sellers"` 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"`
}

View File

@ -10,7 +10,9 @@ func getSellerValue(val string) string {
var Seller = struct { var Seller = struct {
GetSellerInfoByID string GetSellerInfoByID string
GetListSellerInfoByIDs string GetListSellerInfoByIDs string
GetListSellerInfoSupportChatByIDs string
}{ }{
GetSellerInfoByID: getSellerValue("get_seller_info_by_id"), GetSellerInfoByID: getSellerValue("get_seller_info_by_id"),
GetListSellerInfoByIDs: getSellerValue("get_list_seller_info_by_ids"), GetListSellerInfoByIDs: getSellerValue("get_list_seller_info_by_ids"),
GetListSellerInfoSupportChatByIDs: getSellerValue("get_list_seller_info_support_chat_by_ids"),
} }