Proper affiliate rewards
This commit is contained in:
parent
bb3dbe5718
commit
a179961138
|
@ -17,7 +17,7 @@ import (
|
||||||
var (
|
var (
|
||||||
clientActions = map[string]func(c *fiber.Ctx, person *p.Person, profile *p.Profile, notifications *[]aid.JSON) error {
|
clientActions = map[string]func(c *fiber.Ctx, person *p.Person, profile *p.Profile, notifications *[]aid.JSON) error {
|
||||||
"QueryProfile": clientQueryProfileAction,
|
"QueryProfile": clientQueryProfileAction,
|
||||||
"ClientQuestLogin": clientQueryProfileAction,
|
"ClientQuestLogin": clientClientQuestLoginAction,
|
||||||
"MarkItemSeen": clientMarkItemSeenAction,
|
"MarkItemSeen": clientMarkItemSeenAction,
|
||||||
"SetItemFavoriteStatusBatch": clientSetItemFavoriteStatusBatchAction,
|
"SetItemFavoriteStatusBatch": clientSetItemFavoriteStatusBatchAction,
|
||||||
"EquipBattleRoyaleCustomization": clientEquipBattleRoyaleCustomizationAction,
|
"EquipBattleRoyaleCustomization": clientEquipBattleRoyaleCustomizationAction,
|
||||||
|
@ -130,6 +130,10 @@ func clientQueryProfileAction(c *fiber.Ctx, person *p.Person, profile *p.Profile
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func clientClientQuestLoginAction(c *fiber.Ctx, person *p.Person, profile *p.Profile, notifications *[]aid.JSON) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func clientMarkItemSeenAction(c *fiber.Ctx, person *p.Person, profile *p.Profile, notifications *[]aid.JSON) error {
|
func clientMarkItemSeenAction(c *fiber.Ctx, person *p.Person, profile *p.Profile, notifications *[]aid.JSON) error {
|
||||||
var body struct {
|
var body struct {
|
||||||
ItemIds []string `json:"itemIds"`
|
ItemIds []string `json:"itemIds"`
|
||||||
|
@ -664,6 +668,17 @@ func clientPurchaseCatalogEntryAction(c *fiber.Ctx, person *p.Person, profile *p
|
||||||
"primary": true,
|
"primary": true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
affiliate := person.CommonCoreProfile.Attributes.GetAttributeByKey("mtx_affiliate")
|
||||||
|
if affiliate == nil {
|
||||||
|
return c.Status(400).JSON(aid.ErrorBadRequest("Invalid affiliate attribute"))
|
||||||
|
}
|
||||||
|
|
||||||
|
creator := p.Find(p.AttributeConvert[string](affiliate))
|
||||||
|
if creator != nil {
|
||||||
|
creator.CommonCoreProfile.Items.GetItemByTemplateID("Currency:MtxPurchased").Quantity += body.ExpectedTotalPrice
|
||||||
|
creator.Profile0Profile.Items.GetItemByTemplateID("Currency:MtxPurchased").Quantity += body.ExpectedTotalPrice
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
main.go
4
main.go
|
@ -152,12 +152,10 @@ func main() {
|
||||||
|
|
||||||
party := r.Group("/party/api/v1/Fortnite")
|
party := r.Group("/party/api/v1/Fortnite")
|
||||||
party.Use(handlers.MiddlewareFortnite)
|
party.Use(handlers.MiddlewareFortnite)
|
||||||
|
|
||||||
party.Get("/user/:accountId", handlers.GetPartiesForUser)
|
party.Get("/user/:accountId", handlers.GetPartiesForUser)
|
||||||
party.Get("/user/:accountId/settings/privacy", handlers.GetPartyUserPrivacy)
|
party.Get("/user/:accountId/settings/privacy", handlers.GetPartyUserPrivacy)
|
||||||
party.Get("/user/:accountId/notifications/undelivered/count", handlers.GetPartyNotifications)
|
party.Get("/user/:accountId/notifications/undelivered/count", handlers.GetPartyNotifications)
|
||||||
party.Get("/user/:accountId/pings/:friendId/parties", handlers.GetPartyPingsFromFriend)
|
party.Get("/user/:accountId/pings/:friendId/parties", handlers.GetPartyPingsFromFriend)
|
||||||
|
|
||||||
party.Get("/parties/:partyId", handlers.GetPartyForMember)
|
party.Get("/parties/:partyId", handlers.GetPartyForMember)
|
||||||
party.Post("/parties", handlers.PostPartyCreate)
|
party.Post("/parties", handlers.PostPartyCreate)
|
||||||
party.Post("/parties/:partyId/invites/:accountId", handlers.PostPartyInvite)
|
party.Post("/parties/:partyId/invites/:accountId", handlers.PostPartyInvite)
|
||||||
|
@ -166,9 +164,7 @@ func main() {
|
||||||
party.Patch("/parties/:partyId", handlers.PatchPartyUpdateState)
|
party.Patch("/parties/:partyId", handlers.PatchPartyUpdateState)
|
||||||
party.Patch("/parties/:partyId/members/:accountId/meta", handlers.PatchPartyUpdateMemberState)
|
party.Patch("/parties/:partyId/members/:accountId/meta", handlers.PatchPartyUpdateMemberState)
|
||||||
party.Delete("/parties/:partyId/members/:accountId", handlers.DeletePartyMember)
|
party.Delete("/parties/:partyId/members/:accountId", handlers.DeletePartyMember)
|
||||||
|
|
||||||
// post /parties/:partyId/members/:accountId/conferences/connection (join a voip channel)
|
// post /parties/:partyId/members/:accountId/conferences/connection (join a voip channel)
|
||||||
|
|
||||||
// get /user/:accountId/pings/:pinger/friendId/parties (get pings from a friend)
|
// get /user/:accountId/pings/:pinger/friendId/parties (get pings from a friend)
|
||||||
// post /user/:accountId/pings/:pinger/join (join a party from a ping)
|
// post /user/:accountId/pings/:pinger/join (join a party from a ping)
|
||||||
// post /user/:friendId/pings/:accountId (send a ping)
|
// post /user/:friendId/pings/:accountId (send a ping)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import "github.com/ectrc/snow/aid"
|
||||||
|
|
||||||
type FullProfileUpdate struct {
|
type FullProfileUpdate struct {
|
||||||
ChangeType string `json:"changeType"`
|
ChangeType string `json:"changeType"`
|
||||||
Profile aid.JSON `json:"profile"`
|
Profile interface{} `json:"profile"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StatModified struct {
|
type StatModified struct {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user