This commit is contained in:
邹宗楠
2023-10-09 17:37:55 +08:00
parent 9aedf80217
commit 77685f8676
2 changed files with 30 additions and 15 deletions

View File

@@ -4742,24 +4742,34 @@ func RefreshStoreBind(ctx *jxcontext.Context) (err error) {
return err return err
} }
func UpdateVendorStoreBussinessStatus(ctx *jxcontext.Context, storeID, vendorID, status int) (err error) { func UpdateVendorStoreBussinessStatus(ctx *jxcontext.Context, storeID int, vendorID []int, status int) (err error) {
var ( var (
db = dao.GetDB() db = dao.GetDB()
) )
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID, "")
if err != nil { errList := make([]string, 0, 0)
return err for _, v := range vendorID {
} storeDetail, err := dao.GetStoreDetail(db, storeID, v, "")
handler := partner.GetPurchasePlatformFromVendorID(vendorID) if err != nil {
if err = handler.UpdateStoreLineStatus(ctx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, status); err == nil { return err
if storeMaps, _ := dao.GetStoresMapList(db, []int{vendorID}, []int{storeID}, nil, model.StoreStatusAll, }
model.StoreIsSyncAll, "", "", ""); len(storeMaps) > 0 { handler := partner.GetPurchasePlatformFromVendorID(v)
storeMaps[0].IsOnline = status if err = handler.UpdateStoreLineStatus(ctx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, status); err == nil {
storeMaps[0].Status = status if storeMaps, _ := dao.GetStoresMapList(db, []int{v}, []int{storeID}, nil, model.StoreStatusAll,
dao.UpdateEntity(db, storeMaps[0], "IsOnline", "Status") model.StoreIsSyncAll, "", "", ""); len(storeMaps) > 0 {
storeMaps[0].IsOnline = status
storeMaps[0].Status = status
dao.UpdateEntity(db, storeMaps[0], "IsOnline", "Status")
}
} else {
errList = append(errList, fmt.Sprintf("平台[%d],门店id[%d],错误:%s", v, storeID, err.Error()))
} }
} }
return err
if len(errList) == model.NO {
return nil
}
return fmt.Errorf(strings.Join(errList, ","))
} }
type JdPage struct { type JdPage struct {

View File

@@ -1169,14 +1169,19 @@ func (c *StoreController) GetStoreAcctBalance() {
// @Description 直接修改平台门店上下线 // @Description 直接修改平台门店上下线
// @Param token header string true "认证token" // @Param token header string true "认证token"
// @Param storeID formData int true "门店ID" // @Param storeID formData int true "门店ID"
// @Param vendorID formData int true "平台ID" // @Param vendorIDs query string true "订单所属厂商列表[1,2,3],缺省不限制"
// @Param status formData int true "状态,-1 下线1上线" // @Param status formData int true "状态,-1 下线1上线"
// @Success 200 {object} controllers.CallResult // @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult
// @router /UpdateVendorStoreBussinessStatus [post] // @router /UpdateVendorStoreBussinessStatus [post]
func (c *StoreController) UpdateVendorStoreBussinessStatus() { func (c *StoreController) UpdateVendorStoreBussinessStatus() {
c.callUpdateVendorStoreBussinessStatus(func(params *tStoreUpdateVendorStoreBussinessStatusParams) (retVal interface{}, errCode string, err error) { c.callUpdateVendorStoreBussinessStatus(func(params *tStoreUpdateVendorStoreBussinessStatusParams) (retVal interface{}, errCode string, err error) {
err = cms.UpdateVendorStoreBussinessStatus(params.Ctx, params.StoreID, params.VendorID, params.Status) var vendorIDList []int
if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDList); err != nil {
return retVal, "", err
}
err = cms.UpdateVendorStoreBussinessStatus(params.Ctx, params.StoreID, vendorIDList, params.Status)
return retVal, "", err return retVal, "", err
}) })
} }