forked from x/icebergs
add some
This commit is contained in:
parent
eb5b405e8e
commit
a1732e6292
@ -31,53 +31,53 @@ func init() {
|
||||
offset, limit, stats := kit.Int(kit.Select("0", arg, 1)), kit.Int(kit.Select("1000", arg, 2)), map[string]int{}
|
||||
switch arg[0] {
|
||||
case BENCH, ERROR, DEBUG:
|
||||
m.Cmd(nfs.CAT, _debug_file(arg[0]), func(line string, index int) {
|
||||
if index < offset || index >= offset+limit || !strings.Contains(line, kit.Select("", arg, 3)) {
|
||||
m.Cmd(nfs.CAT, _debug_file(arg[0]), func(text string, index int) {
|
||||
if index < offset || index >= offset+limit || !strings.Contains(text, kit.Select("", arg, 3)) {
|
||||
return
|
||||
}
|
||||
ls := strings.SplitN(line, lex.SP, 6)
|
||||
if _, e := time.Parse(kit.Split(ice.MOD_TIMES)[0], ls[0]); e != nil || len(ls) < 6 {
|
||||
m.Push(mdb.TIME, "").Push(mdb.ID, "")
|
||||
ls := strings.SplitN(strings.ReplaceAll(text, " ", " "), lex.SP, 8)
|
||||
if _, e := time.Parse(kit.Split(ice.MOD_TIMES)[0], ls[0]); e != nil || len(ls) < 8 {
|
||||
m.Push(mdb.TIME, "").Push(ice.LOG_TRACEID, "").Push(mdb.ID, "")
|
||||
m.Push(nfs.PATH, "").Push(nfs.FILE, "").Push(nfs.LINE, "")
|
||||
m.Push(ctx.SHIP, "").Push(LEVEL, "").Push(nfs.CONTENT, line)
|
||||
m.Push(ctx.SHIP, "").Push(LEVEL, "").Push(nfs.CONTENT, text)
|
||||
return
|
||||
}
|
||||
m.Push(mdb.TIME, ls[0]+lex.SP+ls[1]).Push(mdb.ID, ls[2])
|
||||
m.Push(mdb.TIME, ls[0]+lex.SP+ls[1]).Push(ice.LOG_TRACEID, ls[3]).Push(mdb.ID, ls[4])
|
||||
m.Push(nfs.PATH, ice.USR_ICEBERGS)
|
||||
if i := strings.LastIndex(ls[5], lex.SP); strings.HasPrefix(ls[5][i+1:], ice.BASE) || strings.HasPrefix(ls[5][i+1:], ice.CORE) || strings.HasPrefix(ls[5][i+1:], ice.MISC) {
|
||||
m.Push(nfs.FILE, strings.TrimSpace(strings.Split(ls[5][i:], nfs.DF)[0]))
|
||||
m.Push(nfs.LINE, strings.TrimSpace(strings.Split(ls[5][i:], nfs.DF)[1]))
|
||||
ls[5] = ls[5][:i]
|
||||
} else if strings.HasPrefix(ls[5][i+1:], ice.USR_ICEBERGS) {
|
||||
m.Push(nfs.FILE, strings.TrimPrefix(strings.TrimSpace(strings.Split(ls[5][i:], nfs.DF)[0]), ice.USR_ICEBERGS))
|
||||
m.Push(nfs.LINE, strings.TrimSpace(strings.Split(ls[5][i:], nfs.DF)[1]))
|
||||
ls[5] = ls[5][:i]
|
||||
if i := strings.LastIndex(ls[7], lex.SP); strings.HasPrefix(ls[7][i+1:], ice.BASE) || strings.HasPrefix(ls[7][i+1:], ice.CORE) || strings.HasPrefix(ls[7][i+1:], ice.MISC) {
|
||||
m.Push(nfs.FILE, strings.TrimSpace(strings.Split(ls[7][i:], nfs.DF)[0]))
|
||||
m.Push(nfs.LINE, strings.TrimSpace(strings.Split(ls[7][i:], nfs.DF)[1]))
|
||||
ls[7] = ls[7][:i]
|
||||
} else if strings.HasPrefix(ls[7][i+1:], ice.USR_ICEBERGS) {
|
||||
m.Push(nfs.FILE, strings.TrimPrefix(strings.TrimSpace(strings.Split(ls[7][i:], nfs.DF)[0]), ice.USR_ICEBERGS))
|
||||
m.Push(nfs.LINE, strings.TrimSpace(strings.Split(ls[7][i:], nfs.DF)[1]))
|
||||
ls[7] = ls[7][:i]
|
||||
} else {
|
||||
m.Push(nfs.FILE, "base/web/serve.go").Push(nfs.LINE, "62")
|
||||
}
|
||||
if ls[4] == ice.LOG_CMDS {
|
||||
if ls[6] == ice.LOG_CMDS {
|
||||
_ls := strings.SplitN(ls[5], lex.SP, 2)
|
||||
if ls[4], ls[5] = _ls[0], _ls[1]; !unicode.IsDigit(rune(ls[5][0])) {
|
||||
_ls := strings.SplitN(ls[5], lex.SP, 2)
|
||||
ls[4], ls[5] = ls[4]+lex.SP+_ls[0], _ls[1]
|
||||
if ls[6], ls[7] = _ls[0], _ls[1]; !unicode.IsDigit(rune(ls[7][0])) {
|
||||
_ls := strings.SplitN(ls[7], lex.SP, 2)
|
||||
ls[6], ls[7] = ls[6]+lex.SP+_ls[0], _ls[1]
|
||||
}
|
||||
}
|
||||
m.Push(ctx.SHIP, ls[3]).Push(LEVEL, ls[4]).Push(nfs.CONTENT, ls[5])
|
||||
stats[ls[4]]++
|
||||
m.Push(ctx.SHIP, ls[5]).Push(LEVEL, ls[6]).Push(nfs.CONTENT, ls[7])
|
||||
stats[ls[6]]++
|
||||
})
|
||||
case WATCH:
|
||||
m.Cmd(nfs.CAT, ice.VAR_LOG+arg[0]+".log", func(line string, index int) {
|
||||
if len(arg) > 2 && !strings.Contains(line, arg[2]) || index < offset {
|
||||
m.Cmd(nfs.CAT, ice.VAR_LOG+arg[0]+".log", func(text string, index int) {
|
||||
if len(arg) > 2 && !strings.Contains(text, arg[2]) || index < offset {
|
||||
return
|
||||
}
|
||||
ls := strings.SplitN(line, lex.SP, 6)
|
||||
m.Push(mdb.TIME, ls[0]+lex.SP+ls[1]).Push(mdb.ID, ls[2])
|
||||
i := strings.LastIndex(ls[5], lex.SP)
|
||||
ls := strings.SplitN(strings.ReplaceAll(text, " ", " "), lex.SP, 8)
|
||||
m.Push(mdb.TIME, ls[0]+lex.SP+ls[1]).Push(ice.LOG_TRACEID, ls[3]).Push(mdb.ID, ls[4])
|
||||
i := strings.LastIndex(ls[7], lex.SP)
|
||||
m.Push(nfs.PATH, ice.USR_ICEBERGS)
|
||||
m.Push(nfs.FILE, strings.TrimSpace(strings.Split(ls[5][i:], nfs.DF)[0]))
|
||||
m.Push(nfs.LINE, strings.TrimSpace(strings.Split(ls[5][i:], nfs.DF)[1]))
|
||||
m.Push(ctx.SHIP, ls[3]).Push(LEVEL, ls[4]).Push(nfs.CONTENT, ls[5][:i])
|
||||
stats[ls[4]]++
|
||||
m.Push(nfs.FILE, strings.TrimSpace(strings.Split(ls[7][i:], nfs.DF)[0]))
|
||||
m.Push(nfs.LINE, strings.TrimSpace(strings.Split(ls[7][i:], nfs.DF)[1]))
|
||||
m.Push(ctx.SHIP, ls[5]).Push(LEVEL, ls[6]).Push(nfs.CONTENT, ls[7][:i])
|
||||
stats[ls[6]]++
|
||||
})
|
||||
}
|
||||
m.StatusTimeCountTotal(offset+m.Length(), stats)
|
||||
|
@ -38,7 +38,16 @@ func _hash_insert(m *ice.Message, prefix, chain string, arg ...string) string {
|
||||
if arg[0] == HASH {
|
||||
m.Echo(arg[1]).Conf(prefix, kit.Keys(chain, HASH, arg[1]), kit.Data(arg[2:]))
|
||||
} else {
|
||||
m.Echo(Rich(m, prefix, chain, kit.Data(arg, TARGET, m.Optionv(TARGET))))
|
||||
func() {
|
||||
switch target := m.Optionv(TARGET).(type) {
|
||||
case []string:
|
||||
if len(target) == 0 {
|
||||
m.Echo(Rich(m, prefix, chain, kit.Data(arg)))
|
||||
return
|
||||
}
|
||||
}
|
||||
m.Echo(Rich(m, prefix, chain, kit.Data(arg, TARGET, m.Optionv(TARGET))))
|
||||
}()
|
||||
}
|
||||
saveImportant(m, prefix, chain, kit.Simple(INSERT, prefix, chain, HASH, HASH, m.Result(), TIME, m.Time(), arg)...)
|
||||
return m.Result()
|
||||
@ -158,7 +167,7 @@ func StatusHashAction(arg ...Any) ice.Actions {
|
||||
PRUNES: &ice.Action{Name: "prunes status", Hand: func(m *ice.Message, arg ...string) {
|
||||
args := []string{}
|
||||
kit.For(kit.Split(m.OptionDefault(STATUS, "error,close,stop,end")), func(s string) { args = append(args, STATUS, s) })
|
||||
m.Cmdy(PRUNES, m.PrefixKey(), "", HASH, args, ice.OptionFields(HashField(m)))
|
||||
m.Cmdy(PRUNES, m.PrefixKey(), m.Option(SUBKEY), HASH, args, ice.OptionFields(HashField(m)))
|
||||
}},
|
||||
}, HashAction(arg...))
|
||||
}
|
||||
@ -191,11 +200,11 @@ func HashField(m *ice.Message) string {
|
||||
return kit.Select(HASH_FIELD, Config(m, FIELD))
|
||||
}
|
||||
func HashInputs(m *ice.Message, arg ...Any) *ice.Message {
|
||||
return m.Cmdy(INPUTS, m.PrefixKey(), "", HASH, arg)
|
||||
return m.Cmdy(INPUTS, m.PrefixKey(), m.Option(SUBKEY), HASH, arg)
|
||||
}
|
||||
func HashCreate(m *ice.Message, arg ...Any) string {
|
||||
kit.If(len(arg) == 0 || len(kit.Simple(arg...)) == 0, func() { arg = append(arg, m.OptionSimple(strings.Replace(HashField(m), "hash,", "", 1))) })
|
||||
return m.Echo(m.Cmdx(append(kit.List(INSERT, m.PrefixKey(), "", HASH, logs.FileLineMeta(-1)), arg...)...)).Result()
|
||||
return m.Echo(m.Cmdx(append(kit.List(INSERT, m.PrefixKey(), m.Option(SUBKEY), HASH, logs.FileLineMeta(-1)), arg...)...)).Result()
|
||||
}
|
||||
func HashRemove(m *ice.Message, arg ...Any) *ice.Message {
|
||||
if args := kit.Simple(arg...); len(args) == 0 {
|
||||
@ -203,13 +212,13 @@ func HashRemove(m *ice.Message, arg ...Any) *ice.Message {
|
||||
} else if len(args) == 1 {
|
||||
arg = kit.List(HashKey(m), args[0])
|
||||
}
|
||||
return m.Cmdy(DELETE, m.PrefixKey(), "", HASH, arg)
|
||||
return m.Cmdy(DELETE, m.PrefixKey(), m.Option(SUBKEY), HASH, arg)
|
||||
}
|
||||
func HashModify(m *ice.Message, arg ...Any) *ice.Message {
|
||||
if args := kit.Simple(arg...); args[0] != HASH && args[0] != HashShort(m) {
|
||||
arg = append(kit.List(m.OptionSimple(HashKey(m))), arg...)
|
||||
}
|
||||
return m.Cmd(MODIFY, m.PrefixKey(), "", HASH, arg)
|
||||
return m.Cmd(MODIFY, m.PrefixKey(), m.Option(SUBKEY), HASH, arg)
|
||||
}
|
||||
func HashSelect(m *ice.Message, arg ...string) *ice.Message {
|
||||
if len(arg) > 0 && arg[0] == FOREACH {
|
||||
|
@ -115,7 +115,7 @@ const (
|
||||
OFFEND = "offend"
|
||||
OFFSET = "offset"
|
||||
RANDOM = "random"
|
||||
SUBKEY = "subkey"
|
||||
SUBKEY = "mdb.sub"
|
||||
|
||||
ACTION = "action"
|
||||
UPLOAD = "upload"
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
"shylinux.com/x/icebergs/base/web/html"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
@ -14,14 +13,12 @@ const ADMIN = "admin"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
ADMIN: {Help: "管理", Meta: kit.Dict(
|
||||
ctx.TRANS, kit.Dict(html.INPUT, kit.Dict(mdb.TYPE, "单位", PRICE, "价格", AMOUNT, "总价")),
|
||||
), Actions: ice.MergeActions(ice.Actions{
|
||||
ADMIN: {Help: "管理", Actions: ice.MergeActions(ice.Actions{
|
||||
web.UPLOAD: {Hand: func(m *ice.Message, arg ...string) { m.Echo(m.Append(mdb.HASH)) }},
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(GOODS, mdb.INPUTS, arg) }},
|
||||
}, GOODS, ctx.ConfAction(ctx.TOOLS, Prefix(GOODS))), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, ctx.ConfAction(ctx.TOOLS, Prefix(GOODS)), GOODS), Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(GOODS, arg).PushAction(mdb.MODIFY, mdb.REMOVE)
|
||||
kit.If(m.IsMobileUA(), func() { m.Action(mdb.CREATE) }, func() { m.Action(mdb.CREATE, "filter:text") })
|
||||
m.Action(mdb.CREATE)
|
||||
kit.If(len(arg) > 0, func() {
|
||||
kit.For(kit.Split(m.Append(nfs.IMAGE)), func(p string) {
|
||||
m.EchoImages(web.MergeURL2(m, web.SHARE_CACHE+p, ice.POD, m.Append(web.SPACE)))
|
||||
@ -33,8 +30,8 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func _status_amount(m *ice.Message) (total float64) {
|
||||
m.Table(func(value ice.Maps) { total += kit.Float(value[PRICE]) * kit.Float(value[mdb.COUNT]) })
|
||||
m.StatusTimeCount(AMOUNT, kit.Format("%0.2f", total))
|
||||
func _status_amount(m *ice.Message) (amount float64) {
|
||||
m.Table(func(value ice.Maps) { amount += kit.Float(value[PRICE]) * kit.Float(value[mdb.COUNT]) })
|
||||
m.StatusTimeCount(AMOUNT, kit.Format("%0.2f", amount))
|
||||
return
|
||||
}
|
||||
|
@ -6,25 +6,23 @@ import (
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
"shylinux.com/x/icebergs/base/web/html"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const (
|
||||
PRICE = "price"
|
||||
UNITS = "units"
|
||||
)
|
||||
const GOODS = "goods"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
GOODS: {Help: "商品", Icon: "mall.png", Meta: kit.Dict(
|
||||
ctx.TRANS, kit.Dict(html.INPUT, kit.Dict(mdb.TYPE, "单位", PRICE, "价格", AMOUNT, "总价")),
|
||||
), Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create zone* name* text price* count*=1 type*=件,个,份,斤 image*=4@img"},
|
||||
mdb.MODIFY: {Name: "modify zone* name* text price* count*=1 type*=件,个,份,斤 image*=4@img"},
|
||||
ORDER: {Name: "order count*=1", Help: "选购", Hand: func(m *ice.Message, arg ...string) {}},
|
||||
}, web.ExportCacheAction(nfs.IMAGE), mdb.ExportHashAction(ctx.TOOLS, Prefix(ORDER), mdb.FIELD, "time,hash,zone,name,text,price,count,type,image")), Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(len(arg) == 0 && m.IsMobileUA(), func() { m.OptionDefault(ice.MSG_FIELDS, "zone,name,price,count,type,text,hash,time,image") })
|
||||
GOODS: {Help: "商品", Icon: "mall.png", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create zone* name* text price* count*=1 units*=件,个,份,斤 image*=4@img"},
|
||||
mdb.MODIFY: {Name: "modify zone* name* text price* count*=1 units*=件,个,份,斤 image*=4@img"},
|
||||
ORDER: {Name: "order count*=1", Help: "选购", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(CART, mdb.INSERT, arg) }},
|
||||
}, web.ExportCacheAction(nfs.IMAGE), mdb.ExportHashAction(ctx.TOOLS, kit.Fields(Prefix(CART), Prefix(ORDER)), mdb.FIELD, "time,hash,zone,name,text,price,count,units,image")), Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(len(arg) == 0 && m.IsMobileUA(), func() { m.OptionDefault(ice.MSG_FIELDS, "zone,name,price,count,units,text,hash,time,image") })
|
||||
mdb.HashSelect(m, arg...).PushAction(ORDER).Action("filter:text")
|
||||
web.PushPodCmd(m, "", arg...).Sort("zone,name")
|
||||
ctx.DisplayLocal(m, "")
|
||||
|
@ -10,6 +10,6 @@ const MALL = "mall"
|
||||
|
||||
var Index = &ice.Context{Name: MALL, Help: "贸易中心"}
|
||||
|
||||
func init() { web.Index.Register(Index, nil, ASSET, SALARY) }
|
||||
func init() { web.Index.Register(Index, nil) }
|
||||
|
||||
func Prefix(arg ...ice.Any) string { return web.Prefix(MALL, kit.Keys(arg...)) }
|
||||
|
@ -1,5 +1,16 @@
|
||||
chapter "市场"
|
||||
|
||||
mall.go
|
||||
mall.shy
|
||||
supply.go
|
||||
custom.go
|
||||
asset.go
|
||||
admin.go
|
||||
goods.go
|
||||
cart.go
|
||||
order.go
|
||||
return
|
||||
|
||||
section "asset"
|
||||
refer `
|
||||
公积金 https://grwsyw.gjj.beijing.gov.cn/ish/flow/menu/PPLGRZH0102?_r=0.6644871172745264
|
||||
|
@ -3,16 +3,68 @@ package mall
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const (
|
||||
ORDER_CONFIRM = "confirm"
|
||||
ORDER_CANCEL = "cancel"
|
||||
ORDER_PAYED = "payed"
|
||||
ORDER_TRANSIT = "transit"
|
||||
ORDER_RECEIVED = "received"
|
||||
ORDER_RETURNED = "returned"
|
||||
ORDER_REFUNDED = "refunded"
|
||||
|
||||
PAY = "pay"
|
||||
CANCEL = "cancel"
|
||||
DELIVERY = "delivery"
|
||||
RECEIVE = "receive"
|
||||
RETURN = "return"
|
||||
REFUND = "refund"
|
||||
)
|
||||
const ORDER = "order"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
ORDER: {Name: "order hash auto", Help: "订单", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create zone* type name* text price* count* image*=4@img"},
|
||||
}), Hand: func(m *ice.Message, arg ...string) {
|
||||
|
||||
ORDER: {Help: "订单", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INSERT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Options(mdb.SUBKEY, kit.Keys(mdb.HASH, m.Option(mdb.HASH)))
|
||||
mdb.HashCreate(m, arg)
|
||||
}}, // mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) {}},
|
||||
PAY: {Help: "支付", Hand: func(m *ice.Message, arg ...string) { mdb.HashModify(m, mdb.STATUS, ORDER_PAYED) }},
|
||||
CANCEL: {Help: "取消", Hand: func(m *ice.Message, arg ...string) { mdb.HashModify(m, mdb.STATUS, ORDER_CANCEL) }},
|
||||
DELIVERY: {Help: "发货", Hand: func(m *ice.Message, arg ...string) { mdb.HashModify(m, mdb.STATUS, ORDER_TRANSIT) }},
|
||||
RECEIVE: {Help: "收货", Hand: func(m *ice.Message, arg ...string) { mdb.HashModify(m, mdb.STATUS, ORDER_RECEIVED) }},
|
||||
RETURN: {Help: "退货", Hand: func(m *ice.Message, arg ...string) { mdb.HashModify(m, mdb.STATUS, ORDER_RETURNED) }},
|
||||
REFUND: {Help: "退钱", Hand: func(m *ice.Message, arg ...string) { mdb.HashModify(m, mdb.STATUS, ORDER_REFUNDED) }},
|
||||
}, mdb.ExportHashAction(mdb.FIELD, "time,hash,username,status,amount", mdb.FIELDS, "time,goods,price,count,units,name,text,image")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
stats := map[string]int{}
|
||||
mdb.HashSelect(m, arg...).Table(func(value ice.Maps) {
|
||||
switch value[mdb.STATUS] {
|
||||
case ORDER_CONFIRM:
|
||||
m.PushButton(PAY, CANCEL)
|
||||
case ORDER_CANCEL:
|
||||
m.PushButton(mdb.REMOVE)
|
||||
case ORDER_PAYED:
|
||||
m.PushButton(DELIVERY)
|
||||
case ORDER_TRANSIT:
|
||||
m.PushButton(RECEIVE)
|
||||
case ORDER_RECEIVED:
|
||||
m.PushButton(RETURN)
|
||||
case ORDER_RETURNED:
|
||||
m.PushButton(REFUND)
|
||||
default:
|
||||
m.PushButton("")
|
||||
}
|
||||
stats[value[mdb.STATUS]]++
|
||||
})
|
||||
m.StatusTimeCount(stats)
|
||||
} else {
|
||||
m.Options(mdb.SUBKEY, kit.Keys(mdb.HASH, arg[0])).OptionFields(mdb.Config(m, mdb.FIELDS))
|
||||
mdb.HashSelect(m, arg[1:]...)
|
||||
_status_amount(m)
|
||||
}
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
package mall
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const (
|
||||
MONTH = "month"
|
||||
INCOME = "income"
|
||||
TAX = "tax"
|
||||
)
|
||||
const SALARY = "salary"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
SALARY: {Name: "salary month auto create", Help: "工资", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create month company amount income tax 公积金 养老保险 医疗保险 生育保险 工伤保险 失业保险 企业公积金 企业养老保险 企业医疗保险 企业生育保险 企业工伤保险 企业失业保险", Help: "添加"},
|
||||
}, mdb.HashAction(mdb.SHORT, MONTH, mdb.FIELD, "month,company,amount,income,tax")), Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashSelect(m, arg...)
|
||||
amount, income, tax := 0, 0, 0
|
||||
m.Table(func(value ice.Maps) {
|
||||
amount += kit.Int(value[AMOUNT])
|
||||
income += kit.Int(value[INCOME])
|
||||
tax += kit.Int(value[TAX])
|
||||
})
|
||||
m.StatusTime(AMOUNT, amount, INCOME, income, TAX, tax)
|
||||
}},
|
||||
})
|
||||
}
|
6
info.go
6
info.go
@ -6,6 +6,7 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"shylinux.com/x/icebergs/base/web/html"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
"shylinux.com/x/toolkits/miss"
|
||||
)
|
||||
@ -147,6 +148,11 @@ func MergeActions(arg ...Any) Actions {
|
||||
h.Hand = MergeHand(h.Hand, func(m *Message, arg ...string) {
|
||||
_cmd := m._cmd
|
||||
m.Search(from, func(p *Context, s *Context, key string, cmd *Command) {
|
||||
kit.For(kit.Value(cmd.Meta, kit.Keys(CTX_TRANS, html.INPUT)), func(k, v string) {
|
||||
if kit.Format(kit.Value(_cmd.Meta, kit.Keys(CTX_TRANS, html.INPUT, k))) == "" {
|
||||
kit.Value(_cmd.Meta, kit.Keys(CTX_TRANS, html.INPUT, k), v)
|
||||
}
|
||||
})
|
||||
for k, v := range cmd.Actions {
|
||||
func(k string) {
|
||||
if h, ok := list[k]; !ok {
|
||||
|
@ -17,6 +17,7 @@ const (
|
||||
|
||||
type java struct {
|
||||
ice.Code
|
||||
ice.Lang
|
||||
regexp string `data:"java"`
|
||||
linux string `data:"https://mirrors.huaweicloud.com/openjdk/18/openjdk-18_linux-x64_bin.tar.gz"`
|
||||
list string `name:"list path auto listScript order install" help:"编译器"`
|
||||
@ -29,6 +30,11 @@ func (s java) Init(m *ice.Message) {
|
||||
cli.IsCentos(m.Message, JAVA, "java-1.8.0-openjdk-devel.x86_64")
|
||||
cli.IsCentos(m.Message, JAVAC, "java-1.8.0-openjdk-devel.x86_64")
|
||||
cli.IsCentos(m.Message, MVN, "maven java-1.8.0-openjdk-devel.x86_64")
|
||||
s.Lang.Init(m, nfs.SCRIPT, m.Resource(""))
|
||||
}
|
||||
func (s java) Render(m *ice.Message, arg ...string) {
|
||||
}
|
||||
func (s java) Engine(m *ice.Message, arg ...string) {
|
||||
}
|
||||
func (s java) List(m *ice.Message, arg ...string) {
|
||||
s.Code.Source(m, "", arg...)
|
||||
|
@ -49,6 +49,9 @@ func Render(m *Message, cmd string, args ...Any) string {
|
||||
case RENDER_ANCHOR:
|
||||
return kit.Format(`<a href="%s" target="_blank">%s</a>`, kit.Select(arg[0], arg, 1), arg[0])
|
||||
case RENDER_IMAGES:
|
||||
if len(arg) > 1 {
|
||||
return kit.Format(`<img src="%s" height="%s">`, arg[0], arg[1])
|
||||
}
|
||||
return kit.Format(`<img src="%s">`, arg[0])
|
||||
case RENDER_VIDEOS:
|
||||
return kit.Format(`<video src="%s" controls autoplay>`, arg[0])
|
||||
@ -167,8 +170,8 @@ func (m *Message) PushAnchor(arg ...string) {
|
||||
func (m *Message) PushQRCode(key, src string) {
|
||||
kit.If(!m.IsCliUA(), func() { m.Push(key, Render(m, RENDER_QRCODE, src)) })
|
||||
}
|
||||
func (m *Message) PushImages(key, src string) {
|
||||
kit.If(!m.IsCliUA(), func() { m.Push(key, Render(m, RENDER_IMAGES, src)) })
|
||||
func (m *Message) PushImages(key, src string, arg ...string) {
|
||||
kit.If(!m.IsCliUA(), func() { m.Push(key, Render(m, RENDER_IMAGES, src, arg)) })
|
||||
}
|
||||
func (m *Message) PushVideos(key, src string) {
|
||||
kit.If(!m.IsCliUA(), func() { m.Push(key, Render(m, RENDER_VIDEOS, src)) })
|
||||
|
Loading…
x
Reference in New Issue
Block a user