diff --git a/server/internal/api/exports.go b/server/internal/api/exports.go index aa790c7..42125e2 100644 --- a/server/internal/api/exports.go +++ b/server/internal/api/exports.go @@ -96,8 +96,8 @@ func (a *ExportsAPI) create(w http.ResponseWriter, r *http.Request) { } var fs []string json.Unmarshal(fields, &fs) - wl := whitelist() - req := exporter.BuildRequest{MainTable: main, Fields: fs, Filters: p.Filters} + wl := whitelist() + req := exporter.BuildRequest{MainTable: main, Datasource: ds, Fields: fs, Filters: p.Filters} q, args, err := exporter.BuildSQL(req, wl) if err != nil { r = WithSQL(r, q) @@ -182,10 +182,11 @@ func (a *ExportsAPI) runJob(id uint64, db *sql.DB, q string, args []interface{}, var filtersJSON []byte row := a.meta.QueryRow("SELECT template_id, filters_json FROM export_jobs WHERE id=?", id) _ = row.Scan(&tplID, &filtersJSON) - var main string - var fieldsJSON []byte - tr := a.meta.QueryRow("SELECT main_table, fields_json FROM export_templates WHERE id=?", tplID) - _ = tr.Scan(&main, &fieldsJSON) + var tplDS string + var main string + var fieldsJSON []byte + tr := a.meta.QueryRow("SELECT datasource, main_table, fields_json FROM export_templates WHERE id=?", tplID) + _ = tr.Scan(&tplDS, &main, &fieldsJSON) var fs []string var fl map[string]interface{} json.Unmarshal(fieldsJSON, &fs) @@ -211,7 +212,7 @@ func (a *ExportsAPI) runJob(id uint64, db *sql.DB, q string, args []interface{}, var tick int64 for _, rg := range chunks { fl["create_time_between"] = []string{rg[0], rg[1]} - req := exporter.BuildRequest{MainTable: main, Fields: fs, Filters: fl} + req := exporter.BuildRequest{MainTable: main, Datasource: tplDS, Fields: fs, Filters: fl} cq, cargs, err := exporter.BuildSQL(req, wl) if err != nil { continue @@ -515,10 +516,11 @@ func (a *ExportsAPI) runJob(id uint64, db *sql.DB, q string, args []interface{}, var filtersJSON []byte row := a.meta.QueryRow("SELECT template_id, filters_json FROM export_jobs WHERE id=?", id) _ = row.Scan(&tplID, &filtersJSON) - var main string - var fieldsJSON []byte - tr := a.meta.QueryRow("SELECT main_table, fields_json FROM export_templates WHERE id=?", tplID) - _ = tr.Scan(&main, &fieldsJSON) + var tplDS string + var main string + var fieldsJSON []byte + tr := a.meta.QueryRow("SELECT datasource, main_table, fields_json FROM export_templates WHERE id=?", tplID) + _ = tr.Scan(&tplDS, &main, &fieldsJSON) var fs []string var fl map[string]interface{} json.Unmarshal(fieldsJSON, &fs) @@ -544,7 +546,7 @@ func (a *ExportsAPI) runJob(id uint64, db *sql.DB, q string, args []interface{}, var tick int64 for _, rg := range chunks { fl["create_time_between"] = []string{rg[0], rg[1]} - req := exporter.BuildRequest{MainTable: main, Fields: fs, Filters: fl} + req := exporter.BuildRequest{MainTable: main, Datasource: tplDS, Fields: fs, Filters: fl} cq, cargs, err := exporter.BuildSQL(req, wl) if err != nil { continue @@ -790,10 +792,11 @@ func (a *ExportsAPI) getSQL(w http.ResponseWriter, r *http.Request, id string) { fail(w, r, http.StatusNotFound, "not found") return } - tr := a.meta.QueryRow("SELECT main_table, fields_json FROM export_templates WHERE id=?", tplID) - var main string - var fields []byte - if err := tr.Scan(&main, &fields); err != nil { + tr := a.meta.QueryRow("SELECT datasource, main_table, fields_json FROM export_templates WHERE id=?", tplID) + var ds string + var main string + var fields []byte + if err := tr.Scan(&ds, &main, &fields); err != nil { fail(w, r, http.StatusBadRequest, "template not found") return } @@ -801,8 +804,8 @@ func (a *ExportsAPI) getSQL(w http.ResponseWriter, r *http.Request, id string) { var fl map[string]interface{} json.Unmarshal(fields, &fs) json.Unmarshal(filters, &fl) - wl := whitelist() - req := exporter.BuildRequest{MainTable: main, Fields: fs, Filters: fl} + wl := whitelist() + req := exporter.BuildRequest{MainTable: main, Datasource: ds, Fields: fs, Filters: fl} q, args, err := exporter.BuildSQL(req, wl) if err != nil { fail(w, r, http.StatusBadRequest, err.Error()) diff --git a/server/internal/exporter/sqlbuilder.go b/server/internal/exporter/sqlbuilder.go index 237c633..238a444 100644 --- a/server/internal/exporter/sqlbuilder.go +++ b/server/internal/exporter/sqlbuilder.go @@ -8,9 +8,10 @@ import ( ) type BuildRequest struct { - MainTable string - Fields []string // table.field - Filters map[string]interface{} + MainTable string + Datasource string + Fields []string // table.field + Filters map[string]interface{} } func BuildSQL(req BuildRequest, whitelist map[string]bool) (string, []interface{}, error) { @@ -30,6 +31,21 @@ func BuildSQL(req BuildRequest, whitelist map[string]bool) (string, []interface{ t, f := parts[0], parts[1] need[t] = true if t == "order" { + if req.MainTable == "order_info" { + switch f { + case "order_number": f = "order_no" + case "key": f = "key_code" + case "creator": f = "user_id" + case "out_trade_no": f = "out_order_no" + case "plan_id": f = "activity_id" + case "reseller_id": f = "merchant_id" + case "product_id": f = "goods_id" + case "pay_amount": f = "pay_price" + case "key_batch_id": f = "key_batch_name" + } + cols = append(cols, "`order_info`."+escape(f)) + continue + } if f == "status" { cols = append(cols, "CASE `order`.type " + "WHEN 1 THEN (CASE `order`.status WHEN 0 THEN '待充值' WHEN 1 THEN '充值中' WHEN 2 THEN '已完成' WHEN 3 THEN '充值失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '待支付' END) " + diff --git a/server/log/server-20251126.log b/server/log/server-20251126.log index 11e7375..588ecf1 100644 --- a/server/log/server-20251126.log +++ b/server/log/server-20251126.log @@ -379,3 +379,152 @@ job_id=47 sql=UPDATE export_jobs SET status=?, started_at=? WHERE id= ? args=[ru {"bytes":1614,"duration_ms":10,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:12:48+08:00"} {"bytes":914,"duration_ms":107,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:12:51+08:00"} {"bytes":1040,"duration_ms":51,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:15:41+08:00"} +{"bytes":1040,"duration_ms":54,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:21:44+08:00"} +{"bytes":8025,"duration_ms":328,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:21:49+08:00"} +{"bytes":8025,"duration_ms":335,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:21:50+08:00"} +{"bytes":8025,"duration_ms":339,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:21:51+08:00"} +{"bytes":8025,"duration_ms":323,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:21:52+08:00"} +{"bytes":8025,"duration_ms":320,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:21:53+08:00"} +{"bytes":8025,"duration_ms":315,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:21:54+08:00"} +{"bytes":8025,"duration_ms":340,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:21:55+08:00"} +{"bytes":8025,"duration_ms":336,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:21:56+08:00"} +{"bytes":8025,"duration_ms":366,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:21:57+08:00"} +{"bytes":8025,"duration_ms":330,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:21:58+08:00"} +{"bytes":8025,"duration_ms":339,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:21:59+08:00"} +{"bytes":8025,"duration_ms":335,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:00+08:00"} +{"bytes":4228,"duration_ms":200,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:01+08:00"} +{"bytes":8025,"duration_ms":419,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:01+08:00"} +{"bytes":8025,"duration_ms":328,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:02+08:00"} +{"bytes":8025,"duration_ms":328,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:03+08:00"} +{"bytes":8025,"duration_ms":325,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:04+08:00"} +{"bytes":8025,"duration_ms":320,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:05+08:00"} +{"bytes":8025,"duration_ms":319,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:06+08:00"} +{"bytes":8025,"duration_ms":336,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:07+08:00"} +{"bytes":8025,"duration_ms":313,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:08+08:00"} +{"bytes":8025,"duration_ms":332,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:09+08:00"} +{"bytes":8025,"duration_ms":332,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:10+08:00"} +{"bytes":8025,"duration_ms":317,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:11+08:00"} +{"bytes":8025,"duration_ms":408,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:12+08:00"} +{"bytes":8025,"duration_ms":320,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:13+08:00"} +{"bytes":8025,"duration_ms":330,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:14+08:00"} +{"bytes":8025,"duration_ms":327,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:15+08:00"} +{"bytes":8025,"duration_ms":340,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:16+08:00"} +{"bytes":8025,"duration_ms":320,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:17+08:00"} +{"bytes":2385,"duration_ms":424,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:44+08:00"} +{"bytes":2385,"duration_ms":290,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:45+08:00"} +{"bytes":870,"duration_ms":113,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:46+08:00"} +{"bytes":8025,"duration_ms":341,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:50+08:00"} +{"bytes":8025,"duration_ms":373,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:51+08:00"} +{"bytes":8025,"duration_ms":335,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:52+08:00"} +{"bytes":907,"duration_ms":294,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:52+08:00"} +{"bytes":907,"duration_ms":266,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:53+08:00"} +{"bytes":907,"duration_ms":282,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:54+08:00"} +{"bytes":907,"duration_ms":267,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:55+08:00"} +{"bytes":8025,"duration_ms":304,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:55+08:00"} +{"bytes":8025,"duration_ms":287,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:56+08:00"} +{"bytes":8025,"duration_ms":296,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:57+08:00"} +{"bytes":8025,"duration_ms":282,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:58+08:00"} +{"bytes":8025,"duration_ms":293,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:22:59+08:00"} +{"bytes":8025,"duration_ms":321,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:23:00+08:00"} +{"bytes":8025,"duration_ms":287,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:23:01+08:00"} +{"bytes":870,"duration_ms":157,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:23:39+08:00"} +{"bytes":1040,"duration_ms":48,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:26:25+08:00"} +{"bytes":1040,"duration_ms":109,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:26:37+08:00"} +trace_id=ce3fc42577d7ec54c98662c042cf3864 sql=INSERT INTO export_templates (name, datasource, main_table, fields_json, filters_json, file_format, visibility, owner_id, enabled, stats_enabled, last_validated_at, created_at, updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) args=[易码通订单导出 ymt order_info [91 34 111 114 100 101 114 46 111 114 100 101 114 95 110 117 109 98 101 114 34 44 34 111 114 100 101 114 46 99 114 101 97 116 111 114 34 44 34 111 114 100 101 114 46 111 117 116 95 116 114 97 100 101 95 110 111 34 44 34 111 114 100 101 114 46 116 121 112 101 34 44 34 111 114 100 101 114 46 115 116 97 116 117 115 34 44 34 111 114 100 101 114 46 99 111 110 116 114 97 99 116 95 112 114 105 99 101 34 44 34 111 114 100 101 114 46 110 117 109 34 44 34 111 114 100 101 114 46 116 111 116 97 108 34 44 34 111 114 100 101 114 46 112 97 121 95 97 109 111 117 110 116 34 44 34 111 114 100 101 114 46 99 114 101 97 116 101 95 116 105 109 101 34 93] [123 34 99 114 101 97 116 101 95 116 105 109 101 95 98 101 116 119 101 101 110 34 58 91 34 50 48 50 53 45 48 49 45 48 49 32 48 48 58 48 48 58 48 48 34 44 34 50 48 50 53 45 49 50 45 51 49 32 50 51 58 53 57 58 53 57 34 93 44 34 99 114 101 97 116 111 114 95 105 110 34 58 91 50 50 49 93 125] xlsx private 221 1 0 2025-11-26 18:26:53.743479 +0800 CST m=+2105.410593751 2025-11-26 18:26:53.743479 +0800 CST m=+2105.410593751 2025-11-26 18:26:53.743479 +0800 CST m=+2105.410593751] +{"bytes":79,"duration_ms":125,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":201,"trace_id":"","ts":"2025-11-26T18:26:53+08:00"} +{"bytes":1362,"duration_ms":93,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:27:05+08:00"} +trace_id=b281a93cfb77aa0f35988fcf13368506 sql=SELECT datasource, main_table, fields_json FROM export_templates WHERE id= ? args=[15] +trace_id=b281a93cfb77aa0f35988fcf13368506 status=400 file=response.go:43 method=POST path=/api/exports query=userId=221 remote=[::1]:60466 payload={"template_id":15,"requested_by":221,"permission":{},"options":null,"file_format":"xlsx","filters":{"create_time_between":["2025-01-01 00:00:00","2025-12-31 23:59:59"],"creator_in":[221]},"datasource":"ymt"} msg=unsupported main table +{"bytes":99,"duration_ms":154,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":400,"trace_id":"","ts":"2025-11-26T18:27:19+08:00"} +connecting YMT MySQL: 47.97.27.195:3306 db merketing user root +connecting Marketing MySQL: 192.168.6.92:3306 db market user root +YMT DSN: root:lansexiongdi6,@tcp(47.97.27.195:3306)/merketing?parseTime=True&loc=Local&charset=utf8mb4 +Marketing DSN: root:lansexiongdi@tcp(192.168.6.92:3306)/market?parseTime=True&loc=Local&charset=utf8mb4 +server listening on :8077 +trace_id=c0be1a4a6bcbb5abe0692a1a7951c4f8 sql=SELECT datasource, main_table, fields_json FROM export_templates WHERE id= ? args=[15] +sql=EXPLAIN SELECT `order`.order_number,`order`.creator,`order`.out_trade_no,CASE `order`.type WHEN 1 THEN '直充卡密' WHEN 2 THEN '立减金' WHEN 3 THEN '红包' ELSE '' END AS type,CASE `order`.type WHEN 1 THEN (CASE `order`.status WHEN 0 THEN '待充值' WHEN 1 THEN '充值中' WHEN 2 THEN '已完成' WHEN 3 THEN '充值失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '待支付' END) WHEN 2 THEN (CASE `order`.status WHEN 0 THEN '待领取' WHEN 1 THEN '待领取' WHEN 2 THEN '已领取' WHEN 3 THEN '领取失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '待支付' END) WHEN 3 THEN (CASE `order`.status WHEN 0 THEN '待领取' WHEN 1 THEN '待领取' WHEN 2 THEN '已核销' WHEN 3 THEN '领取失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '' END) ELSE (CASE `order`.status WHEN 0 THEN '待充值' WHEN 1 THEN '充值中' WHEN 2 THEN '已完成' WHEN 3 THEN '充值失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '待支付' END) END AS status,`order`.contract_price,`order`.num,`order`.total,`order`.pay_amount,`order`.create_time FROM `order_info` WHERE `order_info`.user_id IN (?) AND `order_info`.create_time BETWEEN ? AND ? args=[221 2025-01-01 00:00:00 2025-12-31 23:59:59] +trace_id=c0be1a4a6bcbb5abe0692a1a7951c4f8 status=400 file=response.go:43 method=POST path=/api/exports query=userId=221 remote=[::1]:60685 sql=SELECT `order`.order_number,`order`.creator,`order`.out_trade_no,CASE `order`.type WHEN 1 THEN '直充卡密' WHEN 2 THEN '立减金' WHEN 3 THEN '红包' ELSE '' END AS type,CASE `order`.type WHEN 1 THEN (CASE `order`.status WHEN 0 THEN '待充值' WHEN 1 THEN '充值中' WHEN 2 THEN '已完成' WHEN 3 THEN '充值失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '待支付' END) WHEN 2 THEN (CASE `order`.status WHEN 0 THEN '待领取' WHEN 1 THEN '待领取' WHEN 2 THEN '已领取' WHEN 3 THEN '领取失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '待支付' END) WHEN 3 THEN (CASE `order`.status WHEN 0 THEN '待领取' WHEN 1 THEN '待领取' WHEN 2 THEN '已核销' WHEN 3 THEN '领取失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '' END) ELSE (CASE `order`.status WHEN 0 THEN '待充值' WHEN 1 THEN '充值中' WHEN 2 THEN '已完成' WHEN 3 THEN '充值失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '待支付' END) END AS status,`order`.contract_price,`order`.num,`order`.total,`order`.pay_amount,`order`.create_time FROM `order_info` WHERE `order_info`.user_id IN (?) AND `order_info`.create_time BETWEEN ? AND ? payload={"template_id":15,"requested_by":221,"permission":{},"options":null,"file_format":"xlsx","filters":{"create_time_between":["2025-01-01 00:00:00","2025-12-31 23:59:59"],"creator_in":[221]},"datasource":"ymt"} msg=Error 1054 (42S22): Unknown column 'order.order_number' in 'field list' +{"bytes":148,"duration_ms":185,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":400,"trace_id":"","ts":"2025-11-26T18:28:05+08:00"} +{"bytes":1362,"duration_ms":46,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:28:21+08:00"} +{"bytes":666,"duration_ms":88,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:28:31+08:00"} +trace_id=aefd03861ae7dd759d71f90ded8c67fa sql=SELECT datasource, main_table, fields_json FROM export_templates WHERE id= ? args=[15] +sql=EXPLAIN SELECT `order`.order_number,`order`.creator,`order`.out_trade_no,CASE `order`.type WHEN 1 THEN '直充卡密' WHEN 2 THEN '立减金' WHEN 3 THEN '红包' ELSE '' END AS type,CASE `order`.type WHEN 1 THEN (CASE `order`.status WHEN 0 THEN '待充值' WHEN 1 THEN '充值中' WHEN 2 THEN '已完成' WHEN 3 THEN '充值失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '待支付' END) WHEN 2 THEN (CASE `order`.status WHEN 0 THEN '待领取' WHEN 1 THEN '待领取' WHEN 2 THEN '已领取' WHEN 3 THEN '领取失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '待支付' END) WHEN 3 THEN (CASE `order`.status WHEN 0 THEN '待领取' WHEN 1 THEN '待领取' WHEN 2 THEN '已核销' WHEN 3 THEN '领取失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '' END) ELSE (CASE `order`.status WHEN 0 THEN '待充值' WHEN 1 THEN '充值中' WHEN 2 THEN '已完成' WHEN 3 THEN '充值失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '待支付' END) END AS status,`order`.contract_price,`order`.num,`order`.total,`order`.pay_amount,`order`.create_time FROM `order_info` WHERE `order_info`.user_id IN (?) AND `order_info`.create_time BETWEEN ? AND ? args=[221 2025-01-01 00:00:00 2025-12-31 23:59:59] +trace_id=aefd03861ae7dd759d71f90ded8c67fa status=400 file=response.go:43 method=POST path=/api/exports query=userId=221 remote=[::1]:60893 sql=SELECT `order`.order_number,`order`.creator,`order`.out_trade_no,CASE `order`.type WHEN 1 THEN '直充卡密' WHEN 2 THEN '立减金' WHEN 3 THEN '红包' ELSE '' END AS type,CASE `order`.type WHEN 1 THEN (CASE `order`.status WHEN 0 THEN '待充值' WHEN 1 THEN '充值中' WHEN 2 THEN '已完成' WHEN 3 THEN '充值失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '待支付' END) WHEN 2 THEN (CASE `order`.status WHEN 0 THEN '待领取' WHEN 1 THEN '待领取' WHEN 2 THEN '已领取' WHEN 3 THEN '领取失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '待支付' END) WHEN 3 THEN (CASE `order`.status WHEN 0 THEN '待领取' WHEN 1 THEN '待领取' WHEN 2 THEN '已核销' WHEN 3 THEN '领取失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '' END) ELSE (CASE `order`.status WHEN 0 THEN '待充值' WHEN 1 THEN '充值中' WHEN 2 THEN '已完成' WHEN 3 THEN '充值失败' WHEN 4 THEN '已取消' WHEN 5 THEN '已过期' WHEN 6 THEN '待支付' END) END AS status,`order`.contract_price,`order`.num,`order`.total,`order`.pay_amount,`order`.create_time FROM `order_info` WHERE `order_info`.user_id IN (?) AND `order_info`.create_time BETWEEN ? AND ? payload={"template_id":15,"requested_by":221,"permission":{},"options":null,"file_format":"xlsx","filters":{"create_time_between":["2025-01-01 00:00:00","2025-12-31 23:59:59"],"creator_in":[221]},"datasource":"ymt"} msg=Error 1054 (42S22): Unknown column 'order.order_number' in 'field list' +{"bytes":148,"duration_ms":188,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":400,"trace_id":"","ts":"2025-11-26T18:28:48+08:00"} +{"bytes":1362,"duration_ms":54,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:28:51+08:00"} +{"bytes":666,"duration_ms":127,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:28:55+08:00"} +{"bytes":666,"duration_ms":157,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:28:59+08:00"} +{"bytes":1362,"duration_ms":106,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:29:09+08:00"} +{"bytes":1362,"duration_ms":95,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:29:18+08:00"} +{"bytes":1362,"duration_ms":46,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:29:59+08:00"} +{"bytes":1040,"duration_ms":125,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:30:03+08:00"} +{"bytes":1362,"duration_ms":57,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:30:06+08:00"} +{"bytes":666,"duration_ms":99,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:30:32+08:00"} +{"bytes":1362,"duration_ms":46,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:30:47+08:00"} +{"bytes":666,"duration_ms":96,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:30:50+08:00"} +{"bytes":1362,"duration_ms":48,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:31:07+08:00"} +{"bytes":1040,"duration_ms":98,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:31:11+08:00"} +{"bytes":666,"duration_ms":98,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:31:21+08:00"} +{"bytes":1362,"duration_ms":83,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:32:03+08:00"} +{"bytes":1040,"duration_ms":92,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:32:06+08:00"} +{"bytes":1362,"duration_ms":55,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:32:12+08:00"} +trace_id=008447854778ba5c42f0dadcee4a6c57 status=400 file=response.go:43 method=DELETE path=/api/templates/12 query= remote=[::1]:61933 payload= msg=template in use +{"bytes":92,"duration_ms":91,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":400,"trace_id":"","ts":"2025-11-26T18:32:16+08:00"} +{"bytes":79,"duration_ms":2408,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:32:24+08:00"} +{"bytes":1040,"duration_ms":242,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:32:24+08:00"} +{"bytes":79,"duration_ms":1671,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:32:25+08:00"} +{"bytes":1040,"duration_ms":59,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:32:25+08:00"} +{"bytes":1040,"duration_ms":54,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:32:26+08:00"} +trace_id=8ca878b31f1960e1b045f4ca1f595d57 status=400 file=response.go:43 method=DELETE path=/api/templates/14 query= remote=[::1]:62015 payload= msg=template in use +{"bytes":92,"duration_ms":112,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":400,"trace_id":"","ts":"2025-11-26T18:32:32+08:00"} +trace_id=c8f8325ea6a2cea2707e9e8ad67cb1e1 status=400 file=response.go:43 method=DELETE path=/api/templates/14 query= remote=[::1]:62033 payload= msg=template in use +{"bytes":92,"duration_ms":110,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":400,"trace_id":"","ts":"2025-11-26T18:32:36+08:00"} +trace_id=84334a0e8b680bbeb3e9f6bbdc71c571 status=400 file=response.go:43 method=DELETE path=/api/templates/14 query= remote=[::1]:62103 payload= msg=template in use +{"bytes":92,"duration_ms":115,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":400,"trace_id":"","ts":"2025-11-26T18:32:51+08:00"} +{"bytes":870,"duration_ms":106,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:33:03+08:00"} +{"bytes":79,"duration_ms":114,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:33:05+08:00"} +{"bytes":1040,"duration_ms":54,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:33:05+08:00"} +{"bytes":870,"duration_ms":112,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:33:39+08:00"} +trace_id=f48ee44386b6d42db8c9ebd64661fa02 sql=INSERT INTO export_templates (name, datasource, main_table, fields_json, filters_json, file_format, visibility, owner_id, enabled, stats_enabled, last_validated_at, created_at, updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) args=[易码通-直充卡密-订单导出 ymt order [91 34 111 114 100 101 114 46 111 114 100 101 114 95 110 117 109 98 101 114 34 44 34 111 114 100 101 114 46 107 101 121 34 44 34 111 114 100 101 114 46 99 114 101 97 116 111 114 34 44 34 111 114 100 101 114 46 111 117 116 95 116 114 97 100 101 95 110 111 34 44 34 111 114 100 101 114 46 116 121 112 101 34 44 34 111 114 100 101 114 46 115 116 97 116 117 115 34 44 34 111 114 100 101 114 46 97 99 99 111 117 110 116 34 44 34 111 114 100 101 114 46 112 114 111 100 117 99 116 95 105 100 34 44 34 111 114 100 101 114 46 114 101 115 101 108 108 101 114 95 105 100 34 44 34 111 114 100 101 114 46 112 108 97 110 95 105 100 34 44 34 111 114 100 101 114 46 107 101 121 95 98 97 116 99 104 95 105 100 34 44 34 111 114 100 101 114 46 99 111 100 101 95 98 97 116 99 104 95 105 100 34 44 34 111 114 100 101 114 46 99 111 110 116 114 97 99 116 95 112 114 105 99 101 34 44 34 111 114 100 101 114 46 110 117 109 34 44 34 111 114 100 101 114 46 116 111 116 97 108 34 44 34 111 114 100 101 114 46 112 97 121 95 97 109 111 117 110 116 34 44 34 111 114 100 101 114 46 112 97 121 95 116 121 112 101 34 44 34 111 114 100 101 114 46 112 97 121 95 115 116 97 116 117 115 34 44 34 111 114 100 101 114 46 117 115 101 95 99 111 117 112 111 110 34 44 34 111 114 100 101 114 46 100 101 108 105 118 101 114 95 115 116 97 116 117 115 34 44 34 111 114 100 101 114 46 101 120 112 105 114 101 95 116 105 109 101 34 44 34 111 114 100 101 114 46 114 101 99 104 97 114 103 101 95 116 105 109 101 34 44 34 111 114 100 101 114 46 99 114 101 97 116 101 95 116 105 109 101 34 44 34 111 114 100 101 114 46 117 112 100 97 116 101 95 116 105 109 101 34 44 34 111 114 100 101 114 95 100 101 116 97 105 108 46 112 108 97 110 95 116 105 116 108 101 34 44 34 111 114 100 101 114 95 100 101 116 97 105 108 46 114 101 115 101 108 108 101 114 95 110 97 109 101 34 44 34 111 114 100 101 114 95 100 101 116 97 105 108 46 112 114 111 100 117 99 116 95 110 97 109 101 34 44 34 111 114 100 101 114 95 100 101 116 97 105 108 46 115 104 111 119 95 117 114 108 34 44 34 111 114 100 101 114 95 100 101 116 97 105 108 46 111 102 102 105 99 105 97 108 95 112 114 105 99 101 34 44 34 111 114 100 101 114 95 100 101 116 97 105 108 46 99 111 115 116 95 112 114 105 99 101 34 44 34 111 114 100 101 114 95 100 101 116 97 105 108 46 99 114 101 97 116 101 95 116 105 109 101 34 44 34 111 114 100 101 114 95 100 101 116 97 105 108 46 117 112 100 97 116 101 95 116 105 109 101 34 44 34 112 108 97 110 46 105 100 34 44 34 112 108 97 110 46 116 105 116 108 101 34 44 34 112 108 97 110 46 115 116 97 116 117 115 34 44 34 112 108 97 110 46 98 101 103 105 110 95 116 105 109 101 34 44 34 112 108 97 110 46 101 110 100 95 116 105 109 101 34 44 34 107 101 121 95 98 97 116 99 104 46 105 100 34 44 34 107 101 121 95 98 97 116 99 104 46 98 97 116 99 104 95 110 97 109 101 34 44 34 107 101 121 95 98 97 116 99 104 46 98 105 110 100 95 111 98 106 101 99 116 34 44 34 107 101 121 95 98 97 116 99 104 46 113 117 97 110 116 105 116 121 34 44 34 107 101 121 95 98 97 116 99 104 46 115 116 111 99 107 34 44 34 107 101 121 95 98 97 116 99 104 46 98 101 103 105 110 95 116 105 109 101 34 44 34 107 101 121 95 98 97 116 99 104 46 101 110 100 95 116 105 109 101 34 44 34 99 111 100 101 95 98 97 116 99 104 46 105 100 34 44 34 99 111 100 101 95 98 97 116 99 104 46 116 105 116 108 101 34 44 34 99 111 100 101 95 98 97 116 99 104 46 115 116 97 116 117 115 34 44 34 99 111 100 101 95 98 97 116 99 104 46 98 101 103 105 110 95 116 105 109 101 34 44 34 99 111 100 101 95 98 97 116 99 104 46 101 110 100 95 116 105 109 101 34 44 34 99 111 100 101 95 98 97 116 99 104 46 113 117 97 110 116 105 116 121 34 44 34 99 111 100 101 95 98 97 116 99 104 46 117 115 97 103 101 34 44 34 99 111 100 101 95 98 97 116 99 104 46 115 116 111 99 107 34 44 34 109 101 114 99 104 97 110 116 95 107 101 121 95 115 101 110 100 46 109 101 114 99 104 97 110 116 95 105 100 34 44 34 109 101 114 99 104 97 110 116 95 107 101 121 95 115 101 110 100 46 111 117 116 95 98 105 122 95 110 111 34 44 34 109 101 114 99 104 97 110 116 95 107 101 121 95 115 101 110 100 46 107 101 121 34 44 34 109 101 114 99 104 97 110 116 95 107 101 121 95 115 101 110 100 46 115 116 97 116 117 115 34 44 34 109 101 114 99 104 97 110 116 95 107 101 121 95 115 101 110 100 46 117 115 97 103 101 95 116 105 109 101 34 44 34 109 101 114 99 104 97 110 116 95 107 101 121 95 115 101 110 100 46 99 114 101 97 116 101 95 116 105 109 101 34 93] [123 34 116 121 112 101 95 101 113 34 58 49 125] xlsx private 0 1 0 2025-11-26 18:34:13.388648 +0800 CST m=+378.386454542 2025-11-26 18:34:13.388648 +0800 CST m=+378.386454542 2025-11-26 18:34:13.388648 +0800 CST m=+378.386454542] +{"bytes":79,"duration_ms":111,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":201,"trace_id":"","ts":"2025-11-26T18:34:13+08:00"} +{"bytes":1369,"duration_ms":53,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:34:13+08:00"} +{"bytes":1369,"duration_ms":111,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:34:21+08:00"} +{"bytes":1369,"duration_ms":103,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:34:24+08:00"} +{"bytes":1369,"duration_ms":107,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:34:56+08:00"} +{"bytes":1635,"duration_ms":106,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:35:28+08:00"} +{"bytes":1369,"duration_ms":107,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:35:42+08:00"} +{"bytes":1369,"duration_ms":57,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:35:48+08:00"} +{"bytes":1369,"duration_ms":53,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:36:34+08:00"} +{"bytes":1635,"duration_ms":121,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:36:36+08:00"} +{"bytes":1369,"duration_ms":106,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:36:50+08:00"} +{"bytes":1369,"duration_ms":51,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:36:54+08:00"} +{"bytes":1369,"duration_ms":55,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:37:12+08:00"} +{"bytes":1369,"duration_ms":53,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:37:18+08:00"} +{"bytes":1369,"duration_ms":110,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:37:42+08:00"} +{"bytes":1369,"duration_ms":105,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:37:46+08:00"} +{"bytes":1371,"duration_ms":111,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:38:19+08:00"} +{"bytes":1637,"duration_ms":111,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:38:22+08:00"} +{"bytes":1371,"duration_ms":114,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:38:27+08:00"} +{"bytes":1371,"duration_ms":55,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:38:33+08:00"} +{"bytes":1371,"duration_ms":53,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:39:04+08:00"} +{"bytes":1371,"duration_ms":109,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:39:08+08:00"} +{"bytes":1637,"duration_ms":110,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:39:10+08:00"} +{"bytes":1371,"duration_ms":119,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:39:48+08:00"} +{"bytes":1637,"duration_ms":110,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:39:50+08:00"} +{"bytes":1371,"duration_ms":109,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:41:46+08:00"} +{"bytes":1637,"duration_ms":107,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:41:47+08:00"} +{"bytes":1371,"duration_ms":107,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:42:17+08:00"} +{"bytes":1371,"duration_ms":105,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:42:26+08:00"} +{"bytes":1637,"duration_ms":111,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:42:29+08:00"} +{"bytes":1637,"duration_ms":114,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:43:10+08:00"} +{"bytes":925,"duration_ms":11,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:43:10+08:00"} +{"bytes":1371,"duration_ms":105,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:43:40+08:00"} +{"bytes":1637,"duration_ms":107,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:43:42+08:00"} +{"bytes":79,"duration_ms":215,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:43:55+08:00"} +{"bytes":1040,"duration_ms":108,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:43:55+08:00"} +{"bytes":1040,"duration_ms":109,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:50:34+08:00"} +{"bytes":1040,"duration_ms":54,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:52:20+08:00"} +{"bytes":1040,"duration_ms":57,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:52:30+08:00"} +{"bytes":1040,"duration_ms":52,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:52:31+08:00"} +{"bytes":1040,"duration_ms":59,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:52:41+08:00"} +{"bytes":870,"duration_ms":109,"kind":"access","level":"INFO","method":"","path":"","query":"","remote":"","status":200,"trace_id":"","ts":"2025-11-26T18:52:49+08:00"} diff --git a/web/index.html b/web/index.html index 28fba0f..a5c0e32 100644 --- a/web/index.html +++ b/web/index.html @@ -40,8 +40,15 @@ @@ -99,8 +106,8 @@ - - + + @@ -162,8 +169,8 @@ - - + + diff --git a/web/main.js b/web/main.js index b9dd84d..962d52e 100644 --- a/web/main.js +++ b/web/main.js @@ -46,6 +46,7 @@ const { createApp, reactive } = Vue; return uid ? ('?userId=' + encodeURIComponent(uid)) : '' } const hasUserId = Vue.computed(()=> !!getUserId()) + const currentUserId = Vue.computed(()=>{ const v = getUserId(); return v? Number(v): null }) const FIELDS_MAP = { marketing: { order: [ @@ -87,7 +88,7 @@ const { createApp, reactive } = Vue; ], order_cash: [ { value: 'channel', label: '渠道' }, - { value: 'cash_activity_id', label: '红包批次号' }, + { value: 'activity_id', label: '红包批次号' }, { value: 'receive_status', label: '领取状态' }, { value: 'receive_time', label: '拆红包时间' }, { value: 'cash_packet_id', label: '红包ID' }, @@ -99,7 +100,7 @@ const { createApp, reactive } = Vue; ], order_voucher: [ { value: 'channel', label: '渠道' }, - { value: 'channel_activity_id', label: '渠道立减金批次' }, + { value: 'channel_batch_no', label: '渠道立减金批次' }, { value: 'channel_voucher_id', label: '渠道立减金ID' }, { value: 'status', label: '状态' }, { value: 'receive_mode', label: '领取方式' }, @@ -170,32 +171,14 @@ const { createApp, reactive } = Vue; { value: 'out_trade_no', label: '支付流水号' }, { value: 'type', label: '订单类型' }, { value: 'status', label: '订单状态' }, - { value: 'account', label: '账号' }, { value: 'product_id', label: '商品ID' }, { value: 'reseller_id', label: '分销商ID' }, - { value: 'plan_id', label: '计划' }, + { value: 'plan_id', label: '活动ID' }, { value: 'key_batch_id', label: 'key批次' }, - { value: 'code_batch_id', label: '兑换批次ID' }, { value: 'contract_price', label: '合同单价' }, { value: 'num', label: '数量' }, - { value: 'total', label: '总金额' }, { value: 'pay_amount', label: '支付金额' }, - { value: 'pay_type', label: '支付方式' }, { value: 'pay_status', label: '支付状态' }, - { value: 'use_coupon', label: '是否使用优惠券' }, - { value: 'deliver_status', label: '投递状态' }, - { value: 'expire_time', label: '过期处理时间' }, - { value: 'recharge_time', label: '充值时间' }, - { value: 'create_time', label: '创建时间' }, - { value: 'update_time', label: '更新时间' } - ], - order_detail: [ - { value: 'plan_title', label: '计划标题' }, - { value: 'reseller_name', label: '分销商名称' }, - { value: 'product_name', label: '商品名称' }, - { value: 'show_url', label: '商品图片URL' }, - { value: 'official_price', label: '官方价' }, - { value: 'cost_price', label: '成本价' }, { value: 'create_time', label: '创建时间' }, { value: 'update_time', label: '更新时间' } ], @@ -226,54 +209,6 @@ const { createApp, reactive } = Vue; { value: 'official_price', label: '官方价' }, { value: 'out_biz_no', label: '外部业务号' }, { value: 'account_no', label: '账户号' } - ], - plan: [ - { value: 'id', label: '计划ID' }, - { value: 'title', label: '计划标题' }, - { value: 'status', label: '状态' }, - { value: 'begin_time', label: '开始时间' }, - { value: 'end_time', label: '结束时间' } - ], - key_batch: [ - { value: 'id', label: '批次ID' }, - { value: 'batch_name', label: '批次名称' }, - { value: 'bind_object', label: '绑定对象' }, - { value: 'quantity', label: '发放数量' }, - { value: 'stock', label: '剩余库存' }, - { value: 'begin_time', label: '开始时间' }, - { value: 'end_time', label: '结束时间' } - ], - code_batch: [ - { value: 'id', label: '兑换批次ID' }, - { value: 'title', label: '标题' }, - { value: 'status', label: '状态' }, - { value: 'begin_time', label: '开始时间' }, - { value: 'end_time', label: '结束时间' }, - { value: 'quantity', label: '数量' }, - { value: 'usage', label: '使用数' }, - { value: 'stock', label: '库存' } - ], - voucher: [ - { value: 'channel', label: '渠道' }, - { value: 'channel_activity_id', label: '渠道批次号' }, - { value: 'price', label: '合同单价' }, - { value: 'balance', label: '剩余额度' }, - { value: 'used_amount', label: '已用额度' }, - { value: 'denomination', label: '面额' } - ], - voucher_batch: [ - { value: 'channel_activity_id', label: '渠道批次号' }, - { value: 'temp_no', label: '模板编号' }, - { value: 'provider', label: '服务商' }, - { value: 'weight', label: '权重' } - ], - merchant_key_send: [ - { value: 'merchant_id', label: '商户ID' }, - { value: 'out_biz_no', label: '商户业务号' }, - { value: 'key', label: '券码' }, - { value: 'status', label: '状态' }, - { value: 'usage_time', label: '核销时间' }, - { value: 'create_time', label: '创建时间' } ] } } @@ -294,6 +229,26 @@ const { createApp, reactive } = Vue; const FM = FIELDS_MAP[ds] || {} const node = (table, children=[])=>({ value: table, label: TABLE_LABELS[table]||table, children }) const fieldsNode = (table)=> (FM[table]||[]) + const type = Number(state.form.orderType || 0) + if(ds === 'ymt'){ + const orderChildrenBase = [] + orderChildrenBase.push(...fieldsNode('order')) + const orderChildrenFor = (t)=>{ + const ch = [...orderChildrenBase] + if(t===2){ + ch.push(node('order_voucher', fieldsNode('order_voucher'))) + } else if(t===3){ + ch.push(node('order_cash', fieldsNode('order_cash'))) + } else if(!t){ + ch.push(node('order_voucher', fieldsNode('order_voucher'))) + ch.push(node('order_cash', fieldsNode('order_cash'))) + } + return ch + } + const orderNode = node('order', orderChildrenFor(type)) + if(type){ return [ orderNode ] } + return [ { value: 'scene_order', label: '订单数据', children: [ orderNode ] } ] + } const orderChildrenBase = [] orderChildrenBase.push(...fieldsNode('order')) orderChildrenBase.push(node('order_detail', fieldsNode('order_detail'))) @@ -309,22 +264,18 @@ const { createApp, reactive } = Vue; ...fieldsNode('voucher'), node('voucher_batch', fieldsNode('voucher_batch')) ])) - const orderChildrenFor = (type)=>{ + const orderChildrenFor = (t)=>{ const ch = [...orderChildrenBase] - if(type===1){ - // 直充卡密:排除红包与立减金 + if(t===1){ ch.push(node('plan', planChildren)) ch.push(node('merchant_key_send', fieldsNode('merchant_key_send'))) - } else if(type===2){ - // 立减金:排除红包,保留立减金链 + } else if(t===2){ ch.push(node('order_voucher', voucherChildren)) ch.push(node('plan', planChildren)) - } else if(type===3){ - // 红包:仅红包链 + } else if(t===3){ ch.push(node('order_cash', fieldsNode('order_cash'))) ch.push(node('plan', planChildren)) } else { - // 未选择类型:全部显示 ch.push(node('order_cash', fieldsNode('order_cash'))) ch.push(node('order_voucher', voucherChildren)) ch.push(node('plan', planChildren)) @@ -332,14 +283,31 @@ const { createApp, reactive } = Vue; } return ch } - const type = Number(state.form.orderType || 0) const orderNode = node('order', orderChildrenFor(type)) - if(type){ - return [ orderNode ] - } - return [ - { value: 'scene_order', label: '订单数据', children: [ orderNode ] } - ] + if(type){ return [ orderNode ] } + return [ { value: 'scene_order', label: '订单数据', children: [ orderNode ] } ] + }) + const sceneOptions = Vue.computed(()=>{ + const ds = state.form.datasource + return [{ label: '订单数据', value: ds==='ymt' ? 'order_info' : 'order' }] + }) + const editSceneOptions = Vue.computed(()=>{ + const ds = state.edit.datasource + return [{ label: '订单数据', value: ds==='ymt' ? 'order_info' : 'order' }] + }) + const DEFAULT_FIELDS = { + marketing: 'order_number,creator,out_trade_no,type,status,contract_price,num,total,pay_amount,create_time', + ymt: 'order_number,creator,out_trade_no,type,status,contract_price,num,pay_amount,create_time' + } + Vue.watch(()=>state.form.datasource, (ds)=>{ + state.form.fieldsSel = [] + state.form.fieldsRaw = DEFAULT_FIELDS[ds] || '' + state.form.main_table = (ds==='ymt' ? 'order_info' : 'order') + state.form.orderType = 1 + }) + Vue.watch(()=>state.edit.datasource, (ds)=>{ + state.edit.fieldsSel = [] + state.edit.main_table = (ds==='ymt' ? 'order_info' : 'order') }) const orderLeafPaths = (ds)=>{ const FM = FIELDS_MAP[ds] || {} @@ -416,6 +384,25 @@ const { createApp, reactive } = Vue; const FM = FIELDS_MAP[ds] || {} const node = (table, children=[])=>({ value: table, label: TABLE_LABELS[table]||table, children }) const fieldsNode = (table)=> (FM[table]||[]) + const type = Number(state.edit.orderType || 0) + if(ds === 'ymt'){ + const orderChildrenBase = [] + orderChildrenBase.push(...fieldsNode('order')) + const orderChildrenFor = (t)=>{ + const ch = [...orderChildrenBase] + if(t===2){ + ch.push(node('order_voucher', fieldsNode('order_voucher'))) + } else if(t===3){ + ch.push(node('order_cash', fieldsNode('order_cash'))) + } else if(!t){ + ch.push(node('order_voucher', fieldsNode('order_voucher'))) + ch.push(node('order_cash', fieldsNode('order_cash'))) + } + return ch + } + const orderNode = node('order', orderChildrenFor(type)) + return [ orderNode ] + } const orderChildrenBase = [] orderChildrenBase.push(...fieldsNode('order')) orderChildrenBase.push(node('order_detail', fieldsNode('order_detail'))) @@ -431,15 +418,15 @@ const { createApp, reactive } = Vue; ...fieldsNode('voucher'), node('voucher_batch', fieldsNode('voucher_batch')) ])) - const orderChildrenFor = (type)=>{ + const orderChildrenFor = (t)=>{ const ch = [...orderChildrenBase] - if(type===1){ + if(t===1){ ch.push(node('plan', planChildren)) ch.push(node('merchant_key_send', fieldsNode('merchant_key_send'))) - } else if(type===2){ + } else if(t===2){ ch.push(node('order_voucher', voucherChildren)) ch.push(node('plan', planChildren)) - } else if(type===3){ + } else if(t===3){ ch.push(node('order_cash', fieldsNode('order_cash'))) ch.push(node('plan', planChildren)) } else { @@ -450,7 +437,6 @@ const { createApp, reactive } = Vue; } return ch } - const type = Number(state.edit.orderType || 0) const orderNode = node('order', orderChildrenFor(type)) return [ orderNode ] }) @@ -644,7 +630,7 @@ const { createApp, reactive } = Vue; const payload = { name: state.form.name, datasource: state.form.datasource, - main_table: state.form.main_table, + main_table: (state.form.datasource==='ymt' ? 'order_info' : 'order'), fields, filters: { type_eq: Number(state.form.orderType) }, file_format: state.form.file_format, @@ -805,7 +791,7 @@ const { createApp, reactive } = Vue; } } const filters = { type_eq: Number(state.edit.orderType || 1) } - const payload = { name: state.edit.name, visibility: state.edit.visibility, file_format: state.edit.file_format, fields, filters } + const payload = { name: state.edit.name, visibility: state.edit.visibility, file_format: state.edit.file_format, fields, filters, main_table: (state.edit.datasource==='ymt' ? 'order_info' : 'order') } const res = await fetch(API_BASE + '/api/templates/'+id,{method:'PATCH',headers:{'Content-Type':'application/json'},body:JSON.stringify(payload)}) if(res.ok){ msg('保存成功'); state.editVisible=false; loadTemplates() } else { msg(await res.text(),'error') } } @@ -840,22 +826,9 @@ const { createApp, reactive } = Vue; } loadTemplates() - return { ...Vue.toRefs(state), visibilityOptions, formatOptions, datasourceOptions, fieldOptions, editFieldOptions, loadTemplates, createTemplate, openExport, submitExport, loadJob, loadJobs, openJobs, closeJobs, download, openSQL, openEdit, saveEdit, removeTemplate, resizeDialog, createRules, exportRules, editRules, createFormRef, exportFormRef, editFormRef, dsLabel, exportType, isOrder, exportTitle, creatorOptions, resellerOptions, planOptions, hasCreators, hasReseller, hasPlan, hasKeyBatch, hasCodeBatch, jobPercent, fmtDT, fieldsCascader, editFieldsCascader, createCascaderRoot, editCascaderRoot, onCascaderVisible, onFieldsSelChange, hasUserId } + return { ...Vue.toRefs(state), visibilityOptions, formatOptions, datasourceOptions, fieldOptions, editFieldOptions, sceneOptions, editSceneOptions, loadTemplates, createTemplate, openExport, submitExport, loadJob, loadJobs, openJobs, closeJobs, download, openSQL, openEdit, saveEdit, removeTemplate, resizeDialog, createRules, exportRules, editRules, createFormRef, exportFormRef, editFormRef, dsLabel, exportType, isOrder, exportTitle, creatorOptions, resellerOptions, planOptions, hasCreators, hasReseller, hasPlan, hasKeyBatch, hasCodeBatch, jobPercent, fmtDT, fieldsCascader, editFieldsCascader, createCascaderRoot, editCascaderRoot, onCascaderVisible, onFieldsSelChange, hasUserId, currentUserId } } }) app.use(ElementPlus) app.mount('#app') - const DEFAULT_FIELDS = { - marketing: 'order_number,creator,out_trade_no,type,status,contract_price,num,total,pay_amount,create_time', - ymt: 'order_number,creator,out_trade_no,type,status,contract_price,num,total,pay_amount,create_time' - } - Vue.watch(()=>state.form.datasource, (ds)=>{ - state.form.fieldsSel = [] - state.form.fieldsRaw = DEFAULT_FIELDS[ds] || '' - state.form.main_table = 'order' - state.form.orderType = 1 - }) - Vue.watch(()=>state.edit.datasource, ()=>{ - state.edit.fieldsSel = [] - state.edit.main_table = 'order' - }) +