commit
0e8f23fc91
4 changed files with 12 additions and 5 deletions
|
|
@ -60,6 +60,7 @@ Applications developed with YAO
|
||||||
|
|
||||||
| Application | Description | Repository |
|
| Application | Description | Repository |
|
||||||
| -------------------- | ---------------------------------------------------- | --------------------------------------- |
|
| -------------------- | ---------------------------------------------------- | --------------------------------------- |
|
||||||
|
| yaoapp/yao-examples | Yao Examples | https://github.com/YaoApp/yao-examples |
|
||||||
| yaoapp/yao-knowledge | A knowledge base application (Coming soon) | https://github.com/YaoApp/yao-knowledge |
|
| yaoapp/yao-knowledge | A knowledge base application (Coming soon) | https://github.com/YaoApp/yao-knowledge |
|
||||||
| yaoapp/xgen-dev-app | A demo application | https://github.com/YaoApp/xgen-dev-app |
|
| yaoapp/xgen-dev-app | A demo application | https://github.com/YaoApp/xgen-dev-app |
|
||||||
| yaoapp/demo-project | A demo application for project management | https://github.com/yaoapp/demo-project |
|
| yaoapp/demo-project | A demo application for project management | https://github.com/yaoapp/demo-project |
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ YAO 采用 flow-based 的编程模式,通过编写 YAO DSL (JSON 格式逻辑
|
||||||
|
|
||||||
| 应用 | 简介 | 代码仓库 |
|
| 应用 | 简介 | 代码仓库 |
|
||||||
| -------------------- | --------------------------------------- | --------------------------------------- |
|
| -------------------- | --------------------------------------- | --------------------------------------- |
|
||||||
|
| yaoapp/yao-examples | Yao 应用示例 | https://github.com/YaoApp/yao-examples |
|
||||||
| yaoapp/yao-knowledge | ChatGPT 驱动的知识管理库应用 (稍后开放) | https://github.com/YaoApp/yao-knowledge |
|
| yaoapp/yao-knowledge | ChatGPT 驱动的知识管理库应用 (稍后开放) | https://github.com/YaoApp/yao-knowledge |
|
||||||
| yaoapp/xgen-dev-app | 演示应用 (演示) | https://github.com/YaoApp/xgen-dev-app |
|
| yaoapp/xgen-dev-app | 演示应用 (演示) | https://github.com/YaoApp/xgen-dev-app |
|
||||||
| yaoapp/demo-project | 工程项目管理演示应用(演示) | https://github.com/yaoapp/demo-project |
|
| yaoapp/demo-project | 工程项目管理演示应用(演示) | https://github.com/yaoapp/demo-project |
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
package table
|
package table
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/md5"
|
|
||||||
"encoding/hex"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -10,6 +8,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
"github.com/yaoapp/gou/fs"
|
"github.com/yaoapp/gou/fs"
|
||||||
"github.com/yaoapp/gou/model"
|
"github.com/yaoapp/gou/model"
|
||||||
gouProcess "github.com/yaoapp/gou/process"
|
gouProcess "github.com/yaoapp/gou/process"
|
||||||
|
|
@ -252,11 +251,10 @@ func processExport(process *gouProcess.Process) interface{} {
|
||||||
tab := MustGet(process) // 0
|
tab := MustGet(process) // 0
|
||||||
params := process.ArgsQueryParams(1, types.QueryParam{})
|
params := process.ArgsQueryParams(1, types.QueryParam{})
|
||||||
pagesize := process.ArgsInt(2, 50)
|
pagesize := process.ArgsInt(2, 50)
|
||||||
|
log.Trace("[table] export %s %v %d", tab.ID, params, pagesize)
|
||||||
|
|
||||||
// Filename
|
// Filename
|
||||||
hash := md5.Sum([]byte(time.Now().Format("20060102-15:04:05")))
|
fingerprint := uuid.NewString()
|
||||||
fingerprint := string(hex.EncodeToString(hash[:]))
|
|
||||||
fingerprint = strings.ToUpper(fingerprint)
|
|
||||||
dir := time.Now().Format("20060102")
|
dir := time.Now().Format("20060102")
|
||||||
filename := filepath.Join(string(os.PathSeparator), dir, fmt.Sprintf("%s.xlsx", fingerprint))
|
filename := filepath.Join(string(os.PathSeparator), dir, fmt.Sprintf("%s.xlsx", fingerprint))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -569,6 +569,13 @@ func TestProcessExport(t *testing.T) {
|
||||||
fs := fs.MustGet("system")
|
fs := fs.MustGet("system")
|
||||||
size, _ := fs.Size(response.(string))
|
size, _ := fs.Size(response.(string))
|
||||||
assert.Greater(t, size, 1000)
|
assert.Greater(t, size, 1000)
|
||||||
|
|
||||||
|
// Export all data
|
||||||
|
args = []interface{}{"pet", nil, 2}
|
||||||
|
response = process.New("yao.table.Export", args...).Run()
|
||||||
|
assert.NotNil(t, response)
|
||||||
|
size, _ = fs.Size(response.(string))
|
||||||
|
assert.Greater(t, size, 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
func load(t *testing.T) {
|
func load(t *testing.T) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue