mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 11:20:18 +08:00
Add ExtendProductWithProviders().
This commit is contained in:
@ -38,6 +38,8 @@ type Product struct {
|
||||
ReturnUrl string `xorm:"varchar(1000)" json:"returnUrl"`
|
||||
|
||||
State string `xorm:"varchar(100)" json:"state"`
|
||||
|
||||
ProviderObjs []*Provider `xorm:"-" json:"providerObjs"`
|
||||
}
|
||||
|
||||
func GetProductCount(owner, field, value string) int {
|
||||
@ -209,3 +211,14 @@ func BuyProduct(id string, providerName string, user *User, host string) (string
|
||||
|
||||
return payUrl, err
|
||||
}
|
||||
|
||||
func ExtendProductWithProviders(product *Product) {
|
||||
product.ProviderObjs = []*Provider{}
|
||||
|
||||
m := getProviderMap(product.Owner)
|
||||
for _, providerItem := range product.Providers {
|
||||
if provider, ok := m[providerItem]; ok {
|
||||
product.ProviderObjs = append(product.ProviderObjs, provider)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user