mirror of
https://shylinux.com/x/community
synced 2025-05-02 20:27:01 +08:00
add some
This commit is contained in:
parent
388b648a7a
commit
592013abfd
@ -93,9 +93,9 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
|
||||
s.Table.Inputs(m, arg...)
|
||||
}
|
||||
}
|
||||
func (s Table) InputsUID(m *ice.Message, target ice.Any, arg ...string) {
|
||||
func (s Table) InputsUID(m *ice.Message, arg []string, target ice.Any, args ...string) {
|
||||
s.Fields(m, model.UID, model.TITLE)
|
||||
m.Cmdy(target, s.Select, m.OptionSimple(s.PLACE_UID)).RenameAppend(model.UID, arg[0])
|
||||
m.Cmdy(target, s.Select, args).RenameAppend(model.UID, arg[0])
|
||||
m.DisplayInputKeyNameIconTitle()
|
||||
}
|
||||
func (s Table) InputsList(m *ice.Message, list ice.Any, arg ...string) {
|
||||
@ -157,6 +157,7 @@ func (s Table) ValueRemove(m *ice.Message, arg ...string) {
|
||||
s.RecordEventWithName(m, "")
|
||||
}
|
||||
func (s Table) ValueModify(m *ice.Message, arg ...string) {
|
||||
s.TransPrice(m, arg)
|
||||
s.ValueModel(m, s.ValueModify, arg...)
|
||||
s.RecordEventWithName(m, "")
|
||||
}
|
||||
@ -326,6 +327,12 @@ func (s Table) IsVisitor(m *ice.Message) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
func (s Table) IsCreator(m *ice.Message) bool {
|
||||
if role := kit.Int(m.Option(model.USER_ROLE)); role == 1 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
func (s Table) IsLeader(m *ice.Message) bool {
|
||||
if role := kit.Int(m.Option(model.USER_ROLE)); role == 1 || role == 2 {
|
||||
return true
|
||||
@ -434,14 +441,16 @@ func (s Table) SendMessage(m *ice.Message, from, to string, arg ...string) {
|
||||
if m.IsErr() {
|
||||
return
|
||||
}
|
||||
kit.If(len(arg) == 0, func() { arg = append(arg, m.Option(s.PLACE_UID), kit.Select(m.Result(), m.Option(model.UID))) })
|
||||
kit.If(len(arg) == 0, func() { arg = append(arg, m.Option(model.PLACE_UID), kit.Select(m.Option(model.UID), m.Result())) })
|
||||
m.Spawn(ice.Maps{db.DB: ""}).Cmd(s.Prefix(m, message{}), s.Create,
|
||||
model.FROM_USER_UID, kit.Select(m.Option(model.USER_UID), from), model.TO_USER_UID, kit.Select(m.Option(model.USER_UID), to),
|
||||
m.OptionSimple(model.COMMAND_UID), model.ARGS, kit.Join(arg),
|
||||
m.OptionSimple(model.COMMAND_UID), model.ARGS, kit.Join(arg), m.OptionSimple(model.TITLE, model.CONTENT),
|
||||
)
|
||||
}
|
||||
func (s Table) DoneMessage(m *ice.Message, arg ...string) {
|
||||
m.Info("what %v", m.Option("message_uid"))
|
||||
if m.Option(model.MESSAGE_UID) != "" {
|
||||
m.Info("what %v", m.Option("message_uid"))
|
||||
m.Spawn(ice.Maps{db.DB: ""}).Cmd(s.Prefix(m, message{}), message{}.Done, kit.Dict(model.UID, m.Option(model.MESSAGE_UID)))
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ func (s credit) List(m *ice.Message, arg ...string) {
|
||||
m.ProcessField(api.RENZHENGSHOUQUAN_PROFILE, msg.Append(model.AUTH_UID))
|
||||
return
|
||||
}
|
||||
if !s.IsWorker(m) {
|
||||
if !s.IsLeader(m) {
|
||||
m.Echo("本服务暂未申请认证")
|
||||
return
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package gonganxitong
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
"shylinux.com/x/icebergs/base/web/html"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
|
||||
"shylinux.com/x/community/src/gonganxitong/model"
|
||||
@ -15,25 +16,43 @@ type member struct {
|
||||
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"`
|
||||
}
|
||||
|
||||
func (s member) Remove(m *ice.Message, arg ...string) {
|
||||
if s.IsLeader(m) {
|
||||
m.Cmdy(s.UserPlace, s.Delete, s.option(m))
|
||||
}
|
||||
}
|
||||
func (s member) Enable(m *ice.Message, arg ...string) {
|
||||
if s.IsLeader(m) {
|
||||
m.Cmdy(s.UserPlace, s.UpdateField, model.STATUS, MemberNormal, s.option(m))
|
||||
m.Cmdy(s.UserPlace, s.Delete, s.option(m, model.ROLE, kit.Format(UserPlaceTenant), model.STATUS, kit.Format(MemberDisabled)))
|
||||
s.recordEvent(m, "❌", m.Trans("remove member", "删除成员"), html.DANGER)
|
||||
}
|
||||
}
|
||||
func (s member) Disable(m *ice.Message, arg ...string) {
|
||||
if s.IsLeader(m) {
|
||||
m.Cmdy(s.UserPlace, s.UpdateField, model.STATUS, MemberDisabled, s.option(m))
|
||||
m.Cmdy(s.UserPlace, s.UpdateField, model.STATUS, MemberDisabled, s.option(m, model.ROLE, kit.Format(UserPlaceTenant)))
|
||||
s.recordEvent(m, "❌", m.Trans("disable member", "禁用成员"), html.DANGER)
|
||||
}
|
||||
}
|
||||
func (s member) Demote(m *ice.Message, arg ...string) {
|
||||
if s.IsCreator(m) {
|
||||
m.Cmdy(s.UserPlace, s.UpdateField, model.ROLE, kit.Format(UserPlaceTenant), s.option(m))
|
||||
s.recordEvent(m, "❌", m.Trans("demote worker", "降级成为工作人员"), html.DANGER)
|
||||
}
|
||||
}
|
||||
func (s member) Promote(m *ice.Message, arg ...string) {
|
||||
if s.IsCreator(m) {
|
||||
m.Cmdy(s.UserPlace, s.UpdateField, model.ROLE, kit.Format(UserPlaceLandlord), s.option(m))
|
||||
s.recordEvent(m, "✅", m.Trans("promote leader", "升级成为管理人员"), html.NOTICE)
|
||||
}
|
||||
}
|
||||
func (s member) Enable(m *ice.Message, arg ...string) {
|
||||
if s.IsLeader(m) {
|
||||
m.Cmdy(s.UserPlace, s.UpdateField, model.STATUS, MemberNormal, s.option(m, model.ROLE, kit.Format(UserPlaceTenant)))
|
||||
s.recordEvent(m, "✅", m.Trans("enable member", "启用成员"), html.NOTICE)
|
||||
}
|
||||
}
|
||||
func (s member) List(m *ice.Message, arg ...string) {
|
||||
user_uid, isLeader := m.Option(model.USER_UID), s.IsLeader(m)
|
||||
USER_PLACE_ROLE := s.Keys(s.UserPlace, model.ROLE)
|
||||
user_uid, isLeader, isCreator := m.Option(model.USER_UID), s.IsLeader(m), s.IsCreator(m)
|
||||
s.FieldsWithCreatedAT(m, s.UserPlace, model.USER_UID, s.Keys(s.UserPlace, model.ROLE), s.AS(s.Key(s.UserPlace, model.STATUS), model.MEMBER_STATUS))
|
||||
if len(arg) == 1 {
|
||||
m.Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0]).Action()
|
||||
@ -42,6 +61,7 @@ func (s member) List(m *ice.Message, arg ...string) {
|
||||
} else {
|
||||
return
|
||||
}
|
||||
defer m.Sort(kit.Fields(model.MEMBER_STATUS, USER_PLACE_ROLE, model.CREATED_AT))
|
||||
m.Table(func(value ice.Maps) {
|
||||
if !m.FieldsIsDetail() {
|
||||
if user_uid == value[model.USER_UID] {
|
||||
@ -50,19 +70,33 @@ func (s member) List(m *ice.Message, arg ...string) {
|
||||
m.Push("who", "")
|
||||
}
|
||||
}
|
||||
if isLeader {
|
||||
if user_uid == value[model.USER_UID] {
|
||||
m.PushButton()
|
||||
} else {
|
||||
if MemberStatus(kit.Int(value[model.MEMBER_STATUS])) == MemberNormal {
|
||||
m.PushButton(s.Disable)
|
||||
} else {
|
||||
m.PushButton(s.Enable, s.Remove)
|
||||
button := []ice.Any{}
|
||||
if MemberStatus(kit.Int(value[model.MEMBER_STATUS])) == MemberNormal {
|
||||
if isCreator {
|
||||
switch kit.Int(value[USER_PLACE_ROLE]) {
|
||||
case 2:
|
||||
button = append(button, s.Demote)
|
||||
case 3:
|
||||
button = append(button, s.Promote)
|
||||
}
|
||||
}
|
||||
if isLeader {
|
||||
switch kit.Int(value[USER_PLACE_ROLE]) {
|
||||
case 3:
|
||||
button = append(button, s.Disable)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m.PushButton()
|
||||
if isCreator {
|
||||
button = append(button, s.Enable, s.Remove)
|
||||
} else if isLeader {
|
||||
switch kit.Int(value[USER_PLACE_ROLE]) {
|
||||
case 3:
|
||||
button = append(button, s.Enable, s.Remove)
|
||||
}
|
||||
}
|
||||
}
|
||||
m.PushButton(button...)
|
||||
})
|
||||
s.SelectJoinUser(m, model.NAME, model.INFO, model.AVATAR, model.AUTH_UID)
|
||||
s.SelectJoinAuth(m)
|
||||
@ -72,7 +106,10 @@ func (s member) List(m *ice.Message, arg ...string) {
|
||||
func init() { ice.TeamCtxCmd(member{Tables: newTables()}) }
|
||||
|
||||
func (s member) option(m *ice.Message, arg ...string) []string {
|
||||
return m.OptionSimple(s.Keys(s.Place, model.UID), model.UID)
|
||||
return kit.Simple(m.OptionSimple(s.Keys(s.Place, model.UID), model.UID), arg)
|
||||
}
|
||||
func (s member) recordEvent(m *ice.Message, icon, title, style string, arg ...string) {
|
||||
s.RecordEvent(m, kit.JoinWord(icon, title, kit.Cut(m.Option(model.UID), 6), s.TransRole(m, "", style), m.Option(model.USER_NAME)), m.Option(model.UID))
|
||||
}
|
||||
|
||||
type MemberStatus int
|
||||
|
@ -35,6 +35,7 @@ func (s message) List(m *ice.Message, arg ...string) {
|
||||
model.FROM_USER_UID, model.COMMAND_NAME, model.MESSAGE_STATUS, model.SCORE,
|
||||
model.PLACE_UID, model.SERVICE_NAME,
|
||||
s.AS(model.NODENAME, model.SPACE), s.Key(s.command, model.INDEX), model.ARGS,
|
||||
model.TITLE, model.CONTENT,
|
||||
)
|
||||
if len(arg) < 2 {
|
||||
args := []string{model.TO_USER_UID, m.Option(model.USER_UID)}
|
||||
|
@ -5,10 +5,15 @@ Volcanos(chat.ONIMPORT, {
|
||||
can.onimport.myView(can, msg, function(value) { var args = can.core.Split(value.args)
|
||||
value.icons = value.user_avatar||value.icons; if (value.score > 0) { value._style = ["sticky"] }
|
||||
return [
|
||||
{view: html.TITLE, list: [value.place_name, value.command_name, value.detail||(args[1]||"").slice(0, 6), can.onimport.textView(can, value)]},
|
||||
{view: html.STATUS, list: [value.city_name, value.street_name, value.service_name]},
|
||||
{view: html.STATUS, list: [can.onimport.timeView(can, value), value.user_name]},
|
||||
value.info && {view: html.OUTPUT, list: [value.info]},
|
||||
{view: html.TITLE, list: [
|
||||
value.command_name, value.title, can.onimport.textView(can, value),
|
||||
]},
|
||||
{view: html.STATUS, list: [
|
||||
value.detail||(args[1]||"").slice(0, 6),
|
||||
can.onimport.timeView(can, value), value.user_name,
|
||||
]},
|
||||
{view: html.STATUS, list: [value.city_name, value.street_name, value.place_name, value.service_name]},
|
||||
{view: html.OUTPUT, list: [value.content]},
|
||||
]
|
||||
})
|
||||
},
|
||||
|
@ -303,10 +303,10 @@ type Command struct {
|
||||
Icon string `gorm:"type:varchar(128)"`
|
||||
}
|
||||
type Message struct {
|
||||
db.ModelWithUID
|
||||
PlaceUID string `gorm:"type:char(32)"`
|
||||
db.ModelContent
|
||||
FromUserUID string `gorm:"type:char(32)"`
|
||||
ToUserUID string `gorm:"type:char(32);index"`
|
||||
PlaceUID string `gorm:"type:char(32)"`
|
||||
CommandUID string `gorm:"type:char(32)"`
|
||||
Args string `gorm:"type:varchar(128)"`
|
||||
Status uint `gorm:"default:0"`
|
||||
|
@ -21,7 +21,11 @@ body.light $output>div.header { background-image:url("/p/src/gonganxitong/portal
|
||||
$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 { border-radius:10px; height:64px !important; width:64px !important; object-fit:cover; position:absolute; top:153px; left:calc(50% - 32px); }
|
||||
$output div.output>div.code img.avatar {
|
||||
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);
|
||||
}
|
||||
$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.myplace>div.output { padding:0 10px; max-height:320px; }
|
||||
@ -35,7 +39,16 @@ $output>div>div.list.mynotice>span:not(.title) { white-space:pre; }
|
||||
$output>div>div.list.mynotice>span:first-child { background-color:var(--hover-bg-color); color:var(--notice-bg-color); padding:0 5px; margin-right:5px; }
|
||||
$output>div>div.list.mynotice>span:last-child { color:gray; }
|
||||
$output>div>div.list.mylist>fieldset>div.output { max-height:none !important; }
|
||||
$output>div>div.list>div.title { font-weight:bold; display:flex; align-items:center; }
|
||||
$output>div>div.list>div.title {
|
||||
font-weight:bold; display:flex; align-items:center;
|
||||
border-left:var(--box-notice3); padding-left:10px;
|
||||
}
|
||||
$output>div>div.list.myallow>div.title {
|
||||
border-left:var(--box-danger3); padding-left:10px;
|
||||
}
|
||||
$output>div>div.list.myorder>div.title {
|
||||
border-left:var(--box-danger3); padding-left:10px;
|
||||
}
|
||||
$output>div>div.list>div.title span:first-child { flex-grow:1; }
|
||||
$output>div>div.list>div.title div.action div.item.filter input:focus { width:320px; transition:width 0.5s; }
|
||||
$output>div>div.list>div.title div.action div.item.filter input { transition:width 0.8s; }
|
||||
@ -74,6 +87,7 @@ $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 div.item.card>div.output>div.container>div.title span { line-height:26px; }
|
||||
$output div.item.title { border-left:var(--box-notice3); margin-left:10px; padding:10px; background-color:var(--output-bg-color); }
|
||||
$output div.item.title.dealList { border-left:var(--box-danger3); }
|
||||
$body div.inputs>div.input.float>div.action { display:flex; }
|
||||
|
||||
$output div.item.card div.title div.action input { margin-right:0; }
|
||||
@ -124,8 +138,8 @@ $output fieldset.story>div.output table.content tr.icon td img { max-height:128p
|
||||
$output fieldset.story>div.output table.content tr.user_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 { display:flex; flex-direction:column; row-gap:10px; }
|
||||
$output fieldset.story>div.output>div.code>img { display:block; margin:auto; width:100%; max-width:390px; }
|
||||
$output fieldset.story>div.output>div.code { display:flex; flex-direction:column; row-gap:10px; margin-top:20px; }
|
||||
$output fieldset.story>div.output>div.code>img { display:block; margin:auto; width:100%; max-width:320px; }
|
||||
$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; }
|
||||
@ -137,7 +151,7 @@ $output>fieldset.story>div.output div.item.card>div.output div.output { padding:
|
||||
$output fieldset.story.form>div.output>div.code>input[type=button] { font-size:18px; margin:10px; height:36px; }
|
||||
$output>fieldset.story.web.team.renzhengshouquan.profile { margin-top:0; }
|
||||
$output>fieldset.story.web.team.credit { margin-top:0; }
|
||||
$output>fieldset.story.web.team.credit>div.output>div.code { margin-top:32px; }
|
||||
$output>fieldset.story.web.team.credit>div.output>div.code { margin-top:64px; }
|
||||
$output>fieldset.message div.tabs span.select { border-top:var(--box-border); }
|
||||
$output>fieldset.message div.tabs span.create.select { border-top:var(--box-danger); }
|
||||
$output>fieldset.message div.tabs span.read.select { border-top:var(--box-notice); }
|
||||
|
@ -5,7 +5,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
otherList: function(can, msg, action) { if (!msg.IsDetail()) { return } typeof action == "string" && (action = [action])
|
||||
can.core.Next(action, function(action, next) {
|
||||
can.run(can.request({}, {uid: msg.Append(UID)}), action, function(msg) { if (msg.Length() == 0) { return next() }
|
||||
can.page.Append(can, can._output, [{view: [[html.ITEM, html.TITLE], "", can.user.trans(can, action)]}])
|
||||
can.page.Append(can, can._output, [{view: [[html.ITEM, html.TITLE, action], "", can.user.trans(can, action)]}])
|
||||
can.onappend.plugin(can, {index: can.ConfIndex()}, function(sub) { can.onimport.myField(can, sub)
|
||||
sub.run = function(event, cmds, cb) { if (!cmds || cmds.length == 0) { cb(msg) } }, next()
|
||||
sub.onexport.output = function(_sub, msg) {
|
||||
|
@ -16,6 +16,7 @@
|
||||
"user": "用户信息", "city": "城市信息", "street": "街道信息", "school": "学校信息", "company": "公司信息",
|
||||
"auth": "认证", "authCreate": "认证申请", "authCity": "城市认证", "authPersonal": "个人认证", "authService": "服务认证", "authCompany": "公司认证",
|
||||
"config": "配置", "code": "编程", "data": "数据", "cache": "缓存",
|
||||
"promote": "升级", "demote": "降级",
|
||||
"icons": {
|
||||
"goodslist": "https://img.icons8.com/officel/80/online-store.png",
|
||||
"paymentlist": "https://img.icons8.com/officel/80/online-payment-with-a-credit-card.png",
|
||||
|
@ -1,2 +1,3 @@
|
||||
$output>div>div.title { padding:10px; }
|
||||
$output>div>div.title { border-left:var(--box-notice3); padding:10px; margin-left:10px; }
|
||||
$output>div.from>div.title { border-left:var(--box-danger3); }
|
||||
$output>div.head { margin-bottom:0; }
|
@ -37,10 +37,10 @@ func (s profile) List(m *ice.Message, arg ...string) {
|
||||
name := m.Append(model.NAME)
|
||||
switch AuthType(kit.Int(m.Append(model.AUTH_TYPE))) {
|
||||
case AuthService:
|
||||
name = kit.JoinWord(m.Append(model.CITY_NAME), m.Append(model.STREET_NAME), m.Append(model.PLACE_NAME))
|
||||
kit.If(s.IsWorker(m), func() { m.PushAction(s.Modify, s.Enter) }, func() { m.PushAction() })
|
||||
s.SelectJoinRecent(m, "")
|
||||
s.SelectJoinService(m)
|
||||
name = kit.JoinWord(m.Append(model.CITY_NAME), m.Append(model.STREET_NAME), m.Append(model.PLACE_NAME))
|
||||
case AuthCompany:
|
||||
kit.If(s.IsWorker(m), func() { m.PushAction(s.Modify, s.Enter) }, func() { m.PushAction() })
|
||||
case AuthPersonal:
|
||||
|
Loading…
x
Reference in New Issue
Block a user