42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package ebai
|
|
|
|
import (
|
|
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
|
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
|
"git.rosy.net.cn/jx-callback/business/model"
|
|
"git.rosy.net.cn/jx-callback/business/partner"
|
|
"git.rosy.net.cn/jx-callback/globals"
|
|
"git.rosy.net.cn/jx-callback/globals/api"
|
|
)
|
|
|
|
var (
|
|
CurPurchaseHandler *PurchaseHandler
|
|
)
|
|
|
|
type PurchaseHandler struct {
|
|
partner.BasePurchasePlatform
|
|
}
|
|
|
|
func init() {
|
|
CurPurchaseHandler = new(PurchaseHandler)
|
|
partner.RegisterPurchasePlatform(CurPurchaseHandler)
|
|
}
|
|
|
|
func EbaiBusStatus2JxStatus(ebaiStatus int) int {
|
|
if ebaiStatus == ebaiapi.ShopBusStatusHaveRest || ebaiStatus == ebaiapi.ShopBusStatusSuspended {
|
|
return model.StoreStatusClosed
|
|
}
|
|
return model.StoreStatusOpened
|
|
}
|
|
|
|
func (p *PurchaseHandler) GetVendorID() int {
|
|
return model.VendorIDEBAI
|
|
}
|
|
|
|
func (p *PurchaseHandler) UploadImg(ctx *jxcontext.Context, imgURL string, imgData []byte, imgName string) (imgHint string, err error) {
|
|
if globals.EnableEbaiStoreWrite {
|
|
imgHint, err = api.EbaiAPI.PictureUpload(imgURL, imgData)
|
|
}
|
|
return imgHint, err
|
|
}
|