This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-12-16 15:17:17 +08:00
parent 758128292e
commit 74b73cf64d
3 changed files with 33 additions and 20 deletions

View File

@ -200,24 +200,26 @@ type Paymentlist struct {
type Meeting struct {
db.ModelWithUID
PlaceUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32)"`
Vendor string `gorm:"type:varchar(128)"`
UserID string `gorm:"type:varchar(32)"`
}
type Document struct {
db.ModelWithUID
PlaceUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32)"`
FolderID string `gorm:"type:varchar(128)"`
Vendor string `gorm:"type:varchar(128)"`
}
type Contract struct {
db.ModelWithUID
PlaceUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32)"`
}
type Photo struct {
db.ModelWithUID
PlaceUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32)"`
SpaceID string `gorm:"type:varchar(128)"`
AccessToken string `gorm:"type:varchar(512)"`
Vendor string `gorm:"type:varchar(128)"`
@ -242,9 +244,9 @@ type Apply struct {
}
type Allow struct {
db.ModelWithUID
ApplyUID string `gorm:"type:char(32)"`
PlaceUID string `gorm:"type:char(32);index:idx_place"`
UserUID string `gorm:"type:char(32);index:idx_place"`
ApplyUID string `gorm:"type:char(32)"`
Status uint8 `gorm:"default:0"`
}
type Event struct {

View File

@ -200,6 +200,9 @@ func (s Portal) PlaceRemove(m *ice.Message, arg ...string) {
m.Cmdy(s.UserPlace, s.Delete, m.OptionSimple(model.USER_UID, model.UID))
}
func (s Portal) PlaceCheck(m *ice.Message, arg ...string) {
if m.PrefixKey() == api.RENZHENGSHOUQUAN_PORTAL {
return
}
s.Tables(m, kit.Format("LEFT JOIN %s ON %s = %s and %s IS NULL",
s.TableNames(s.UserPlace),
s.Key(s.UserPlace, s.Keys(s.Place, model.UID)),
@ -212,30 +215,42 @@ func (s Portal) PlaceCheck(m *ice.Message, arg ...string) {
s.Key(s.Place, model.AUTH_UID),
)
m.Cmdy(s.Place, s.Table.Select, kit.Format("%s IS NULL", model.USER_UID))
m.PushAction(s.PlaceTrash)
m.Table(func(value ice.Maps) { m.Push(model.INDEX, m.PrefixKey()) }).DisplayTable()
}
func (s Portal) PlaceTrash(m *ice.Message, arg ...string) {
m.Cmd(s.PrefixPortal(m), s.AfterPlaceTrash)
defer m.Cmd(s.PrefixPortal(m), s.BeforePlaceTrash)
m.Option("__place_uid", s.Keys(s.Place, model.UID))
for key, _ := range m.Target().Commands {
if strings.HasPrefix(key, "_") {
continue
}
if key == m.CommandKey() {
if kit.IsIn(key, "cleanup", "portal", "service") {
continue
}
if key == "portal" {
if s.Key(s.UserPlace, model.UID) == kit.Keys(s.TableName(key), model.UID) {
continue
}
m.Cmd(key, s.PlaceTrash)
if s.Key(s.Place, model.UID) == kit.Keys(s.TableName(key), model.UID) {
continue
}
m.Cmdy(m.Prefix(key), s.PlaceTrash)
}
if m.Cmd(s.Place, s.Delete); m.PrefixKey() == api.RENZHENGSHOUQUAN_PORTAL {
m.Cmd(s.UserPlace, s.RemoveBy, model.AUTH_UID, m.Option(model.UID))
}
m.DisplayTable()
}
func (s Table) PlaceTrash(m *ice.Message, arg ...string) {
m.Push("key", m.PrefixKey())
if s.Place == nil {
m.Push("table", "")
m.Push("place_uid", "")
if m.Configv("db") == nil {
return
}
if m.Push("key", m.PrefixKey()); s.Place == nil {
s.RemoveBy(m, kit.Format("%s = ?", m.Option("__place_uid")), m.Option(model.UID))
m.Push("table", s.TableName(m.CommandKey())).Push(model.PLACE_UID, m.Option("__place_uid"))
} else {
m.Push("table", s.TableNames(s.Place))
m.Push("place_uid", s.Keys(s.Place, model.UID))
s.RemoveBy(m, "place_uid = ?", m.Option(model.UID))
m.Push("table", s.TableNames(s.Place)).Push(model.PLACE_UID, "place_uid")
}
}
func (s Portal) PlaceList(m *ice.Message, arg ...string) *ice.Message {
@ -310,6 +325,8 @@ func (s Portal) BeforePlaceCreate(m *ice.Message, arg ...string) {}
func (s Portal) AfterPlaceCreate(m *ice.Message, arg ...string) {}
func (s Portal) BeforePlaceRemove(m *ice.Message, arg ...string) {}
func (s Portal) AfterPlaceRemove(m *ice.Message, arg ...string) {}
func (s Portal) BeforePlaceTrash(m *ice.Message, arg ...string) {}
func (s Portal) AfterPlaceTrash(m *ice.Message, arg ...string) {}
func (s Portal) BeforePlaceAuth(m *ice.Message, arg ...string) {}
func (s Portal) AfterPlaceAuth(m *ice.Message, arg ...string) {}

View File

@ -42,17 +42,11 @@ func (s setting) List(m *ice.Message, arg ...string) {
msg := s.Select(m.Spawn(), model.PLACE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID))
msg.Table(func(value ice.Maps) { data[value[model.NAME]] = value[model.VALUE] })
s.Hash.List(m).Table(func(value ice.Maps) { m.Push(model.VALUE, data[value[model.NAME]]) }).Action()
m.Action(s.PlaceTrash)
} else if len(arg) == 2 {
s.SelectDetail(m, model.PLACE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID), model.NAME, arg[1])
}
s.DisplayBase(m, "").DisplayCSS("")
}
func (s setting) PlaceTrash(m *ice.Message, arg ...string) {
// m.Cmdy(s.UserPlace, s.Select, model.PLACE_UID, m.Option(model.PLACE_UID))
m.Cmdy(s.Place, s.Select, model.UID, m.Option(model.PLACE_UID))
m.DisplayTable()
}
func init() { ice.TeamCtxCmd(setting{Table: newTable()}) }