mirror of
https://shylinux.com/x/community
synced 2025-07-01 13:14:44 +08:00
add some
This commit is contained in:
parent
19e593e055
commit
8fee722a09
@ -52,7 +52,8 @@ type Table struct {
|
||||
marketPlaceInfo string `name:"marketPlaceInfo" role:"void"`
|
||||
messagePlaceInfo string `name:"messagePlaceInfo" 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) {
|
||||
@ -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.RenameAppend(model.USER_UID, arg[0], model.NAME, model.USER_NAME, model.USER_AVATAR, mdb.ICONS)
|
||||
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:
|
||||
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.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) {
|
||||
it := reflect.ValueOf(list).MapRange()
|
||||
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)()
|
||||
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 {
|
||||
PLACE_UID = kit.Select(model.PLACE_UID, PLACE_UID)
|
||||
if m.Length() == 0 {
|
||||
@ -300,6 +337,18 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
||||
})
|
||||
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) {
|
||||
if len(arg) == 0 {
|
||||
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) {
|
||||
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) {
|
||||
if m.IsErr() {
|
||||
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)
|
||||
}
|
||||
|
||||
func (s Table) Prefix(m *ice.Message, target ice.Any) string {
|
||||
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) Prefix(m *ice.Message, target ice.Any) string { 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) PrefixRecent(m *ice.Message) string { return m.Prefix(kit.TypeName(recent{})) }
|
||||
func (s Table) PrefixService(m *ice.Message) string { return m.Prefix(kit.TypeName(service{})) }
|
||||
|
||||
func (s Table) findSpaceCmd(m *ice.Message, cmd ice.Any) ice.Any {
|
||||
cmds := ice.GetTypeKey(cmd)
|
||||
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]) })
|
||||
}
|
||||
}
|
||||
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 {
|
||||
return s.SpaceCmdy(m, ice.OPS, arg...)
|
||||
}
|
||||
|
@ -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:not(:hover) { background-color:var(--plugin-bg-color) !important; }
|
||||
$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; }
|
@ -11,18 +11,20 @@ import (
|
||||
|
||||
type member struct {
|
||||
Tables
|
||||
user user
|
||||
order string `data:"102"`
|
||||
role string `data:"leader,worker,server"`
|
||||
remove string `name:"remove" role:"void"`
|
||||
enable string `name:"enable" role:"void"`
|
||||
disable string `name:"disable" role:"void"`
|
||||
promote string `name:"promote" role:"void"`
|
||||
demote string `name:"demote" role:"void"`
|
||||
setCookie string `name:"setCookie" help:"切换"`
|
||||
setInfo string `name:"setInfo info" help:"备注" role:"void"`
|
||||
main string `name:"main" help:"主页" role:"void"`
|
||||
auth string `name:"auth" help:"认证" role:"void"`
|
||||
user user
|
||||
order string `data:"102"`
|
||||
role string `data:"leader,worker,server"`
|
||||
remove string `name:"remove" role:"void"`
|
||||
enable string `name:"enable" role:"void"`
|
||||
disable string `name:"disable" role:"void"`
|
||||
promote string `name:"promote" role:"void"`
|
||||
demote string `name:"demote" role:"void"`
|
||||
setLanguage string `name:"setLanguage language" help:"语言" role:"void"`
|
||||
setInfo string `name:"setInfo info" help:"备注" role:"void"`
|
||||
setCookie string `name:"setCookie" help:"切换"`
|
||||
main string `name:"main" 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) {
|
||||
@ -86,6 +88,15 @@ func (s member) UserInfo(m *ice.Message, arg ...string) {
|
||||
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) {
|
||||
USER_PLACE_ROLE := s.Keys(s.UserPlace, model.ROLE)
|
||||
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)
|
||||
if len(arg) == 1 {
|
||||
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 {
|
||||
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 {
|
||||
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.AUTH_UID)
|
||||
s.SelectJoinUser(m, model.NAME, model.INFO, model.AVATAR, model.LANGUAGE, model.AUTH_UID)
|
||||
if s.IsLeader(m) {
|
||||
s.SelectJoinSess(m)
|
||||
s.OtherListCmd(m, s.SessList)
|
||||
}
|
||||
s.SelectJoinAuth(m)
|
||||
m.Table(func(value ice.Maps) {
|
||||
if !m.FieldsIsDetail() {
|
||||
@ -130,6 +145,9 @@ func (s member) List(m *ice.Message, arg ...string) {
|
||||
}
|
||||
}
|
||||
button = append(button, s.SetInfo)
|
||||
kit.If(value[model.USER_UID] == user_uid, func() {
|
||||
button = append(button, s.SetLanguage)
|
||||
})
|
||||
if isLeader {
|
||||
switch kit.Int(value[USER_PLACE_ROLE]) {
|
||||
case 3:
|
||||
|
@ -9,6 +9,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
value.member_status != "normal" && can.onimport.textView(can, value, "member_status"),
|
||||
]},
|
||||
{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),
|
||||
]
|
||||
})
|
||||
|
@ -28,6 +28,7 @@ const (
|
||||
MEMBER_STATUS = "member_status"
|
||||
PLACE_UID = "place_uid"
|
||||
PLACE_NAME = "place_name"
|
||||
PLACE_AVATAR = "place_avatar"
|
||||
PLACE_TYPE = "place_type"
|
||||
PLACE_INIT = "place_init"
|
||||
PLACE_ADDRESS = "place_address"
|
||||
@ -71,6 +72,7 @@ const (
|
||||
COMMAND_NAME = "command_name"
|
||||
MESSAGE_UID = "message_uid"
|
||||
MESSAGE_STATUS = "message_status"
|
||||
RECENT_UID = "recent_uid"
|
||||
SERVICE_UID = "service_uid"
|
||||
SERVICE_ICON = "service_icon"
|
||||
SERVICE_NAME = "service_name"
|
||||
@ -122,18 +124,28 @@ const (
|
||||
SPENDLIST_UID = "spendlist_uid"
|
||||
SPACE_ID = "space_id"
|
||||
SIZE = "size"
|
||||
LOCATION = "location"
|
||||
IP = "ip"
|
||||
UA = "ua"
|
||||
AGENT = "agent"
|
||||
SYSTEM = "system"
|
||||
LANGUAGE = "language"
|
||||
)
|
||||
|
||||
type Sess struct {
|
||||
db.ModelWithUID
|
||||
UserUID string `gorm:"type:char(32);index"`
|
||||
Agent string `gorm:"type:varchar(255)"`
|
||||
IP string `gorm:"type:varchar(16)"`
|
||||
UserUID string `gorm:"type:char(32);index"`
|
||||
Location string `gorm:"type:varchar(128)"`
|
||||
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 {
|
||||
db.ModelWithAuth
|
||||
OpenID string `gorm:"type:char(32);index"`
|
||||
Email string `gorm:"type:varchar(64)"`
|
||||
OpenID string `gorm:"type:char(32);index"`
|
||||
Email string `gorm:"type:varchar(64)"`
|
||||
Language string `gorm:"type:char(8)"`
|
||||
}
|
||||
type UserPlace struct {
|
||||
db.ModelUserPlace
|
||||
@ -315,14 +327,15 @@ type Message struct {
|
||||
}
|
||||
type Recent struct {
|
||||
db.ModelWithUID
|
||||
UserUID string `gorm:"type:char(32);index"`
|
||||
PlaceUID string `gorm:"type:char(32);index"`
|
||||
ServiceUID string `gorm:"type:char(32)"`
|
||||
PlaceName string `gorm:"type:varchar(64)"`
|
||||
StreetName string `gorm:"type:varchar(64)"`
|
||||
CityName string `gorm:"type:varchar(64)"`
|
||||
AuthStatus uint8 `gorm:"default:0"`
|
||||
Score uint8 `gorm:"default:0"`
|
||||
UserUID string `gorm:"type:char(32);index"`
|
||||
PlaceUID string `gorm:"type:char(32);index"`
|
||||
ServiceUID string `gorm:"type:char(32)"`
|
||||
PlaceAVATAR string `gorm:"type:varchar(128)"`
|
||||
PlaceName string `gorm:"type:varchar(64)"`
|
||||
StreetName string `gorm:"type:varchar(64)"`
|
||||
CityName string `gorm:"type:varchar(64)"`
|
||||
AuthStatus uint8 `gorm:"default:0"`
|
||||
Score uint8 `gorm:"default:0"`
|
||||
}
|
||||
type Service struct {
|
||||
db.ModelWithUID
|
||||
|
@ -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.output>div.code { font-size:16px; position:relative; }
|
||||
$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;
|
||||
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.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 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; }
|
||||
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 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); }
|
||||
@ -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; }
|
||||
// $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 div.space { flex-grow:1; }
|
||||
$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.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>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>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].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; }
|
||||
@ -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 { padding: 10px 5px; }
|
||||
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; }
|
||||
|
@ -174,8 +174,6 @@ func (s Portal) List(m *ice.Message, arg ...string) {
|
||||
s.DisplayBase(m, "").DisplayCSS("")
|
||||
}
|
||||
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])
|
||||
if msg.Length() == 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.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
|
||||
}
|
||||
func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
|
||||
@ -335,11 +335,14 @@ func (s Portal) ValueList(m *ice.Message, arg ...string) {
|
||||
}
|
||||
return
|
||||
}
|
||||
s.Table.FieldsWithCreatedAT(m, m.Option(db.TARGET), m.Optionv(mdb.FIELDS).([]ice.Any)...)
|
||||
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)...)
|
||||
}
|
||||
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 {
|
||||
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 {
|
||||
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) 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") })
|
||||
m.Cmd(s.Prefix(m, s.recent), s.Create, args)
|
||||
}
|
||||
|
@ -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"}])
|
||||
},
|
||||
myValue: function(can, value) { return [
|
||||
{view: html.TITLE, list: [value.auth_name||value._name, can.onimport.authView(can, value),
|
||||
{text: [value.__type, "", [mdb.TYPE, value._type, value._type_style]]}, value._role != "visitor" && {text: [value.__role, "", [aaa.ROLE, value._role, value._role_style]]},
|
||||
]},
|
||||
can.ConfIndex() != "web.team.renzhengshouquan.portal" && {view: html.STATUS, list: [
|
||||
value.city_name, "|",
|
||||
value._street, "|",
|
||||
can.ConfHelp(), "|",
|
||||
value.space_title||can.user.info.titles,
|
||||
{view: html.TITLE, list: [
|
||||
value.auth_name||value._name, can.onimport.authView(can, value),
|
||||
{text: [value.__type, "", [mdb.TYPE, value._type, value._type_style]]},
|
||||
value._role != "visitor" && {text: [value.__role, "", [aaa.ROLE, value._role, value._role_style]]},
|
||||
]},
|
||||
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]},
|
||||
] },
|
||||
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 (msg.Length() > 0) { msg.Echo(can.ConfHelp()+" "+can.user.info.titles)
|
||||
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) })
|
||||
} 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.page.style(can, can._root.Action._output, html.VISIBILITY, html.HIDDEN)
|
||||
sub.Option("city_name", "深圳市")
|
||||
sub.Option("company_name", "云轩领航")
|
||||
if (!can.misc.isDebug(can)) { return }
|
||||
sub.Option("street_name", "粤海街道")
|
||||
sub.Option("school_name", "深圳中学")
|
||||
sub.Option("company_name", "云轩领航")
|
||||
sub.Option("place_name", "软件产业基地")
|
||||
sub.Option("queue_name", "二楼产检")
|
||||
sub.Option("group_name", "销售部-华东地区")
|
||||
|
@ -40,6 +40,7 @@
|
||||
"authPersonal": "notice"
|
||||
},
|
||||
"input": {
|
||||
"place": "场景",
|
||||
"process_time": "开始时间",
|
||||
"plan_status": "计划状态",
|
||||
"task_count": "任务数量",
|
||||
|
@ -31,15 +31,17 @@ func (s recent) Remove(m *ice.Message, arg ...string) {
|
||||
s.Delete(m, m.OptionSimple(model.USER_UID, model.UID)...)
|
||||
}
|
||||
func (s recent) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.service).Fields(m, s.Key(s, model.UID), s.Key(s, model.UPDATED_AT),
|
||||
model.PLACE_UID, s.Key(s, model.PLACE_NAME), s.Key(s, model.PLACE_AVATAR),
|
||||
model.SERVICE_UID,
|
||||
s.Key(s, model.CITY_NAME), s.Key(s, model.STREET_NAME), model.SERVICE_NAME, model.SERVICE_ICON,
|
||||
s.Key(s, model.AUTH_STATUS), model.SCORE, s.AS(model.NODENAME, model.SPACE), model.INDEX,
|
||||
)
|
||||
if len(arg) < 2 {
|
||||
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,
|
||||
s.Key(s, model.CITY_NAME), s.Key(s, model.STREET_NAME), s.Key(s, model.PLACE_NAME),
|
||||
s.AS(model.NODENAME, model.SPACE), model.INDEX, model.PLACE_UID,
|
||||
).Orders(m, s.Desc(model.SCORE), s.Desc(s.Key(s, model.UPDATED_AT)))
|
||||
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()
|
||||
} else if len(arg) == 2 {
|
||||
s.SelectDetail(m, model.USER_UID, m.Option(model.USER_UID), model.UID, arg[1])
|
||||
} else {
|
||||
s.SelectDetail(m, model.USER_UID, m.Option(model.USER_UID), s.Key(s, model.UID), arg[1])
|
||||
}
|
||||
m.Table(func(value ice.Maps) {
|
||||
if value[model.SCORE] == "0" {
|
||||
|
@ -2,10 +2,10 @@ Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
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") }
|
||||
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 [
|
||||
{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() {
|
||||
// can.onimport.myPlugin(can, {space: value.space, index: value.index, args: [value.place_uid]})
|
||||
|
@ -12,19 +12,48 @@ import (
|
||||
type sess struct {
|
||||
Table
|
||||
user user
|
||||
fields string `data:"user_uid,agent,system,location,ip,ua"`
|
||||
create string `name:"create user_uid*"`
|
||||
repair string `name:"repair"`
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
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) {
|
||||
msg := s.Select(m.Spawn(), model.UID, arg[0])
|
||||
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_USERNAME, msg.Append(model.UID))
|
||||
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_USERUID, msg.Append(model.UID))
|
||||
m.Option(model.USER_UID, msg.Append(model.UID))
|
||||
|
8
src/gonganxitong/sess.js
Normal file
8
src/gonganxitong/sess.js
Normal 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),
|
||||
] })
|
||||
},
|
||||
})
|
@ -18,7 +18,7 @@ type user struct {
|
||||
Table
|
||||
setting setting
|
||||
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"`
|
||||
modify string `name:"modify info" 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) {
|
||||
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 {
|
||||
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())
|
||||
} 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))
|
||||
}
|
||||
}
|
||||
@ -44,12 +45,14 @@ func (s user) Remove(m *ice.Message, arg ...string) {
|
||||
s.Delete(m, m.OptionSimple(model.UID)...)
|
||||
}
|
||||
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 m.IsTech() {
|
||||
s.Limit(m, 3000)
|
||||
s.Select(m, arg...).Table(func(value ice.Maps) {
|
||||
if value[model.UID] != m.Option(model.USER_UID) {
|
||||
m.PushButton(s.SetCookie)
|
||||
m.PushButton(s.SetCookie, s.Remove)
|
||||
} else {
|
||||
m.PushButton()
|
||||
}
|
||||
@ -58,7 +61,7 @@ func (s user) List(m *ice.Message, arg ...string) {
|
||||
m.StatusTimeCount(mdb.TOTAL, s.SelectTotal(m))
|
||||
}
|
||||
} 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) {
|
||||
m.EchoInfoButton("请申请个人认证", s.AuthCreate)
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
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.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
|
||||
{view: html.TITLE, list: [value.title||value.name||value.user_name, can.onimport.titleAction(can, value)]}, can.onimport.metaView(can, value),
|
||||
{view: html.OUTPUT, list: [value.content||value.info]},
|
||||
] })
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user