From bf77469cdc16a8cbefbeaee8b8c33f112a993981 Mon Sep 17 00:00:00 2001 From: shy Date: Thu, 5 Sep 2024 20:02:47 +0800 Subject: [PATCH] add some --- src/development/common.go | 41 --------------- src/development/model/model.go | 35 ------------- src/development/portal.go | 13 ----- src/development/portal.json | 30 ----------- src/development/release.go | 25 --------- src/development/release.js | 12 ----- src/development/repos.go | 21 -------- src/development/userRepos.go | 15 ------ src/gongyinglian/brand.go | 2 +- src/gongyinglian/common.go | 84 ++++++++++++++++++------------- src/gongyinglian/expense.go | 6 +-- src/gongyinglian/express.go | 30 +---------- src/gongyinglian/loan.go | 6 +-- src/gongyinglian/model/model.go | 69 +++++++++---------------- src/gongyinglian/order.js | 2 +- src/gongyinglian/payment.go | 31 +----------- src/gongyinglian/portal.go | 4 +- src/gongyinglian/portal.json | 1 + src/gongyinglian/product.go | 12 ++--- src/gongyinglian/product.js | 2 +- src/gongyinglian/quality.go | 2 +- src/gongyinglian/refund.go | 31 +----------- src/gongyinglian/return.go | 30 +---------- src/gongyinglian/shop.go | 12 ++++- src/guanlixitong/common.go | 2 +- src/guanlixitong/portal.go | 2 +- src/guanlixitong/target.go | 23 +++------ src/guanlixitong/target.js | 2 +- src/operation/cloud.go | 21 -------- src/operation/common.go | 41 --------------- src/operation/model/model.go | 35 ------------- src/operation/portal.go | 15 ------ src/operation/portal.json | 34 ------------- src/operation/publish.go | 25 --------- src/operation/publish.js | 12 ----- src/operation/userCloud.go | 15 ------ src/shichangyingxiao/portal.go | 2 +- src/shichangyingxiao/promotion.go | 23 +++------ src/shichangyingxiao/promotion.js | 2 +- src/zijinlian/investment.go | 23 +++------ src/zijinlian/investment.js | 2 +- src/zijinlian/portal.go | 2 +- 42 files changed, 137 insertions(+), 660 deletions(-) delete mode 100644 src/development/common.go delete mode 100644 src/development/model/model.go delete mode 100644 src/development/portal.go delete mode 100644 src/development/portal.json delete mode 100644 src/development/release.go delete mode 100644 src/development/release.js delete mode 100644 src/development/repos.go delete mode 100644 src/development/userRepos.go delete mode 100644 src/operation/cloud.go delete mode 100644 src/operation/common.go delete mode 100644 src/operation/model/model.go delete mode 100644 src/operation/portal.go delete mode 100644 src/operation/portal.json delete mode 100644 src/operation/publish.go delete mode 100644 src/operation/publish.js delete mode 100644 src/operation/userCloud.go diff --git a/src/development/common.go b/src/development/common.go deleted file mode 100644 index 2f4d6d0..0000000 --- a/src/development/common.go +++ /dev/null @@ -1,41 +0,0 @@ -package development - -import ( - "shylinux.com/x/ice" - kit "shylinux.com/x/toolkits" - - "shylinux.com/x/enterprise/src/development/model" - "shylinux.com/x/enterprise/src/guanlixitong" -) - -type Table struct { - guanlixitong.Table - list string `name:"list repos_uid uid auto" role:"void"` -} - -func (s Table) Inputs(m *ice.Message, arg ...string) { - switch arg[0] { - case model.USER_REPOS_ROLE: - s.InputsListRole(m, UserReposRoleList, arg...) - case model.REPOS_TYPE: - s.InputsList(m, ReposTypeList, arg...) - default: - s.Table.Inputs(m, arg...) - } -} -func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message { - m.RewriteAppend(func(value, key string, index int) string { - switch key { - case model.USER_REPOS_ROLE: - value = UserReposRole(kit.Int(value)).String() - case model.REPOS_TYPE: - value = ReposType(kit.Int(value)).String() - } - return value - }) - return s.Table.RewriteAppend(m) -} - -type Tables struct{ Table } - -func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {} diff --git a/src/development/model/model.go b/src/development/model/model.go deleted file mode 100644 index 842097b..0000000 --- a/src/development/model/model.go +++ /dev/null @@ -1,35 +0,0 @@ -package model - -import "shylinux.com/x/mysql-story/src/db" - -const ( - UID = "uid" - NAME = "name" - TYPE = "type" - ROLE = "role" - TITLE = "title" - CONTENT = "content" - USER_UID = "user_uid" - USER_REPOS_ROLE = "user_repos_role" - REPOS_UID = "repos_uid" - REPOS_NAME = "repos_name" - REPOS_TYPE = "repos_type" - RELEASE_UID = "release_uid" - COMPANY_UID = "company_uid" - CITY_UID = "city_uid" -) - -type UserRepos struct { - db.ModelUserPlace - ReposUID string `gorm:"type:char(32);index"` -} -type Repos struct { - db.ModelPlace - CompanyUID string `gorm:"type:char(32);index"` -} -type Release struct { - db.ModelContent - ReposUID string `gorm:"type:char(32);index"` -} - -func init() { db.CmdModels("", &UserRepos{}, &Repos{}, &Release{}) } diff --git a/src/development/portal.go b/src/development/portal.go deleted file mode 100644 index 3fd4184..0000000 --- a/src/development/portal.go +++ /dev/null @@ -1,13 +0,0 @@ -package development - -import ( - "shylinux.com/x/community/src/gonganxitong" - "shylinux.com/x/enterprise/src/guanlixitong" -) - -type Portal struct { - guanlixitong.Portal - placeCreate string `name:"placeCreate city_name* company_name* repos_type*:select repos_name*" role:"void"` -} - -func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userRepos{}, repos{})}) } diff --git a/src/development/portal.json b/src/development/portal.json deleted file mode 100644 index 6acf5d9..0000000 --- a/src/development/portal.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "portal": "系统开发", - "member": "项目成员", - "release": "版本发布", - "icons": { - "release": "https://img.icons8.com/officel/80/activity-grid.png" - }, - "input": { - "My Repos": "我的项目", - "user_repos_role": "用户角色", - "repos_name": "项目名称", - "repos_type": "项目类型" - }, - "value": { - "user_repos_role": { - "visitor": "访客", - "creator": "创建人", - "leader": "管理人员", - "worker": "工作人员", - "server": "服务人员", - "style": { - "creator": "danger" - } - }, - "repos_type": { - "local": "本地", - "remote": "远程" - } - } -} \ No newline at end of file diff --git a/src/development/release.go b/src/development/release.go deleted file mode 100644 index 16ca495..0000000 --- a/src/development/release.go +++ /dev/null @@ -1,25 +0,0 @@ -package development - -import ( - "shylinux.com/x/ice" - kit "shylinux.com/x/toolkits" - - "shylinux.com/x/enterprise/src/development/model" -) - -type release struct { - Table - repos repos - userRepos userRepos - create string `name:"create title* content*" role:"leader"` -} - -func (s release) Create(m *ice.Message, arg ...string) { - s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.REPOS_UID))...) - s.RecordEventWithName(m, "") -} -func (s release) List(m *ice.Message, arg ...string) { - s.TablesWithRole(m, arg, s.userRepos, s.repos, s, model.TITLE, model.CONTENT).Display("") -} - -func init() { ice.TeamCtxCmd(release{}) } diff --git a/src/development/release.js b/src/development/release.js deleted file mode 100644 index f2b29a7..0000000 --- a/src/development/release.js +++ /dev/null @@ -1,12 +0,0 @@ -Volcanos(chat.ONIMPORT, { - _init: function(can, msg) { can.onimport.shareTitle(can, msg) - can.onimport.itemcards(can, msg, function(value) { return [ - {view: html.TITLE, list: [value.title]}, - {view: html.STATUS, list: [ - value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), - value.user_name, can.onimport.textView(can, value, "user_repos_role", aaa.ROLE), - ]}, - {view: html.OUTPUT, list: [value.content]}, - ] }) - }, -}) \ No newline at end of file diff --git a/src/development/repos.go b/src/development/repos.go deleted file mode 100644 index 044cb30..0000000 --- a/src/development/repos.go +++ /dev/null @@ -1,21 +0,0 @@ -package development - -import "shylinux.com/x/ice" - -type repos struct{ Table } - -func init() { ice.TeamCtxCmd(repos{}) } - -type ReposType int - -const ( - ReposLocal ReposType = iota - ReposRemote -) - -var ReposTypeList = map[ReposType]string{ - ReposLocal: "local", - ReposRemote: "remote", -} - -func (s ReposType) String() string { return ReposTypeList[s] } diff --git a/src/development/userRepos.go b/src/development/userRepos.go deleted file mode 100644 index 84076ce..0000000 --- a/src/development/userRepos.go +++ /dev/null @@ -1,15 +0,0 @@ -package development - -import ( - "shylinux.com/x/ice" - - "shylinux.com/x/enterprise/src/guanlixitong" -) - -type userRepos struct{ Table } - -func init() { ice.TeamCtxCmd(userRepos{}) } - -type UserReposRole = guanlixitong.UserGroupRole - -var UserReposRoleList = guanlixitong.UserGroupRoleList diff --git a/src/gongyinglian/brand.go b/src/gongyinglian/brand.go index 7245cd7..7bdc460 100644 --- a/src/gongyinglian/brand.go +++ b/src/gongyinglian/brand.go @@ -2,6 +2,6 @@ package gongyinglian import "shylinux.com/x/ice" -type brand struct{ TableView } +type brand struct{ Value } func init() { ice.TeamCtxCmd(brand{}) } diff --git a/src/gongyinglian/common.go b/src/gongyinglian/common.go index e42f124..412772b 100644 --- a/src/gongyinglian/common.go +++ b/src/gongyinglian/common.go @@ -1,8 +1,8 @@ package gongyinglian import ( + "path" "shylinux.com/x/ice" - "shylinux.com/x/icebergs/base/mdb" kit "shylinux.com/x/toolkits" "shylinux.com/x/enterprise/src/gongyinglian/model" @@ -65,17 +65,8 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message { }) return s.Table.RewriteAppend(m) } -func (s TableView) transPrice(m *ice.Message, arg ...string) []string { - for i := 0; i < len(arg); i += 2 { - switch arg[i] { - case model.AMOUNT, model.PRICE: - arg[i+1] = kit.Format(kit.Int(kit.Float(arg[i+1]) * 100)) - } - } - return arg -} func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message { - role := UserStoreRole(kit.Int(m.Cmd(userStore{}, s.Select, m.OptionSimple(model.STORE_UID, model.USER_UID)).Append(model.ROLE))) + role := UserStoreRole(s.UserPlaceRole(m)) m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserStoreCreator.String())...), role.String()) return m } @@ -114,7 +105,11 @@ func (s Table) checkOrderRole(m *ice.Message, arg ...string) bool { return true } -type TableView struct { +type Tables struct{ Table } + +func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {} + +type Value struct { Table fields string `data:"name,info"` create string `name:"create name info" role:"boss"` @@ -122,35 +117,54 @@ type TableView struct { remove string `name:"remove" role:"boss"` } -func (s TableView) Create(m *ice.Message, arg ...string) { - arg = s.transPrice(m, arg...) - s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.STORE_UID))...) - s.RecordEventWithName(m, "") +func (s Value) Create(m *ice.Message, arg ...string) { + s.Table.ValueCreate(m, s.transPrice(m, arg...)...) } -func (s TableView) Modify(m *ice.Message, arg ...string) { - arg = s.transPrice(m, arg...) - s.Table.Update(m, kit.Dict(arg), m.OptionSimple(model.STORE_UID, model.UID)...) - s.RecordEventWithName(m, "") +func (s Value) Modify(m *ice.Message, arg ...string) { + s.Table.ValueModify(m, s.transPrice(m, arg...)...) } -func (s TableView) Remove(m *ice.Message, arg ...string) { - s.Table.Delete(m, m.OptionSimple(model.STORE_UID, model.UID)...) - s.RecordEventWithName(m, "") +func (s Value) Remove(m *ice.Message, arg ...string) { + s.Table.ValueRemove(m, arg...) } -func (s TableView) List(m *ice.Message, arg ...string) { - if len(arg) == 0 { - s.Select(m, m.OptionSimple(model.STORE_UID)...) +func (s Value) List(m *ice.Message, arg ...string) { + s.Table.ValueList(m, arg) + if m.Length() == 0 { + m.EchoInfoButton("") + } + if m.Exists(path.Join(path.Dir(kit.FileLines(1)), m.CommandKey()+".js")) { + m.Display(m.CommandKey() + ".js") + } +} +func (s Value) transPrice(m *ice.Message, arg ...string) []string { + for i := 0; i < len(arg); i += 2 { + switch arg[i] { + case model.AMOUNT, model.PRICE: + arg[i+1] = kit.Format(kit.Int(kit.Float(arg[i+1]) * 100)) + } + } + return arg +} + +type Relative struct{ Table } + +func (s Relative) List(m *ice.Message, arg ...string) { + if !s.checkListRole(m, arg...) { return } - kit.If(m.Config(mdb.FIELDS), func(p string) { s.FieldsWithCreatedAT(m, "", kit.TransArgs(kit.Split(p, ",", ","))...) }) + order := Order{} + s.Tables(m, Order{}).FieldsWithCreatedAT(m, order, + s.AS(model.TO_USER_UID, model.USER_UID), m.CommandKey()+"_"+model.STATUS, + s.Key(order, model.AMOUNT), s.Key(order, model.TOTAL), + model.COMPANY_UID, model.OPEN_ID, model.ORDER_UID, + ) if len(arg) == 1 { - s.Select(m, model.STORE_UID, arg[0]) - kit.If(m.Length() == 0, func() { m.EchoInfoButton("", s.Create) }) + s.Select(m, model.FROM_STORE_UID, arg[0]).Action() } else if len(arg) == 2 { - s.SelectDetail(m, model.STORE_UID, arg[0], model.UID, arg[1]) + s.SelectDetail(m, model.FROM_STORE_UID, arg[0], s.Key(m.CommandKey(), model.UID), arg[1]) + } else { + return } - m.PushAction(s.Modify, s.Remove) + s.SelectJoinCompany(m) + s.SelectJoinUser(m) + m.Display(m.CommandKey() + ".js") } - -type Tables struct{ Table } - -func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {} diff --git a/src/gongyinglian/expense.go b/src/gongyinglian/expense.go index 944c554..a1b0fab 100644 --- a/src/gongyinglian/expense.go +++ b/src/gongyinglian/expense.go @@ -8,7 +8,7 @@ import ( ) type expense struct { - TableView + Value fields string `data:"expense_type,amount,name,info"` create string `name:"create expense_type* amount* name info" role:"boss"` modify string `name:"modify amount* name info" role:"boss"` @@ -16,11 +16,11 @@ type expense struct { func (s expense) Create(m *ice.Message, arg ...string) { arg = kit.TransArgKeys(arg, model.EXPENSE_TYPE, model.TYPE) - s.TableView.Create(m, kit.Simple(arg, model.FROM_USER_UID, m.Option(model.USER_UID))...) + s.Value.Create(m, kit.Simple(arg, model.FROM_USER_UID, m.Option(model.USER_UID))...) } func (s expense) List(m *ice.Message, arg ...string) { if s.checkListRole(m, arg...) { - s.TableView.List(m, arg...) + s.Value.List(m, arg...) } } diff --git a/src/gongyinglian/express.go b/src/gongyinglian/express.go index a8b2aa9..4485324 100644 --- a/src/gongyinglian/express.go +++ b/src/gongyinglian/express.go @@ -1,34 +1,8 @@ package gongyinglian -import ( - "shylinux.com/x/ice" +import "shylinux.com/x/ice" - "shylinux.com/x/enterprise/src/gongyinglian/model" -) - -type express struct { - Table - order Order -} - -func (s express) List(m *ice.Message, arg ...string) { - if !s.checkListRole(m, arg...) { - return - } - s.Tables(m, s.order).FieldsWithCreatedAT(m, s, - s.AS(model.TO_USER_UID, model.USER_UID), model.EXPRESS_STATUS, - model.COMPANY_UID, model.OPEN_ID, model.ORDER_UID, - ) - if len(arg) == 1 { - s.Select(m, model.FROM_STORE_UID, arg[0]).Action() - } else if len(arg) == 2 { - s.SelectDetail(m, model.FROM_STORE_UID, arg[0], s.Key(s, model.UID), arg[1]) - } else { - return - } - s.SelectJoinCompany(m) - s.SelectJoinUser(m) -} +type express struct{ Relative } func init() { ice.TeamCtxCmd(express{}) } diff --git a/src/gongyinglian/loan.go b/src/gongyinglian/loan.go index 7bd8838..6e0d8b7 100644 --- a/src/gongyinglian/loan.go +++ b/src/gongyinglian/loan.go @@ -8,7 +8,7 @@ import ( ) type loan struct { - TableView + Value fields string `data:"loan_type,amount,name,info"` create string `name:"create loan_type* amount name info" role:"boss"` modify string `name:"modify name info amount" role:"boss"` @@ -16,11 +16,11 @@ type loan struct { func (s loan) Create(m *ice.Message, arg ...string) { arg = kit.TransArgKeys(arg, model.LOAN_TYPE, model.TYPE) - s.TableView.Create(m, kit.Simple(arg, model.TO_USER_UID, m.Option(model.USER_UID))...) + s.Value.Create(m, kit.Simple(arg, model.TO_USER_UID, m.Option(model.USER_UID))...) } func (s loan) List(m *ice.Message, arg ...string) { if s.checkListRole(m, arg...) { - s.TableView.List(m, arg...) + s.Value.List(m, arg...) } } diff --git a/src/gongyinglian/model/model.go b/src/gongyinglian/model/model.go index 3b5967e..9375319 100644 --- a/src/gongyinglian/model/model.go +++ b/src/gongyinglian/model/model.go @@ -11,8 +11,6 @@ const ( STATUS = "status" TITLE = "title" CONTENT = "content" - ADDRESS = "address" - OPEN_ID = "open_id" USER_UID = "user_uid" USER_STORE_ROLE = "user_store_role" STORE_UID = "store_uid" @@ -44,13 +42,14 @@ const ( LOAN_TYPE = "loan_type" COMPANY_UID = "company_uid" CITY_UID = "city_uid" + ADDRESS = "address" + OPEN_ID = "open_id" AMOUNT = "amount" TOTAL = "total" PRICE = "price" STOCK = "stock" COUNT = "count" UNIT = "unit" - INIT = "init" ) type UserStore struct { @@ -62,27 +61,25 @@ type Store struct { CompanyUID string `gorm:"type:char(32);index"` } type Shop struct { - db.ModelWithUID + db.ModelNameInfo + UserUID string `gorm:"type:char(32);index"` StoreUID string `gorm:"type:char(32);index"` - Name string `gorm:"type:varchar(64)"` Address string `gorm:"type:varchar(255)"` } type Warehouse struct { - db.ModelWithUID + db.ModelNameInfo + UserUID string `gorm:"type:char(32);index"` StoreUID string `gorm:"type:char(32);index"` - Name string `gorm:"type:varchar(64)"` Address string `gorm:"type:varchar(255)"` } type Product struct { - db.ModelWithUID + db.ModelNameInfo + UserUID string `gorm:"type:char(32);index"` StoreUID string `gorm:"type:char(32);index"` ShopUID string `gorm:"type:char(32);index"` WarehouseUID string `gorm:"type:char(32);index"` QualityUID string `gorm:"type:char(32);index"` BrandUID string `gorm:"type:char(32);index"` - Name string `gorm:"type:varchar(64)"` - Info string - Type uint8 `gorm:"default:0"` Price uint `gorm:"default:0"` Stock uint `gorm:"default:0"` Unit string `gorm:"type:varchar(8)"` @@ -116,34 +113,22 @@ type OrderDetail struct { Count int `gorm:"default:0"` } type Payment struct { - db.ModelWithUID - OrderUID string `gorm:"type:char(32);index"` - CompanyUID string `gorm:"type:char(32)"` - OpenID string `gorm:"type:varchar(128)"` - Status uint8 `gorm:"default:0"` + db.ModelExternal + OrderUID string `gorm:"type:char(32);index"` } type Express struct { - db.ModelWithUID - OrderUID string `gorm:"type:char(32);index"` - CompanyUID string `gorm:"type:char(32)"` - OpenID string `gorm:"type:varchar(128)"` - Status uint8 `gorm:"default:0"` + db.ModelExternal + OrderUID string `gorm:"type:char(32);index"` } type Return struct { - db.ModelWithUID + db.ModelExternal OrderUID string `gorm:"type:char(32);index"` ExpressUID string `gorm:"type:char(32)"` - CompanyUID string `gorm:"type:char(32)"` - OpenID string `gorm:"type:varchar(128)"` - Status uint8 `gorm:"default:0"` } type Refund struct { - db.ModelWithUID + db.ModelExternal OrderUID string `gorm:"type:char(32);index"` PaymentUID string `gorm:"type:char(32)"` - CompanyUID string `gorm:"type:char(32)"` - OpenID string `gorm:"type:varchar(128)"` - Status uint8 `gorm:"default:0"` } func init() { @@ -155,34 +140,28 @@ func init() { } type Brand struct { - db.ModelWithUID + db.ModelNameInfo + UserUID string `gorm:"type:char(32);index"` StoreUID string `gorm:"type:char(32);index"` - Name string `gorm:"type:varchar(64)"` - Info string } type Quality struct { - db.ModelWithUID + db.ModelNameInfo + UserUID string `gorm:"type:char(32);index"` StoreUID string `gorm:"type:char(32);index"` - Name string `gorm:"type:varchar(64)"` - Info string } type Expense struct { - db.ModelWithUID + db.ModelNameInfo + UserUID string `gorm:"type:char(32);index"` StoreUID string `gorm:"type:char(32);index"` FromUserUID string `gorm:"type:char(32)"` ToUserUID string `gorm:"type:char(32)"` - Name string `gorm:"type:varchar(64)"` - Info string - Type uint8 `gorm:"default:0"` - Amount int `gorm:"default:0"` + Amount int `gorm:"default:0"` } type Loan struct { - db.ModelWithUID + db.ModelNameInfo + UserUID string `gorm:"type:char(32);index"` StoreUID string `gorm:"type:char(32);index"` FromUserUID string `gorm:"type:char(32)"` ToUserUID string `gorm:"type:char(32)"` - Name string `gorm:"type:varchar(64)"` - Info string - Type uint8 `gorm:"default:0"` - Amount int `gorm:"default:0"` + Amount int `gorm:"default:0"` } diff --git a/src/gongyinglian/order.js b/src/gongyinglian/order.js index 15d2fb3..c5da236 100644 --- a/src/gongyinglian/order.js +++ b/src/gongyinglian/order.js @@ -1,5 +1,5 @@ Volcanos(chat.ONIMPORT, { - _init: function(can, msg) { can.onimport.shareTitle(can, msg) + _init: function(can, msg) { can.onimport.itemcards(can, msg, function(value) { return [ {view: html.TITLE, list: [value.name||value.user_name||"待确认", can.onimport.textView(can, value, "order_type", mdb.TYPE)]}, {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), can.onimport.textView(can, value, "order_status", mdb.STATUS)]}, diff --git a/src/gongyinglian/payment.go b/src/gongyinglian/payment.go index 18c9dae..d29d924 100644 --- a/src/gongyinglian/payment.go +++ b/src/gongyinglian/payment.go @@ -1,35 +1,8 @@ package gongyinglian -import ( - "shylinux.com/x/ice" +import "shylinux.com/x/ice" - "shylinux.com/x/enterprise/src/gongyinglian/model" -) - -type payment struct { - Table - order Order -} - -func (s payment) List(m *ice.Message, arg ...string) { - if !s.checkListRole(m, arg...) { - return - } - s.Tables(m, s.order).FieldsWithCreatedAT(m, s, - s.AS(model.TO_USER_UID, model.USER_UID), model.PAYMENT_STATUS, - model.COMPANY_UID, model.OPEN_ID, model.ORDER_UID, - s.Key(s.order, model.AMOUNT), model.TOTAL, - ) - if len(arg) == 1 { - s.Select(m, model.FROM_STORE_UID, arg[0]).Action() - } else if len(arg) == 2 { - s.SelectDetail(m, model.FROM_STORE_UID, arg[0], s.Key(s, model.UID), arg[1]) - } else { - return - } - s.SelectJoinCompany(m) - s.SelectJoinUser(m) -} +type payment struct{ Relative } func init() { ice.TeamCtxCmd(payment{}) } diff --git a/src/gongyinglian/portal.go b/src/gongyinglian/portal.go index cf786d4..5819224 100644 --- a/src/gongyinglian/portal.go +++ b/src/gongyinglian/portal.go @@ -10,6 +10,4 @@ type Portal struct { placeCreate string `name:"placeCreate city_name* company_name* store_type*:select store_name*" role:"void"` } -func init() { - gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userStore{}, store{})}) -} +func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userStore{}, store{})}) } diff --git a/src/gongyinglian/portal.json b/src/gongyinglian/portal.json index 1cc177a..b42ea98 100644 --- a/src/gongyinglian/portal.json +++ b/src/gongyinglian/portal.json @@ -53,6 +53,7 @@ "product_type": "产品类型", "company_uid": "公司", "to_store_uid": "收货店铺", + "from_store_uid":"出货店铺", "payment_status": "付款状态", "express_status": "快递状态", "return_status": "退货状态", diff --git a/src/gongyinglian/product.go b/src/gongyinglian/product.go index 24fddb3..2e634c8 100644 --- a/src/gongyinglian/product.go +++ b/src/gongyinglian/product.go @@ -8,7 +8,7 @@ import ( ) type Product struct { - TableView + Value shop Shop warehouse Warehouse quality quality @@ -24,7 +24,7 @@ type Product struct { func (s Product) Create(m *ice.Message, arg ...string) { arg = kit.TransArgKeys(arg, model.PRODUCT_TYPE, model.TYPE) - s.TableView.Create(m, arg...) + s.Value.Create(m, arg...) } func (s Product) List(m *ice.Message, arg ...string) { if m.Option(model.PRODUCT_TYPE) != kit.Format(ProductGoods) && !s.checkListRole(m, arg...) { @@ -53,10 +53,10 @@ func (s Product) List(m *ice.Message, arg ...string) { } m.PushAction(s.Modify, s.Remove).Display("") } -func (s Product) SetShop(m *ice.Message, arg ...string) { s.TableView.Modify(m, arg...) } -func (s Product) SetWarehouse(m *ice.Message, arg ...string) { s.TableView.Modify(m, arg...) } -func (s Product) SetQuality(m *ice.Message, arg ...string) { s.TableView.Modify(m, arg...) } -func (s Product) SetBrand(m *ice.Message, arg ...string) { s.TableView.Modify(m, arg...) } +func (s Product) SetShop(m *ice.Message, arg ...string) { s.Value.Modify(m, arg...) } +func (s Product) SetWarehouse(m *ice.Message, arg ...string) { s.Value.Modify(m, arg...) } +func (s Product) SetQuality(m *ice.Message, arg ...string) { s.Value.Modify(m, arg...) } +func (s Product) SetBrand(m *ice.Message, arg ...string) { s.Value.Modify(m, arg...) } func init() { ice.TeamCtxCmd(Product{}) } diff --git a/src/gongyinglian/product.js b/src/gongyinglian/product.js index 027042e..a40f987 100644 --- a/src/gongyinglian/product.js +++ b/src/gongyinglian/product.js @@ -1,5 +1,5 @@ Volcanos(chat.ONIMPORT, { - _init: function(can, msg) { can.onimport.shareTitle(can, msg) + _init: function(can, msg) { can.onimport.itemcards(can, msg, function(value) { return [ {view: html.TITLE, list: [value.name, can.onimport.textView(can, value, "product_type", mdb.TYPE)]}, {view: html.STATUS, list: ["单价:", value.price, "元", "库存:", value.stock, value.unit, value.shop_name||"", value.warehouse_name||""]}, diff --git a/src/gongyinglian/quality.go b/src/gongyinglian/quality.go index 8c31775..0e56da4 100644 --- a/src/gongyinglian/quality.go +++ b/src/gongyinglian/quality.go @@ -2,6 +2,6 @@ package gongyinglian import "shylinux.com/x/ice" -type quality struct{ TableView } +type quality struct{ Value } func init() { ice.TeamCtxCmd(quality{}) } diff --git a/src/gongyinglian/refund.go b/src/gongyinglian/refund.go index 1d70012..6b26a0c 100644 --- a/src/gongyinglian/refund.go +++ b/src/gongyinglian/refund.go @@ -1,35 +1,8 @@ package gongyinglian -import ( - "shylinux.com/x/ice" +import "shylinux.com/x/ice" - "shylinux.com/x/enterprise/src/gongyinglian/model" -) - -type refund struct { - Table - order Order -} - -func (s refund) List(m *ice.Message, arg ...string) { - if !s.checkListRole(m, arg...) { - return - } - s.Tables(m, s.order).FieldsWithCreatedAT(m, s, - s.AS(model.TO_USER_UID, model.USER_UID), model.REFUND_STATUS, - model.COMPANY_UID, model.OPEN_ID, model.ORDER_UID, - s.Key(s.order, model.AMOUNT), model.TOTAL, - ) - if len(arg) == 1 { - s.Select(m, model.FROM_STORE_UID, arg[0]).Action() - } else if len(arg) == 2 { - s.SelectDetail(m, model.FROM_STORE_UID, arg[0], s.Key(s, model.UID), arg[1]) - } else { - return - } - s.SelectJoinCompany(m) - s.SelectJoinUser(m) -} +type refund struct{ Relative } func init() { ice.TeamCtxCmd(refund{}) } diff --git a/src/gongyinglian/return.go b/src/gongyinglian/return.go index 88efd14..ec952d9 100644 --- a/src/gongyinglian/return.go +++ b/src/gongyinglian/return.go @@ -1,34 +1,8 @@ package gongyinglian -import ( - "shylinux.com/x/ice" +import "shylinux.com/x/ice" - "shylinux.com/x/enterprise/src/gongyinglian/model" -) - -type Return struct { - Table - order Order -} - -func (s Return) List(m *ice.Message, arg ...string) { - if !s.checkListRole(m, arg...) { - return - } - s.Tables(m, s.order).FieldsWithCreatedAT(m, s, - s.AS(model.TO_USER_UID, model.USER_UID), model.RETURN_STATUS, - model.COMPANY_UID, model.OPEN_ID, model.ORDER_UID, - ) - if len(arg) == 1 { - s.Select(m, model.FROM_STORE_UID, arg[0]).Action() - } else if len(arg) == 2 { - s.SelectDetail(m, model.FROM_STORE_UID, arg[0], s.Key(s, model.UID), arg[1]) - } else { - return - } - s.SelectJoinCompany(m) - s.SelectJoinUser(m) -} +type Return struct{ Relative } func init() { ice.TeamCtxCmd(Return{}) } diff --git a/src/gongyinglian/shop.go b/src/gongyinglian/shop.go index 0769c2b..d06a97a 100644 --- a/src/gongyinglian/shop.go +++ b/src/gongyinglian/shop.go @@ -1,12 +1,20 @@ package gongyinglian -import "shylinux.com/x/ice" +import ( + "shylinux.com/x/ice" + kit "shylinux.com/x/toolkits" +) type Shop struct { - TableView + Value fields string `data:"name,address"` create string `name:"create name* address" role:"boss"` modify string `name:"modify name* address" role:"boss"` } +func (s Shop) List(m *ice.Message, arg ...string) { + s.Table.ValueList(m, arg) + kit.If(m.Length() == 0, func() { m.EchoInfoButton("") }) +} + func init() { ice.TeamCtxCmd(Shop{}) } diff --git a/src/guanlixitong/common.go b/src/guanlixitong/common.go index 6f1a469..69f0fd3 100644 --- a/src/guanlixitong/common.go +++ b/src/guanlixitong/common.go @@ -24,7 +24,7 @@ func (s Table) Inputs(m *ice.Message, arg ...string) { m.Cmdy(company{}, s.Select).Cut(model.UID, model.NAME).RenameAppend(model.UID, arg[0]) m.DisplayInputKeyNameIconTitle() case model.COMPANY_NAME, model.CITY_NAME: - m.Cmdy(Portal{}, "placeList", m.Option(model.USER_UID)).Cut(arg[0]) + m.Cmdy(Portal{}, Portal{}.PlaceList, m.Option(model.USER_UID)).Cut(arg[0]) default: s.Table.Inputs(m, arg...) } diff --git a/src/guanlixitong/portal.go b/src/guanlixitong/portal.go index 61091c9..f2e5a60 100644 --- a/src/guanlixitong/portal.go +++ b/src/guanlixitong/portal.go @@ -4,7 +4,7 @@ import "shylinux.com/x/community/src/gonganxitong" type Portal struct { gonganxitong.Portal - placeCreate string `name:"placeCreate city_name* company_name* group_type*:select group_name*" role:"void"` + placeCreate string `name:"placeCreate city_name* company_name* group_name* group_type*:select" role:"void"` } func init() { gonganxitong.PortalCmd(NewPortal(userGroup{}, group{})) } diff --git a/src/guanlixitong/target.go b/src/guanlixitong/target.go index c2cc701..2a24b17 100644 --- a/src/guanlixitong/target.go +++ b/src/guanlixitong/target.go @@ -1,25 +1,16 @@ package guanlixitong -import ( - "shylinux.com/x/ice" - kit "shylinux.com/x/toolkits" - - "shylinux.com/x/enterprise/src/guanlixitong/model" -) +import "shylinux.com/x/ice" type target struct { Table - group group - userGroup userGroup - create string `name:"create title* content*" role:"leader"` + fields string `data:"title,content"` + create string `name:"create title* content*" role:"leader"` + remove string `name:"remove" role:"leader"` } -func (s target) Create(m *ice.Message, arg ...string) { - s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.GROUP_UID, model.USER_UID))...) - s.RecordEventWithName(m, "") -} -func (s target) List(m *ice.Message, arg ...string) { - s.TablesWithRole(m, arg, s.userGroup, s.group, s, model.TITLE, model.CONTENT).Display("") -} +func (s target) Create(m *ice.Message, arg ...string) { s.Table.ValueCreate(m, arg...) } +func (s target) Remove(m *ice.Message, arg ...string) { s.Table.ValueRemove(m, arg...) } +func (s target) List(m *ice.Message, arg ...string) { s.Table.ValueList(m, arg).Display("") } func init() { ice.TeamCtxCmd(target{}) } diff --git a/src/guanlixitong/target.js b/src/guanlixitong/target.js index b7ff53c..b9d05bc 100644 --- a/src/guanlixitong/target.js +++ b/src/guanlixitong/target.js @@ -1,5 +1,5 @@ Volcanos(chat.ONIMPORT, { - _init: function(can, msg) { can.onimport.shareTitle(can, msg) + _init: function(can, msg) { can.onimport.itemcards(can, msg, function(value) { return [ {view: html.TITLE, list: [value.title]}, {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]}, diff --git a/src/operation/cloud.go b/src/operation/cloud.go deleted file mode 100644 index e1f69f1..0000000 --- a/src/operation/cloud.go +++ /dev/null @@ -1,21 +0,0 @@ -package operation - -import "shylinux.com/x/ice" - -type cloud struct{ Table } - -func init() { ice.TeamCtxCmd(cloud{}) } - -type CloudType int - -const ( - CloudAliyun CloudType = iota - CloudTencent -) - -var CloudTypeList = map[CloudType]string{ - CloudAliyun: "aliyun", - CloudTencent: "tencent", -} - -func (s CloudType) String() string { return CloudTypeList[s] } diff --git a/src/operation/common.go b/src/operation/common.go deleted file mode 100644 index 32fdff1..0000000 --- a/src/operation/common.go +++ /dev/null @@ -1,41 +0,0 @@ -package operation - -import ( - "shylinux.com/x/ice" - kit "shylinux.com/x/toolkits" - - "shylinux.com/x/enterprise/src/guanlixitong" - "shylinux.com/x/enterprise/src/operation/model" -) - -type Table struct { - guanlixitong.Table - list string `name:"list cloud_uid uid auto" role:"void"` -} - -func (s Table) Inputs(m *ice.Message, arg ...string) { - switch arg[0] { - case model.USER_CLOUD_ROLE: - s.InputsListRole(m, UserCloudRoleList, arg...) - case model.CLOUD_TYPE: - s.InputsList(m, CloudTypeList, arg...) - default: - s.Table.Inputs(m, arg...) - } -} -func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message { - m.RewriteAppend(func(value, key string, index int) string { - switch key { - case model.USER_CLOUD_ROLE: - value = UserCloudRole(kit.Int(value)).String() - case model.CLOUD_TYPE: - value = CloudType(kit.Int(value)).String() - } - return value - }) - return s.Table.RewriteAppend(m) -} - -type Tables struct{ Table } - -func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {} diff --git a/src/operation/model/model.go b/src/operation/model/model.go deleted file mode 100644 index 130b9e6..0000000 --- a/src/operation/model/model.go +++ /dev/null @@ -1,35 +0,0 @@ -package model - -import "shylinux.com/x/mysql-story/src/db" - -const ( - UID = "uid" - NAME = "name" - TYPE = "type" - ROLE = "role" - TITLE = "title" - CONTENT = "content" - USER_UID = "user_uid" - USER_CLOUD_ROLE = "user_cloud_role" - CLOUD_UID = "cloud_uid" - CLOUD_NAME = "cloud_name" - CLOUD_TYPE = "cloud_type" - PUBLISH_UID = "publish_uid" - COMPANY_UID = "company_uid" - CITY_UID = "city_uid" -) - -type UserCloud struct { - db.ModelUserPlace - CloudUID string `gorm:"type:char(32);index"` -} -type Cloud struct { - db.ModelPlace - CompanyUID string `gorm:"type:char(32);index"` -} -type Publish struct { - db.ModelContent - CloudUID string `gorm:"type:char(32);index"` -} - -func init() { db.CmdModels("", &UserCloud{}, &Cloud{}, &Publish{}) } diff --git a/src/operation/portal.go b/src/operation/portal.go deleted file mode 100644 index 3bdad8b..0000000 --- a/src/operation/portal.go +++ /dev/null @@ -1,15 +0,0 @@ -package operation - -import ( - "shylinux.com/x/community/src/gonganxitong" - "shylinux.com/x/enterprise/src/guanlixitong" -) - -type Portal struct { - guanlixitong.Portal - placeCreate string `name:"placeCreate city_name* company_name* cloud_type*:select cloud_name*" role:"void"` -} - -func init() { - gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userCloud{}, cloud{})}) -} diff --git a/src/operation/portal.json b/src/operation/portal.json deleted file mode 100644 index 165071d..0000000 --- a/src/operation/portal.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "portal": "系统运维", - "publish": "系统发布", - "icons": { - "publish": "https://img.icons8.com/officel/80/activity-grid.png" - }, - "input": { - "My Cloud": "我的集群", - "user_cloud_role": "用户角色", - "cloud_name": "集群名称", - "cloud_type": "集群类型" - }, - "value": { - "user_cloud_role": { - "visitor": "访客", - "creator": "创建人", - "leader": "管理人员", - "worker": "工作人员", - "server": "服务人员", - "style": { - "creator": "danger", - "leader": "danger" - } - }, - "cloud_type": { - "aliyun": "阿里云", - "tencent": "腾讯云", - "icons": { - "aliyun": "usr/icons/aliyun.png", - "tencent": "usr/icons/tencent.png" - } - } - } -} \ No newline at end of file diff --git a/src/operation/publish.go b/src/operation/publish.go deleted file mode 100644 index 4f86d91..0000000 --- a/src/operation/publish.go +++ /dev/null @@ -1,25 +0,0 @@ -package operation - -import ( - "shylinux.com/x/ice" - kit "shylinux.com/x/toolkits" - - "shylinux.com/x/enterprise/src/operation/model" -) - -type publish struct { - Table - cloud cloud - userCloud userCloud - create string `name:"create title* content*" role:"leader"` -} - -func (s publish) Create(m *ice.Message, arg ...string) { - s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.CLOUD_UID))...) - s.RecordEventWithName(m, "") -} -func (s publish) List(m *ice.Message, arg ...string) { - s.TablesWithRole(m, arg, s.userCloud, s.cloud, s, model.TITLE, model.CONTENT).Display("") -} - -func init() { ice.TeamCtxCmd(publish{}) } diff --git a/src/operation/publish.js b/src/operation/publish.js deleted file mode 100644 index b384773..0000000 --- a/src/operation/publish.js +++ /dev/null @@ -1,12 +0,0 @@ -Volcanos(chat.ONIMPORT, { - _init: function(can, msg) { can.onimport.shareTitle(can, msg) - can.onimport.itemcards(can, msg, function(value) { return [ - {view: html.TITLE, list: [value.title]}, - {view: html.STATUS, list: [ - value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), - value.user_name, can.onimport.textView(can, value, "user_cloud_role", aaa.ROLE), - ]}, - {view: html.OUTPUT, list: [value.content]}, - ] }) - }, -}) \ No newline at end of file diff --git a/src/operation/userCloud.go b/src/operation/userCloud.go deleted file mode 100644 index 1db3dfe..0000000 --- a/src/operation/userCloud.go +++ /dev/null @@ -1,15 +0,0 @@ -package operation - -import ( - "shylinux.com/x/ice" - - "shylinux.com/x/enterprise/src/guanlixitong" -) - -type userCloud struct{ Table } - -func init() { ice.TeamCtxCmd(userCloud{}) } - -type UserCloudRole = guanlixitong.UserGroupRole - -var UserCloudRoleList = guanlixitong.UserGroupRoleList diff --git a/src/shichangyingxiao/portal.go b/src/shichangyingxiao/portal.go index 2abde06..814c23f 100644 --- a/src/shichangyingxiao/portal.go +++ b/src/shichangyingxiao/portal.go @@ -7,7 +7,7 @@ import ( type Portal struct { guanlixitong.Portal - placeCreate string `name:"placeCreate city_name* company_name* channel_type*:select channel_name*" role:"void"` + placeCreate string `name:"placeCreate city_name* company_name* channel_name* channel_type*:select" role:"void"` } func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userChannel{}, channel{})}) } diff --git a/src/shichangyingxiao/promotion.go b/src/shichangyingxiao/promotion.go index 08be02b..08123f4 100644 --- a/src/shichangyingxiao/promotion.go +++ b/src/shichangyingxiao/promotion.go @@ -1,25 +1,16 @@ package shichangyingxiao -import ( - "shylinux.com/x/ice" - kit "shylinux.com/x/toolkits" - - "shylinux.com/x/enterprise/src/shichangyingxiao/model" -) +import "shylinux.com/x/ice" type promotion struct { Table - channel channel - userChannel userChannel - create string `name:"create title* content*" role:"leader"` + fields string `data:"title,content"` + create string `name:"create title* content*" role:"leader"` + remove string `name:"remove" role:"leader"` } -func (s promotion) Create(m *ice.Message, arg ...string) { - s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.CHANNEL_UID))...) - s.RecordEventWithName(m, "") -} -func (s promotion) List(m *ice.Message, arg ...string) { - s.TablesWithRole(m, arg, s.userChannel, s.channel, s, model.TITLE, model.CONTENT).Display("") -} +func (s promotion) Create(m *ice.Message, arg ...string) { s.Table.ValueCreate(m, arg...) } +func (s promotion) Remove(m *ice.Message, arg ...string) { s.Table.ValueRemove(m, arg...) } +func (s promotion) List(m *ice.Message, arg ...string) { s.Table.ValueList(m, arg).Display("") } func init() { ice.TeamCtxCmd(promotion{}) } diff --git a/src/shichangyingxiao/promotion.js b/src/shichangyingxiao/promotion.js index b7ff53c..b9d05bc 100644 --- a/src/shichangyingxiao/promotion.js +++ b/src/shichangyingxiao/promotion.js @@ -1,5 +1,5 @@ Volcanos(chat.ONIMPORT, { - _init: function(can, msg) { can.onimport.shareTitle(can, msg) + _init: function(can, msg) { can.onimport.itemcards(can, msg, function(value) { return [ {view: html.TITLE, list: [value.title]}, {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]}, diff --git a/src/zijinlian/investment.go b/src/zijinlian/investment.go index d84c50f..097b21f 100644 --- a/src/zijinlian/investment.go +++ b/src/zijinlian/investment.go @@ -1,25 +1,16 @@ package zijinlian -import ( - "shylinux.com/x/ice" - kit "shylinux.com/x/toolkits" - - "shylinux.com/x/enterprise/src/zijinlian/model" -) +import "shylinux.com/x/ice" type investment struct { Table - capital capital - userCapital userCapital - create string `name:"create title* content*" role:"leader"` + fields string `data:"title,content"` + create string `name:"create title* content*" role:"leader"` + remove string `name:"remove" role:"leader"` } -func (s investment) Create(m *ice.Message, arg ...string) { - s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.CAPITAL_UID))...) - s.RecordEventWithName(m, "") -} -func (s investment) List(m *ice.Message, arg ...string) { - s.TablesWithRole(m, arg, s.userCapital, s.capital, s, model.TITLE, model.CONTENT).Display("") -} +func (s investment) Create(m *ice.Message, arg ...string) { s.Table.ValueCreate(m, arg...) } +func (s investment) Remove(m *ice.Message, arg ...string) { s.Table.ValueRemove(m, arg...) } +func (s investment) List(m *ice.Message, arg ...string) { s.Table.ValueList(m, arg) } func init() { ice.TeamCtxCmd(investment{}) } diff --git a/src/zijinlian/investment.js b/src/zijinlian/investment.js index b7ff53c..b9d05bc 100644 --- a/src/zijinlian/investment.js +++ b/src/zijinlian/investment.js @@ -1,5 +1,5 @@ Volcanos(chat.ONIMPORT, { - _init: function(can, msg) { can.onimport.shareTitle(can, msg) + _init: function(can, msg) { can.onimport.itemcards(can, msg, function(value) { return [ {view: html.TITLE, list: [value.title]}, {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]}, diff --git a/src/zijinlian/portal.go b/src/zijinlian/portal.go index e4b9a6e..cabb934 100644 --- a/src/zijinlian/portal.go +++ b/src/zijinlian/portal.go @@ -7,7 +7,7 @@ import ( type Portal struct { guanlixitong.Portal - placeCreate string `name:"placeCreate city_name* company_name* capital_type*:select capital_name*" role:"void"` + placeCreate string `name:"placeCreate city_name* company_name* capital_name* capital_type*:select" role:"void"` } func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userCapital{}, capital{})}) }