...
|
...
|
@@ -11,6 +11,7 @@ import ( |
|
|
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/middleware"
|
|
|
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
|
|
|
|
...
|
...
|
@@ -202,11 +203,21 @@ func (controller *ExcelDataController) FileImport() { |
|
|
formWriter.Close()
|
|
|
target, _ := url.Parse(constant.ALLIED_CREATION_MANUFACTURE_HOST)
|
|
|
targetPath := strings.Replace(controller.Ctx.Request.URL.Path, "/v1/web", "", 1)
|
|
|
resp, err := http.Post(
|
|
|
target.String()+targetPath,
|
|
|
formWriter.FormDataContentType(),
|
|
|
bodyBuf,
|
|
|
)
|
|
|
newReq, _ := http.NewRequest(http.MethodPost, target.String()+targetPath, bodyBuf)
|
|
|
// 传递当前登录信息(可配置)
|
|
|
loginToken, ok := middleware.FormCtxLoginToken(controller.Ctx)
|
|
|
if ok && loginToken.CompanyId > 0 && loginToken.OrgId > 0 {
|
|
|
newReq.Header.Set("companyId", fmt.Sprintf("%v", loginToken.CompanyId))
|
|
|
newReq.Header.Set("orgId", fmt.Sprintf("%v", loginToken.OrgId))
|
|
|
newReq.Header.Set("userId", fmt.Sprintf("%v", loginToken.UserId))
|
|
|
orgIdList := make([]string, 0)
|
|
|
for i := range loginToken.OrgIds {
|
|
|
orgIdList = append(orgIdList, fmt.Sprintf("%d", loginToken.OrgIds[i]))
|
|
|
}
|
|
|
newReq.Header.Add("orgIds", fmt.Sprintf("%v", strings.Join(orgIdList, ",")))
|
|
|
}
|
|
|
newReq.Header.Set("Content-Type", formWriter.FormDataContentType())
|
|
|
resp, err := http.DefaultClient.Do(newReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
controller.Response(nil, e)
|
...
|
...
|
|