Compare commits

..

No commits in common. "aaf8de98306b35f61ad2b0956af93598aff2dc0d" and "d6f50295c71dfe7fae9c5b6d7b637ecafff5247e" have entirely different histories.

8 changed files with 22 additions and 125 deletions

View File

@ -1,21 +0,0 @@
package client
import (
"git.selly.red/Selly-Modules/natsio"
"git.selly.red/Selly-Modules/natsio/model"
"git.selly.red/Selly-Modules/natsio/subject"
)
// Socket ...
type Socket struct{}
// GetSocket ...
func GetSocket() Socket {
return Socket{}
}
// EmitSocketEventDataReward ...
func (s Socket) EmitSocketEventDataReward(p model.PayloadEmitSocketEvent) error {
_, err := natsio.GetServer().Request(subject.Socket.EmitEventReward, toBytes(p))
return err
}

View File

@ -2,17 +2,13 @@ package jsconsumer
// Selly ...
var Selly = struct {
PushNotification string
UpdateSellerAffiliateStatistic string
CheckAnDInsertCashflowBySeller string
SubscriberTopic string
UpdateSellerSavingCampaignStatistic string
GenerateVoucherPromotion string
PushNotification string
UpdateSellerAffiliateStatistic string
CheckAnDInsertCashflowBySeller string
SubscriberTopic string
}{
PushNotification: "PULL_PUSH_NOTIFICATION",
UpdateSellerAffiliateStatistic: "PULL_UPDATE_SELLER_AFFILIATE_STATISTIC",
CheckAnDInsertCashflowBySeller: "PULL_CHECK_AND_INSERT_CASHFLOW_BY_SELLER",
SubscriberTopic: "PULL_SUBSCRIBER_TOPIC",
UpdateSellerSavingCampaignStatistic: "PULL_UPDATE_SELLER_SAVING_CAMPAIGN_STATISTIC",
GenerateVoucherPromotion: "PULL_GENERATE_VOUCHER_PROMOTION",
PushNotification: "PULL_PUSH_NOTIFICATION",
UpdateSellerAffiliateStatistic: "PULL_UPDATE_SELLER_AFFILIATE_STATISTIC",
CheckAnDInsertCashflowBySeller: "PULL_CHECK_AND_INSERT_CASHFLOW_BY_SELLER",
SubscriberTopic: "PULL_SUBSCRIBER_TOPIC",
}

View File

@ -1,7 +1,5 @@
package jsmodel
import "go.mongodb.org/mongo-driver/bson/primitive"
// PushNotification ...
type PushNotification struct {
User string `json:"user"`
@ -14,11 +12,9 @@ type PushNotification struct {
// NotificationOptions ...
type NotificationOptions struct {
Title string `json:"title"`
Content string `json:"content"`
CampaignID string `json:"campaignId,omitempty"`
SellerSavingCampaignID string `json:"sellerSavingCampaignId,omitempty"`
SellerSavingCampaignStatus string `json:"sellerSavingCampaignStatus,omitempty"`
Title string `json:"title"`
Content string `json:"content"`
CampaignID string `json:"campaignId,omitempty"`
}
// PayloadUpdateSellerAffiliateStatistic ...
@ -66,39 +62,6 @@ type CashFlowOptions struct {
// Campaign
CampaignID string `json:"campaignId,omitempty"`
CampaignName string `json:"campaignName,omitempty"`
// SavingCampaign
SavingCampaignID string `json:"savingCampaignId,omitempty"`
SavingCampaignName string `json:"savingCampaignName,omitempty"`
SavingCampaignItemID string `json:"savingCampaignItemId,omitempty"`
SavingCampaignItemName string `json:"savingCampaignItemName,omitempty"`
}
// PayloadUpdateSellerSavingCampaignStatistic ...
type PayloadUpdateSellerSavingCampaignStatistic struct {
SellerID string `json:"sellerId"`
Statistic SellerSavingCampaignStatistic `json:"statistic"`
}
// SellerSavingCampaignStatistic ...
type SellerSavingCampaignStatistic struct {
SavingCampaignCashPending float64 `json:"savingCampaignCashPending"`
SavingCampaignCashCompleted float64 `json:"savingCampaignCashCompleted"`
}
// GenerateVoucherPromotion ...
type GenerateVoucherPromotion struct {
Cash float64 `json:"cash"`
TargetID primitive.ObjectID `json:"targetId"`
TargetType string `json:"targetType"`
Options GenerateVoucherPromotionOptions `json:"options"`
Seller primitive.ObjectID `json:"seller"`
}
// GenerateVoucherPromotionOptions ...
type GenerateVoucherPromotionOptions struct {
Title string `json:"title"`
}
// SubscriberNotificationTopic ...

View File

@ -11,17 +11,13 @@ func getSellyValue(val string) string {
// Selly ...
var Selly = struct {
PushNotification string
UpdateSellerAffiliateStatistic string
CheckAnDInsertCashflowBySeller string
SubscriberTopic string
UpdateSellerSavingCampaignStatistic string
GenerateVoucherPromotion string
PushNotification string
UpdateSellerAffiliateStatistic string
CheckAnDInsertCashflowBySeller string
SubscriberTopic string
}{
PushNotification: getSellyValue("push_notifications"),
UpdateSellerAffiliateStatistic: getSellyValue("update_seller_affiliate_statistic"),
CheckAnDInsertCashflowBySeller: getSellyValue("check_and_insert_cashflow_statistic"),
SubscriberTopic: getSellyValue("subscriber_topic"),
UpdateSellerSavingCampaignStatistic: getSellyValue("update_seller_saving_campaign_statistic"),
GenerateVoucherPromotion: getSellyValue("generate_voucher_promotion"),
PushNotification: getSellyValue("push_notifications"),
UpdateSellerAffiliateStatistic: getSellyValue("update_seller_affiliate_statistic"),
CheckAnDInsertCashflowBySeller: getSellyValue("check_and_insert_cashflow_statistic"),
SubscriberTopic: getSellyValue("subscriber_topic"),
}

View File

@ -4,11 +4,9 @@ import "time"
// ResponseSellerInfo ...
type ResponseSellerInfo struct {
ID string `json:"_id"`
Name string `json:"name"`
Code string `json:"code"`
IsAccountPro bool `json:"isAccountPro"`
CashRemaining float64 `json:"cashRemaining"`
ID string `json:"_id"`
Name string `json:"name"`
Code string `json:"code"`
}
// ResponseListSellerInfo ...

View File

@ -1,19 +0,0 @@
package model
// PayloadEmitSocketEvent ...
type PayloadEmitSocketEvent struct {
User string `json:"user"`
Message string `json:"message"`
Data string `json:"data"`
IsNotRemove bool `json:"isNotRemove"`
}
// PayloadEventSocketReward ...
type PayloadEventSocketReward struct {
Type string `json:"type"`
Title string `json:"title"`
Cash float64 `json:"cash"`
Message string `json:"message"`
Photo interface{} `json:"photo"`
Action *ActionType `json:"action"`
}

View File

@ -18,7 +18,6 @@ var prefixes = struct {
Queue string
Campaign string
Affiliate string
Socket string
}{
Communication: "communication",
Order: "order",
@ -37,5 +36,4 @@ var prefixes = struct {
Queue: "queue",
Campaign: "campaign",
Affiliate: "affiliate",
Socket: "socket",
}

View File

@ -1,14 +0,0 @@
package subject
import "fmt"
func getSocketValue(val string) string {
return fmt.Sprintf("%s.%s", prefixes.Socket, val)
}
// Socket ...
var Socket = struct {
EmitEventReward string
}{
EmitEventReward: getSocketValue("emit_event_reward"),
}