testuploadimg
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
@@ -579,9 +581,15 @@ func (c *StoreSkuController) RefreshJxPriceByExcel() {
|
||||
// @router /FocusStoreSkusByExcel [post]
|
||||
func (c *StoreSkuController) FocusStoreSkusByExcel() {
|
||||
c.callFocusStoreSkusByExcel(func(params *tStoreSkuFocusStoreSkusByExcelParams) (retVal interface{}, errCode string, err error) {
|
||||
r := c.Ctx.Request
|
||||
files := r.MultipartForm.File["userfiles"]
|
||||
retVal, err = cms.FocusStoreSkusByExcel(params.Ctx, files, params.IsAsync, params.IsContinueWhenError)
|
||||
// r := c.Ctx.Request
|
||||
// files := r.MultipartForm.File["userfiles"]
|
||||
// retVal, err = cms.FocusStoreSkusByExcel(params.Ctx, files, params.IsAsync, params.IsContinueWhenError)
|
||||
file, head, err := c.GetFile("userfiles")
|
||||
defer file.Close()
|
||||
if path.Ext(head.Filename) != "jpg" && path.Ext(head.Filename) != "png" {
|
||||
err = fmt.Errorf("文件格式不对!")
|
||||
}
|
||||
c.SaveToFile("userfiles", "./static/img/"+head.Filename)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user