aa
This commit is contained in:
@@ -1526,8 +1526,24 @@ func GetCoupons(db *DaoDB, couponType int, couponStatuss, storeIDs []int, keywor
|
|||||||
sql += " AND b.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
sql += " AND b.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||||
sqlParams = append(sqlParams, storeIDs)
|
sqlParams = append(sqlParams, storeIDs)
|
||||||
}
|
}
|
||||||
fmt.Println(sql)
|
|
||||||
fmt.Println(sqlParams)
|
|
||||||
err = GetRows(db, &coupons, sql, sqlParams)
|
err = GetRows(db, &coupons, sql, sqlParams)
|
||||||
return coupons, err
|
return coupons, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetStoreCoupons(db *DaoDB, couponIDs, storeIDs []int) (storeCoupons []*model.StoreCoupons, err error) {
|
||||||
|
sql := `
|
||||||
|
SELECT *
|
||||||
|
FROM store_coupons
|
||||||
|
WHERE deleted_at = ?
|
||||||
|
`
|
||||||
|
sqlParams := []interface{}{utils.DefaultTimeValue}
|
||||||
|
if len(couponIDs) > 0 {
|
||||||
|
sql += " AND coupon_id IN (" + GenQuestionMarks(len(couponIDs)) + ")"
|
||||||
|
sqlParams = append(sqlParams, couponIDs)
|
||||||
|
}
|
||||||
|
if len(storeIDs) > 0 {
|
||||||
|
sql += " AND store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||||
|
sqlParams = append(sqlParams, storeIDs)
|
||||||
|
}
|
||||||
|
return storeCoupons, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -2210,3 +2210,7 @@ func AddCoupons(ctx *jxcontext.Context, coupons *model.Coupons, count int, store
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func UpdateCoupons(ctx *jxcontext.Context, coupons *model.Coupons, count int, storeIDs []int) (err error) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|||||||
@@ -327,3 +327,24 @@ func (c *JxOrderController) AddCoupons() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 修改优惠券
|
||||||
|
// @Description 修改优惠券
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param payload formData string true "优惠券类型 payload"
|
||||||
|
// @Param storeIDs formData string false "门店IDs"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /UpdateCoupons [post]
|
||||||
|
func (c *JxOrderController) UpdateCoupons() {
|
||||||
|
c.callUpdateCoupons(func(params *tJxorderUpdateCouponsParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
payload := make(map[string]interface{})
|
||||||
|
var storeIDs []int
|
||||||
|
if err = utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err == nil {
|
||||||
|
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
|
||||||
|
err = localjx.UpdateCoupons(params.Ctx, payload, storeIDs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user