This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-08-21 11:06:37 +08:00
parent c2534e6512
commit ab3d71eb26
11 changed files with 40 additions and 48 deletions

View File

@ -114,38 +114,38 @@ type OrderDetail struct {
db.ModelWithUID
StoreUID string `gorm:"type:char(32);index"`
OrderUID string `gorm:"type:char(32);index"`
ProductUID string `gorm:"type:char(32);index"`
ProductUID string `gorm:"type:char(32)"`
Price int `gorm:"default:0"`
Count int `gorm:"default:0"`
}
type Payment struct {
db.ModelWithUID
OrderUID string `gorm:"type:char(32);index"`
CompanyUID string `gorm:"type:char(32);index"`
OpenID string `gorm:"type:varchar(128);index"`
CompanyUID string `gorm:"type:char(32)"`
OpenID string `gorm:"type:varchar(128)"`
Status uint8
}
type Express struct {
db.ModelWithUID
OrderUID string `gorm:"type:char(32);index"`
CompanyUID string `gorm:"type:char(32);index"`
OpenID string `gorm:"type:varchar(128);index"`
CompanyUID string `gorm:"type:char(32)"`
OpenID string `gorm:"type:varchar(128)"`
Status uint8
}
type Return struct {
db.ModelWithUID
OrderUID string `gorm:"type:char(32);index"`
ExpressUID string `gorm:"type:char(32);index"`
CompanyUID string `gorm:"type:char(32);index"`
OpenID string `gorm:"type:varchar(128);index"`
ExpressUID string `gorm:"type:char(32)"`
CompanyUID string `gorm:"type:char(32)"`
OpenID string `gorm:"type:varchar(128)"`
Status uint8
}
type Refund struct {
db.ModelWithUID
OrderUID string `gorm:"type:char(32);index"`
PaymentUID string `gorm:"type:char(32);index"`
CompanyUID string `gorm:"type:char(32);index"`
OpenID string `gorm:"type:varchar(128);index"`
PaymentUID string `gorm:"type:char(32)"`
CompanyUID string `gorm:"type:char(32)"`
OpenID string `gorm:"type:varchar(128)"`
Status uint8
}
@ -172,8 +172,8 @@ type Quality struct {
type Expense struct {
db.ModelWithUID
StoreUID string `gorm:"type:char(32);index"`
FromUserUID string `gorm:"type:char(32);index"`
ToUserUID 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
@ -182,8 +182,8 @@ type Expense struct {
type Loan struct {
db.ModelWithUID
StoreUID string `gorm:"type:char(32);index"`
FromUserUID string `gorm:"type:char(32);index"`
ToUserUID 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

View File

@ -1,6 +1,7 @@
chapter "供应链"
field web.code.mysql.client
field web.code.mysql.query args `mysql gongyinglian`
field web.code.db.models
order `
userStore.go

View File

@ -27,13 +27,10 @@ func (s Product) Create(m *ice.Message, arg ...string) {
s.TableView.Create(m, arg...)
}
func (s Product) List(m *ice.Message, arg ...string) {
m.Info("what %v", 123)
if m.Option(model.PRODUCT_TYPE) != kit.Format(ProductGoods) && !s.checkListRole(m, arg...) {
return
}
m.Info("what %v", 123)
if len(arg) == 0 {
m.Info("what %v", 123)
args := m.OptionSimple(model.STORE_UID)
kit.If(m.Option(model.PRODUCT_TYPE), func(p string) { args = append(args, model.TYPE, p) })
s.Select(m, args...)

View File

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

View File

@ -28,8 +28,12 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
}
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
m.RewriteAppend(func(value, key string, index int) string {
kit.If(key == model.GROUP_TYPE, func() { value = GroupType(kit.Int(value)).String() })
kit.If(key == model.USER_GROUP_ROLE, func() { value = UserGroupRole(kit.Int(value)).String() })
switch key {
case model.USER_GROUP_ROLE:
value = UserGroupRole(kit.Int(value)).String()
case model.GROUP_TYPE:
value = GroupType(kit.Int(value)).String()
}
return value
})
return s.Table.RewriteAppend(m)
@ -37,20 +41,17 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
func (s Table) SelectJoinCompany(m *ice.Message) *ice.Message {
return s.SelectJoin(m, company{}, model.NAME, model.CITY_UID)
}
func (s Table) checkRole(m *ice.Message, arg ...UserGroupRole) bool {
kit.If(len(arg) == 0, func() { arg = append(arg, UserGroupLeader) })
func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message {
role := UserGroupRole(kit.Int(m.Cmd(userGroup{}, s.Select, m.OptionSimple(model.GROUP_UID, model.USER_UID)).Append(model.ROLE)))
for _, v := range append(arg, UserGroupCreator) {
if role == v {
return true
}
}
return !m.WarnNotRight(true, role.String())
}
func (s Table) recordEvent(m *ice.Message, info string, arg ...string) *ice.Message {
s.Table.RecordEvent(m, m.Option(model.GROUP_UID), info, kit.Select(m.Option(model.UID), arg, 0))
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserGroupCreator.String())...), role.String())
return m
}
func (s Table) recordEvent(m *ice.Message, info string, arg ...string) {
s.Table.RecordEvent(m, m.Option(model.GROUP_UID), info, kit.Select(m.Option(model.UID), arg, 0))
}
func (s Table) recordEventWithName(m *ice.Message, info string) {
s.Table.RecordEventWithName(m, m.Option(model.GROUP_UID), info)
}
type Tables struct{ Table }

View File

@ -28,20 +28,20 @@ type UserGroup struct {
type Group struct {
db.ModelWithUID
CompanyUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:char(64)"`
Name string `gorm:"type:varchar(64)"`
Type uint8
}
type Company struct {
db.ModelWithUID
CityUID string `gorm:"type:char(32);index:idx_city"`
Name string `gorm:"type:char(64);index:idx_city"`
Name string `gorm:"type:varchar(64);index:idx_city"`
Info string
}
type Target struct {
db.ModelWithUID
GroupUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32)"`
Title string `gorm:"type:char(64)"`
Title string `gorm:"type:varchar(64)"`
Content string
}

View File

@ -4,8 +4,6 @@ import "shylinux.com/x/community/src/gonganxitong"
type Portal struct {
gonganxitong.Portal
name string `data:"管理系统"`
list string `name:"list group_uid index uid auto" role:"void"`
placeCreate string `name:"placeCreate city_name* company_name* group_name*" role:"void"`
}

View File

@ -1,3 +1,4 @@
chapter "管理系统"
field web.code.mysql.client
field web.code.mysql.query args `mysql guanlixitong`
field web.code.mysql.query args `mysql guanlixitong`
field web.code.db.models

View File

@ -11,14 +11,12 @@ type target struct {
Table
group group
userGroup userGroup
create string `name:"create title* content*" role:"void"`
create string `name:"create title* content*" role:"leader"`
}
func (s target) Create(m *ice.Message, arg ...string) {
if s.checkRole(m) {
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.GROUP_UID, model.USER_UID))...)
s.recordEvent(m, m.Trans("create target ", "创建团队目标 ")+m.Option(model.TITLE), m.Result())
}
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("")

View File

@ -1,6 +1,5 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
if (msg.IsDetail()) { var value = msg.TableDetail(); msg.Option("_share_title", value.title), msg.Option("_share_content", value.content) }
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [{text: value.title}]},
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)}, {text: value.user_name}]},

View File

@ -23,7 +23,6 @@ func (s userGroup) User(m *ice.Message, arg ...string) {
}
m.RenameAppend(model.ROLE, model.USER_GROUP_ROLE)
s.SelectJoinUser(m)
s.RewriteAppend(m)
}
func (s userGroup) List(m *ice.Message, arg ...string) {
s.Tables(m, s.group, s.company).FieldsWithCreatedAT(m, s,
@ -38,7 +37,6 @@ func (s userGroup) List(m *ice.Message, arg ...string) {
return
}
s.SelectJoinCity(m)
s.RewriteAppend(m)
}
func init() { ice.TeamCtxCmd(userGroup{}) }