特殊处理err
This commit is contained in:
@@ -1786,7 +1786,6 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dao.Commit(db, txDB)
|
dao.Commit(db, txDB)
|
||||||
globals.SugarLogger.Debug("检查一下isStoreMapNeedSync(vendorID, valid)=============%s", isStoreMapNeedSync(vendorID, valid))
|
|
||||||
if isStoreMapNeedSync(vendorID, valid) {
|
if isStoreMapNeedSync(vendorID, valid) {
|
||||||
globals.SugarLogger.Debug("1.isStoreMapNeedSync(vendorID, valid)=================", isStoreMapNeedSync(vendorID, valid))
|
globals.SugarLogger.Debug("1.isStoreMapNeedSync(vendorID, valid)=================", isStoreMapNeedSync(vendorID, valid))
|
||||||
_, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName)
|
_, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName)
|
||||||
|
|||||||
@@ -189,7 +189,6 @@ func SyncStoreSkuNew2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFla
|
|||||||
globals.SugarLogger.Debugf("SyncStoreCategories in SyncStoreSkuNew2 err on: %s", err)
|
globals.SugarLogger.Debugf("SyncStoreCategories in SyncStoreSkuNew2 err on: %s", err)
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
globals.SugarLogger.Debugf("同步商品分类,看看走不走: 门店地[%d],平台门店地[%s],商品id[%v]", storeID, vendorStoreID, skuIDs)
|
|
||||||
err = syncStoreSkuNew(ctx, task, causeFlag, false, vendorID, storeID, vendorOrgCode, nameIDs, skuIDs, excludeSkuIDs, useVendorPriceDirectly, isContinueWhenError)
|
err = syncStoreSkuNew(ctx, task, causeFlag, false, vendorID, storeID, vendorOrgCode, nameIDs, skuIDs, excludeSkuIDs, useVendorPriceDirectly, isContinueWhenError)
|
||||||
}
|
}
|
||||||
return result, err
|
return result, err
|
||||||
|
|||||||
@@ -131,7 +131,8 @@ func (P *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
|||||||
errList.AddErr(err)
|
errList.AddErr(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return vendorStoreIDs, errors.New(fmt.Sprintf("%s", utils.Format4Output(errList, true)))
|
endErr := errList.GetErrListAsOne()
|
||||||
|
return vendorStoreIDs, errors.New(fmt.Sprintf("创建抖店平台店铺相关错误信息:%v", endErr))
|
||||||
}
|
}
|
||||||
|
|
||||||
//电子围栏 仓库 运费模板 限售模板 更新与绑定
|
//电子围栏 仓库 运费模板 限售模板 更新与绑定
|
||||||
@@ -256,9 +257,8 @@ func CreateOrUpdateAll(vendorOrgCode string, storeID, vendorStoreID int64) (stri
|
|||||||
endErr := errList.GetErrListAsOne()
|
endErr := errList.GetErrListAsOne()
|
||||||
if utils.IsNil(errList) {
|
if utils.IsNil(errList) {
|
||||||
globals.SugarLogger.Debug("绑定门店需进行的错误处理:%v", errors.New(fmt.Sprintf("%s", utils.Format4Output(errList, true))))
|
globals.SugarLogger.Debug("绑定门店需进行的错误处理:%v", errors.New(fmt.Sprintf("%s", utils.Format4Output(errList, true))))
|
||||||
return "门店绑定成功,但需要根据提示进行处理", errors.New(fmt.Sprintf("%s", endErr))
|
return "门店绑定成功,但需要根据提示进行处理", endErr
|
||||||
} else {
|
} else {
|
||||||
globals.SugarLogger.Debug("the last step of")
|
|
||||||
return "门店绑定成功", nil
|
return "门店绑定成功", nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -372,7 +372,7 @@ func (P *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
endErr := errList.GetErrListAsOne()
|
endErr := errList.GetErrListAsOne()
|
||||||
return errors.New(fmt.Sprintf("endErr=%s", endErr))
|
return errors.New(fmt.Sprintf("更新抖店平台店铺信息,相关处理错误:%v", endErr))
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateStoreStatus shop/unsuspendStore 门店恢复营业
|
// UpdateStoreStatus shop/unsuspendStore 门店恢复营业
|
||||||
@@ -463,7 +463,6 @@ func CreateFreightTemplate(storeCode int) (int64, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp.TemplateId, nil
|
return resp.TemplateId, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
//京西平台的电子围栏形状
|
||||||
|
LocalShapeCircular = 3 //圆
|
||||||
|
LocalShapePolygon = 2 //普通多边形
|
||||||
|
)
|
||||||
|
|
||||||
// /warehouse/create 创建单个区域仓
|
// /warehouse/create 创建单个区域仓
|
||||||
func CreateWarehouse(appOrgCode, outWarehouseID string) (warehouseID int64, err error) {
|
func CreateWarehouse(appOrgCode, outWarehouseID string) (warehouseID int64, err error) {
|
||||||
tempName := "京西菜市(" + outWarehouseID + ")的区域仓"
|
tempName := "京西菜市(" + outWarehouseID + ")的区域仓"
|
||||||
@@ -98,6 +104,7 @@ func CreateFenceByStore(appOrgCode string, storeID int64) (fenceID string, err e
|
|||||||
db *dao.DaoDB
|
db *dao.DaoDB
|
||||||
localStore *LocalStore
|
localStore *LocalStore
|
||||||
vertex []warehouse_createFence_request.VerticesItem
|
vertex []warehouse_createFence_request.VerticesItem
|
||||||
|
param = &warehouse_createFence_request.WarehouseCreateFenceParam{}
|
||||||
)
|
)
|
||||||
sqlParam := []interface{}{
|
sqlParam := []interface{}{
|
||||||
model.VendorIDDD,
|
model.VendorIDDD,
|
||||||
@@ -112,14 +119,8 @@ func CreateFenceByStore(appOrgCode string, storeID int64) (fenceID string, err e
|
|||||||
return "", fmt.Errorf("storeID必填")
|
return "", fmt.Errorf("storeID必填")
|
||||||
}
|
}
|
||||||
if err = dao.GetRow(db, &localStore, sqlStr, sqlParam...); err == nil {
|
if err = dao.GetRow(db, &localStore, sqlStr, sqlParam...); err == nil {
|
||||||
param := &warehouse_createFence_request.WarehouseCreateFenceParam{
|
|
||||||
FenceInfo: &warehouse_createFence_request.FenceInfo{
|
|
||||||
OutFenceId: utils.Int64ToStr(storeID), //绑定基于此id
|
|
||||||
Shape: int32(localStore.DeliveryRangeType),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
globals.SugarLogger.Debug("localStore.DeliveryRangeType==============", localStore.DeliveryRangeType)
|
globals.SugarLogger.Debug("localStore.DeliveryRangeType==============", localStore.DeliveryRangeType)
|
||||||
if localStore.DeliveryRangeType == tiktok_api.ShapeCircular {
|
if localStore.DeliveryRangeType == LocalShapeCircular {
|
||||||
circular := &warehouse_createFence_request.Circular{
|
circular := &warehouse_createFence_request.Circular{
|
||||||
Center: &warehouse_createFence_request.Center{
|
Center: &warehouse_createFence_request.Center{
|
||||||
Longitude: utils.Int2Float64(localStore.Lng),
|
Longitude: utils.Int2Float64(localStore.Lng),
|
||||||
@@ -128,7 +129,8 @@ func CreateFenceByStore(appOrgCode string, storeID int64) (fenceID string, err e
|
|||||||
Radius: utils.Str2Float64(localStore.DeliveryRange),
|
Radius: utils.Str2Float64(localStore.DeliveryRange),
|
||||||
}
|
}
|
||||||
param.FenceInfo.Circular = circular
|
param.FenceInfo.Circular = circular
|
||||||
} else if localStore.DeliveryRangeType == tiktok_api.ShapePolygon {
|
param.FenceInfo.Shape = tiktok_api.ShapeCircular
|
||||||
|
} else if localStore.DeliveryRangeType == LocalShapePolygon {
|
||||||
tempStr := strings.Split(localStore.DeliveryRange, ";")
|
tempStr := strings.Split(localStore.DeliveryRange, ";")
|
||||||
for v := len(tempStr) - 1; v >= 0; v-- {
|
for v := len(tempStr) - 1; v >= 0; v-- {
|
||||||
s2 := strings.Split(tempStr[v], ",")
|
s2 := strings.Split(tempStr[v], ",")
|
||||||
@@ -139,7 +141,9 @@ func CreateFenceByStore(appOrgCode string, storeID int64) (fenceID string, err e
|
|||||||
vertex = append(vertex, vertices)
|
vertex = append(vertex, vertices)
|
||||||
}
|
}
|
||||||
param.FenceInfo.Polygon.Vertices = vertex
|
param.FenceInfo.Polygon.Vertices = vertex
|
||||||
|
param.FenceInfo.Shape = tiktok_api.ShapePolygon
|
||||||
}
|
}
|
||||||
|
param.FenceInfo.OutFenceId = utils.Int64ToStr(storeID) //绑定基于此id
|
||||||
resp, err := getAPI(appOrgCode, 0, "").CreateFence(param)
|
resp, err := getAPI(appOrgCode, 0, "").CreateFence(param)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
@@ -168,7 +172,7 @@ func UpdateFenceByStore(appOrgCode, outFenceID string, storeID int) error {
|
|||||||
var (
|
var (
|
||||||
db *dao.DaoDB
|
db *dao.DaoDB
|
||||||
localStore *LocalStore
|
localStore *LocalStore
|
||||||
verticeses []warehouse_setFence_request.VerticesItem
|
vertex []warehouse_setFence_request.VerticesItem
|
||||||
)
|
)
|
||||||
sqlParam := []interface{}{
|
sqlParam := []interface{}{
|
||||||
model.VendorIDDD,
|
model.VendorIDDD,
|
||||||
@@ -205,9 +209,9 @@ func UpdateFenceByStore(appOrgCode, outFenceID string, storeID int) error {
|
|||||||
Longitude: utils.Str2Float64(s2[0]),
|
Longitude: utils.Str2Float64(s2[0]),
|
||||||
Latitude: utils.Str2Float64(s2[1]),
|
Latitude: utils.Str2Float64(s2[1]),
|
||||||
}
|
}
|
||||||
verticeses = append(verticeses, vertices)
|
vertex = append(vertex, vertices)
|
||||||
}
|
}
|
||||||
param.FenceInfo.Polygon.Vertices = verticeses
|
param.FenceInfo.Polygon.Vertices = vertex
|
||||||
}
|
}
|
||||||
if err := getAPI(appOrgCode, 0, "").SetFence(param); err != nil {
|
if err := getAPI(appOrgCode, 0, "").SetFence(param); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -254,7 +258,6 @@ func FreightSpecialTreat(vendorOrgCode string, vendorStoreID, storeID int64) err
|
|||||||
errList.AddErr(fmt.Errorf("获取门店(%d) 绑定运费模板出错:%v", vendorStoreID, err))
|
errList.AddErr(fmt.Errorf("获取门店(%d) 绑定运费模板出错:%v", vendorStoreID, err))
|
||||||
}
|
}
|
||||||
if bindFreightIDs == 0 { //(1)未查询到绑定信息,不算错误
|
if bindFreightIDs == 0 { //(1)未查询到绑定信息,不算错误
|
||||||
globals.SugarLogger.Debug("我在创建绑定运费模板这里=========================")
|
|
||||||
if freightTemplateID, err := CreateFreightTemplate(int(storeID)); err != nil || freightTemplateID == 0 || utils.IsNil(freightTemplateID) {
|
if freightTemplateID, err := CreateFreightTemplate(int(storeID)); err != nil || freightTemplateID == 0 || utils.IsNil(freightTemplateID) {
|
||||||
globals.SugarLogger.Debug("创建运费模板失败:", err)
|
globals.SugarLogger.Debug("创建运费模板失败:", err)
|
||||||
errList.AddErr(fmt.Errorf("创建运费模板失败:%v", err))
|
errList.AddErr(fmt.Errorf("创建运费模板失败:%v", err))
|
||||||
@@ -272,15 +275,14 @@ func FreightSpecialTreat(vendorOrgCode string, vendorStoreID, storeID int64) err
|
|||||||
errList.AddErr(fmt.Errorf("更新运费模板失败:%v", err))
|
errList.AddErr(fmt.Errorf("更新运费模板失败:%v", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err = dao.CreateEntity(db, FreightTemplate); err != nil {
|
err1 := dao.CreateEntity(db, FreightTemplate)
|
||||||
globals.SugarLogger.Debug("db update storeID,vendorStoreID defeat on :", err)
|
if err1 != nil {
|
||||||
errList.AddErr(fmt.Errorf("db update storeID,vendorStoreID defeat on :%v", err))
|
_, err2 := dao.UpdateEntity(db, FreightTemplate, "TemplateID")
|
||||||
} else {
|
if err2 != nil {
|
||||||
_, err1 := dao.UpdateEntity(db, FreightTemplate, "TemplateID")
|
|
||||||
errList.AddErr(fmt.Errorf("同步进数据库错误信息:%v", err1))
|
errList.AddErr(fmt.Errorf("同步进数据库错误信息:%v", err1))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
endErr := errList.GetErrListAsOne()
|
endErr := errList.GetErrListAsOne()
|
||||||
globals.SugarLogger.Info("utils.IsNil(errList)==============", utils.IsNil(errList))
|
globals.SugarLogger.Debugf("errList===============%s", endErr)
|
||||||
globals.SugarLogger.Debugf("errList===============%s\n,endErr========%v", utils.Format4Output(errList, false), endErr)
|
|
||||||
return endErr
|
return endErr
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user