- return cat num in initdata.InitVendorCategory
This commit is contained in:
@@ -164,11 +164,11 @@ func InitSkuName(ctx *jxcontext.Context, isForce, isAsync, isContinueWhenError b
|
|||||||
return hint, err
|
return hint, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitVendorCategory(ctx *jxcontext.Context) (err error) {
|
func InitVendorCategory(ctx *jxcontext.Context) (num int64, err error) {
|
||||||
if handler, ok := partner.PurchasePlatformHandlers[model.VendorIDMTWM].(*mtwm.PurchaseHandler); ok {
|
if handler, ok := partner.PurchasePlatformHandlers[model.VendorIDMTWM].(*mtwm.PurchaseHandler); ok {
|
||||||
cats, err2 := handler.GetVendorCategories()
|
cats, err2 := handler.GetVendorCategories()
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
return err2
|
return num, err2
|
||||||
}
|
}
|
||||||
|
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
@@ -180,15 +180,16 @@ func InitVendorCategory(ctx *jxcontext.Context) (err error) {
|
|||||||
WHERE vendor_id = ?
|
WHERE vendor_id = ?
|
||||||
`
|
`
|
||||||
if _, err = dao.ExecuteSQL(db, sql, model.VendorIDMTWM); err != nil {
|
if _, err = dao.ExecuteSQL(db, sql, model.VendorIDMTWM); err != nil {
|
||||||
return err
|
return num, err
|
||||||
}
|
}
|
||||||
for _, cat := range cats {
|
for _, cat := range cats {
|
||||||
dao.WrapAddIDCULEntity(cat, ctx.GetUserName())
|
dao.WrapAddIDCULEntity(cat, ctx.GetUserName())
|
||||||
if err = dao.CreateEntity(db, cat); err != nil {
|
if err = dao.CreateEntity(db, cat); err != nil {
|
||||||
return err
|
return num, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dao.Commit(db)
|
dao.Commit(db)
|
||||||
|
num = int64(len(cats))
|
||||||
}
|
}
|
||||||
return err
|
return num, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ func (c *InitDataController) InitSkuName() {
|
|||||||
// @router /InitVendorCategory [post]
|
// @router /InitVendorCategory [post]
|
||||||
func (c *InitDataController) InitVendorCategory() {
|
func (c *InitDataController) InitVendorCategory() {
|
||||||
c.callInitVendorCategory(func(params *tInitdataInitVendorCategoryParams) (retVal interface{}, errCode string, err error) {
|
c.callInitVendorCategory(func(params *tInitdataInitVendorCategoryParams) (retVal interface{}, errCode string, err error) {
|
||||||
err = initdata.InitVendorCategory(params.Ctx)
|
retVal, err = initdata.InitVendorCategory(params.Ctx)
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user