aa
This commit is contained in:
@@ -573,7 +573,7 @@ func CreateAct(ctx *jxcontext.Context, act *model.Act, vendorIDs []int, vendorOr
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
dao.WrapAddIDCULDEntity(act, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(act, ctx.GetUserName())
|
||||||
err = dao.CreateEntity(db, act)
|
err = dao.CreateEntityTx(txDB, act)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dao.Rollback(db, txDB)
|
dao.Rollback(db, txDB)
|
||||||
return "", err
|
return "", err
|
||||||
|
|||||||
@@ -246,7 +246,8 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
|
|||||||
db2 = dao.GetDB()
|
db2 = dao.GetDB()
|
||||||
}
|
}
|
||||||
if model.IsSyncStatusNew(storeMap.SyncStatus) {
|
if model.IsSyncStatusNew(storeMap.SyncStatus) {
|
||||||
if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName, nil, nil); err == nil {
|
storeDetail, _ := dao.GetStoreDetail(db, storeMap.StoreID, storeMap.VendorID, storeMap.VendorOrgCode)
|
||||||
|
if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName, nil, storeDetail); err == nil {
|
||||||
resultList = append(resultList, 1)
|
resultList = append(resultList, 1)
|
||||||
} else {
|
} else {
|
||||||
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "创建门店")
|
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "创建门店")
|
||||||
@@ -284,7 +285,8 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
|
|||||||
var vendorStoreID string
|
var vendorStoreID string
|
||||||
storeMap := loopMapInfo.StoreMapList[0]
|
storeMap := loopMapInfo.StoreMapList[0]
|
||||||
if model.IsSyncStatusNew(storeMap.SyncStatus) {
|
if model.IsSyncStatusNew(storeMap.SyncStatus) {
|
||||||
if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName, nil, nil); err == nil {
|
storeDetail, _ := dao.GetStoreDetail(db, storeMap.StoreID, storeMap.VendorID, storeMap.VendorOrgCode)
|
||||||
|
if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName, nil, storeDetail); err == nil {
|
||||||
resultList = append(resultList, 1)
|
resultList = append(resultList, 1)
|
||||||
} else {
|
} else {
|
||||||
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "创建门店")
|
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "创建门店")
|
||||||
|
|||||||
@@ -166,7 +166,6 @@ func Init() {
|
|||||||
ScheduleTimerFunc("doDailyWork", doDailyWork, dailyWorkTimeList)
|
ScheduleTimerFunc("doDailyWork", doDailyWork, dailyWorkTimeList)
|
||||||
|
|
||||||
ScheduleTimerFunc("doDailyWork2", doDailyWork2, dailyWorkTimeList2)
|
ScheduleTimerFunc("doDailyWork2", doDailyWork2, dailyWorkTimeList2)
|
||||||
|
|
||||||
// ScheduleTimerFuncByInterval(func() {
|
// ScheduleTimerFuncByInterval(func() {
|
||||||
// orderman.SaveJdsOrders(jxcontext.AdminCtx, time.Now().Add(-20*time.Minute), time.Now())
|
// orderman.SaveJdsOrders(jxcontext.AdminCtx, time.Now().Add(-20*time.Minute), time.Now())
|
||||||
// }, 10*time.Second, 10*time.Minute)
|
// }, 10*time.Second, 10*time.Minute)
|
||||||
|
|||||||
@@ -207,6 +207,16 @@ func CreateEntity(db *DaoDB, item interface{}) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateEntityTx(txDB orm.TxOrmer, item interface{}) (err error) {
|
||||||
|
if txDB == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, err = txDB.Insert(item); err != nil && !IsDuplicateError(err) {
|
||||||
|
globals.SugarLogger.Errorf("CreateEntity %s failed with error:%v", reflect.TypeOf(item).Name(), err)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// InsertMulti执行成功后ID不会改写成正确的(象Insert一样)
|
// InsertMulti执行成功后ID不会改写成正确的(象Insert一样)
|
||||||
func CreateMultiEntities(db *DaoDB, item interface{}) (err error) {
|
func CreateMultiEntities(db *DaoDB, item interface{}) (err error) {
|
||||||
if db == nil {
|
if db == nil {
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package api
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/baseapi/platformapi/mtunionapi"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/platformapi/fnpsapi"
|
"git.rosy.net.cn/baseapi/platformapi/fnpsapi"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/platformapi/unipushapi"
|
"git.rosy.net.cn/baseapi/platformapi/unipushapi"
|
||||||
@@ -46,6 +48,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
MtUnionAPI *mtunionapi.API
|
||||||
|
|
||||||
JdAPI *jdapi.API
|
JdAPI *jdapi.API
|
||||||
JdPageAPI *jdapi.API
|
JdPageAPI *jdapi.API
|
||||||
|
|
||||||
@@ -111,6 +115,7 @@ func init() {
|
|||||||
|
|
||||||
// 这样写的原因是在测试时,可以重新读取配置文件
|
// 这样写的原因是在测试时,可以重新读取配置文件
|
||||||
func Init() {
|
func Init() {
|
||||||
|
MtUnionAPI = mtunionapi.New("appKey", "appSecret")
|
||||||
if !beego.AppConfig.DefaultBool("disableJd", false) {
|
if !beego.AppConfig.DefaultBool("disableJd", false) {
|
||||||
//初始化京东api
|
//初始化京东api
|
||||||
// JdAPI = jdapi.New(beego.AppConfig.DefaultString("jdToken"), beego.AppConfig.DefaultString("jdAppKey"), beego.AppConfig.DefaultString("jdSecret"))
|
// JdAPI = jdapi.New(beego.AppConfig.DefaultString("jdToken"), beego.AppConfig.DefaultString("jdAppKey"), beego.AppConfig.DefaultString("jdSecret"))
|
||||||
|
|||||||
Reference in New Issue
Block a user