Refactor API to include app parameter in download endpoint
This commit is contained in:
parent
3074a8e432
commit
31a52d03e3
4 changed files with 14 additions and 2 deletions
|
|
@ -149,7 +149,7 @@ func exportAPI() error {
|
|||
Path: "/:id/download/:field",
|
||||
Method: "GET",
|
||||
Process: "yao.form.Download",
|
||||
In: []interface{}{"$param.id", "$param.field", "$query.name", "$query.token"},
|
||||
In: []interface{}{"$param.id", "$param.field", "$query.name", "$query.token", "$query.app"},
|
||||
Out: api.Out{
|
||||
Status: 200,
|
||||
Body: "{{content}}",
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ func processDownload(process *gouProcess.Process) interface{} {
|
|||
field := process.ArgsString(1)
|
||||
file := process.ArgsString(2)
|
||||
tokenString := process.ArgsString(3)
|
||||
isAppRoot := process.ArgsInt(4, 0)
|
||||
|
||||
// checking
|
||||
ext := fs.ExtName(file)
|
||||
|
|
@ -104,6 +105,11 @@ func processDownload(process *gouProcess.Process) interface{} {
|
|||
name = form.Action.Download.Process
|
||||
}
|
||||
|
||||
// The root path of the application the Upload Component props.appRoot=true
|
||||
if isAppRoot == 1 {
|
||||
name = "fs.app.Download"
|
||||
}
|
||||
|
||||
// Create process
|
||||
p, err := gouProcess.Of(name, file)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ func exportAPI() error {
|
|||
Path: "/:id/download/:field",
|
||||
Method: "GET",
|
||||
Process: "yao.table.Download",
|
||||
In: []interface{}{"$param.id", "$param.field", "$query.name", "$query.token"},
|
||||
In: []interface{}{"$param.id", "$param.field", "$query.name", "$query.token", "$query.app"},
|
||||
Out: api.Out{
|
||||
Status: 200,
|
||||
Body: "{{content}}",
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ func processDownload(process *gouProcess.Process) interface{} {
|
|||
field := process.ArgsString(1)
|
||||
file := process.ArgsString(2)
|
||||
tokenString := process.ArgsString(3)
|
||||
isAppRoot := process.ArgsInt(4, 0)
|
||||
|
||||
// checking
|
||||
ext := fs.ExtName(file)
|
||||
|
|
@ -89,6 +90,11 @@ func processDownload(process *gouProcess.Process) interface{} {
|
|||
name = tab.Action.Download.Process
|
||||
}
|
||||
|
||||
// The root path of the application the Upload Component props.appRoot=true
|
||||
if isAppRoot == 1 {
|
||||
name = "fs.app.Download"
|
||||
}
|
||||
|
||||
// Create process
|
||||
p, err := gouProcess.Of(name, file)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue