This commit is contained in:
IT 老营长 @云轩领航-创始人 2025-06-02 19:12:51 +08:00
parent 19e593e055
commit 8fee722a09
15 changed files with 230 additions and 71 deletions

View File

@ -52,7 +52,8 @@ type Table struct {
marketPlaceInfo string `name:"marketPlaceInfo" role:"void"` marketPlaceInfo string `name:"marketPlaceInfo" role:"void"`
messagePlaceInfo string `name:"messagePlaceInfo" role:"void"` messagePlaceInfo string `name:"messagePlaceInfo" role:"void"`
applyCreate string `name:"applyCreate" role:"void"` applyCreate string `name:"applyCreate" role:"void"`
userInfo string `name:"userInfo" role:"worker" help:"用户信息"` userInfo string `name:"userInfo" role:"void" help:"用户信息"`
upload string `name:"upload" role:"worker"`
} }
func (s Table) LoadTrans(m *ice.Message, arg ...string) { func (s Table) LoadTrans(m *ice.Message, arg ...string) {
@ -96,6 +97,11 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
m.Cmdy(s.Prefix(m, member{}), m.Option(model.PLACE_UID)).Cut(model.USER_UID, model.USER_NAME, model.USER_AVATAR) m.Cmdy(s.Prefix(m, member{}), m.Option(model.PLACE_UID)).Cut(model.USER_UID, model.USER_NAME, model.USER_AVATAR)
m.RenameAppend(model.USER_UID, arg[0], model.NAME, model.USER_NAME, model.USER_AVATAR, mdb.ICONS) m.RenameAppend(model.USER_UID, arg[0], model.NAME, model.USER_NAME, model.USER_AVATAR, mdb.ICONS)
m.DisplayInputKeyNameIconTitle() m.DisplayInputKeyNameIconTitle()
case model.RECENT_UID:
s.InputsRecent(m)
case model.LANGUAGE:
m.Push(arg[0], "zh-cn")
m.Push(arg[0], "en-us")
default: default:
s.Table.Inputs(m, arg...) s.Table.Inputs(m, arg...)
} }
@ -105,6 +111,16 @@ func (s Table) InputsUID(m *ice.Message, arg []string, target ice.Any, args ...s
m.Cmdy(target, s.Select, args).RenameAppend(model.UID, arg[0]) m.Cmdy(target, s.Select, args).RenameAppend(model.UID, arg[0])
m.DisplayInputKeyNameIconTitle() m.DisplayInputKeyNameIconTitle()
} }
func (s Table) InputsRecent(m *ice.Message) string {
m.Cmdy(s.PrefixRecent(m)).Option("_input_args", model.UID, model.PLACE_NAME, model.PLACE_AVATAR)
return ""
}
func (s Table) InputsListCmd(m *ice.Message, target ice.Any, arg ...string) {
if len(arg) == 0 {
arg = append(arg, model.UID, model.NAME, model.ICON)
}
m.Cmdy(target, m.Option(model.PLACE_UID)).Option("_input_args", arg)
}
func (s Table) InputsList(m *ice.Message, list ice.Any, arg ...string) { func (s Table) InputsList(m *ice.Message, list ice.Any, arg ...string) {
it := reflect.ValueOf(list).MapRange() it := reflect.ValueOf(list).MapRange()
for it.Next() { for it.Next() {
@ -245,6 +261,27 @@ func (s Table) SelectJoinAuth(m *ice.Message, arg ...string) *ice.Message {
defer s.SaveBack(m, ice.MSG_USERPOD, ice.MSG_USERROLE)() defer s.SaveBack(m, ice.MSG_USERPOD, ice.MSG_USERROLE)()
return s.SelectJoin(m, s.findSpaceCmd(m, api.RENZHENGSHOUQUAN_AUTH), arg...) return s.SelectJoin(m, s.findSpaceCmd(m, api.RENZHENGSHOUQUAN_AUTH), arg...)
} }
func (s Table) SelectJoinSess(m *ice.Message, arg ...string) *ice.Message {
UID, TARGET_UID := model.USER_UID, model.USER_UID
target := sess{}
if m.Length() == 0 {
return m
}
list := []string{}
m.Table(func(value ice.Maps) { list = kit.AddUniq(list, value[UID]) })
msg := m.Spawn()
arg = kit.Split("agent,system,ip,location,ua")
s.Fields(msg, append(arg, TARGET_UID))
s.Orders(msg, s.Desc(model.CREATED_AT))
s.Groups(msg, TARGET_UID)
s.Limit(msg, 3000)
data := msg.CmdMap(target, s.SelectList, TARGET_UID, list, TARGET_UID)
m.Table(func(value ice.Maps) {
recent := data[value[TARGET_UID]]
kit.For(arg, func(k string) { m.Push(k, recent[k]) })
})
return m
}
func (s Table) SelectJoinRecent(m *ice.Message, PLACE_UID string, arg ...string) *ice.Message { func (s Table) SelectJoinRecent(m *ice.Message, PLACE_UID string, arg ...string) *ice.Message {
PLACE_UID = kit.Select(model.PLACE_UID, PLACE_UID) PLACE_UID = kit.Select(model.PLACE_UID, PLACE_UID)
if m.Length() == 0 { if m.Length() == 0 {
@ -300,6 +337,18 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
}) })
return m return m
} }
func (s Table) OtherListCmd(m *ice.Message, arg ...ice.Any) *ice.Message {
kit.If(m.FieldsIsDetail() && m.Length() > 0 && s.IsWorker(m), func() { m.Option("otherList", kit.Fields(arg...)) })
return m
}
func (s Table) OtherList(m *ice.Message, target ice.Any, arg ...string) {
if len(arg) == 0 {
arg = append(arg, m.CommandKey()+"_uid", m.Option(model.UID))
}
m.Cmdy(target, s.Select, arg)
// s.Display(m, kit.Select("", strings.Split(ice.GetTypeKey(target), "."), -1)+".js")
m.Option("_other_cmd", ice.GetTypeKey(target))
}
func (s Table) Update(m *ice.Message, data ice.Any, arg ...string) { func (s Table) Update(m *ice.Message, data ice.Any, arg ...string) {
if len(arg) == 0 { if len(arg) == 0 {
arg = append(arg, model.UID, kit.Select(m.Option(model.UID), m.Option(s.Keys(m.CommandKey(), model.UID)))) arg = append(arg, model.UID, kit.Select(m.Option(model.UID), m.Option(s.Keys(m.CommandKey(), model.UID))))
@ -312,6 +361,9 @@ func (s Table) UpdateAuth(m *ice.Message, arg ...string) {
func (s Table) UpdateField(m *ice.Message, arg ...string) { func (s Table) UpdateField(m *ice.Message, arg ...string) {
s.Update(m, kit.Dict(arg[0], arg[1]), arg[2:]...) s.Update(m, kit.Dict(arg[0], arg[1]), arg[2:]...)
} }
func (s Table) Upload(m *ice.Message, arg ...string) {
m.Echo(m.Resource(m.UploadSaveHash("usr/image/")))
}
func (s Table) UploadUpdate(m *ice.Message, field, uid string, arg ...string) { func (s Table) UploadUpdate(m *ice.Message, field, uid string, arg ...string) {
if m.IsErr() { if m.IsErr() {
return return
@ -544,15 +596,12 @@ func (s Table) TransRole(m *ice.Message, arg ...string) string {
return kit.Format(`<span class="role %s %s">%s</span>`, value, kit.Select("", arg, 1), role) return kit.Format(`<span class="role %s %s">%s</span>`, value, kit.Select("", arg, 1), role)
} }
func (s Table) Prefix(m *ice.Message, target ice.Any) string { func (s Table) Prefix(m *ice.Message, target ice.Any) string { return m.Prefix(kit.TypeName(target)) }
return m.Prefix(kit.TypeName(target)) func (s Table) PrefixPortal(m *ice.Message) string { return m.Prefix(kit.TypeName(Portal{})) }
} func (s Table) PrefixMember(m *ice.Message) string { return m.Prefix(kit.TypeName(member{})) }
func (s Table) PrefixPortal(m *ice.Message) string { func (s Table) PrefixRecent(m *ice.Message) string { return m.Prefix(kit.TypeName(recent{})) }
return m.Prefix(kit.TypeName(Portal{})) func (s Table) PrefixService(m *ice.Message) string { return m.Prefix(kit.TypeName(service{})) }
}
func (s Table) PrefixMember(m *ice.Message) string {
return m.Prefix(kit.TypeName(member{}))
}
func (s Table) findSpaceCmd(m *ice.Message, cmd ice.Any) ice.Any { func (s Table) findSpaceCmd(m *ice.Message, cmd ice.Any) ice.Any {
cmds := ice.GetTypeKey(cmd) cmds := ice.GetTypeKey(cmd)
if space, ok := cmdSpace[cmds]; ok && space != ice.Info.NodeName { if space, ok := cmdSpace[cmds]; ok && space != ice.Info.NodeName {
@ -568,6 +617,28 @@ func (s Table) SaveBack(m *ice.Message, arg ...string) func() {
kit.For(arg, func(i int, k string) { m.Option(k, list[i]) }) kit.For(arg, func(i int, k string) { m.Option(k, list[i]) })
} }
} }
func (s Table) TargetAddCount(m *ice.Message, target ice.Any, arg ...string) Table {
if !m.IsErr() {
m.Cmd(target, s.AddCount, kit.Select(s.Keys(m.CommandKey(), model.COUNT), arg, 0), kit.Select("-1", "1", m.ActionKey() == mdb.CREATE), m.Option(s.Keys(target, model.UID)))
}
return s
}
func (s Table) WaitWorkerCreate(m *ice.Message, help string) {
kit.If(!s.IsWorker(m), func() {
kit.If(m.Action().Length() == 0, func() { m.SetResult("请等待「工作人员」创建" + help) })
})
}
func (s Table) WaitLeaderCreate(m *ice.Message, help string) {
kit.If(!s.IsLeader(m), func() {
kit.If(m.Action().Length() == 0, func() { m.SetResult("请等待「管理人员」创建" + help) })
})
}
func (s Table) EchoQRCodeIcon(m *ice.Message, link, icon, title string) {
m.EchoQRCode(link).Echo(title).EchoImages(icon, "32", "avatar")
}
func (s Table) SpaceLink(m *ice.Message, space, index string, arg ...string) string {
return m.Cmdx(web.SPACE, space, index, s.Link, arg, ice.Maps{ice.MSG_USERPOD: space, ice.MSG_USERROLE: aaa.TECH})
}
func (s Table) SpaceOpsCmdy(m *ice.Message, arg ...ice.Any) *ice.Message { func (s Table) SpaceOpsCmdy(m *ice.Message, arg ...ice.Any) *ice.Message {
return s.SpaceCmdy(m, ice.OPS, arg...) return s.SpaceCmdy(m, ice.OPS, arg...)
} }

View File

@ -1,4 +1,5 @@
$output>div.list>div.item.myself { position:sticky; top:0; bottom:0; z-index:2; } $output>div.list>div.item.myself { position:sticky; top:0; bottom:0; z-index:2; }
$output>div.list>div.item.myself:not(:hover) { background-color:var(--plugin-bg-color) !important; } $output>div.list>div.item.myself:not(:hover) { background-color:var(--plugin-bg-color) !important; }
$output>div.list>div.item.myself div.title span { font-weight:bold; } $output>div.list>div.item.myself div.title span { font-weight:bold; }
body.width1 $output>div.list>div.item.myself>div.output { background-color:var(--plugin-bg-color) !important; }
body.width1 $output>div.list>div.item.card div.title span.role { margin-left:auto; } body.width1 $output>div.list>div.item.card div.title span.role { margin-left:auto; }

View File

@ -19,10 +19,12 @@ type member struct {
disable string `name:"disable" role:"void"` disable string `name:"disable" role:"void"`
promote string `name:"promote" role:"void"` promote string `name:"promote" role:"void"`
demote string `name:"demote" role:"void"` demote string `name:"demote" role:"void"`
setCookie string `name:"setCookie" help:"切换"` setLanguage string `name:"setLanguage language" help:"语言" role:"void"`
setInfo string `name:"setInfo info" help:"备注" role:"void"` setInfo string `name:"setInfo info" help:"备注" role:"void"`
setCookie string `name:"setCookie" help:"切换"`
main string `name:"main" help:"主页" role:"void"` main string `name:"main" help:"主页" role:"void"`
auth string `name:"auth" help:"认证" role:"void"` auth string `name:"auth" help:"认证" role:"void"`
sessList string `name:"sessList" role:"void"`
} }
func (s member) Remove(m *ice.Message, arg ...string) { func (s member) Remove(m *ice.Message, arg ...string) {
@ -86,6 +88,15 @@ func (s member) UserInfo(m *ice.Message, arg ...string) {
m.ProcessField(api.RENZHENGSHOUQUAN_PORTAL, []string{msg.Append(model.UID)}, arg...) m.ProcessField(api.RENZHENGSHOUQUAN_PORTAL, []string{msg.Append(model.UID)}, arg...)
} }
} }
func (s member) SetLanguage(m *ice.Message, arg ...string) {
msg := m.Cmd(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), m.Option(model.PLACE_UID), s.Key(s.UserPlace, model.UID), m.Option(model.UID))
m.Cmdy(user{}, s.UpdateField, arg, model.UID, msg.Append(model.USER_UID))
}
func (s member) SessList(m *ice.Message, arg ...string) {
msg := m.Cmd(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), m.Option(model.PLACE_UID), s.Key(s.UserPlace, model.UID), m.Option(model.UID))
s.OtherList(m, sess{}, msg.AppendSimple(model.USER_UID)...)
m.Display("sess.js")
}
func (s member) List(m *ice.Message, arg ...string) { func (s member) List(m *ice.Message, arg ...string) {
USER_PLACE_ROLE := s.Keys(s.UserPlace, model.ROLE) USER_PLACE_ROLE := s.Keys(s.UserPlace, model.ROLE)
user_uid, isLeader, isCreator := m.Option(model.USER_UID), s.IsLeader(m), s.IsCreator(m) user_uid, isLeader, isCreator := m.Option(model.USER_UID), s.IsLeader(m), s.IsCreator(m)
@ -93,13 +104,17 @@ func (s member) List(m *ice.Message, arg ...string) {
USER_PLACE_ROLE, model.INFO, model.USER_UID).Limit(m, 300) USER_PLACE_ROLE, model.INFO, model.USER_UID).Limit(m, 300)
if len(arg) == 1 { if len(arg) == 1 {
m.Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0]).Action() m.Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0]).Action()
defer m.Sort(kit.Fields(model.MEMBER_STATUS, USER_PLACE_ROLE, model.AUTH_STATUS, model.CREATED_AT))
} else if len(arg) == 2 { } else if len(arg) == 2 {
m.FieldsSetDetail().Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0], s.Key(s.UserPlace, model.UID), arg[1]).Action() m.FieldsSetDetail().Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0], s.Key(s.UserPlace, model.UID), arg[1]).Action()
} else { } else {
return return
} }
defer m.Sort(kit.Fields(model.MEMBER_STATUS, USER_PLACE_ROLE, model.AUTH_STATUS, model.CREATED_AT)) s.SelectJoinUser(m, model.NAME, model.INFO, model.AVATAR, model.LANGUAGE, model.AUTH_UID)
s.SelectJoinUser(m, model.NAME, model.INFO, model.AVATAR, model.AUTH_UID) if s.IsLeader(m) {
s.SelectJoinSess(m)
s.OtherListCmd(m, s.SessList)
}
s.SelectJoinAuth(m) s.SelectJoinAuth(m)
m.Table(func(value ice.Maps) { m.Table(func(value ice.Maps) {
if !m.FieldsIsDetail() { if !m.FieldsIsDetail() {
@ -130,6 +145,9 @@ func (s member) List(m *ice.Message, arg ...string) {
} }
} }
button = append(button, s.SetInfo) button = append(button, s.SetInfo)
kit.If(value[model.USER_UID] == user_uid, func() {
button = append(button, s.SetLanguage)
})
if isLeader { if isLeader {
switch kit.Int(value[USER_PLACE_ROLE]) { switch kit.Int(value[USER_PLACE_ROLE]) {
case 3: case 3:

View File

@ -9,6 +9,7 @@ Volcanos(chat.ONIMPORT, {
value.member_status != "normal" && can.onimport.textView(can, value, "member_status"), value.member_status != "normal" && can.onimport.textView(can, value, "member_status"),
]}, ]},
{view: html.STATUS, list: [value.info||value.auth_info||value.user_info]}, {view: html.STATUS, list: [value.info||value.auth_info||value.user_info]},
value.location && {view: html.STATUS, list: [value.location, value.system]},
can.onimport.titleAction(can, value), can.onimport.titleAction(can, value),
] ]
}) })

View File

@ -28,6 +28,7 @@ const (
MEMBER_STATUS = "member_status" MEMBER_STATUS = "member_status"
PLACE_UID = "place_uid" PLACE_UID = "place_uid"
PLACE_NAME = "place_name" PLACE_NAME = "place_name"
PLACE_AVATAR = "place_avatar"
PLACE_TYPE = "place_type" PLACE_TYPE = "place_type"
PLACE_INIT = "place_init" PLACE_INIT = "place_init"
PLACE_ADDRESS = "place_address" PLACE_ADDRESS = "place_address"
@ -71,6 +72,7 @@ const (
COMMAND_NAME = "command_name" COMMAND_NAME = "command_name"
MESSAGE_UID = "message_uid" MESSAGE_UID = "message_uid"
MESSAGE_STATUS = "message_status" MESSAGE_STATUS = "message_status"
RECENT_UID = "recent_uid"
SERVICE_UID = "service_uid" SERVICE_UID = "service_uid"
SERVICE_ICON = "service_icon" SERVICE_ICON = "service_icon"
SERVICE_NAME = "service_name" SERVICE_NAME = "service_name"
@ -122,18 +124,28 @@ const (
SPENDLIST_UID = "spendlist_uid" SPENDLIST_UID = "spendlist_uid"
SPACE_ID = "space_id" SPACE_ID = "space_id"
SIZE = "size" SIZE = "size"
LOCATION = "location"
IP = "ip"
UA = "ua"
AGENT = "agent"
SYSTEM = "system"
LANGUAGE = "language"
) )
type Sess struct { type Sess struct {
db.ModelWithUID db.ModelWithUID
UserUID string `gorm:"type:char(32);index"` UserUID string `gorm:"type:char(32);index"`
Agent string `gorm:"type:varchar(255)"` Location string `gorm:"type:varchar(128)"`
IP string `gorm:"type:varchar(16)"` IP string `gorm:"type:varchar(16)"`
UA string `gorm:"type:varchar(255)"`
Agent string `gorm:"type:varchar(255)"`
System string `gorm:"type:varchar(32)"`
} }
type User struct { type User struct {
db.ModelWithAuth db.ModelWithAuth
OpenID string `gorm:"type:char(32);index"` OpenID string `gorm:"type:char(32);index"`
Email string `gorm:"type:varchar(64)"` Email string `gorm:"type:varchar(64)"`
Language string `gorm:"type:char(8)"`
} }
type UserPlace struct { type UserPlace struct {
db.ModelUserPlace db.ModelUserPlace
@ -318,6 +330,7 @@ type Recent struct {
UserUID string `gorm:"type:char(32);index"` UserUID string `gorm:"type:char(32);index"`
PlaceUID string `gorm:"type:char(32);index"` PlaceUID string `gorm:"type:char(32);index"`
ServiceUID string `gorm:"type:char(32)"` ServiceUID string `gorm:"type:char(32)"`
PlaceAVATAR string `gorm:"type:varchar(128)"`
PlaceName string `gorm:"type:varchar(64)"` PlaceName string `gorm:"type:varchar(64)"`
StreetName string `gorm:"type:varchar(64)"` StreetName string `gorm:"type:varchar(64)"`
CityName string `gorm:"type:varchar(64)"` CityName string `gorm:"type:varchar(64)"`

View File

@ -34,9 +34,10 @@ $output>div.header img { height:100%; width:100%; object-fit:cover; }
$output>div.action>div.list { margin:0 10px; } $output>div.action>div.list { margin:0 10px; }
$output div.output>div.code { font-size:16px; position:relative; } $output div.output>div.code { font-size:16px; position:relative; }
$output div.output>div.code img.avatar { $output div.output>div.code img.avatar {
box-shadow:var(--box-shadow); border:solid 2px white;
border-radius:10px; object-fit:cover; --qrcode-icon-height:48px; border-radius:10px; object-fit:cover; --qrcode-icon-height:48px;
height:var(--qrcode-icon-height) !important; width:var(--qrcode-icon-height) !important; height:var(--qrcode-icon-height) !important; width:var(--qrcode-icon-height) !important;
position:absolute; top:calc(50% - var(--qrcode-icon-height) / 2 - 16px); left:calc(50% - var(--qrcode-icon-height) / 2); position:absolute; top:calc(50% - var(--qrcode-icon-height) / 2 - 26px); left:calc(50% - var(--qrcode-icon-height) / 2);
} }
$output>div>div.code { margin-bottom:20px; display:flex; flex-direction:column; align-items:center; } $output>div>div.code { margin-bottom:20px; display:flex; flex-direction:column; align-items:center; }
$output>div>div.list { border-radius:10px; background-color:var(--output-bg-color); padding:10px; margin:10px; } $output>div>div.list { border-radius:10px; background-color:var(--output-bg-color); padding:10px; margin:10px; }
@ -79,6 +80,7 @@ $output>div>div.list>div.output>div.item.index:not(.hide) { padding:5px 10px; di
$output>div>div.list>div.output>div.item.index img { height:36px; width:36px; object-fit:contain; } $output>div>div.list>div.output>div.item.index img { height:36px; width:36px; object-fit:contain; }
$output>div>div.list>div.output>div.item.index i { font-size:22px; padding:5px; } $output>div>div.list>div.output>div.item.index i { font-size:22px; padding:5px; }
$output>div>div.list>div.output>div.item.index span { font-size:12px; white-space:pre; max-width:80px; } $output>div>div.list>div.output>div.item.index span { font-size:12px; white-space:pre; max-width:80px; }
body.en $output>div>div.list>div.output>div.item.index span { font-family:monospace; }
$output>div>div.list div.code { text-align:center; } $output>div>div.list div.code { text-align:center; }
$output>div>div.list div.code input { background-color:var(--notice-bg-color); color:var(--notice-fg-color); font-size:18px; margin:auto; min-width:200px; display:block; margin-top:10px; } $output>div>div.list div.code input { background-color:var(--notice-bg-color); color:var(--notice-fg-color); font-size:18px; margin:auto; min-width:200px; display:block; margin-top:10px; }
$output>div>div.list fieldset.story>div.output { background-color:var(--plugin-bg-color); } $output>div>div.list fieldset.story>div.output { background-color:var(--plugin-bg-color); }
@ -99,6 +101,7 @@ $output div.item.card div.title span.score { background-color:var(--hover-bg-col
body.width1 $output div.item.card div.title span.price { margin-left:auto; } body.width1 $output div.item.card div.title span.price { margin-left:auto; }
// $output div.item.card div.title span.auth { font-size:14px; padding:3px; } // $output div.item.card div.title span.auth { font-size:14px; padding:3px; }
$output div.item.card div.title span.time { position:absolute; right:0; font-size:12px; color:gray; } $output div.item.card div.title span.time { position:absolute; right:0; font-size:12px; color:gray; }
$output div.item.card div.title div.space { flex-grow:1; }
$output div.item.card div.title span:first-child { word-break:break-all; } $output div.item.card div.title span:first-child { word-break:break-all; }
$output fieldset.story>div.item.card div.title span { line-height:26px; } $output fieldset.story>div.item.card div.title span { line-height:26px; }
$output fieldset.story>div.output { background-color:var(--plugin-bg-color); } $output fieldset.story>div.output { background-color:var(--plugin-bg-color); }
@ -176,7 +179,10 @@ $output fieldset.story>div.output table.content tr.user_avatar td img { max-heig
$output fieldset.story>div.output table.content tr.auth_avatar td img { max-height:128px; max-width:128px; } $output fieldset.story>div.output table.content tr.auth_avatar td img { max-height:128px; max-width:128px; }
$output fieldset.story>div.output>div.code { text-align:center; } $output fieldset.story>div.output>div.code { text-align:center; }
$output fieldset.story>div.output>div.code { display:flex; flex-direction:column; row-gap:10px; margin-top:20px; margin-bottom:20px; } $output fieldset.story>div.output>div.code { display:flex; flex-direction:column; row-gap:10px; margin-top:20px; margin-bottom:20px; }
$output fieldset.story>div.output>div.code>img { display:block; margin:auto; width:100%; max-width:320px; } $output div.code>img { display:block; margin:10px auto; }
$output fieldset.story>div.output>div.info>input[type=button] { box-shadow:var(--box-shadow); border:none; background-color:var(--notice-bg-color); color:var(--notice-fg-color); font-size:20px; height:48px; width:100%; max-width:320px; }
$output div.output>div.code>img.qrcode { box-shadow:var(--box-shadow); border-radius:10px; }
$output fieldset.story>div.output>div.info { padding:10px 20px; text-align:center; }
$output fieldset.story>div.output>div.code>input[type=button] { background-color:var(--notice-bg-color); color:var(--notice-fg-color); float:right; } $output fieldset.story>div.output>div.code>input[type=button] { background-color:var(--notice-bg-color); color:var(--notice-fg-color); float:right; }
$output fieldset.story>div.output>div.code>input[type=button].danger { border:var(--box-danger); background-color:transparent; color:var(--danger-bg-color); } $output fieldset.story>div.output>div.code>input[type=button].danger { border:var(--box-danger); background-color:transparent; color:var(--danger-bg-color); }
$output fieldset.story>div.output>div.code div.item.button { margin-top:20px; } $output fieldset.story>div.output>div.code div.item.button { margin-top:20px; }
@ -226,4 +232,7 @@ body:not(.mobile) $action div.item.notice input[type=button]:hover { background-
body.en $output>fieldset table.content td:first-child { max-width:190px; min-width:100px; width:unset;} body.en $output>fieldset table.content td:first-child { max-width:190px; min-width:100px; width:unset;}
body.en $output>fieldset table.content td { padding: 10px 5px; } body.en $output>fieldset table.content td { padding: 10px 5px; }
fieldset.web.team.storage.file div.item.card div.title span:first-child { flex-grow:1; } fieldset.web.team.storage.file div.item.card div.title span:first-child { flex-grow:1; }
body.width1>div.inputs>div.input {
height:100%;
}
$fieldset { box-shadow:none; } $fieldset { box-shadow:none; }

View File

@ -174,8 +174,6 @@ func (s Portal) List(m *ice.Message, arg ...string) {
s.DisplayBase(m, "").DisplayCSS("") s.DisplayBase(m, "").DisplayCSS("")
} }
func (s Portal) PlaceListOption(m *ice.Message, arg ...string) *ice.Message { func (s Portal) PlaceListOption(m *ice.Message, arg ...string) *ice.Message {
m.Option("portal_icon", m.Resource(kit.Select(ice.Info.NodeIcon, m.GetCommand().Icon)))
m.Option("space_title", ice.Info.Titles)
msg := m.Cmd("", s.PlaceList, m.Option(model.USER_UID), arg[0]) msg := m.Cmd("", s.PlaceList, m.Option(model.USER_UID), arg[0])
if msg.Length() == 0 { if msg.Length() == 0 {
msg = m.Cmd(s.Place, s.Table.Select, model.UID, arg[0]) msg = m.Cmd(s.Place, s.Table.Select, model.UID, arg[0])
@ -202,6 +200,8 @@ func (s Portal) PlaceListOption(m *ice.Message, arg ...string) *ice.Message {
)) ))
m.Option(model.STREET_NAME, msg.Append(s.Keys(s.Street, model.NAME))) m.Option(model.STREET_NAME, msg.Append(s.Keys(s.Street, model.NAME)))
m.Option(model.PLACE_NAME, msg.Append(s.Keys(s.Place, model.NAME))) m.Option(model.PLACE_NAME, msg.Append(s.Keys(s.Place, model.NAME)))
m.Option("portal_icon", m.Resource(kit.Select(ice.Info.NodeIcon, m.GetCommand().Icon)))
m.Option("space_title", ice.Info.Titles)
return msg return msg
} }
func (s Portal) PlaceCreate(m *ice.Message, arg ...string) { func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
@ -335,11 +335,14 @@ func (s Portal) ValueList(m *ice.Message, arg ...string) {
} }
return return
} }
target := m.Option(db.TARGET)
if m.Optionv(mdb.SELECT) == nil {
s.Table.FieldsWithCreatedAT(m, m.Option(db.TARGET), m.Optionv(mdb.FIELDS).([]ice.Any)...) s.Table.FieldsWithCreatedAT(m, m.Option(db.TARGET), m.Optionv(mdb.FIELDS).([]ice.Any)...)
}
if len(arg) == 1 { if len(arg) == 1 {
s.Table.Select(m, PLACE_UID, arg[0]).Action(s.Create) s.Table.Select(m, s.Key(target, PLACE_UID), arg[0]).Action(s.Create)
} else if len(arg) == 2 { } else if len(arg) == 2 {
s.Table.SelectDetail(m, PLACE_UID, arg[0], model.UID, arg[1]) s.Table.SelectDetail(m, s.Key(target, PLACE_UID), arg[0], s.Key(target, model.UID), arg[1])
} else { } else {
return return
} }
@ -359,7 +362,9 @@ func (s Portal) BeforePlaceAuth(m *ice.Message, arg ...string) {}
func (s Portal) AfterPlaceAuth(m *ice.Message, arg ...string) {} func (s Portal) AfterPlaceAuth(m *ice.Message, arg ...string) {}
func (s Portal) AddRecent(m *ice.Message, arg ...string) { func (s Portal) AddRecent(m *ice.Message, arg ...string) {
args := kit.Simple(model.PLACE_UID, arg[0], m.OptionSimple(model.SERVICE_UID, model.PLACE_NAME, model.STREET_NAME, model.CITY_NAME)) args := kit.Simple(model.PLACE_UID, arg[0], model.PLACE_AVATAR, m.Resource(kit.Select(
ice.Info.NodeIcon, m.GetCommand().Icon, m.Option(model.AVATAR), m.Option(model.AUTH_AVATAR),
)), m.OptionSimple(model.SERVICE_UID, model.PLACE_NAME, model.STREET_NAME, model.CITY_NAME))
kit.If(kit.IsIn(m.Append(model.AUTH_STATUS), "2", "issued"), func() { args = append(args, model.AUTH_STATUS, "2") }) kit.If(kit.IsIn(m.Append(model.AUTH_STATUS), "2", "issued"), func() { args = append(args, model.AUTH_STATUS, "2") })
m.Cmd(s.Prefix(m, s.recent), s.Create, args) m.Cmd(s.Prefix(m, s.recent), s.Create, args)
} }

View File

@ -29,15 +29,12 @@ Volcanos(chat.ONIMPORT, {
can.page.Append(can, can.page.SelectOne(can, target, "div.code"), [{img: can.misc.Resource(can, avatar||can.ConfIcons()||can.user.info.favicon), className: "avatar"}]) can.page.Append(can, can.page.SelectOne(can, target, "div.code"), [{img: can.misc.Resource(can, avatar||can.ConfIcons()||can.user.info.favicon), className: "avatar"}])
}, },
myValue: function(can, value) { return [ myValue: function(can, value) { return [
{view: html.TITLE, list: [value.auth_name||value._name, can.onimport.authView(can, value), {view: html.TITLE, list: [
{text: [value.__type, "", [mdb.TYPE, value._type, value._type_style]]}, value._role != "visitor" && {text: [value.__role, "", [aaa.ROLE, value._role, value._role_style]]}, value.auth_name||value._name, can.onimport.authView(can, value),
]}, {text: [value.__type, "", [mdb.TYPE, value._type, value._type_style]]},
can.ConfIndex() != "web.team.renzhengshouquan.portal" && {view: html.STATUS, list: [ value._role != "visitor" && {text: [value.__role, "", [aaa.ROLE, value._role, value._role_style]]},
value.city_name, "|",
value._street, "|",
can.ConfHelp(), "|",
value.space_title||can.user.info.titles,
]}, ]},
can.onimport.shipView(can, {city_name: value.city_name, street_name: value._street, service_name: can.ConfHelp()+" "+(value.space_title||can.user.info.titles)}),
{view: html.STATUS, list: [value.auth_info||value._info]}, {view: html.STATUS, list: [value.auth_info||value._info]},
] }, ] },
myTrans: function(can, value) { myTrans: function(can, value) {
@ -90,6 +87,8 @@ Volcanos(chat.ONIMPORT, {
if (can.Option(PLACE_UID) == "") { var uid = can.onimport.myPlace(can, msg, can.ui.myplace) if (can.Option(PLACE_UID) == "") { var uid = can.onimport.myPlace(can, msg, can.ui.myplace)
if (msg.Length() > 0) { msg.Echo(can.ConfHelp()+" "+can.user.info.titles) if (msg.Length() > 0) { msg.Echo(can.ConfHelp()+" "+can.user.info.titles)
can.misc.isDebug(can) && can.onimport.qrcode(can, msg) can.misc.isDebug(can) && can.onimport.qrcode(can, msg)
} else {
can.user.agent.init(can, location.hostname, can.misc.Resource(can, can.ConfIcons()))
} }
msg.Length() > 0? can.run({}, [uid], function(msg) { showIndex(can._index_msg = msg) }): can.run({}, [uid], function(msg) { can.onimport.myOrder(can, can._index_msg = msg, can.ui.myorder) }) msg.Length() > 0? can.run({}, [uid], function(msg) { showIndex(can._index_msg = msg) }): can.run({}, [uid], function(msg) { can.onimport.myOrder(can, can._index_msg = msg, can.ui.myorder) })
} else { can.onappend.style(can, "public", can._output) } else { can.onappend.style(can, "public", can._output)
@ -229,10 +228,10 @@ Volcanos(chat.ONACTION, {
can.user.isMobile && can._root.Inputs && can._root.Inputs.appendChild(sub._target) can.user.isMobile && can._root.Inputs && can._root.Inputs.appendChild(sub._target)
can.user.isMobile && can.page.style(can, can._root.Action._output, html.VISIBILITY, html.HIDDEN) can.user.isMobile && can.page.style(can, can._root.Action._output, html.VISIBILITY, html.HIDDEN)
sub.Option("city_name", "深圳市") sub.Option("city_name", "深圳市")
sub.Option("company_name", "云轩领航")
if (!can.misc.isDebug(can)) { return } if (!can.misc.isDebug(can)) { return }
sub.Option("street_name", "粤海街道") sub.Option("street_name", "粤海街道")
sub.Option("school_name", "深圳中学") sub.Option("school_name", "深圳中学")
sub.Option("company_name", "云轩领航")
sub.Option("place_name", "软件产业基地") sub.Option("place_name", "软件产业基地")
sub.Option("queue_name", "二楼产检") sub.Option("queue_name", "二楼产检")
sub.Option("group_name", "销售部-华东地区") sub.Option("group_name", "销售部-华东地区")

View File

@ -40,6 +40,7 @@
"authPersonal": "notice" "authPersonal": "notice"
}, },
"input": { "input": {
"place": "场景",
"process_time": "开始时间", "process_time": "开始时间",
"plan_status": "计划状态", "plan_status": "计划状态",
"task_count": "任务数量", "task_count": "任务数量",

View File

@ -31,15 +31,17 @@ func (s recent) Remove(m *ice.Message, arg ...string) {
s.Delete(m, m.OptionSimple(model.USER_UID, model.UID)...) s.Delete(m, m.OptionSimple(model.USER_UID, model.UID)...)
} }
func (s recent) List(m *ice.Message, arg ...string) { func (s recent) List(m *ice.Message, arg ...string) {
if len(arg) < 2 {
s.Tables(m, s.service).Fields(m, s.Key(s, model.UID), s.Key(s, model.UPDATED_AT), s.Tables(m, s.service).Fields(m, s.Key(s, model.UID), s.Key(s, model.UPDATED_AT),
model.SERVICE_ICON, model.SERVICE_NAME, s.Key(s, model.AUTH_STATUS), model.SCORE, model.PLACE_UID, s.Key(s, model.PLACE_NAME), s.Key(s, model.PLACE_AVATAR),
s.Key(s, model.CITY_NAME), s.Key(s, model.STREET_NAME), s.Key(s, model.PLACE_NAME), model.SERVICE_UID,
s.AS(model.NODENAME, model.SPACE), model.INDEX, model.PLACE_UID, s.Key(s, model.CITY_NAME), s.Key(s, model.STREET_NAME), model.SERVICE_NAME, model.SERVICE_ICON,
).Orders(m, s.Desc(model.SCORE), s.Desc(s.Key(s, model.UPDATED_AT))) s.Key(s, model.AUTH_STATUS), model.SCORE, s.AS(model.NODENAME, model.SPACE), model.INDEX,
)
if len(arg) < 2 {
s.Orders(m, s.Desc(model.SCORE), s.Desc(s.Key(s, model.UPDATED_AT)))
s.Select(m, model.USER_UID, m.Option(model.USER_UID)).Action() s.Select(m, model.USER_UID, m.Option(model.USER_UID)).Action()
} else if len(arg) == 2 { } else {
s.SelectDetail(m, model.USER_UID, m.Option(model.USER_UID), model.UID, arg[1]) s.SelectDetail(m, model.USER_UID, m.Option(model.USER_UID), s.Key(s, model.UID), arg[1])
} }
m.Table(func(value ice.Maps) { m.Table(func(value ice.Maps) {
if value[model.SCORE] == "0" { if value[model.SCORE] == "0" {

View File

@ -2,10 +2,10 @@ Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { value._style = []; if (value.score > 0) { value._style = ["sticky"] } can.onimport.myView(can, msg, function(value) { value._style = []; if (value.score > 0) { value._style = ["sticky"] }
if (can._stacks_root && can._stacks_root._stacks[[value.space,value.index, value.place_uid].join(",")]) { value._style.push("loaded") } if (can._stacks_root && can._stacks_root._stacks[[value.space,value.index, value.place_uid].join(",")]) { value._style.push("loaded") }
value.icons = can.misc.Resource(can, value.service_icon.split("?")[0], value.space) value.icons = can.misc.Resource(can, value.place_avatar||value.service_icon.split("?")[0], value.space)
return [ return [
{view: html.TITLE, list: [value.place_name, can.onimport.authView(can, value), can.onimport.timeView(can, value)]}, {view: html.TITLE, list: [value.place_name, can.onimport.authView(can, value), can.onimport.timeView(can, value)]},
{view: html.STATUS, list: [value.city_name, value.street_name, value.service_name]}, can.onimport.shipView(can, value),
] ]
}, function(event, value) { can.onaction._goback? can.onaction._goback(event, function() { }, function(event, value) { can.onaction._goback? can.onaction._goback(event, function() {
// can.onimport.myPlugin(can, {space: value.space, index: value.index, args: [value.place_uid]}) // can.onimport.myPlugin(can, {space: value.space, index: value.index, args: [value.place_uid]})

View File

@ -12,19 +12,48 @@ import (
type sess struct { type sess struct {
Table Table
user user user user
fields string `data:"user_uid,agent,system,location,ip,ua"`
create string `name:"create user_uid*"` create string `name:"create user_uid*"`
repair string `name:"repair"`
} }
func (s sess) Create(m *ice.Message, arg ...string) { func (s sess) Create(m *ice.Message, arg ...string) {
s.Insert(m, model.USER_UID, m.Option(model.USER_UID), web.AGENT, m.Option(ice.MSG_USERUA), aaa.IP, m.Option(ice.MSG_USERIP)) s.Insert(m, kit.Simple(model.USER_UID, m.Option(model.USER_UID),
m.Options(web.ParseUA(m.Message)).OptionSimple(model.IP, model.UA, model.AGENT, model.SYSTEM),
model.LOCATION, kit.Format(web.PublicIP(m.Message, m.Option(ice.MSG_USERIP))),
)...)
m.ProcessCookie(ice.MSG_SESSID, m.Option(ice.MSG_SESSID, kit.JoinWord(web.SPACE, m.Option(ice.MSG_USERPOD), m.PrefixKey(), aaa.CHECK, m.Result())), "-2") m.ProcessCookie(ice.MSG_SESSID, m.Option(ice.MSG_SESSID, kit.JoinWord(web.SPACE, m.Option(ice.MSG_USERPOD), m.PrefixKey(), aaa.CHECK, m.Result())), "-2")
} }
func (s sess) Repair(m *ice.Message, arg ...string) {
m.Cmdy("").Table(func(value ice.Maps) {
if false {
s.Update(m, kit.Dict(model.LOCATION, kit.Format(web.PublicIP(m.Message, value[model.IP]))), model.UID, value[model.UID])
m.Sleep("100ms")
return
}
if value["ua"] != "" {
msg := m.Spawn()
msg.Option(ice.MSG_USERIP, value["ip"])
msg.Option(ice.MSG_USERUA, value["ua"])
s.Update(m, msg.Options(web.ParseUA(msg.Message)).OptionSimple(model.AGENT, model.SYSTEM), model.UID, value[model.UID])
}
})
}
func (s sess) List(m *ice.Message, arg ...string) {
if len(arg) == 0 {
if m.IsTech() {
s.Tables(m, user{}).FieldsWithCreatedAT(m, s, kit.Split("user_uid,name,info,avatar,background,agent,system,location,ip,ua")).Limit(m, 3000)
s.Select(m, arg...).PushAction(s.Remove).Action(s.Repair)
}
}
}
func (s sess) Check(m *ice.Message, arg ...string) { func (s sess) Check(m *ice.Message, arg ...string) {
msg := s.Select(m.Spawn(), model.UID, arg[0]) msg := s.Select(m.Spawn(), model.UID, arg[0])
msg = m.Cmd(s.user, s.Select, model.UID, msg.Append(model.USER_UID)) msg = m.Cmd(s.user, s.Select, model.UID, msg.Append(model.USER_UID))
m.Option(ice.MSG_USERROLE, aaa.VOID) m.Option(ice.MSG_USERROLE, aaa.VOID)
m.Option(ice.MSG_USERNAME, msg.Append(model.UID)) m.Option(ice.MSG_USERNAME, msg.Append(model.UID))
m.Option(ice.MSG_USERNICK, msg.Append(model.NAME)) m.Option(ice.MSG_USERNICK, msg.Append(model.NAME))
m.Option(ice.MSG_LANGUAGE, msg.Append(model.LANGUAGE))
m.Option(ice.MSG_AVATAR, msg.Append(model.AVATAR)) m.Option(ice.MSG_AVATAR, msg.Append(model.AVATAR))
m.Option(ice.MSG_USERUID, msg.Append(model.UID)) m.Option(ice.MSG_USERUID, msg.Append(model.UID))
m.Option(model.USER_UID, msg.Append(model.UID)) m.Option(model.USER_UID, msg.Append(model.UID))

8
src/gonganxitong/sess.js Normal file
View File

@ -0,0 +1,8 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.location, value.ip, value.system]},
can.onimport.metaView(can, value),
] })
},
})

View File

@ -18,7 +18,7 @@ type user struct {
Table Table
setting setting setting setting
template string `data:"4b-Z_r8dZmm1pHdd2h4A10VVYX4OIHvemlLjsHKBj2s"` template string `data:"4b-Z_r8dZmm1pHdd2h4A10VVYX4OIHvemlLjsHKBj2s"`
fields string `data:"name,info,avatar,background,auth_uid"` fields string `data:"auth_uid,language,name,info,avatar,background"`
create string `name:"create open_id* avatar usernick"` create string `name:"create open_id* avatar usernick"`
modify string `name:"modify info" role:"void"` modify string `name:"modify info" role:"void"`
list string `name:"list uid auto" role:"void"` list string `name:"list uid auto" role:"void"`
@ -29,11 +29,12 @@ type user struct {
func (s user) Create(m *ice.Message, arg ...string) { func (s user) Create(m *ice.Message, arg ...string) {
m.OptionDefault(aaa.AVATAR, m.Option(ice.MSG_AVATAR), aaa.USERNICK, m.Option(ice.MSG_USERNICK)) m.OptionDefault(aaa.AVATAR, m.Option(ice.MSG_AVATAR), aaa.USERNICK, m.Option(ice.MSG_USERNICK))
args := kit.Simple(m.OptionSimple(model.AVATAR), model.NAME, m.Option(aaa.USERNICK), model.LANGUAGE, m.Option(ice.MSG_LANGUAGE))
if msg := s.Table.Select(m.Spawn(), m.OptionSimple(model.OPEN_ID)...); msg.Length() == 0 { if msg := s.Table.Select(m.Spawn(), m.OptionSimple(model.OPEN_ID)...); msg.Length() == 0 {
s.Insert(m, kit.Simple(m.OptionSimple(model.OPEN_ID, model.AVATAR), model.NAME, m.Option(aaa.USERNICK))...) s.Insert(m, kit.Simple(m.OptionSimple(model.OPEN_ID), args)...)
m.Option(model.USER_UID, m.Result()) m.Option(model.USER_UID, m.Result())
} else { } else {
s.Update(m, kit.Dict(m.OptionSimple(model.AVATAR), model.NAME, m.Option(aaa.USERNICK)), msg.AppendSimple(model.UID)...) s.Update(m, args, msg.AppendSimple(model.UID)...)
m.Option(model.USER_UID, msg.Append(model.UID)) m.Option(model.USER_UID, msg.Append(model.UID))
} }
} }
@ -44,12 +45,14 @@ func (s user) Remove(m *ice.Message, arg ...string) {
s.Delete(m, m.OptionSimple(model.UID)...) s.Delete(m, m.OptionSimple(model.UID)...)
} }
func (s user) List(m *ice.Message, arg ...string) { func (s user) List(m *ice.Message, arg ...string) {
s.Tables(m, "LEFT JOIN sesses ON users.uid = sesses.user_uid").Groups(m, "user_uid").Orders(m, s.Desc("sesses.created_at"))
s.FieldsWithCreatedAT(m, s, kit.Split("auth_uid,name,info,avatar,background,agent,system,location,ip,ua")).Limit(m, 3000)
if len(arg) == 0 { if len(arg) == 0 {
if m.IsTech() { if m.IsTech() {
s.Limit(m, 3000) s.Limit(m, 3000)
s.Select(m, arg...).Table(func(value ice.Maps) { s.Select(m, arg...).Table(func(value ice.Maps) {
if value[model.UID] != m.Option(model.USER_UID) { if value[model.UID] != m.Option(model.USER_UID) {
m.PushButton(s.SetCookie) m.PushButton(s.SetCookie, s.Remove)
} else { } else {
m.PushButton() m.PushButton()
} }
@ -58,7 +61,7 @@ func (s user) List(m *ice.Message, arg ...string) {
m.StatusTimeCount(mdb.TOTAL, s.SelectTotal(m)) m.StatusTimeCount(mdb.TOTAL, s.SelectTotal(m))
} }
} else { } else {
s.SelectDetail(m, model.UID, arg[0]) s.SelectDetail(m, s.Key(s, model.UID), arg[0])
if m.Append(model.AUTH_UID) == "" && arg[0] == m.Option(model.USER_UID) { if m.Append(model.AUTH_UID) == "" && arg[0] == m.Option(model.USER_UID) {
m.EchoInfoButton("请申请个人认证", s.AuthCreate) m.EchoInfoButton("请申请个人认证", s.AuthCreate)
} }

View File

@ -1,8 +1,7 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [ can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title||value.name||value.user_name, can.onimport.titleAction(can, value)]}, {view: html.TITLE, list: [value.title||value.name||value.user_name, can.onimport.titleAction(can, value)]}, can.onimport.metaView(can, value),
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
{view: html.OUTPUT, list: [value.content||value.info]}, {view: html.OUTPUT, list: [value.content||value.info]},
] }) ] })
}, },