This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-09-05 20:02:47 +08:00
parent 05aa8296e0
commit bf77469cdc
42 changed files with 137 additions and 660 deletions

View File

@ -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) {}

View File

@ -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{}) }

View File

@ -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{})}) }

View File

@ -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": "远程"
}
}
}

View File

@ -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{}) }

View File

@ -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]},
] })
},
})

View File

@ -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] }

View File

@ -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

View File

@ -2,6 +2,6 @@ package gongyinglian
import "shylinux.com/x/ice" import "shylinux.com/x/ice"
type brand struct{ TableView } type brand struct{ Value }
func init() { ice.TeamCtxCmd(brand{}) } func init() { ice.TeamCtxCmd(brand{}) }

View File

@ -1,8 +1,8 @@
package gongyinglian package gongyinglian
import ( import (
"path"
"shylinux.com/x/ice" "shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/mdb"
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
"shylinux.com/x/enterprise/src/gongyinglian/model" "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) 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 { 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()) m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserStoreCreator.String())...), role.String())
return m return m
} }
@ -114,7 +105,11 @@ func (s Table) checkOrderRole(m *ice.Message, arg ...string) bool {
return true return true
} }
type TableView struct { type Tables struct{ Table }
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}
type Value struct {
Table Table
fields string `data:"name,info"` fields string `data:"name,info"`
create string `name:"create name info" role:"boss"` create string `name:"create name info" role:"boss"`
@ -122,35 +117,54 @@ type TableView struct {
remove string `name:"remove" role:"boss"` remove string `name:"remove" role:"boss"`
} }
func (s TableView) Create(m *ice.Message, arg ...string) { func (s Value) Create(m *ice.Message, arg ...string) {
arg = s.transPrice(m, arg...) s.Table.ValueCreate(m, s.transPrice(m, arg...)...)
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.STORE_UID))...)
s.RecordEventWithName(m, "")
} }
func (s TableView) Modify(m *ice.Message, arg ...string) { func (s Value) Modify(m *ice.Message, arg ...string) {
arg = s.transPrice(m, arg...) s.Table.ValueModify(m, s.transPrice(m, arg...)...)
s.Table.Update(m, kit.Dict(arg), m.OptionSimple(model.STORE_UID, model.UID)...)
s.RecordEventWithName(m, "")
} }
func (s TableView) Remove(m *ice.Message, arg ...string) { func (s Value) Remove(m *ice.Message, arg ...string) {
s.Table.Delete(m, m.OptionSimple(model.STORE_UID, model.UID)...) s.Table.ValueRemove(m, arg...)
s.RecordEventWithName(m, "")
} }
func (s TableView) List(m *ice.Message, arg ...string) { func (s Value) List(m *ice.Message, arg ...string) {
if len(arg) == 0 { s.Table.ValueList(m, arg)
s.Select(m, m.OptionSimple(model.STORE_UID)...) 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 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 { if len(arg) == 1 {
s.Select(m, model.STORE_UID, arg[0]) s.Select(m, model.FROM_STORE_UID, arg[0]).Action()
kit.If(m.Length() == 0, func() { m.EchoInfoButton("", s.Create) })
} else if len(arg) == 2 { } 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) {}

View File

@ -8,7 +8,7 @@ import (
) )
type expense struct { type expense struct {
TableView Value
fields string `data:"expense_type,amount,name,info"` fields string `data:"expense_type,amount,name,info"`
create string `name:"create expense_type* amount* name info" role:"boss"` create string `name:"create expense_type* amount* name info" role:"boss"`
modify string `name:"modify 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) { func (s expense) Create(m *ice.Message, arg ...string) {
arg = kit.TransArgKeys(arg, model.EXPENSE_TYPE, model.TYPE) 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) { func (s expense) List(m *ice.Message, arg ...string) {
if s.checkListRole(m, arg...) { if s.checkListRole(m, arg...) {
s.TableView.List(m, arg...) s.Value.List(m, arg...)
} }
} }

View File

@ -1,34 +1,8 @@
package gongyinglian package gongyinglian
import ( import "shylinux.com/x/ice"
"shylinux.com/x/ice"
"shylinux.com/x/enterprise/src/gongyinglian/model" type express struct{ Relative }
)
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)
}
func init() { ice.TeamCtxCmd(express{}) } func init() { ice.TeamCtxCmd(express{}) }

View File

@ -8,7 +8,7 @@ import (
) )
type loan struct { type loan struct {
TableView Value
fields string `data:"loan_type,amount,name,info"` fields string `data:"loan_type,amount,name,info"`
create string `name:"create loan_type* amount name info" role:"boss"` create string `name:"create loan_type* amount name info" role:"boss"`
modify string `name:"modify name info amount" 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) { func (s loan) Create(m *ice.Message, arg ...string) {
arg = kit.TransArgKeys(arg, model.LOAN_TYPE, model.TYPE) 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) { func (s loan) List(m *ice.Message, arg ...string) {
if s.checkListRole(m, arg...) { if s.checkListRole(m, arg...) {
s.TableView.List(m, arg...) s.Value.List(m, arg...)
} }
} }

View File

@ -11,8 +11,6 @@ const (
STATUS = "status" STATUS = "status"
TITLE = "title" TITLE = "title"
CONTENT = "content" CONTENT = "content"
ADDRESS = "address"
OPEN_ID = "open_id"
USER_UID = "user_uid" USER_UID = "user_uid"
USER_STORE_ROLE = "user_store_role" USER_STORE_ROLE = "user_store_role"
STORE_UID = "store_uid" STORE_UID = "store_uid"
@ -44,13 +42,14 @@ const (
LOAN_TYPE = "loan_type" LOAN_TYPE = "loan_type"
COMPANY_UID = "company_uid" COMPANY_UID = "company_uid"
CITY_UID = "city_uid" CITY_UID = "city_uid"
ADDRESS = "address"
OPEN_ID = "open_id"
AMOUNT = "amount" AMOUNT = "amount"
TOTAL = "total" TOTAL = "total"
PRICE = "price" PRICE = "price"
STOCK = "stock" STOCK = "stock"
COUNT = "count" COUNT = "count"
UNIT = "unit" UNIT = "unit"
INIT = "init"
) )
type UserStore struct { type UserStore struct {
@ -62,27 +61,25 @@ type Store struct {
CompanyUID string `gorm:"type:char(32);index"` CompanyUID string `gorm:"type:char(32);index"`
} }
type Shop struct { type Shop struct {
db.ModelWithUID db.ModelNameInfo
UserUID string `gorm:"type:char(32);index"`
StoreUID 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)"` Address string `gorm:"type:varchar(255)"`
} }
type Warehouse struct { type Warehouse struct {
db.ModelWithUID db.ModelNameInfo
UserUID string `gorm:"type:char(32);index"`
StoreUID 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)"` Address string `gorm:"type:varchar(255)"`
} }
type Product struct { type Product struct {
db.ModelWithUID db.ModelNameInfo
UserUID string `gorm:"type:char(32);index"`
StoreUID string `gorm:"type:char(32);index"` StoreUID string `gorm:"type:char(32);index"`
ShopUID string `gorm:"type:char(32);index"` ShopUID string `gorm:"type:char(32);index"`
WarehouseUID string `gorm:"type:char(32);index"` WarehouseUID string `gorm:"type:char(32);index"`
QualityUID string `gorm:"type:char(32);index"` QualityUID string `gorm:"type:char(32);index"`
BrandUID 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"` Price uint `gorm:"default:0"`
Stock uint `gorm:"default:0"` Stock uint `gorm:"default:0"`
Unit string `gorm:"type:varchar(8)"` Unit string `gorm:"type:varchar(8)"`
@ -116,34 +113,22 @@ type OrderDetail struct {
Count int `gorm:"default:0"` Count int `gorm:"default:0"`
} }
type Payment struct { type Payment struct {
db.ModelWithUID db.ModelExternal
OrderUID string `gorm:"type:char(32);index"` OrderUID string `gorm:"type:char(32);index"`
CompanyUID string `gorm:"type:char(32)"`
OpenID string `gorm:"type:varchar(128)"`
Status uint8 `gorm:"default:0"`
} }
type Express struct { type Express struct {
db.ModelWithUID db.ModelExternal
OrderUID string `gorm:"type:char(32);index"` OrderUID string `gorm:"type:char(32);index"`
CompanyUID string `gorm:"type:char(32)"`
OpenID string `gorm:"type:varchar(128)"`
Status uint8 `gorm:"default:0"`
} }
type Return struct { type Return struct {
db.ModelWithUID db.ModelExternal
OrderUID string `gorm:"type:char(32);index"` OrderUID string `gorm:"type:char(32);index"`
ExpressUID string `gorm:"type:char(32)"` 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 { type Refund struct {
db.ModelWithUID db.ModelExternal
OrderUID string `gorm:"type:char(32);index"` OrderUID string `gorm:"type:char(32);index"`
PaymentUID string `gorm:"type:char(32)"` 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() { func init() {
@ -155,34 +140,28 @@ func init() {
} }
type Brand struct { type Brand struct {
db.ModelWithUID db.ModelNameInfo
UserUID string `gorm:"type:char(32);index"`
StoreUID string `gorm:"type:char(32);index"` StoreUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:varchar(64)"`
Info string
} }
type Quality struct { type Quality struct {
db.ModelWithUID db.ModelNameInfo
UserUID string `gorm:"type:char(32);index"`
StoreUID string `gorm:"type:char(32);index"` StoreUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:varchar(64)"`
Info string
} }
type Expense struct { type Expense struct {
db.ModelWithUID db.ModelNameInfo
UserUID string `gorm:"type:char(32);index"`
StoreUID string `gorm:"type:char(32);index"` StoreUID string `gorm:"type:char(32);index"`
FromUserUID string `gorm:"type:char(32)"` FromUserUID string `gorm:"type:char(32)"`
ToUserUID 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 { type Loan struct {
db.ModelWithUID db.ModelNameInfo
UserUID string `gorm:"type:char(32);index"`
StoreUID string `gorm:"type:char(32);index"` StoreUID string `gorm:"type:char(32);index"`
FromUserUID string `gorm:"type:char(32)"` FromUserUID string `gorm:"type:char(32)"`
ToUserUID 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"`
} }

View File

@ -1,5 +1,5 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg) _init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) { return [ 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.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)]}, {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), can.onimport.textView(can, value, "order_status", mdb.STATUS)]},

View File

@ -1,35 +1,8 @@
package gongyinglian package gongyinglian
import ( import "shylinux.com/x/ice"
"shylinux.com/x/ice"
"shylinux.com/x/enterprise/src/gongyinglian/model" type payment struct{ Relative }
)
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)
}
func init() { ice.TeamCtxCmd(payment{}) } func init() { ice.TeamCtxCmd(payment{}) }

View File

@ -10,6 +10,4 @@ type Portal struct {
placeCreate string `name:"placeCreate city_name* company_name* store_type*:select store_name*" role:"void"` placeCreate string `name:"placeCreate city_name* company_name* store_type*:select store_name*" role:"void"`
} }
func init() { func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userStore{}, store{})}) }
gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userStore{}, store{})})
}

View File

@ -53,6 +53,7 @@
"product_type": "产品类型", "product_type": "产品类型",
"company_uid": "公司", "company_uid": "公司",
"to_store_uid": "收货店铺", "to_store_uid": "收货店铺",
"from_store_uid":"出货店铺",
"payment_status": "付款状态", "payment_status": "付款状态",
"express_status": "快递状态", "express_status": "快递状态",
"return_status": "退货状态", "return_status": "退货状态",

View File

@ -8,7 +8,7 @@ import (
) )
type Product struct { type Product struct {
TableView Value
shop Shop shop Shop
warehouse Warehouse warehouse Warehouse
quality quality quality quality
@ -24,7 +24,7 @@ type Product struct {
func (s Product) Create(m *ice.Message, arg ...string) { func (s Product) Create(m *ice.Message, arg ...string) {
arg = kit.TransArgKeys(arg, model.PRODUCT_TYPE, model.TYPE) 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) { func (s Product) List(m *ice.Message, arg ...string) {
if m.Option(model.PRODUCT_TYPE) != kit.Format(ProductGoods) && !s.checkListRole(m, arg...) { 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("") m.PushAction(s.Modify, s.Remove).Display("")
} }
func (s Product) SetShop(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.TableView.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.TableView.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.TableView.Modify(m, arg...) } func (s Product) SetBrand(m *ice.Message, arg ...string) { s.Value.Modify(m, arg...) }
func init() { ice.TeamCtxCmd(Product{}) } func init() { ice.TeamCtxCmd(Product{}) }

View File

@ -1,5 +1,5 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg) _init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) { return [ 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.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||""]}, {view: html.STATUS, list: ["单价:", value.price, "元", "库存:", value.stock, value.unit, value.shop_name||"", value.warehouse_name||""]},

View File

@ -2,6 +2,6 @@ package gongyinglian
import "shylinux.com/x/ice" import "shylinux.com/x/ice"
type quality struct{ TableView } type quality struct{ Value }
func init() { ice.TeamCtxCmd(quality{}) } func init() { ice.TeamCtxCmd(quality{}) }

View File

@ -1,35 +1,8 @@
package gongyinglian package gongyinglian
import ( import "shylinux.com/x/ice"
"shylinux.com/x/ice"
"shylinux.com/x/enterprise/src/gongyinglian/model" type refund struct{ Relative }
)
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)
}
func init() { ice.TeamCtxCmd(refund{}) } func init() { ice.TeamCtxCmd(refund{}) }

View File

@ -1,34 +1,8 @@
package gongyinglian package gongyinglian
import ( import "shylinux.com/x/ice"
"shylinux.com/x/ice"
"shylinux.com/x/enterprise/src/gongyinglian/model" type Return struct{ Relative }
)
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)
}
func init() { ice.TeamCtxCmd(Return{}) } func init() { ice.TeamCtxCmd(Return{}) }

View File

@ -1,12 +1,20 @@
package gongyinglian package gongyinglian
import "shylinux.com/x/ice" import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
)
type Shop struct { type Shop struct {
TableView Value
fields string `data:"name,address"` fields string `data:"name,address"`
create string `name:"create name* address" role:"boss"` create string `name:"create name* address" role:"boss"`
modify string `name:"modify 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{}) } func init() { ice.TeamCtxCmd(Shop{}) }

View File

@ -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.Cmdy(company{}, s.Select).Cut(model.UID, model.NAME).RenameAppend(model.UID, arg[0])
m.DisplayInputKeyNameIconTitle() m.DisplayInputKeyNameIconTitle()
case model.COMPANY_NAME, model.CITY_NAME: 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: default:
s.Table.Inputs(m, arg...) s.Table.Inputs(m, arg...)
} }

View File

@ -4,7 +4,7 @@ import "shylinux.com/x/community/src/gonganxitong"
type Portal struct { type Portal struct {
gonganxitong.Portal 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{})) } func init() { gonganxitong.PortalCmd(NewPortal(userGroup{}, group{})) }

View File

@ -1,25 +1,16 @@
package guanlixitong package guanlixitong
import ( import "shylinux.com/x/ice"
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/enterprise/src/guanlixitong/model"
)
type target struct { type target struct {
Table Table
group group fields string `data:"title,content"`
userGroup userGroup
create string `name:"create title* content*" role:"leader"` create string `name:"create title* content*" role:"leader"`
remove string `name:"remove" role:"leader"`
} }
func (s target) Create(m *ice.Message, arg ...string) { func (s target) Create(m *ice.Message, arg ...string) { s.Table.ValueCreate(m, arg...) }
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.GROUP_UID, model.USER_UID))...) func (s target) Remove(m *ice.Message, arg ...string) { s.Table.ValueRemove(m, arg...) }
s.RecordEventWithName(m, "") func (s target) List(m *ice.Message, arg ...string) { s.Table.ValueList(m, arg).Display("") }
}
func (s target) List(m *ice.Message, arg ...string) {
s.TablesWithRole(m, arg, s.userGroup, s.group, s, model.TITLE, model.CONTENT).Display("")
}
func init() { ice.TeamCtxCmd(target{}) } func init() { ice.TeamCtxCmd(target{}) }

View File

@ -1,5 +1,5 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg) _init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) { return [ can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title]}, {view: html.TITLE, list: [value.title]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]}, {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},

View File

@ -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] }

View File

@ -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) {}

View File

@ -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{}) }

View File

@ -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{})})
}

View File

@ -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"
}
}
}
}

View File

@ -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{}) }

View File

@ -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]},
] })
},
})

View File

@ -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

View File

@ -7,7 +7,7 @@ import (
type Portal struct { type Portal struct {
guanlixitong.Portal 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{})}) } func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userChannel{}, channel{})}) }

View File

@ -1,25 +1,16 @@
package shichangyingxiao package shichangyingxiao
import ( import "shylinux.com/x/ice"
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/enterprise/src/shichangyingxiao/model"
)
type promotion struct { type promotion struct {
Table Table
channel channel fields string `data:"title,content"`
userChannel userChannel
create string `name:"create title* content*" role:"leader"` create string `name:"create title* content*" role:"leader"`
remove string `name:"remove" role:"leader"`
} }
func (s promotion) Create(m *ice.Message, arg ...string) { func (s promotion) Create(m *ice.Message, arg ...string) { s.Table.ValueCreate(m, arg...) }
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.CHANNEL_UID))...) func (s promotion) Remove(m *ice.Message, arg ...string) { s.Table.ValueRemove(m, arg...) }
s.RecordEventWithName(m, "") func (s promotion) List(m *ice.Message, arg ...string) { s.Table.ValueList(m, arg).Display("") }
}
func (s promotion) List(m *ice.Message, arg ...string) {
s.TablesWithRole(m, arg, s.userChannel, s.channel, s, model.TITLE, model.CONTENT).Display("")
}
func init() { ice.TeamCtxCmd(promotion{}) } func init() { ice.TeamCtxCmd(promotion{}) }

View File

@ -1,5 +1,5 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg) _init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) { return [ can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title]}, {view: html.TITLE, list: [value.title]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]}, {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},

View File

@ -1,25 +1,16 @@
package zijinlian package zijinlian
import ( import "shylinux.com/x/ice"
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/enterprise/src/zijinlian/model"
)
type investment struct { type investment struct {
Table Table
capital capital fields string `data:"title,content"`
userCapital userCapital
create string `name:"create title* content*" role:"leader"` create string `name:"create title* content*" role:"leader"`
remove string `name:"remove" role:"leader"`
} }
func (s investment) Create(m *ice.Message, arg ...string) { func (s investment) Create(m *ice.Message, arg ...string) { s.Table.ValueCreate(m, arg...) }
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.CAPITAL_UID))...) func (s investment) Remove(m *ice.Message, arg ...string) { s.Table.ValueRemove(m, arg...) }
s.RecordEventWithName(m, "") func (s investment) List(m *ice.Message, arg ...string) { s.Table.ValueList(m, arg) }
}
func (s investment) List(m *ice.Message, arg ...string) {
s.TablesWithRole(m, arg, s.userCapital, s.capital, s, model.TITLE, model.CONTENT).Display("")
}
func init() { ice.TeamCtxCmd(investment{}) } func init() { ice.TeamCtxCmd(investment{}) }

View File

@ -1,5 +1,5 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg) _init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) { return [ can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title]}, {view: html.TITLE, list: [value.title]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]}, {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},

View File

@ -7,7 +7,7 @@ import (
type Portal struct { type Portal struct {
guanlixitong.Portal 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{})}) } func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userCapital{}, capital{})}) }