- use json to serialize promotion params.
- remove CreatePromotionByExcel
This commit is contained in:
@@ -2,7 +2,6 @@ package controllers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
|
||||
@@ -53,37 +52,37 @@ func (c *PromotionController) CreatePromotion() {
|
||||
|
||||
// @Param token header string true "认证token"
|
||||
|
||||
// @Title 发送文件给门店
|
||||
// @Description 发送文件给门店,调用GET方法得到浏览器端参考的上传HTML实现,userfiles
|
||||
// @Param type formData int true "促销类型,3:直降,4:限时抢购"
|
||||
// @Param isAsync formData bool false "是否异常,缺省否(暂时只支持同步)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /CreatePromotionByExcel [post,get]
|
||||
func (c *PromotionController) CreatePromotionByExcel() {
|
||||
if c.Ctx.Input.IsGet() {
|
||||
w := c.Ctx.ResponseWriter
|
||||
// 上传页面
|
||||
w.Header().Add("Content-Type", "text/html")
|
||||
w.WriteHeader(200)
|
||||
html := `
|
||||
<form enctype="multipart/form-data" action="/v2/promotion/CreatePromotionByExcel" method="POST">
|
||||
Send this file: <input name="userfile" accept="*.xlsx" type="file" />
|
||||
<input type="text" name="type" />
|
||||
<input type="text" name="isAsync" />
|
||||
<input type="submit" value="Send File" />
|
||||
</form>
|
||||
`
|
||||
io.WriteString(w, html)
|
||||
} else if c.Ctx.Input.IsPost() {
|
||||
c.callCreatePromotionByExcel(func(params *tPromotionCreatePromotionByExcelParams) (retVal interface{}, errCode string, err error) {
|
||||
r := c.Ctx.Request
|
||||
files := r.MultipartForm.File["userfile"]
|
||||
retVal, err = promotion.CreatePromotionByExcel(params.Ctx, params.IsAsync, params.Type, files[0], "userName") //params.Ctx.GetUserName())
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
}
|
||||
// // @Title 发送文件给门店
|
||||
// // @Description 发送文件给门店,调用GET方法得到浏览器端参考的上传HTML实现,userfiles
|
||||
// // @Param type formData int true "促销类型,3:直降,4:限时抢购"
|
||||
// // @Param isAsync formData bool false "是否异常,缺省否(暂时只支持同步)"
|
||||
// // @Success 200 {object} controllers.CallResult
|
||||
// // @Failure 200 {object} controllers.CallResult
|
||||
// // @router /CreatePromotionByExcel [post,get]
|
||||
// func (c *PromotionController) CreatePromotionByExcel() {
|
||||
// if c.Ctx.Input.IsGet() {
|
||||
// w := c.Ctx.ResponseWriter
|
||||
// // 上传页面
|
||||
// w.Header().Add("Content-Type", "text/html")
|
||||
// w.WriteHeader(200)
|
||||
// html := `
|
||||
// <form enctype="multipart/form-data" action="/v2/promotion/CreatePromotionByExcel" method="POST">
|
||||
// Send this file: <input name="userfile" accept="*.xlsx" type="file" />
|
||||
// <input type="text" name="type" />
|
||||
// <input type="text" name="isAsync" />
|
||||
// <input type="submit" value="Send File" />
|
||||
// </form>
|
||||
// `
|
||||
// io.WriteString(w, html)
|
||||
// } else if c.Ctx.Input.IsPost() {
|
||||
// c.callCreatePromotionByExcel(func(params *tPromotionCreatePromotionByExcelParams) (retVal interface{}, errCode string, err error) {
|
||||
// r := c.Ctx.Request
|
||||
// files := r.MultipartForm.File["userfile"]
|
||||
// retVal, err = promotion.CreatePromotionByExcel(params.Ctx, params.IsAsync, params.Type, files[0], "userName") //params.Ctx.GetUserName())
|
||||
// return retVal, "", err
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
|
||||
// @Title 创建促销
|
||||
// @Description 创建促销
|
||||
|
||||
Reference in New Issue
Block a user