feature-campaign-get-seller-statistic #125
|
@ -34,3 +34,25 @@ func (c Campaign) GetCampaignTransaction(p model.GetCampaignTransactionsRequest)
|
||||||
}
|
}
|
||||||
return r.Data, nil
|
return r.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetCampaignSellerStatistic ....
|
||||||
|
func (c Campaign) GetCampaignSellerStatistic(req model.GetCampaignSellerStatisticBySellerIDs) (*model.ResponseCampaignSellerStatistic, error) {
|
||||||
|
msg, err := natsio.GetServer().Request(subject.Campaign.GetCampaignSellerStatisticBySellerIDs, toBytes(req))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var r struct {
|
||||||
|
Data *model.ResponseCampaignSellerStatistic `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
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
// GetCampaignTransactionsRequest ...
|
// GetCampaignTransactionsRequest ...
|
||||||
type GetCampaignTransactionsRequest struct {
|
type GetCampaignTransactionsRequest struct {
|
||||||
|
@ -12,3 +15,8 @@ type GetCampaignTransactionsRequest struct {
|
||||||
Page int64 `json:"page"`
|
Page int64 `json:"page"`
|
||||||
Limit int64 `json:"limit"`
|
Limit int64 `json:"limit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetCampaignSellerStatisticBySellerIDs ...
|
||||||
|
type GetCampaignSellerStatisticBySellerIDs struct {
|
||||||
|
SellerIDs []primitive.ObjectID
|
||||||
|
}
|
||||||
|
|
|
@ -57,3 +57,32 @@ type ResponseCampaignTransactionOptions struct {
|
||||||
type ResponseCampaignTransactionAdminConfirmData struct {
|
type ResponseCampaignTransactionAdminConfirmData struct {
|
||||||
FriendPublicTotal int64 `json:"friendPublicTotal"`
|
FriendPublicTotal int64 `json:"friendPublicTotal"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ResponseCampaignSellerStatisticList ...
|
||||||
|
type ResponseCampaignSellerStatisticList struct {
|
||||||
|
List []ResponseCampaignSellerStatistic `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResponseCampaignSellerStatistic ...
|
||||||
|
type ResponseCampaignSellerStatistic struct {
|
||||||
|
SellerID primitive.ObjectID `json:"sellerId"`
|
||||||
|
Statistic CampaignSellerStatistic `json:"Statistic"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CampaignSellerStatistic ...
|
||||||
|
type CampaignSellerStatistic struct {
|
||||||
|
TotalNotRejected int64 `bson:"totalNotRejected" json:"totalNotRejected"`
|
||||||
|
CashTotalNotRejected float64 `bson:"cashTotalNotRejected" json:"cashTotalNotRejected"`
|
||||||
|
|
||||||
|
TotalCompleted int64 `bson:"totalCompleted" json:"totalCompleted"`
|
||||||
|
CashTotalCompleted float64 `bson:"cashTotalCompleted" json:"cashTotalCompleted"`
|
||||||
|
|
||||||
|
TotalPending int64 `bson:"totalPending" json:"totalPending"`
|
||||||
|
CashTotalPending float64 `bson:"cashTotalPending" json:"cashTotalPending"`
|
||||||
|
|
||||||
|
TotalApproved int64 `bson:"totalApproved" json:"totalApproved"`
|
||||||
|
CashTotalApproved float64 `bson:"cashTotalApproved" json:"cashTotalApproved"`
|
||||||
|
|
||||||
|
TotalRejected int64 `bson:"totalRejected" json:"totalRejected"`
|
||||||
|
CashTotalRejected float64 `bson:"cashTotalRejected" json:"cashTotalRejected"`
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ func getCampaignValue(val string) string {
|
||||||
// Campaign ...
|
// Campaign ...
|
||||||
var Campaign = struct {
|
var Campaign = struct {
|
||||||
GetListCampaignTransactionAdminInfoByIDs string
|
GetListCampaignTransactionAdminInfoByIDs string
|
||||||
|
GetCampaignSellerStatisticBySellerIDs string
|
||||||
}{
|
}{
|
||||||
GetListCampaignTransactionAdminInfoByIDs: getCampaignValue("get_list_campaign_transaction_admin_info_by_ids"),
|
GetListCampaignTransactionAdminInfoByIDs: getCampaignValue("get_list_campaign_transaction_admin_info_by_ids"),
|
||||||
|
GetCampaignSellerStatisticBySellerIDs: getCampaignValue("get_campaign_seller_statistic_by_seller_ids"),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue