Browse Source

头图附件地址修改

weixianghui 5 years ago
parent
commit
a01c1fd689
2 changed files with 18 additions and 0 deletions
  1. 1 0
      core/src/qfw/coreconfig/SysConfig.go
  2. 17 0
      core/src/qfw/manage/course.go

+ 1 - 0
core/src/qfw/coreconfig/SysConfig.go

@@ -50,6 +50,7 @@ type config struct {
 	PushSubscribeRpc          string                 `json:"pushSubscribeRpc"`
 	JyRpc                     string                 `json:"jyRpc"`
 	Invoice_interface_address string                 `json:"invoice_interface_address"`
+	SpdbGetUrl 				  string                 `json:"spdbGetUrl"`
 }
 type smtp struct {
 	Addr     string `json:"addr"`

+ 17 - 0
core/src/qfw/manage/course.go

@@ -3,6 +3,7 @@ package manage
 import (
 	"encoding/json"
 	"fmt"
+	"net/http"
 	"net/url"
 	"qfw/coreconfig"
 	cutil "qfw/coreutil"
@@ -571,6 +572,14 @@ func (this *CourseManage) CreateOnLineApi() {
 			if mongodb.Save("jy_course", mData) == "" {
 				return &FuncResult{false, errors.New("增加课程失败"), nil}
 			} else {
+				if fileUrl != "" {
+					//生成访问地址
+					http.Get(coreconfig.SysConfig.SpdbGetUrl + "/course/fileInit?fileId="+fileUrl+"&model=file")
+				}
+				if picUrl != "" {
+					//生成访问地址
+					http.Get(coreconfig.SysConfig.SpdbGetUrl + "/course/fileInit?fileId="+picUrl+"&model=img")
+				}
 				return &FuncResult{true, nil, nil}
 			}
 		} else if Dotype == "edit" {
@@ -596,6 +605,14 @@ func (this *CourseManage) CreateOnLineApi() {
 			if !updateFlag {
 				return &FuncResult{false, errors.New("修改课程失败"), nil}
 			} else {
+				if fileUrl != "" {
+					//生成访问地址
+					http.Get(coreconfig.SysConfig.SpdbGetUrl + "/course/fileInit?fileId="+fileUrl+"&model=file")
+				}
+				if picUrl != "" {
+					//生成访问地址
+					http.Get(coreconfig.SysConfig.SpdbGetUrl + "/course/fileInit?fileId="+picUrl+"&model=img")
+				}
 				return &FuncResult{true, nil, nil}
 			}
 		}