This commit is contained in:
cdle
2023-06-28 13:35:04 +08:00
parent 3bdbb07ba3
commit bae0e14898
24 changed files with 354 additions and 322 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -8,6 +8,6 @@
</head>
<body>
<div id="root"></div>
<script src="/admin/umi.90fadbb5.js"></script>
<script src="/admin/umi.c62847bc.js"></script>
</body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[929],{83645:function(K,c,e){e.r(c),e.d(c,{default:function(){return C}});var g=e(25359),s=e.n(g),h=e(49811),y=e.n(h),k=e(54306),m=e.n(k),j=e(12472),I=e(55147),v=e(86195),T=e(44901),d=e(50959),S=e(83766),a=e(11527),b=function(){return(0,a.jsx)(S.vY,{title:"\u6570\u636E\u7EDF\u8BA1",request:y()(s()().mark(function i(){return s()().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",(0,v.request)("/api/fanyong/tongji"));case 1:case"end":return n.stop()}},i)})),column:2,columns:[{title:"\u8BA2\u5355\u603B\u6570\u91CF",key:"order_num",dataIndex:"order_num"},{title:"\u7528\u6237\u603B\u6570\u91CF",key:"user_num",dataIndex:"user_num"},{title:"\u5B9E\u9645\u603B\u6536\u5165(\u542B\u8FD4\u4F63)",key:"total_actual",dataIndex:"total_actual",valueType:"money",fieldProps:{moneySymbol:"$"}},{title:"\u9884\u4F30\u603B\u6536\u5165(\u542B\u8FD4\u4F63)",key:"total_estimate",dataIndex:"total_estimate",valueType:"money",fieldProps:{moneySymbol:"$"}},{title:"\u5B9E\u9645\u8FD4\u4F63\u91D1\u989D",key:"total_rake_actual",dataIndex:"total_rake_actual",valueType:"money",fieldProps:{moneySymbol:"$"}},{title:"\u9884\u4F30\u8FD4\u4F63\u91D1\u989D",key:"total_rake_estimate",dataIndex:"total_rake_estimate",valueType:"money",fieldProps:{moneySymbol:"$"}},{title:"\u5B9E\u9645\u8FD4\u4F63\u6536\u76CA",key:"total_irake_actual",dataIndex:"total_irake_actual",valueType:"money",fieldProps:{moneySymbol:"$"}},{title:"\u9884\u4F30\u8FD4\u4F63\u6536\u76CA",key:"total_irake_estimate",dataIndex:"total_irake_estimate",valueType:"money",fieldProps:{moneySymbol:"$"}},{title:"\u5B9E\u9645\u8FD4\u4F63\u6536\u76CA\u7387",key:"total_irake_actual_pct",dataIndex:"total_irake_actual_pct",valueType:"percent"},{title:"\u9884\u4F30\u8FD4\u4F63\u6536\u76CA\u7387",key:"total_irake_estimate_pct",dataIndex:"total_irake_estimate_pct",valueType:"percent"},{title:"\u5B9E\u9645\u603B\u6536\u5165(\u4E0D\u542B\u8FD4\u4F63)",key:"total_actual",dataIndex:"total_iactual",valueType:"money",fieldProps:{moneySymbol:"$"}},{title:"\u9884\u4F30\u603B\u6536\u5165(\u4E0D\u542B\u8FD4\u4F63)",key:"total_estimate",dataIndex:"total_iestimate",valueType:"money",fieldProps:{moneySymbol:"$"}}]})},P=function(o){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return(0,a.jsx)(T.Z,{count:o,overflowCount:1e4,style:{marginBlockStart:-2,marginInlineStart:4,color:n?"#1890FF":"#999",backgroundColor:n?"#E6F7FF":"#eee"}})},C=function(){var i=(0,d.useState)("tab1"),o=m()(i,2),n=o[0],$=o[1],F=(0,d.useState)([]),f=m()(F,2),R=f[0],E=f[1],p=(0,d.useRef)();return(0,a.jsxs)(j._z,{children:[(0,a.jsx)(b,{}),(0,a.jsx)(I.Rs,{search:{filterType:"light"},rowKey:"name",request:y()(s()().mark(function l(){var r,t=arguments;return s()().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return r=t.length>0&&t[0]!==void 0?t[0]:{},r.activeKey=n,u.abrupt("return",(0,v.request)("/api/fanyong",{params:r}).then(function(x){return E(x.tabs),x}));case 3:case"end":return u.stop()}},l)})),pagination:{defaultPageSize:10},metas:{site:{title:"\u8D2D\u7269\u5E73\u53F0",valueType:"select",fieldProps:{},valueEnum:{all:{text:"\u5168\u90E8"},tb:{text:"\u6DD8\u5B9D"},jd:{text:"\u4EAC\u4E1C"},pdd:{text:"\u62FC\u591A\u591A"}}},user_id:{title:"\u7528\u6237",valueType:"select",fieldProps:{mode:"multiple"},valueEnum:{all:{text:"\u5168\u90E8"},tb:{text:"\u6DD8\u5B9D"},jd:{text:"\u4EAC\u4E1C"},pdd:{text:"\u62FC\u591A\u591A"}}},avatar:{dataIndex:"image",search:!1},title:{dataIndex:"sku_name",search:!1},description:{dataIndex:"status",search:!1},content:{search:!1,dataIndex:"content",render:function(r){return(0,a.jsx)("div",{style:{display:"flex",justifyContent:"space-around"},children:r.map(function(t){return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{style:{color:"#00000073"},children:t.label}),(0,a.jsxs)("div",{style:{color:"#000000D9"},children:[t.status==="success"&&(0,a.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",backgroundColor:"#52c41a",marginInlineEnd:8}}),t.value]})]},t.label)})},"label")}},actions:{render:function(r,t){return[(0,a.jsx)("a",{href:t.image,target:"_blank",rel:"noopener noreferrer",children:"\u64CD\u4F5C"},"link")]}}},actionRef:p,toolbar:{menu:{activeKey:n,items:R.map(function(l){return{key:l.key,label:(0,a.jsxs)("span",{children:[l.title,P(l.value,n===l.key)]})}}),onChange:function(r){var t;$(r),(t=p.current)===null||t===void 0||t.reload()}}}})]})}}}]);
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+19
View File
@@ -72,3 +72,22 @@ func MakeBucketObject(vm *goja.Runtime, uuid string, on_start bool, bucket stora
// },
// })
// })
func JsBucket(vm *goja.Runtime, name string, uuid string, on_start bool) goja.Proxy {
return vm.NewProxy(MakeBucketObject(vm, uuid, on_start, MakeBucket(name)), &goja.ProxyTrapConfig{
Get: func(target *goja.Object, property string, receiver goja.Value) (value goja.Value) {
obj := target.Get(property)
if obj != nil {
return obj
}
result := target.Get("get").Export().(func(...interface{}) interface{})(property)
return vm.ToValue(result)
},
Set: func(target *goja.Object, property string, value, receiver goja.Value) (success bool) {
result := target.Get("set").Export().(func(interface{}, interface{}) error)(
property, value.Export(),
)
return result == nil
},
})
}
+1
View File
@@ -229,6 +229,7 @@ func initWebPluginList() {
}
}
}
rr.Data[i].Description = parseReply2(rr.Data[i].Description)
}
ctx.JSON(200, rr)
return
+1 -17
View File
@@ -112,24 +112,8 @@ func CancelPluginCrons(uuid string) {
func SetPluginMethod(vm *goja.Runtime, uuid string, on_start bool, running func() bool) {
vm.Set("Bucket", func(name string) interface{} {
return vm.NewProxy(MakeBucketObject(vm, uuid, on_start, MakeBucket(name)), &goja.ProxyTrapConfig{
Get: func(target *goja.Object, property string, receiver goja.Value) (value goja.Value) {
obj := target.Get(property)
if obj != nil {
return obj
}
result := target.Get("get").Export().(func(...interface{}) interface{})(property)
return vm.ToValue(result)
},
Set: func(target *goja.Object, property string, value, receiver goja.Value) (success bool) {
result := target.Get("set").Export().(func(interface{}, interface{}) error)(
property, value.Export(),
)
return result == nil
},
})
return JsBucket(vm, name, uuid, on_start)
})
sillyplusJsIplm := func(call goja.ConstructorCall) *goja.Object {
userId := fmt.Sprintf("%d", rand.Int63())
call.This.Set("isSlaveMode", func() bool {
+28
View File
@@ -11,6 +11,7 @@ import (
"time"
"github.com/cdle/sillyplus/utils"
"github.com/dop251/goja"
"github.com/gin-gonic/gin"
"github.com/goccy/go-json"
)
@@ -215,3 +216,30 @@ func parseReply(str string) string {
return MakeBucket(b_k[1]).GetString(b_k[2])
})
}
// 能处理字符:你好,我是${ user.name ?? 6 }
func parseReply2(str string) string {
re := regexp.MustCompile(`\$\{\s*([^{}]+)\s*\}`)
return re.ReplaceAllStringFunc(str, func(match string) string {
script := match[2 : len(match)-1]
script = regexp.MustCompile(`(\w+)\.(\w+)`).ReplaceAllStringFunc(script, func(match string) string {
parts := strings.Split(match, ".")
return fmt.Sprintf(`Bucket("%s")["%s"]`, parts[0], parts[1])
})
vm := goja.New()
vm.Set("Bucket", func(name string) interface{} {
return JsBucket(vm, name, "", false)
})
v, err := vm.RunString(script)
if err == nil {
return v.String()
}
return match
// b_k := strings.Split(bk, ".")
// if len(b_k) != 3 {
// return fmt.Sprintf("${%s}", bk)
// }
// return MakeBucket(b_k[1]).GetString(b_k[2])
// return ""
})
}