From 41a003df55db505f821c764fc1c3c6a48e1f486d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Sun, 19 Jan 2020 17:20:11 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=B0=8F=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/store.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 35d230973..28cf4cd52 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -573,13 +573,13 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore } else if sort == -1 { sql += " ORDER BY a.score DESC" } else if sort == 2 { - sql += " ORDER BY t1.direct_down_count" + sql += " ORDER BY t2.direct_down_count" } else if sort == -2 { - sql += " ORDER BY t1.direct_down_count DESC" + sql += " ORDER BY t2.direct_down_count DESC" } else if sort == 3 { - sql += " ORDER BY t1.sec_kill_count" + sql += " ORDER BY t2.sec_kill_count" } else if sort == -3 { - sql += " ORDER BY t1.sec_kill_count DESC" + sql += " ORDER BY t2.sec_kill_count DESC" } sql += " LIMIT ? OFFSET ?" sqlParams = append(sqlParams, pageSize, offset) From 64e08219dbe0c4b66fc760847cd945f48c348f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 20 Jan 2020 13:40:01 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=90=84=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E7=88=86=E5=93=81=E6=8A=A5=E8=AD=A6=EF=BC=88=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 146 ++++++++++++++++++- business/partner/purchase/mtwm/store_sku2.go | 2 +- 2 files changed, 139 insertions(+), 9 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index c7cc84f53..2275246f5 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -13,12 +13,15 @@ import ( "time" "unicode" + "git.rosy.net.cn/jx-callback/globals/api" + "git.rosy.net.cn/jx-callback/globals/refutil" "git.rosy.net.cn/jx-callback/business/jxstore/event" "git.rosy.net.cn/baseapi" + "git.rosy.net.cn/jx-callback/business/jxutils/ddmsg" "git.rosy.net.cn/jx-callback/business/jxutils/excel" "git.rosy.net.cn/jx-callback/business/jxutils/tasksch" "git.rosy.net.cn/jx-callback/business/partner/purchase/jd" @@ -26,6 +29,7 @@ import ( "git.rosy.net.cn/jx-callback/business/partner" + "git.rosy.net.cn/baseapi/platformapi/dingdingapi" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils/errlist" "git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin" @@ -164,6 +168,12 @@ type tUpdateStoresSkus struct { SkuBindInfos []*StoreSkuBindInfo } +type tStoreSkusSecKill struct { + StoreID int + SecKillCount int + SecKillCount2 int +} + const ( maxStoreNameBind = 10000 // 最大门店SkuName bind个数 maxStoreNameBind2 = 10000 // 最大门店乘SkuName个数 @@ -3320,17 +3330,137 @@ func getCellForSpecTag(rowNum int, row []string, storeSkuMap map[int][]*partner. isSpec int ) for k, cell := range row { - if k == 0 { - storeID = int(utils.Str2Int64(cell)) - } - if k == 1 { - skuID = int(utils.Str2Int64(cell)) - } - if k == 2 { - isSpec = int(utils.Str2Int64(cell)) + if cell != "" { + if k == 0 { + storeID = int(utils.Str2Int64(cell)) + } + if k == 1 { + skuID = int(utils.Str2Int64(cell)) + } + if k == 2 { + isSpec = int(utils.Str2Int64(cell)) + } } } skuMap.SkuID = skuID skuMap.IsSpecialty = isSpec storeSkuMap[storeID] = append(storeSkuMap[storeID], skuMap) } + +func SendSeckillSkusCountMsg(ctx *jxcontext.Context, vendorIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) { + // 1. 如果爆品低于8个,报警 type1 + // 2. 爆品价格低于1元商品小于5个,报警 type2 + var ( + type1Count = 8 + type2Count = 5 + ) + db := dao.GetDB() + storeList, err := dao.GetStoreList(db, nil, nil, []int{model.StoreStatusOpened, model.StoreStatusClosed, model.StoreStatusHaveRest}, nil, "") + task := tasksch.NewParallelTask("SendSeckillSkusCountMsg", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx, + func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + store := batchItemList[0].(*model.Store) + for _, vendorID := range vendorIDs { + storeDetial, _ := dao.GetStoreDetail(db, store.ID, vendorID) + var type1, type2 int + switch vendorID { + case model.VendorIDEBAI: + result, err := api.EbaiAPI.GetStoresShowWindowSkus(utils.Str2Int64(storeDetial.VendorStoreID)) + if err != nil { + return retVal, err + } + for _, v := range result.SkuList { + type1++ + if v.SalePrice < 1 { + type2++ + } + } + case model.VendorIDMTWM: + handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler) + remoteSkuList, err := handler.GetStoreSkusFullInfo(ctx, nil, store.ID, storeDetial.VendorStoreID, nil) + if err != nil { + return retVal, err + } + for _, v := range remoteSkuList { + for _, vv := range v.SkuList { + if vv.IsSpecialty == 1 { + type1++ + } + if vv.IsSpecialty == 1 && vv.VendorPrice < 100 { + type2++ + } + } + } + case model.VendorIDJD: + var storeSecKill *tStoreSkusSecKill + sql := ` + SELECT t1.store_id,count(*) sec_kill_count, count(t1.price < 100 or NULL) sec_kill_count2 + FROM( + SELECT a.store_id, a.sku_id, d.type, MIN(b.act_price) price + FROM store_sku_bind a + LEFT JOIN act_store_sku b ON a.store_id = b.store_id AND b.sku_id = a.sku_id + LEFT JOIN act_map c ON c.act_id = b.act_id + LEFT JOIN act d ON d.id = c.act_id + WHERE 1=1 + AND a.store_id = ? + AND c.vendor_id = ? + AND NOW() BETWEEN d.begin_at AND d.end_at + AND d.type = ? + AND a.status = ? + AND a.deleted_at = ? + GROUP BY 1,2,3)t1 + GROUP BY 1 + ` + sqlParams := []interface{}{ + model.ActSkuSecKill, + store.ID, vendorID, + model.ActSkuSecKill, model.StoreSkuBindStatusNormal, + utils.DefaultTimeValue, + } + err = dao.GetRow(db, &storeSecKill, sql, sqlParams...) + type1 = storeSecKill.SecKillCount + type2 = storeSecKill.SecKillCount2 + } + if type1 < type1Count || type2 < type2Count { + err = sendDDMsgBySpecSkusCount(db, type1, type2, storeDetial, vendorID) + } + fmt.Println(type1, type2, vendorID) + } + return retVal, err + }, storeList) + tasksch.HandleTask(task, nil, true).Run() + if !isAsync { + _, err = task.GetResult(0) + } else { + hint = task.GetID() + } + return hint, err +} + +func sendDDMsgBySpecSkusCount(db *dao.DaoDB, type1Count, type2Count int, store *dao.StoreDetail, vendorID int) (err error) { + var ( + operatorName string + operatorPhone string + type1 = "爆品数量低于8个!" + type2 = "爆品价格小于1元的爆品数量低于5个!" + typeResult = "" + ) + if store.OperatorPhone != "" { + operatorName = store.OperatorName + operatorPhone = store.OperatorPhone + } else if store.OperatorPhone2 != "" { + operatorName = store.OperatorName2 + operatorPhone = store.OperatorPhone2 + } + if type1Count < 8 { + typeResult += type1 + } + if type2Count < 5 { + typeResult += type2 + } + noticeMsg := fmt.Sprintf("运营负责人:[%v],门店ID:[%v],平台门店ID[%v],门店名:[%v],平台:[%v],警告类型:[%v]", operatorName, store.ID, store.VendorStoreID, store.Name, model.VendorChineseNames[vendorID], typeResult) + user, err := dao.GetUserByID(db, "mobile", operatorPhone) + user2, err := dao.GetUserByID(db, "mobile", store.MarketManPhone) + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user.UserID, "警告!门店爆品数量异常!", noticeMsg) + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user2.UserID, "警告!门店爆品数量异常!", noticeMsg) + return err +} diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index fe33e6e34..320260e29 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -495,7 +495,7 @@ func vendorSku2Jx(appFood *mtwmapi.AppFood) (skuName *partner.SkuNameInfo) { StoreSkuInfo: partner.StoreSkuInfo{ VendorSkuID: vendorSku.SkuID, SkuID: skuID, - + IsSpecialty: appFood.IsSpecialty, Stock: int(utils.Str2Int64WithDefault(vendorSku.Stock, partner.UnlimitedStoreSkuStock)), VendorPrice: jxutils.StandardPrice2Int(utils.Str2Float64WithDefault(vendorSku.Price, 0)), Status: mtwmSkuStatus2Jx(appFood.IsSoldOut), From cc6f201690f770e279bb47e8c1673b37c78d3b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Sun, 19 Jan 2020 17:20:11 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=B0=8F=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/store.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 35d230973..28cf4cd52 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -573,13 +573,13 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore } else if sort == -1 { sql += " ORDER BY a.score DESC" } else if sort == 2 { - sql += " ORDER BY t1.direct_down_count" + sql += " ORDER BY t2.direct_down_count" } else if sort == -2 { - sql += " ORDER BY t1.direct_down_count DESC" + sql += " ORDER BY t2.direct_down_count DESC" } else if sort == 3 { - sql += " ORDER BY t1.sec_kill_count" + sql += " ORDER BY t2.sec_kill_count" } else if sort == -3 { - sql += " ORDER BY t1.sec_kill_count DESC" + sql += " ORDER BY t2.sec_kill_count DESC" } sql += " LIMIT ? OFFSET ?" sqlParams = append(sqlParams, pageSize, offset) From 5f1607b73e1554c70ac5e8c35a649837cd8f9477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 20 Jan 2020 13:40:01 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=90=84=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E7=88=86=E5=93=81=E6=8A=A5=E8=AD=A6=EF=BC=88=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 146 ++++++++++++++++++- business/partner/purchase/mtwm/store_sku2.go | 2 +- 2 files changed, 139 insertions(+), 9 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index c7cc84f53..2275246f5 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -13,12 +13,15 @@ import ( "time" "unicode" + "git.rosy.net.cn/jx-callback/globals/api" + "git.rosy.net.cn/jx-callback/globals/refutil" "git.rosy.net.cn/jx-callback/business/jxstore/event" "git.rosy.net.cn/baseapi" + "git.rosy.net.cn/jx-callback/business/jxutils/ddmsg" "git.rosy.net.cn/jx-callback/business/jxutils/excel" "git.rosy.net.cn/jx-callback/business/jxutils/tasksch" "git.rosy.net.cn/jx-callback/business/partner/purchase/jd" @@ -26,6 +29,7 @@ import ( "git.rosy.net.cn/jx-callback/business/partner" + "git.rosy.net.cn/baseapi/platformapi/dingdingapi" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils/errlist" "git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin" @@ -164,6 +168,12 @@ type tUpdateStoresSkus struct { SkuBindInfos []*StoreSkuBindInfo } +type tStoreSkusSecKill struct { + StoreID int + SecKillCount int + SecKillCount2 int +} + const ( maxStoreNameBind = 10000 // 最大门店SkuName bind个数 maxStoreNameBind2 = 10000 // 最大门店乘SkuName个数 @@ -3320,17 +3330,137 @@ func getCellForSpecTag(rowNum int, row []string, storeSkuMap map[int][]*partner. isSpec int ) for k, cell := range row { - if k == 0 { - storeID = int(utils.Str2Int64(cell)) - } - if k == 1 { - skuID = int(utils.Str2Int64(cell)) - } - if k == 2 { - isSpec = int(utils.Str2Int64(cell)) + if cell != "" { + if k == 0 { + storeID = int(utils.Str2Int64(cell)) + } + if k == 1 { + skuID = int(utils.Str2Int64(cell)) + } + if k == 2 { + isSpec = int(utils.Str2Int64(cell)) + } } } skuMap.SkuID = skuID skuMap.IsSpecialty = isSpec storeSkuMap[storeID] = append(storeSkuMap[storeID], skuMap) } + +func SendSeckillSkusCountMsg(ctx *jxcontext.Context, vendorIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) { + // 1. 如果爆品低于8个,报警 type1 + // 2. 爆品价格低于1元商品小于5个,报警 type2 + var ( + type1Count = 8 + type2Count = 5 + ) + db := dao.GetDB() + storeList, err := dao.GetStoreList(db, nil, nil, []int{model.StoreStatusOpened, model.StoreStatusClosed, model.StoreStatusHaveRest}, nil, "") + task := tasksch.NewParallelTask("SendSeckillSkusCountMsg", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx, + func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + store := batchItemList[0].(*model.Store) + for _, vendorID := range vendorIDs { + storeDetial, _ := dao.GetStoreDetail(db, store.ID, vendorID) + var type1, type2 int + switch vendorID { + case model.VendorIDEBAI: + result, err := api.EbaiAPI.GetStoresShowWindowSkus(utils.Str2Int64(storeDetial.VendorStoreID)) + if err != nil { + return retVal, err + } + for _, v := range result.SkuList { + type1++ + if v.SalePrice < 1 { + type2++ + } + } + case model.VendorIDMTWM: + handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler) + remoteSkuList, err := handler.GetStoreSkusFullInfo(ctx, nil, store.ID, storeDetial.VendorStoreID, nil) + if err != nil { + return retVal, err + } + for _, v := range remoteSkuList { + for _, vv := range v.SkuList { + if vv.IsSpecialty == 1 { + type1++ + } + if vv.IsSpecialty == 1 && vv.VendorPrice < 100 { + type2++ + } + } + } + case model.VendorIDJD: + var storeSecKill *tStoreSkusSecKill + sql := ` + SELECT t1.store_id,count(*) sec_kill_count, count(t1.price < 100 or NULL) sec_kill_count2 + FROM( + SELECT a.store_id, a.sku_id, d.type, MIN(b.act_price) price + FROM store_sku_bind a + LEFT JOIN act_store_sku b ON a.store_id = b.store_id AND b.sku_id = a.sku_id + LEFT JOIN act_map c ON c.act_id = b.act_id + LEFT JOIN act d ON d.id = c.act_id + WHERE 1=1 + AND a.store_id = ? + AND c.vendor_id = ? + AND NOW() BETWEEN d.begin_at AND d.end_at + AND d.type = ? + AND a.status = ? + AND a.deleted_at = ? + GROUP BY 1,2,3)t1 + GROUP BY 1 + ` + sqlParams := []interface{}{ + model.ActSkuSecKill, + store.ID, vendorID, + model.ActSkuSecKill, model.StoreSkuBindStatusNormal, + utils.DefaultTimeValue, + } + err = dao.GetRow(db, &storeSecKill, sql, sqlParams...) + type1 = storeSecKill.SecKillCount + type2 = storeSecKill.SecKillCount2 + } + if type1 < type1Count || type2 < type2Count { + err = sendDDMsgBySpecSkusCount(db, type1, type2, storeDetial, vendorID) + } + fmt.Println(type1, type2, vendorID) + } + return retVal, err + }, storeList) + tasksch.HandleTask(task, nil, true).Run() + if !isAsync { + _, err = task.GetResult(0) + } else { + hint = task.GetID() + } + return hint, err +} + +func sendDDMsgBySpecSkusCount(db *dao.DaoDB, type1Count, type2Count int, store *dao.StoreDetail, vendorID int) (err error) { + var ( + operatorName string + operatorPhone string + type1 = "爆品数量低于8个!" + type2 = "爆品价格小于1元的爆品数量低于5个!" + typeResult = "" + ) + if store.OperatorPhone != "" { + operatorName = store.OperatorName + operatorPhone = store.OperatorPhone + } else if store.OperatorPhone2 != "" { + operatorName = store.OperatorName2 + operatorPhone = store.OperatorPhone2 + } + if type1Count < 8 { + typeResult += type1 + } + if type2Count < 5 { + typeResult += type2 + } + noticeMsg := fmt.Sprintf("运营负责人:[%v],门店ID:[%v],平台门店ID[%v],门店名:[%v],平台:[%v],警告类型:[%v]", operatorName, store.ID, store.VendorStoreID, store.Name, model.VendorChineseNames[vendorID], typeResult) + user, err := dao.GetUserByID(db, "mobile", operatorPhone) + user2, err := dao.GetUserByID(db, "mobile", store.MarketManPhone) + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user.UserID, "警告!门店爆品数量异常!", noticeMsg) + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user2.UserID, "警告!门店爆品数量异常!", noticeMsg) + return err +} diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index fe33e6e34..320260e29 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -495,7 +495,7 @@ func vendorSku2Jx(appFood *mtwmapi.AppFood) (skuName *partner.SkuNameInfo) { StoreSkuInfo: partner.StoreSkuInfo{ VendorSkuID: vendorSku.SkuID, SkuID: skuID, - + IsSpecialty: appFood.IsSpecialty, Stock: int(utils.Str2Int64WithDefault(vendorSku.Stock, partner.UnlimitedStoreSkuStock)), VendorPrice: jxutils.StandardPrice2Int(utils.Str2Float64WithDefault(vendorSku.Price, 0)), Status: mtwmSkuStatus2Jx(appFood.IsSoldOut), From e48d262f8f8aab4688aaa1ccb967dee57e929020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 20 Jan 2020 14:14:22 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=88=86=E5=93=81=E9=A2=84=E8=AD=A6?= =?UTF-8?q?=EF=BC=88=E6=B5=8B=E8=AF=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 18 ++++++++++++------ controllers/cms_store_sku.go | 19 +++++++++++++++++++ routers/commentsRouter_controllers.go | 9 +++++++++ 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 2275246f5..0fbadda48 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -169,7 +169,8 @@ type tUpdateStoresSkus struct { } type tStoreSkusSecKill struct { - StoreID int + StoreID int `orm:"column(store_id)"` + VendorID int `orm:"column(vendor_id)"` SecKillCount int SecKillCount2 int } @@ -3347,7 +3348,7 @@ func getCellForSpecTag(rowNum int, row []string, storeSkuMap map[int][]*partner. storeSkuMap[storeID] = append(storeSkuMap[storeID], skuMap) } -func SendSeckillSkusCountMsg(ctx *jxcontext.Context, vendorIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) { +func SendSeckillSkusCountMsg(ctx *jxcontext.Context, vendorIDs []int, isAsync, isContinueWhenError bool) (hint interface{}, err error) { // 1. 如果爆品低于8个,报警 type1 // 2. 爆品价格低于1元商品小于5个,报警 type2 var ( @@ -3391,7 +3392,7 @@ func SendSeckillSkusCountMsg(ctx *jxcontext.Context, vendorIDs []int, isAsync, i } } case model.VendorIDJD: - var storeSecKill *tStoreSkusSecKill + var storeSecKill = &tStoreSkusSecKill{} sql := ` SELECT t1.store_id,count(*) sec_kill_count, count(t1.price < 100 or NULL) sec_kill_count2 FROM( @@ -3411,7 +3412,6 @@ func SendSeckillSkusCountMsg(ctx *jxcontext.Context, vendorIDs []int, isAsync, i GROUP BY 1 ` sqlParams := []interface{}{ - model.ActSkuSecKill, store.ID, vendorID, model.ActSkuSecKill, model.StoreSkuBindStatusNormal, utils.DefaultTimeValue, @@ -3421,15 +3421,21 @@ func SendSeckillSkusCountMsg(ctx *jxcontext.Context, vendorIDs []int, isAsync, i type2 = storeSecKill.SecKillCount2 } if type1 < type1Count || type2 < type2Count { + var storeSecKill2 = &tStoreSkusSecKill{} + storeSecKill2.StoreID = store.ID + storeSecKill2.VendorID = vendorID + storeSecKill2.SecKillCount = type1 + storeSecKill2.SecKillCount2 = type2 + retVal = []*tStoreSkusSecKill{storeSecKill2} err = sendDDMsgBySpecSkusCount(db, type1, type2, storeDetial, vendorID) } - fmt.Println(type1, type2, vendorID) } return retVal, err }, storeList) tasksch.HandleTask(task, nil, true).Run() if !isAsync { - _, err = task.GetResult(0) + result, err := task.GetResult(0) + return result, err } else { hint = task.GetID() } diff --git a/controllers/cms_store_sku.go b/controllers/cms_store_sku.go index 0a7d7c542..313280bf8 100644 --- a/controllers/cms_store_sku.go +++ b/controllers/cms_store_sku.go @@ -649,3 +649,22 @@ func (c *StoreSkuController) UpdateStoreSkusSpecTag() { return retVal, "", err }) } + +// @Title 手动爆品预警 +// @Description 手动爆品预警 +// @Param token header string true "认证token" +// @Param vendorIDs formData string true "厂商ID列表" +// @Param isAsync formData bool true "是否异步,缺省是同步" +// @Param isContinueWhenError formData bool true "单个同步失败是否继续,缺省false" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /SendSeckillSkusCountMsg [post] +func (c *StoreSkuController) SendSeckillSkusCountMsg() { + var vendorIDList []int + c.callSendSeckillSkusCountMsg(func(params *tStoreSkuSendSeckillSkusCountMsgParams) (retVal interface{}, errCode string, err error) { + if jxutils.Strings2Objs(params.VendorIDs, &vendorIDList); err == nil { + retVal, err = cms.SendSeckillSkusCountMsg(params.Ctx, vendorIDList, params.IsAsync, params.IsContinueWhenError) + } + return retVal, "", err + }) +} diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index 05688d600..348f548af 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -1845,6 +1845,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"], + beego.ControllerComments{ + Method: "SendSeckillSkusCountMsg", + Router: `/SendSeckillSkusCountMsg`, + AllowHTTPMethods: []string{"post"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"], beego.ControllerComments{ Method: "SyncJdStoreProducts",