From 4fc6b9ac7e0a7fb87464e6650370763a1a0978bc Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期四, 18 四月 2024 16:25:29 +0800
Subject: [PATCH] 把工厂名返给前端
---
controllers/operation.go | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/controllers/operation.go b/controllers/operation.go
index 229b1eb..a2f7ca1 100644
--- a/controllers/operation.go
+++ b/controllers/operation.go
@@ -871,14 +871,19 @@
}
var fileUrl string
+ companyName := conf.WebConf.CompanyName
+ if companyName == "" {
+ util.ResponseFormat(c, code.RequestParamError, "缂哄皯宸ュ巶鍚嶇О閰嶇疆")
+ return
+ }
if operation.BaseOperationType == constvar.BaseOperationTypeIncoming {
- if conf.WebConf.CompanyName == "jialian" {
+ if companyName == "jialian" {
fileUrl, err = JialianOperation(constvar.FileTemplateCategory_JialianInput, operation)
if err != nil {
util.ResponseFormat(c, code.RequestParamError, err.Error())
return
}
- } else if conf.WebConf.CompanyName == "geruimi" {
+ } else if companyName == "geruimi" {
fileUrl, err = ExportInputSelfmade(constvar.FileTemplateCategory_Selfmade, operation)
if err != nil {
util.ResponseFormat(c, code.RequestParamError, err.Error())
@@ -886,13 +891,13 @@
}
}
} else if operation.BaseOperationType == constvar.BaseOperationTypeOutgoing {
- if conf.WebConf.CompanyName == "jialian" {
+ if companyName == "jialian" {
fileUrl, err = JialianOperation(constvar.FileTemplateCategory_JialianOutput, operation)
if err != nil {
util.ResponseFormat(c, code.RequestParamError, err.Error())
return
}
- } else if conf.WebConf.CompanyName == "geruimi" {
+ } else if companyName == "geruimi" {
fileUrl, err = ExportInputSelfmade(constvar.FileTemplateCategory_Selfmade, operation)
if err != nil {
util.ResponseFormat(c, code.RequestParamError, err.Error())
@@ -904,7 +909,10 @@
return
}
- util.ResponseFormat(c, code.Success, fileUrl)
+ m := make(map[string]string)
+ m["url"] = fileUrl
+ m["name"] = companyName
+ util.ResponseFormat(c, code.Success, m)
}
func JialianOperation(category constvar.FileTemplateCategory, operation *models.Operation) (string, error) {
--
Gitblit v1.8.0