42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package test
|
|
|
|
import (
|
|
"ai_scheduler/internal/entitys"
|
|
"ai_scheduler/internal/pkg/mapstructure"
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"gitea.cdlsxd.cn/self-tools/l_request"
|
|
)
|
|
|
|
func Test_task(t *testing.T) {
|
|
var c entitys.TaskConfig
|
|
config := `{"param": {"type": "object", "required": ["number"], "properties": {"number": {"type": "string", "description": "订单编号/流水号"}}}, "request": {"url": "http://www.baidu.com/${number}", "headers": {"Authorization": "${authorization}"}, "method": "GET"}}`
|
|
err := json.Unmarshal([]byte(config), &c)
|
|
t.Log(err)
|
|
}
|
|
|
|
type configData struct {
|
|
Param map[string]interface{} `json:"param"`
|
|
Do map[string]interface{} `json:"do"`
|
|
}
|
|
|
|
func Test_task2(t *testing.T) {
|
|
var (
|
|
c l_request.Request
|
|
config configData
|
|
)
|
|
|
|
configJson := `{"tool": "zltxOrderDetail", "param": {"type": "object", "optional": [], "required": ["order_number"], "properties": {"order_number": {"type": "string", "description": "订单编号/流水号"}}}}`
|
|
err := json.Unmarshal([]byte(configJson), &config)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
mapstructure.Decode(config.Do, &c)
|
|
t.Log(err)
|
|
}
|
|
|
|
func in() {
|
|
|
|
}
|