testuploadimg
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
"path"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
@@ -579,9 +581,15 @@ func (c *StoreSkuController) RefreshJxPriceByExcel() {
|
|||||||
// @router /FocusStoreSkusByExcel [post]
|
// @router /FocusStoreSkusByExcel [post]
|
||||||
func (c *StoreSkuController) FocusStoreSkusByExcel() {
|
func (c *StoreSkuController) FocusStoreSkusByExcel() {
|
||||||
c.callFocusStoreSkusByExcel(func(params *tStoreSkuFocusStoreSkusByExcelParams) (retVal interface{}, errCode string, err error) {
|
c.callFocusStoreSkusByExcel(func(params *tStoreSkuFocusStoreSkusByExcelParams) (retVal interface{}, errCode string, err error) {
|
||||||
r := c.Ctx.Request
|
// r := c.Ctx.Request
|
||||||
files := r.MultipartForm.File["userfiles"]
|
// files := r.MultipartForm.File["userfiles"]
|
||||||
retVal, err = cms.FocusStoreSkusByExcel(params.Ctx, files, params.IsAsync, params.IsContinueWhenError)
|
// 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
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user