Merge remote-tracking branch 'origin/mark' into su
This commit is contained in:
@@ -160,7 +160,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
|||||||
if actSkuMap.ActualActPrice <= 0 {
|
if actSkuMap.ActualActPrice <= 0 {
|
||||||
actSkuMap.ActualActPrice = 1
|
actSkuMap.ActualActPrice = 1
|
||||||
}
|
}
|
||||||
if err2 = checkDiscountValidation(act.Type, int(actSkuMap.ActualActPrice*100/actSkuMap.VendorPrice)); err2 != nil {
|
if err2 = checkDiscountValidation(act.Type, float64(actSkuMap.ActualActPrice)*100/float64(actSkuMap.VendorPrice)); err2 != nil {
|
||||||
v.ErrMsg = err2.Error()
|
v.ErrMsg = err2.Error()
|
||||||
v.ActualActPrice = actSkuMap.ActualActPrice
|
v.ActualActPrice = actSkuMap.ActualActPrice
|
||||||
wrongSkuList = append(wrongSkuList, v)
|
wrongSkuList = append(wrongSkuList, v)
|
||||||
@@ -280,14 +280,16 @@ func AddActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, actSto
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkDiscountValidation(actType int, pricePercentage int) (err error) {
|
func checkDiscountValidation(actType int, pricePercentage float64) (err error) {
|
||||||
if actType == model.ActSkuDirectDown && (pricePercentage < minDiscount4SkuDirectDown || pricePercentage > 99) {
|
pricePercentageMin := int(math.Floor(pricePercentage))
|
||||||
if pricePercentage < minDiscount4SkuDirectDown {
|
pricePercentageMax := int(math.Ceil(pricePercentage))
|
||||||
|
if actType == model.ActSkuDirectDown && (pricePercentageMin < minDiscount4SkuDirectDown || pricePercentageMax > 99) {
|
||||||
|
if pricePercentageMin < minDiscount4SkuDirectDown {
|
||||||
err = fmt.Errorf("%s活动折扣必须大于:%d", model.ActTypeName[actType], minDiscount4SkuDirectDown)
|
err = fmt.Errorf("%s活动折扣必须大于:%d", model.ActTypeName[actType], minDiscount4SkuDirectDown)
|
||||||
} else if pricePercentage > 99 {
|
} else if pricePercentageMax > 99 {
|
||||||
err = fmt.Errorf("%s活动必须有折扣", model.ActTypeName[actType])
|
err = fmt.Errorf("%s活动必须有折扣", model.ActTypeName[actType])
|
||||||
}
|
}
|
||||||
} else if actType == model.ActSkuSecKill && pricePercentage > maxDiscount4SkuSecKill {
|
} else if actType == model.ActSkuSecKill && pricePercentageMax > maxDiscount4SkuSecKill {
|
||||||
err = fmt.Errorf("%s活动折扣必须小于:%d", model.ActTypeName[actType], maxDiscount4SkuSecKill)
|
err = fmt.Errorf("%s活动折扣必须小于:%d", model.ActTypeName[actType], maxDiscount4SkuSecKill)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
@@ -308,7 +310,7 @@ func checkActValidation(act *model.Act, vendorIDs []int) (err error) {
|
|||||||
if act.Type == model.ActSkuDirectDown || act.Type == model.ActSkuSecKill {
|
if act.Type == model.ActSkuDirectDown || act.Type == model.ActSkuSecKill {
|
||||||
if act.PricePercentage == 0 {
|
if act.PricePercentage == 0 {
|
||||||
errList.AddErr(fmt.Errorf("必须指定缺省活动折扣"))
|
errList.AddErr(fmt.Errorf("必须指定缺省活动折扣"))
|
||||||
} else if err = checkDiscountValidation(act.Type, act.PricePercentage); err != nil {
|
} else if err = checkDiscountValidation(act.Type, float64(act.PricePercentage)); err != nil {
|
||||||
errList.AddErr(err)
|
errList.AddErr(err)
|
||||||
} else if act.Type == model.ActSkuSecKill && vendorIDMap[model.VendorIDMTWM] == 1 {
|
} else if act.Type == model.ActSkuSecKill && vendorIDMap[model.VendorIDMTWM] == 1 {
|
||||||
errList.AddErr(fmt.Errorf("%s平台不支持%s活动", model.VendorChineseNames[model.VendorIDMTWM], model.ActTypeName[model.ActSkuSecKill]))
|
errList.AddErr(fmt.Errorf("%s平台不支持%s活动", model.VendorChineseNames[model.VendorIDMTWM], model.ActTypeName[model.ActSkuSecKill]))
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ type CmsController struct {
|
|||||||
|
|
||||||
// @Title 得到地点(省,城市,区)信息
|
// @Title 得到地点(省,城市,区)信息
|
||||||
// @Description 得到地点(省,城市,区)信息。
|
// @Description 得到地点(省,城市,区)信息。
|
||||||
// @Param token header string true "认证token"
|
|
||||||
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
||||||
// @Param parentCode query int false "上级地点code,这个指的是国家标准CODE(中国为:100000,北京为:110000,北京市为:110100),不是数据库中的ID"
|
// @Param parentCode query int false "上级地点code,这个指的是国家标准CODE(中国为:100000,北京为:110000,北京市为:110100),不是数据库中的ID"
|
||||||
// @Param level query int false "地点级别:省为1,市为2,区为3,注意直辖市也要分省与市级"
|
// @Param level query int false "地点级别:省为1,市为2,区为3,注意直辖市也要分省与市级"
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ func (c *FoodRecipeController) UpdateFoodRecipe() {
|
|||||||
|
|
||||||
// @Title 查询菜谱列表
|
// @Title 查询菜谱列表
|
||||||
// @Description 查询菜谱列表
|
// @Description 查询菜谱列表
|
||||||
// @Param token header string true "认证token"
|
|
||||||
// @Param keyword query string false "关键字"
|
// @Param keyword query string false "关键字"
|
||||||
// @Param authorID query string false "创建者ID"
|
// @Param authorID query string false "创建者ID"
|
||||||
// @Param skuIDs query string false "skuID列表"
|
// @Param skuIDs query string false "skuID列表"
|
||||||
@@ -93,7 +92,6 @@ func (c *FoodRecipeController) QueryFoodRecipes() {
|
|||||||
|
|
||||||
// @Title 得到我的推荐菜谱列表
|
// @Title 得到我的推荐菜谱列表
|
||||||
// @Description 得到我的推荐菜谱列表
|
// @Description 得到我的推荐菜谱列表
|
||||||
// @Param token header string true "认证token"
|
|
||||||
// @Param keyword query string false "关键字"
|
// @Param keyword query string false "关键字"
|
||||||
// @Param offset query int false "菜谱列表起始序号(以0开始,缺省为0)"
|
// @Param offset query int false "菜谱列表起始序号(以0开始,缺省为0)"
|
||||||
// @Param pageSize query int false "菜谱列表页大小(缺省为50,-1表示全部)"
|
// @Param pageSize query int false "菜谱列表页大小(缺省为50,-1表示全部)"
|
||||||
@@ -109,7 +107,6 @@ func (c *FoodRecipeController) GetRecommendFoodRecipes() {
|
|||||||
|
|
||||||
// @Title 得到菜谱详情
|
// @Title 得到菜谱详情
|
||||||
// @Description 得到菜谱详情
|
// @Description 得到菜谱详情
|
||||||
// @Param token header string true "认证token"
|
|
||||||
// @Param recipeID query int true "菜谱ID"
|
// @Param recipeID query int true "菜谱ID"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ func (c *SkuController) GetVendorCategories() {
|
|||||||
|
|
||||||
// @Title 得到商品类别
|
// @Title 得到商品类别
|
||||||
// @Description 得到商品类别(区别于厂商家SKU类别)
|
// @Description 得到商品类别(区别于厂商家SKU类别)
|
||||||
// @Param token header string true "认证token"
|
|
||||||
// @Param parentID query int false "父ID,-1表示所有,缺省为-1"
|
// @Param parentID query int false "父ID,-1表示所有,缺省为-1"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
|||||||
@@ -533,7 +533,6 @@ func (c *StoreController) SyncStoresCourierInfo() {
|
|||||||
|
|
||||||
// @Title 根据位置得到推荐门店列表
|
// @Title 根据位置得到推荐门店列表
|
||||||
// @Description 根据位置得到推荐门店列表
|
// @Description 根据位置得到推荐门店列表
|
||||||
// @Param token header string true "认证token"
|
|
||||||
// @Param lng query float64 true "经度"
|
// @Param lng query float64 true "经度"
|
||||||
// @Param lat query float64 true "纬度"
|
// @Param lat query float64 true "纬度"
|
||||||
// @Param needWalkDistance query bool false "是否需要返回步行距离(且以步行距离排序)"
|
// @Param needWalkDistance query bool false "是否需要返回步行距离(且以步行距离排序)"
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ func (c *StoreSkuController) GetStoreSkus() {
|
|||||||
|
|
||||||
// @Title 得到商家商品信息
|
// @Title 得到商家商品信息
|
||||||
// @Description 得到商家商品信息,如下条件之间是与的关系。对于没有认领的商品,按城市限制。但对于已经认领的商品就不限制了,因为已经在平台上可售,可以操作(改价等等)
|
// @Description 得到商家商品信息,如下条件之间是与的关系。对于没有认领的商品,按城市限制。但对于已经认领的商品就不限制了,因为已经在平台上可售,可以操作(改价等等)
|
||||||
// @Param token header string true "认证token"
|
|
||||||
// @Param storeIDs query string false "门店ID"
|
// @Param storeIDs query string false "门店ID"
|
||||||
// @Param isFocus query bool true "是否已关注(认领)"
|
// @Param isFocus query bool true "是否已关注(认领)"
|
||||||
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
||||||
|
|||||||
Reference in New Issue
Block a user