소스 검색

下载接口拼接前缀

maker 3 년 전
부모
커밋
19d0b38ea5
4개의 변경된 파일10개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 1
      config.yaml
  2. 1 1
      config/config.go
  3. 5 0
      config/prefix_url.go
  4. 1 1
      service/task/upload_file.go

+ 3 - 1
config.yaml

@@ -161,4 +161,6 @@ send-url:
   computer-send-url: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7d095d5b-8240-45fd-a68c-baff3628d83b111"
   keyword-send-url: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=34cbfa5a-c31d-464f-baf8-8363d6f4ac6a"
 #extranet-domain:
-#  control: "http://192.168.50.35:8099"
+#  control: "http://192.168.50.35:8099"
+prefix-url:
+  prefix-local: "172.16.2.92:8080/api/"

+ 1 - 1
config/config.go

@@ -23,7 +23,7 @@ type Server struct {
 
 	Excel Excel `mapstructure:"excel" json:"excel" yaml:"excel"`
 	Timer Timer `mapstructure:"timer" json:"timer" yaml:"timer"`
-
+	PrefixUrl PrefixUrl `mapstructure:"prefix-url" json:"prefix-url" yaml:"prefix-url"`
 	// 跨域配置
 	Cors           CORS           `mapstructure:"cors" json:"cors" yaml:"cors"`
 	SendUrl        SendUrl        `mapstructure:"send-url" json:"send-url" yaml:"send-url"`

+ 5 - 0
config/prefix_url.go

@@ -0,0 +1,5 @@
+package config
+
+type PrefixUrl struct {
+	PrefixLocal string `mapstructure:"prefix-local" json:"prefix-local" yaml:"prefix-local"`
+}

+ 1 - 1
service/task/upload_file.go

@@ -112,7 +112,7 @@ func (e *UploadFileService) UploadFile(gameId int, header *multipart.FileHeader)
 //下载文件
 func (e *UploadFileService) DownloadFile(gameId int, md5String string) (info response.DownloadFile, err error) {
 	var file response.UploadFileResponse
-	var prefix string = "http://assist.qiming321.cn:8001/api/"
+	var prefix string = global.GVA_CONFIG.PrefixUrl.PrefixLocal
 	//数据库中无记录,即不需要更新
 	err = global.GVA_DB.Table("upload_file").Where("game_id = ?", gameId).Last(&file).Error
 	if errors.Is(err, gorm.ErrRecordNotFound) {