diff --git a/core/mall/cart.go b/core/mall/cart.go new file mode 100644 index 00000000..d08c6c7e --- /dev/null +++ b/core/mall/cart.go @@ -0,0 +1,44 @@ +package mall + +import ( + ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/base/aaa" + "shylinux.com/x/icebergs/base/mdb" + "shylinux.com/x/icebergs/base/nfs" + "shylinux.com/x/icebergs/base/web" + kit "shylinux.com/x/toolkits" +) + +const CART = "cart" + +func init() { + Index.MergeCommands(ice.Commands{ + CART: {Name: "cart list", Help: "购物车", Actions: ice.MergeActions(ice.Actions{ + mdb.INSERT: {Hand: func(m *ice.Message, arg ...string) { + m.Options(mdb.SUBKEY, kit.Keys(mdb.HASH, mdb.HashCreate(m.Spawn(), aaa.USERNAME, m.Option(ice.MSG_USERNAME), mdb.SHORT, GOODS))) + mdb.HashCreate(m.Spawn(), GOODS, m.Option(mdb.HASH), m.OptionSimple(mdb.COUNT)) + }}, + mdb.DELETE: {Hand: func(m *ice.Message, arg ...string) { + m.Options(mdb.SUBKEY, kit.KeyHash(m.Option(ice.MSG_USERNAME))) + mdb.HashRemove(m.Spawn(), m.OptionSimple(GOODS)) + }}, + ORDER: {Help: "下单", Hand: func(m *ice.Message, arg ...string) { + msg := m.Cmd("") + var amount float64 + msg.Table(func(value ice.Maps) { + amount += kit.Float(value[PRICE]) * kit.Float(value[mdb.COUNT]) + }) + m.Options(mdb.HASH, m.Cmdx(ORDER, mdb.CREATE, aaa.USERNAME, m.Option(ice.MSG_USERNAME), mdb.STATUS, ORDER_CONFIRM, AMOUNT, amount)) + msg.Table(func(value ice.Maps) { m.Cmd(ORDER, mdb.INSERT, kit.Simple(value)) }) + }}, + }, mdb.ExportHashAction(mdb.SHORT, aaa.USERNAME, mdb.FIELD, "time,username", mdb.FIELDS, "time,goods,count")), Hand: func(m *ice.Message, arg ...string) { + m.Options(mdb.SUBKEY, kit.KeyHash(m.Option(ice.MSG_USERNAME))).OptionFields(mdb.Config(m, mdb.FIELDS)) + mdb.HashSelect(m, arg...).Options(mdb.SUBKEY, "").Table(func(value ice.Maps) { + m.Cmd(GOODS, value[GOODS], func(value ice.Maps) { + m.Push("", value, kit.Split("name,text,price,units")).PushImages(nfs.IMAGE, web.SHARE_CACHE+value[nfs.IMAGE], "64") + }) + }).Cut("image,name,text,price,count,units,goods,time").PushAction(mdb.DELETE).Action(ORDER) + _status_amount(m) + }}, + }) +} diff --git a/core/mall/custom.go b/core/mall/custom.go new file mode 100644 index 00000000..6bb82476 --- /dev/null +++ b/core/mall/custom.go @@ -0,0 +1,19 @@ +package mall + +import ( + ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/base/aaa" + "shylinux.com/x/icebergs/base/mdb" +) + +const CUSTOM = "custom" + +func init() { + Index.MergeCommands(ice.Commands{ + CUSTOM: {Help: "顾客", Actions: ice.MergeActions(mdb.HashAction( + mdb.SHORT, aaa.USERNAME, + )), Hand: func(m *ice.Message, arg ...string) { + + }}, + }) +} diff --git a/core/mall/store.go b/core/mall/store.go new file mode 100644 index 00000000..94d7bfd2 --- /dev/null +++ b/core/mall/store.go @@ -0,0 +1,14 @@ +package mall + +import ( + ice "shylinux.com/x/icebergs" +) + +const STORE = "store" + +func init() { + Index.MergeCommands(ice.Commands{ + STORE: {Help: "商店", Hand: func(m *ice.Message, arg ...string) { + }}, + }) +} diff --git a/core/mall/supply.go b/core/mall/supply.go new file mode 100644 index 00000000..e8a2fd08 --- /dev/null +++ b/core/mall/supply.go @@ -0,0 +1,19 @@ +package mall + +import ( + ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/base/aaa" + "shylinux.com/x/icebergs/base/mdb" +) + +const SUPPLY = "supply" + +func init() { + Index.MergeCommands(ice.Commands{ + SUPPLY: {Help: "供应商", Actions: ice.MergeActions(mdb.HashAction( + mdb.SHORT, aaa.USERNAME, + )), Hand: func(m *ice.Message, arg ...string) { + + }}, + }) +} diff --git a/core/team/salary.go b/core/team/salary.go new file mode 100644 index 00000000..79ebc052 --- /dev/null +++ b/core/team/salary.go @@ -0,0 +1,31 @@ +package team + +import ( + ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/base/mdb" + kit "shylinux.com/x/toolkits" +) + +const ( + AMOUNT = "amount" + 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) + }}, + }) +} diff --git a/misc/java/java.js b/misc/java/java.js new file mode 100644 index 00000000..a8ad720a --- /dev/null +++ b/misc/java/java.js @@ -0,0 +1,83 @@ +Volcanos(chat.ONSYNTAX, { + java: { + prefix: {"//": code.COMMENT}, + regexp: {"[A-Z_0-9]+": code.CONSTANT}, + keyword: { + "package": code.KEYWORD, + "import": code.KEYWORD, + "public": code.KEYWORD, + "private": code.KEYWORD, + "static": code.KEYWORD, + "final": code.KEYWORD, + "class": code.KEYWORD, + "extends": code.KEYWORD, + "implements": code.KEYWORD, + "default": code.KEYWORD, + + "new": code.KEYWORD, + "if": code.KEYWORD, + "else": code.KEYWORD, + "for": code.KEYWORD, + "break": code.KEYWORD, + "try": code.KEYWORD, + "catch": code.KEYWORD, + "return": code.KEYWORD, + + "null": code.CONSTANT, + "true": code.CONSTANT, + "false": code.CONSTANT, + + "int": code.DATATYPE, + "void": code.DATATYPE, + "string": code.DATATYPE, + "boolean": code.DATATYPE, + "Object": code.DATATYPE, + "Class": code.DATATYPE, + "String": code.DATATYPE, + "Integer": code.DATATYPE, + "Long": code.DATATYPE, + "Exception": code.DATATYPE, + "List": code.DATATYPE, + "Map": code.DATATYPE, + + "this": code.OBJECT, + + "interface": code.FUNCTION, + "Override": code.FUNCTION, + "Autowired": code.FUNCTION, + "Retention": code.FUNCTION, + "Configuration": code.FUNCTION, + "Builder": code.FUNCTION, + "Value": code.FUNCTION, + "Data": code.FUNCTION, + "Bean": code.FUNCTION, + "Service": code.FUNCTION, + "Controller": code.FUNCTION, + "Validated": code.FUNCTION, + "RequestMapping": code.FUNCTION, + "RequestParam": code.FUNCTION, + "RequestPart": code.FUNCTION, + "RequestBody": code.FUNCTION, + "ResponseBody": code.FUNCTION, + "PathVariable": code.FUNCTION, + "ApiOperation": code.FUNCTION, + "Api": code.FUNCTION, + "Tag": code.FUNCTION, + }, + func: function(can, push, text, indent) { + var ls = can.core.Split(text) + if (ls[0] == "public") { + if (ls[1] == "class") { + push(ls[2]) + return + } + for (var i = 0; i < ls.length; i++) { + if (ls[i] == "(") { + push(" "+ls[i-1]) + return + } + } + } + }, + }, +})