- temp.
This commit is contained in:
33
business/jxstore/skuman/skuman.go
Normal file
33
business/jxstore/skuman/skuman.go
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package skuman
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
defJdCategoryID = 20462
|
||||||
|
)
|
||||||
|
|
||||||
|
type Sku struct {
|
||||||
|
*model.Sku
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(sku *model.Sku) *Sku {
|
||||||
|
return &Sku{
|
||||||
|
Sku: sku,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetJdCategoryID(sku *model.Sku) int {
|
||||||
|
cat, _ := dao.GetCategory(sku.CategoryID, nil)
|
||||||
|
jdCategoryID := defJdCategoryID
|
||||||
|
if cat != nil && cat.JdCategoryID != 0 {
|
||||||
|
jdCategoryID = cat.JdCategoryID
|
||||||
|
}
|
||||||
|
return jdCategoryID
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetCategories(sku *model.Sku) []int {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
20
business/model/dao/sku.go
Normal file
20
business/model/dao/sku.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals/gormdb"
|
||||||
|
"github.com/jinzhu/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetCategory(ID int, db *gorm.DB) (*model.SkuCategory, error) {
|
||||||
|
if db == nil {
|
||||||
|
db = gormdb.GetDB()
|
||||||
|
}
|
||||||
|
item := &model.SkuCategory{}
|
||||||
|
item.ID = ID
|
||||||
|
err := utils.CallFuncLogError(func() error {
|
||||||
|
return db.First(item).Error
|
||||||
|
}, "GetCategory")
|
||||||
|
return item, err
|
||||||
|
}
|
||||||
20
business/model/dao/store.go
Normal file
20
business/model/dao/store.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals/gormdb"
|
||||||
|
"github.com/jinzhu/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetStore(ID int, db *gorm.DB) (*model.Store, error) {
|
||||||
|
if db == nil {
|
||||||
|
db = gormdb.GetDB()
|
||||||
|
}
|
||||||
|
item := &model.Store{}
|
||||||
|
item.ID = ID
|
||||||
|
err := utils.CallFuncLogError(func() error {
|
||||||
|
return db.First(item).Error
|
||||||
|
}, "GetStore")
|
||||||
|
return item, err
|
||||||
|
}
|
||||||
@@ -52,7 +52,7 @@ type SkuJdCategory struct {
|
|||||||
ModelIDCUO
|
ModelIDCUO
|
||||||
Name string `gorm:"type:varchar(255);index"`
|
Name string `gorm:"type:varchar(255);index"`
|
||||||
Level int
|
Level int
|
||||||
ParentID int64
|
ParentID int
|
||||||
}
|
}
|
||||||
|
|
||||||
type SkuCategory struct {
|
type SkuCategory struct {
|
||||||
@@ -63,8 +63,8 @@ type SkuCategory struct {
|
|||||||
Type int8 // 类别类型
|
Type int8 // 类别类型
|
||||||
Seq int
|
Seq int
|
||||||
|
|
||||||
JdID int64 `gorm:"index"` // 这个是指商家自己的商品类别在京东平台上的ID
|
JdID int `gorm:"index"` // 这个是指商家自己的商品类别在京东平台上的ID
|
||||||
JdCategoryID int64 // 这个是指对应的京东商品类别
|
JdCategoryID int // 这个是指对应的京东商品类别
|
||||||
ElmID string `gorm:"type:varchar(48);index"`
|
ElmID string `gorm:"type:varchar(48);index"`
|
||||||
MtID string `gorm:"type:varchar(48);index"`
|
MtID string `gorm:"type:varchar(48);index"`
|
||||||
DidiID string `gorm:"type:varchar(48);index"`
|
DidiID string `gorm:"type:varchar(48);index"`
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ var (
|
|||||||
CancelWaybillReasonStrNotAcceptIntime = "没有及时抢单"
|
CancelWaybillReasonStrNotAcceptIntime = "没有及时抢单"
|
||||||
CancelWaybillReasonStrSwitch2SelfFailed = "转自送失败"
|
CancelWaybillReasonStrSwitch2SelfFailed = "转自送失败"
|
||||||
CancelWaybillReasonStrOrderAlreadyFinished = "订单已经结束"
|
CancelWaybillReasonStrOrderAlreadyFinished = "订单已经结束"
|
||||||
|
CancelWaybillReasonStrActive = "操作由人员主动发起"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
func (p *PurchaseHandler) AddSku(sku *model.Sku) error {
|
func (p *PurchaseHandler) AddSku(sku *model.Sku) error {
|
||||||
// params := map[string]interface{}{
|
// params := map[string]interface{}{
|
||||||
// "outSkuId": utils.Int2Str(int(sku.ID)),
|
// "outSkuId": utils.Int2Str(int(sku.ID)),
|
||||||
// "categoryId":
|
// "categoryId": skuman.GetJdCategoryID(sku),
|
||||||
// }
|
// }
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user