add renzheng

This commit is contained in:
jingganjiaoyu 2024-08-30 21:55:57 +08:00
parent 3ea9d3b12a
commit 54130a5be2
42 changed files with 634 additions and 261 deletions

View File

@ -47,6 +47,7 @@ func (s allow) List(m *ice.Message, arg ...string) {
m.PushButton()
}
}).Action()
s.DisplayBase(m, "")
}
func (s allow) Reject(m *ice.Message, arg ...string) {
s.process(m, AllowCreate, AllowRejected, m.Trans("role order rejected", "权限审批 已驳回"))

View File

@ -62,6 +62,7 @@ func (s apply) List(m *ice.Message, arg ...string) {
m.PushButton()
}
})
s.DisplayBase(m, "")
}
func (s apply) Cancel(m *ice.Message, arg ...string) {
s.changeStatus(m, ApplyCreate, ApplyCancel)

View File

@ -18,7 +18,6 @@ import (
type UserPlacer interface {
Placer
User(m *ice.Message, arg ...string)
}
type Placer interface {
Inputs(m *ice.Message, arg ...string)
@ -118,16 +117,20 @@ func (s Table) TablesWithRole(m *ice.Message, arg []string, userPlace UserPlacer
}
return s.SelectJoinUser(m)
}
func (s Table) UpdateAuth(m *ice.Message, arg ...string) {
s.Update(m, kit.Dict(model.AUTH_UID, arg[0]), arg[1:]...)
}
func (s Table) Select(m *ice.Message, arg ...string) *ice.Message {
defer s.Display(m, "")
s.Table.Select(m, arg...)
kit.If(m.Length() > 0, func() { s.UserPlaceInit(m) })
return m
}
func (s Table) SelectDetail(m *ice.Message, arg ...string) *ice.Message {
defer s.Display(m, "")
return s.Table.SelectDetail(m, arg...)
}
func (s Table) SelectJoinAuth(m *ice.Message) *ice.Message {
return s.SelectJoin(m, "web.team.renzhengshouquan.auth", model.STATUS)
}
func (s Table) SelectJoinUser(m *ice.Message) *ice.Message {
return s.SelectJoin(m, user{}, model.NAME, model.AVATAR)
}
@ -182,10 +185,10 @@ func (s Table) ChangeStatus(m *ice.Message, uid string, from, to int, arg ...str
return m
}
func (s Table) UserPlaceInit(m *ice.Message, arg ...string) {
if m.Option("user_place_init") == "" {
if m.Option("place_init") == "" {
return
}
m.Cmd(m.Prefix("portal"), "userPlaceCmd", "addCount", model.INIT, 1, m.Option("user_place_uid"), m.Option("user_place_init"))
m.Cmd(m.Prefix("portal"), "placeCmd", "addCount", model.INIT, 1, m.Option("place_uid"), m.Option("place_init"))
}
func (s Table) Update(m *ice.Message, data ice.Map, arg ...string) {
data[model.OPERATOR] = m.Option(model.USER_UID)
@ -199,9 +202,9 @@ func (s Table) RecordEventWithName(m *ice.Message, place_uid, info string, arg .
kit.If(info == "", func() {
info = m.ActionCmdTitle()
switch m.ActionKey() {
case mdb.CREATE:
case mdb.CREATE, "placeCreate":
info = "✅ " + info
case mdb.REMOVE:
case mdb.REMOVE, "placeRemove":
info = "❌ " + info
}
})
@ -214,7 +217,7 @@ func (s Table) AddRecent(m *ice.Message, arg ...string) {
func (s Table) SendMessage(m *ice.Message, from_user_uid, to_user_uid string, arg ...string) {
cmd := m.GetCommand()
kit.If(len(arg) == 0, func() { arg = append(arg, m.Option(s.Keys(s.Place, model.UID)), m.Option(model.UID)) })
m.Spawn(ice.Maps{db.DB: ""}).Cmd(message{}, s.Create, model.FROM_USER_UID, from_user_uid, model.TO_USER_UID, to_user_uid, model.PLACE_NAME, m.Option("_place_name"),
m.Spawn(ice.Maps{db.DB: ""}).Cmd(message{}, s.Create, model.FROM_USER_UID, from_user_uid, model.TO_USER_UID, to_user_uid, model.PLACE_NAME, m.Option(model.PLACE_NAME),
mdb.NAME, cmd.Help, mdb.ICON, cmd.Icon, web.SPACE, m.Option(ice.MSG_USERPOD), ctx.INDEX, m.PrefixKey(), ctx.ARGS, kit.Join(arg))
}
func (s Table) DoneMessage(m *ice.Message, arg ...string) {
@ -235,7 +238,7 @@ func (s Table) SendTemplate(m *ice.Message, from, user_uid, title string, arg ..
link := Portal{}.Link(m, place_uid, m.PrefixKey(), uid)
m.Cmd(user{}, s.SendTemplate, from, user_uid, link, title, name, kit.Cut(uid, 6))
}
func (s Table) Display(m *ice.Message, file string) *ice.Message {
func (s Table) DisplayBase(m *ice.Message, file string) *ice.Message {
if s.Place != nil {
m.Option("_place_uid", s.ToLower(kit.TypeName(s.Place))+"_uid")
m.Option("_place_name", s.ToLower(kit.TypeName(s.Place))+"_name")
@ -245,6 +248,11 @@ func (s Table) Display(m *ice.Message, file string) *ice.Message {
if s.Street != nil {
m.Option("_street_name", s.ToLower(kit.TypeName(s.Street))+"_name")
}
m.Display(m.Resource(path.Join(path.Dir(kit.FileLine(1, 100)), kit.Select(m.CommandKey()+".js", file))))
return m
}
func (s Table) Display(m *ice.Message, file string) *ice.Message {
s.DisplayBase(m, file)
base, sub := path.Dir(kit.FileLine(1, 100)), path.Dir(kit.FileLine(-1, 100))
return m.Display(kit.Format(mdb.Cache(m.Message, kit.Keys(m.PrefixKey(), ctx.DISPLAY, file), func() ice.Any {
if file == "" {

View File

@ -1,10 +1,7 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle && can.onimport.shareTitle(can, msg)
var PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type"), USER_PLACE_ROLE = msg.Option("_user_place_role")
PLACE_TYPE || can.core.List(msg.append, function(key) {
can.base.endWith(key, "_type") && (PLACE_TYPE = key)
can.base.endWith(key, "_role") && (USER_PLACE_ROLE = key)
})
PLACE_TYPE || can.core.List(msg.append, function(key) { can.base.endWith(key, "_type") && (PLACE_TYPE = key), can.base.endWith(key, "_role") && (USER_PLACE_ROLE = key) })
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list:[value.title||value.name||value.user_name,
can.onimport.textView(can, value, PLACE_TYPE, mdb.TYPE), can.onimport.textView(can, value, USER_PLACE_ROLE, aaa.ROLE),

View File

@ -26,6 +26,7 @@ func (s event) List(m *ice.Message, arg ...string) {
} else {
return
}
s.DisplayBase(m, "")
}
func init() { ice.TeamCtxCmd(event{Table: newTable()}) }

View File

@ -46,6 +46,7 @@ func (s Message) List(m *ice.Message, arg ...string) {
}).Action()
m.RenameAppend(model.FROM_USER_UID, model.USER_UID, model.STATUS, model.MESSAGE_STATUS)
s.SelectJoinUser(m)
s.DisplayBase(m, "")
}
func (s Message) Read(m *ice.Message, arg ...string) {
s.Table.Update(m, kit.Dict(model.STATUS, MessageRead), kit.Simple(model.TO_USER_UID, m.Option(model.USER_UID), m.OptionSimple(model.UID), model.STATUS, MessageCreate)...)

View File

@ -28,11 +28,17 @@ const (
PLACE_ADDRESS = "place_address"
STREET_UID = "street_uid"
STREET_NAME = "street_name"
COMPANY_NAME = "company_name"
CITY_UID = "city_uid"
CITY_NAME = "city_name"
AUTH_UID = "auth_uid"
AUTH_TYPE = "auth_type"
AUTH_NAME = "auth_name"
AUTH_STATUS = "auth_status"
EVENT_UID = "event_uid"
APPLY_UID = "apply_uid"
APPLY_STATUS = "apply_status"
FROM_UID = "from_uid"
ALLOW_UID = "allow_uid"
ALLOW_STATUS = "allow_status"
MESSAGE_UID = "message_uid"
@ -60,36 +66,28 @@ type Sess struct {
Agent string `gorm:"type:varchar(255)"`
}
type User struct {
db.ModelWithUID
db.ModelWithAuth
OpenID string `gorm:"type:char(32);index"`
Email string `gorm:"type:varchar(64)"`
Name string `gorm:"type:varchar(32)"`
Avatar string `gorm:"type:varchar(255)"`
}
type UserPlace struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
db.ModelUserPlace
PlaceUID string `gorm:"type:char(32);index"`
Role uint8 `gorm:"default:0"`
Init uint8 `gorm:"default:0"`
BeginTime db.Time
EndTime db.Time
}
type Place struct {
db.ModelWithUID
db.ModelPlace
StreetUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:varchar(64)"`
Address string `gorm:"type:varchar(255)"`
Type uint8 `gorm:"default:0"`
}
type Street struct {
db.ModelWithUID
CityUID string `gorm:"type:char(32);index:idx_city"`
Name string `gorm:"type:varchar(64);index:idx_city"`
Info string
db.ModelStreet
}
type City struct {
db.ModelWithUID
db.ModelWithAuth
Name string `gorm:"type:varchar(64);index"`
}

View File

@ -1,14 +1,27 @@
package gonganxitong
import "shylinux.com/x/ice"
import (
"shylinux.com/x/ice"
"shylinux.com/x/community/src/gonganxitong/model"
)
type placeUser struct {
Tables
user user
order string `data:"80"`
}
func (s placeUser) List(m *ice.Message, arg ...string) {
m.Cmdy(s.UserPlace, s.UserPlace.User, arg).Action()
s.Table.FieldsWithCreatedAT(m, s.UserPlace, model.USER_UID, s.Keys(s.UserPlace, model.ROLE))
if len(arg) == 1 {
m.Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0]).Action()
} 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
}
s.SelectJoinUser(m)
}
func init() { ice.TeamCtxCmd(placeUser{Tables: newTables()}) }

View File

@ -1,6 +1,7 @@
$output { background-color:var(--plugin-bg-color); }
$output div.item.card { margin-bottom:2px; }
$output div.item.card div.status span { word-break:break-all; }
$output div.item.card div.title span.auth { font-size:14px; }
$output div.item.card img { border-radius:5px; padding:0; margin:0; margin-right:10px; height:48px; width:48px; }
$output>div>div.list { border-radius:10px; background-color:var(--output-bg-color); padding:10px; margin:10px; }
$output>div>div.list>div.title { font-weight:bold; display:flex; align-items:center; }

View File

@ -23,6 +23,7 @@ type Portal struct {
list string `name:"list place_uid index uid auto" role:"void"`
placeCreate string `name:"placeCreate city_name* street_name* place_type*:select place_name* address*" icon:"bi bi-plus-square-dotted" role:"void"`
placeRemove string `name:"placeRemove uid*" role:"void"`
placeAuth string `name:"placeAuth" role:"void"`
placeSearch string `name:"placeSearch" icon:"bi bi-search" role:"void"`
scanQRCode string `name:"scanQRCode type text" icon:"bi bi-qr-code-scan" role:"void"`
setIcons string `name:"setIcons icons" icon:"bi bi-info-square"`
@ -51,6 +52,7 @@ func (s Portal) Inputs(m *ice.Message, arg ...string) {
m.Cmdy(s.Place, m.ActionKey(), arg)
}
func (s Portal) Run(m *ice.Message, arg ...string) {
s.DisplayBase(m, "common.js")
m.Search(arg[0], func(key string, cmd *ice.Command) {
sub, role := "", cmd.Role
if len(arg) > 1 && arg[1] == ctx.ACTION {
@ -80,13 +82,25 @@ func (s Portal) List(m *ice.Message, arg ...string) {
return
}
if len(arg) == 0 {
m.Cmdy(s.UserPlace, m.Option(model.USER_UID)).PushAction(s.PlaceRemove).Action(s.PlaceCreate, s.ScanQRCode, s.PlaceSearch)
USER_PLACE_ROLE := s.Keys(s.UserPlace, model.ROLE)
m.Cmdy(m.PrefixKey(), s.PlaceList, m.Option(model.USER_UID)).Table(func(value ice.Maps) {
switch UserPlaceRole(kit.Int(value[USER_PLACE_ROLE])) {
case UserPlaceCreator, UserPlaceLandlord:
if value[model.AUTH_STATUS] == "" {
m.PushButton(s.PlaceAuth, s.PlaceRemove)
break
}
fallthrough
default:
m.PushButton(s.PlaceRemove)
}
}).Action(s.PlaceCreate, s.ScanQRCode, s.PlaceSearch)
kit.If(!m.IsErr() && m.Length() == 0, func() { m.EchoInfoButton("", s.PlaceCreate, s.ScanQRCode, s.PlaceSearch) })
} else if len(arg) == 1 {
if arg[0] != "" {
m.Option("_user_place_role", s.Keys(s.UserPlace, model.ROLE))
m.Option("_street_name", s.Keys(s.Street, model.NAME))
msg := m.Cmd(s.UserPlace, m.Option(model.USER_UID), arg[0])
msg := m.Cmd(m.PrefixKey(), 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])
msg.Push(s.Keys(s.UserPlace, model.ROLE), "0")
@ -96,8 +110,7 @@ func (s Portal) List(m *ice.Message, arg ...string) {
}
s.UserPlace.RewriteAppend(msg)
m.Options(msg.AppendSimple(
s.Keys(s.UserPlace, model.ROLE),
s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE),
s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE), s.Keys(s.UserPlace, model.ROLE),
s.Keys(s.Street, model.NAME), model.CITY_NAME,
))
s.AddRecent(msg, arg[0], msg.Append(s.Keys(s.Place, model.NAME)), msg.Append(mdb.ICONS))
@ -111,7 +124,7 @@ func (s Portal) List(m *ice.Message, arg ...string) {
m.FieldsSetDetail().Cmdy(arg[1], mdb.SELECT, model.UID, arg[2]).PushAction().Action()
}
s.Place.RewriteAppend(m)
s.Display(m, "").DisplayCSS("")
s.DisplayBase(m, "portal.js").DisplayCSS("")
}
func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
@ -127,6 +140,7 @@ func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
return
}
s.RecordEventWithName(m.Options(mdb.NAME, name), m.Result(), "")
m.Option(s.Keys(s.Place, model.UID), m.Result())
args := kit.Simple(s.Keys(s.Place, model.UID), m.Result(), m.OptionSimple(model.USER_UID), model.ROLE, UserPlaceCreator)
m.SetResult().Cmdy(s.UserPlace, s.Create, args)
}
@ -134,6 +148,37 @@ func (s Portal) PlaceRemove(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
m.Cmdy(s.UserPlace, s.Delete, m.OptionSimple(model.USER_UID, model.UID))
}
func (s Portal) PlaceList(m *ice.Message, arg ...string) *ice.Message {
s.Tables(m, s.Place).FieldsWithCreatedAT(m, s.UserPlace,
s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE), s.Keys(s.UserPlace, model.ROLE),
model.INIT, model.AUTH_UID, s.Keys(s.Place, model.UID), s.Keys(s.Street, model.UID),
)
if len(arg) == 1 {
m.Cmdy(s.UserPlace, s.Table.Select, model.USER_UID, arg[0])
} else if len(arg) == 2 {
m.FieldsSetDetail().Cmdy(s.UserPlace, s.Table.Select, model.USER_UID, arg[0], s.Keys(s.Place, model.UID), arg[1])
} else {
return m
}
s.SelectJoin(m, s.Street, model.NAME, model.CITY_UID)
s.SelectJoinCity(m)
s.SelectJoinAuth(m)
return m
}
func (s Portal) PlaceAuth(m *ice.Message, arg ...string) {
if m.Option(model.AUTH_UID) == "" {
m.Option(model.COMPANY_NAME, m.Option(s.Keys(s.Street, model.NAME)))
msg := m.Cmd("web.team.renzhengshouquan.portal", s.PlaceCreate, m.OptionSimple(model.CITY_NAME, model.COMPANY_NAME),
model.AUTH_TYPE, AuthType, model.AUTH_NAME, m.Option(s.Keys(s.Place, model.NAME)), model.FROM_UID, ice.AUTO)
if msg.IsErr() {
m.Copy(msg)
return
}
m.Cmd(s.Place, s.UpdateAuth, msg.Option(model.AUTH_UID), model.UID, m.Option(s.Keys(s.Place, model.UID)))
} else {
m.ProcessHold()
}
}
func (s Portal) PlaceSearch(m *ice.Message, arg ...string) {
m.ProcessRewrite(model.INDEX, m.Prefix("search"))
}
@ -151,6 +196,11 @@ func (s Portal) ScanQRCode(m *ice.Message, arg ...string) {
func (s Portal) UserPlaceCmd(m *ice.Message, arg ...string) {
m.Cmdy(s.UserPlace, arg)
}
func (s Portal) PlaceCmd(m *ice.Message, arg ...string) {
m.Cmdy(s.Place, arg)
}
var AuthType int
func init() { ice.TeamCtxCmd(Portal{Table: newTable()}) }

View File

@ -11,7 +11,9 @@ Volcanos(chat.ONIMPORT, {
typeStyle: function(can, value, key) { return can.Conf("_trans.value."+key+".style."+value[key])||"" },
roleStyle: function(can, value, key) { return can.Conf("_trans.value."+key+".style."+value[key])||"" },
myValue: function(can, value) { return [
{view: html.TITLE, list: [value._name, {text: [value.__type, "", [mdb.TYPE, value._type, value._type_style]]},
{view: html.TITLE, list: [value._name,
can.base.isIn(value.auth_status, "issued", "2") && {view: ["auth", html.SPAN], list: [{icon: "bi bi-patch-check-fill", style: {color: "var(--notice-bg-color)"}}]},
{text: [value.__type, "", [mdb.TYPE, value._type, value._type_style]]},
value._role != "visitor" && {text: [value.__role, "", [aaa.ROLE, value._role, value._role_style]]},
]},
{view: html.STATUS, list: [value.uid.slice(0, 6), value.city_name, value._street]},
@ -90,10 +92,13 @@ Volcanos(chat.ONIMPORT, {
can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Init", "我的初始化")}]}])
msg.Table(function(val) {
if (parseInt(val.init) == parseInt(value.init)+1) { val.args = [value._uid], val.style = html.OUTPUT, value._init = true
debugger
can.onappend.plugin(can, val, function(sub) { var run = sub.run
sub.run = function(event, cmds, cb) {
run(can.request(event, {user_place_uid: value.uid, user_place_init: value.init}), cmds, function(msg) {
if (cmds[1] == mdb.CREATE || cmds.length == 1 && msg.Length() > 0) { can.onmotion.clearInput(can), can.Update() } else { cb(msg) }
run(can.request(event, {place_uid: value._uid, place_init: value.init}), cmds, function(msg) {
if (cmds[1] == mdb.CREATE || cmds.length == 1 && msg.Length() > 0) {
debugger
can.onmotion.clearInput(can), can.Update() } else { cb(msg) }
})
}
}, target)
@ -164,7 +169,7 @@ Volcanos(chat.ONIMPORT, {
})
can.onexport.title(can, sub.Conf(PLACE_NAME, msg.Option(PLACE_NAME)), value.help)
sub.onexport.title = function(sub) { can.onexport.title.apply(can.onexport, [can].concat(can.core.List(arguments).slice(1))) }
var run = sub.run; sub.run = function(event, cmds, cb) { run(can.request(event, {_place_name: sub.Conf(PLACE_NAME)}), cmds, cb) }
var run = sub.run; sub.run = function(event, cmds, cb) { run(can.request(event, {place_name: sub.Conf(PLACE_NAME)}), cmds, cb) }
can.page.Appends(can, ui.action, list)
goback = function() { can.page.ClassList.add(can, can._fields, "_back")
can.onexport.hash(can, ""), can.Option(PLACE_UID, ""), can.Option(ctx.INDEX, ""), can.Update()
@ -211,8 +216,7 @@ Volcanos(chat.ONIMPORT, {
},
plugin: function(can, value) { var action = can._root.Action
var sup = can.sup.sup
value.space = value.space||sup.ConfSpace()
value.index = value.index||sup.ConfIndex()
value.space = value.space||sup.ConfSpace(), value.index = value.index||sup.ConfIndex()
var key = [value.space, value.index, value.args].join(","), sub = action._plugins[key]
if (sub) {
can.page.SelectChild(can, action._output, html.FIELDSET_PLUGIN, function(target) { can.onmotion.toggle(can, target, target == sub._target) })
@ -238,11 +242,9 @@ Volcanos(chat.ONIMPORT, {
cb && cb(sub)
})
},
layout: function(can) {
can.ui.action && can.ui.output && can.onmotion.delay(can, function() {
can.page.style(can, can.ui.output, html.HEIGHT, can.ConfHeight() - can.ui.action.offsetHeight)
})
},
layout: function(can) { can.ui.action && can.ui.output && can.onmotion.delay(can, function() {
can.page.style(can, can.ui.output, html.HEIGHT, can.ConfHeight() - can.ui.action.offsetHeight)
}) },
})
Volcanos(chat.ONEXPORT, {
value: function(can, value, PLACE_UID) { if (!value) { return }

View File

@ -2,6 +2,7 @@
"portal": "用户场景",
"placeCreate": "创建", "placeRemove": "删除",
"placeSearch": "搜索", "scanQRCode": "扫码",
"placeAuth": "认证",
"qrcode": "场景码", "event": "事件流", "apply": "权限申请", "allow": "权限审批",
"email": "邮箱配置", "member": "场景成员", "placeUser": "场景成员",
"message": "消息待办", "recent": "最近访问", "service": "服务发现", "support": "客服支持",

View File

@ -8,9 +8,10 @@ import (
type qrcode struct {
Tables
order string `data:"90"`
role string `data:"creator"`
apply string `name:"apply" role:"void"`
portal Portal
order string `data:"90"`
role string `data:"creator"`
apply string `name:"apply" role:"void"`
}
func (s qrcode) Apply(m *ice.Message, arg ...string) {
@ -23,9 +24,8 @@ func (s qrcode) List(m *ice.Message, arg ...string) {
m.EchoQRCode(m.MergePodCmd("", m.Prefix("portal"), s.Keys(s.Place, model.UID), arg[0]))
}
func (s qrcode) info(m *ice.Message, place_uid, typ string) {
m.Cmdy(s.UserPlace, m.Option(model.USER_UID), place_uid).Cut(model.CITY_NAME, s.Keys(s.Street, model.NAME), s.Keys(s.Place, model.NAME))
m.Push(model.QRCODE_TYPE, typ)
m.Action(s.Apply)
m.Cmdy(m.Prefix("portal"), s.portal.PlaceList, m.Option(model.USER_UID), place_uid).Cut(model.CITY_NAME, s.Keys(s.Street, model.NAME), s.Keys(s.Place, model.NAME))
m.Push(model.QRCODE_TYPE, typ).Action(s.Apply)
}
func init() { ice.TeamCtxCmd(qrcode{Tables: newTables()}) }

View File

@ -35,6 +35,7 @@ func (s recent) List(m *ice.Message, arg ...string) {
s.SelectDetail(m, model.USER_UID, m.Option(model.USER_UID), model.UID, arg[1])
}
m.PushAction(s.Open, s.Remove).Action()
s.DisplayBase(m, "")
}
func (s recent) Open(m *ice.Message, arg ...string) {
m.ProcessOpen(web.S(m.Option(web.SPACE)) + web.C(m.Option(ctx.INDEX)) + "#" + kit.Join(kit.Split(m.Option(ctx.ARGS)), ":"))

View File

@ -20,23 +20,16 @@ const (
)
type User{{.Option "Class"}} struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
db.ModelUserPlace
{{.Option "Class"}}UID string `gorm:"type:char(32);index"`
Role uint8 `gorm:"default:0"`
}
type {{.Option "Class"}} struct {
db.ModelWithUID
db.ModelPlace
CompanyUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:varchar(64)"`
Type uint8 `gorm:"default:0"`
}
type {{.Option "Table"}} struct {
db.ModelWithUID
db.ModelContent
{{.Option "Class"}}UID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32);index"`
Title string `gorm:"type:varchar(64)"`
Content string
}

View File

@ -1,7 +1,5 @@
{
"portal": "{{.Option "help"}}",
"placeCreate": "创建场景",
"placeRemove": "删除场景",
"{{.Option "table"}}": "场景应用",
"icons": {
"{{.Option "table"}}": "https://img.icons8.com/officel/80/activity-grid.png"
@ -20,7 +18,8 @@
"worker": "工作人员",
"server": "服务人员",
"style": {
"creator": "danger"
"creator": "danger",
"leader": "danger"
}
},
"{{.Option "class"}}_type": {

View File

@ -1,45 +1,10 @@
package {{.Option "name"}}
import (
"shylinux.com/x/ice"
import "shylinux.com/x/ice"
"{{.Option "module"}}/model"
)
type user{{.Option "Class"}} struct{ Table }
type user{{.Option "Class"}} struct {
Table
{{.Option "class"}} {{.Option "class"}}
}
func (s user{{.Option "Class"}}) User(m *ice.Message, arg ...string) {
s.FieldsWithCreatedAT(m, s, model.USER_UID, model.ROLE)
if len(arg) == 1 {
s.Select(m, model.{{.Option "CLASS"}}_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.{{.Option "CLASS"}}_UID, arg[0], model.UID, arg[1])
} else {
return
}
m.RenameAppend(model.ROLE, model.USER_{{.Option "CLASS"}}_ROLE)
s.SelectJoinUser(m)
}
func (s user{{.Option "Class"}}) List(m *ice.Message, arg ...string) {
s.Tables(m, s.{{.Option "class"}}).FieldsWithCreatedAT(m, s,
model.{{.Option "CLASS"}}_NAME, model.{{.Option "CLASS"}}_TYPE, model.USER_{{.Option "CLASS"}}_ROLE,
model.COMPANY_UID, model.{{.Option "CLASS"}}_UID,
)
if len(arg) == 1 {
s.Select(m, model.USER_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.USER_UID, arg[0], s.Key(s, model.{{.Option "CLASS"}}_UID), arg[1])
} else {
return
}
s.SelectJoinCompany(m)
s.SelectJoinCity(m)
}
func init() { ice.TeamCtxCmd(user{{.Option "Class"}}{}) }
func init() { ice.TeamCtxCmd(user{}) }
type User{{.Option "Class"}}Role int

View File

@ -1,45 +1,10 @@
package gonganxitong
import (
"shylinux.com/x/ice"
import "shylinux.com/x/ice"
"shylinux.com/x/community/src/gonganxitong/model"
)
type userPlace struct{ Table }
type userPlace struct {
Table
user user
place place
street street
city city
}
func (s userPlace) User(m *ice.Message, arg ...string) {
s.Tables(m, s.user).FieldsWithCreatedAT(m, s, model.USER_AVATAR, model.USER_NAME, model.USER_PLACE_ROLE)
if len(arg) == 1 {
s.Select(m, model.PLACE_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.PLACE_UID, arg[0], s.Key(s, model.UID), arg[1])
} else {
return
}
}
func (s userPlace) List(m *ice.Message, arg ...string) {
s.Tables(m, s.place, s.street, s.city).FieldsWithCreatedAT(m, s,
model.PLACE_NAME, model.PLACE_TYPE, model.USER_PLACE_ROLE,
model.CITY_NAME, model.STREET_NAME, model.PLACE_ADDRESS, model.PLACE_UID,
model.INIT,
)
if len(arg) == 1 {
s.Select(m, model.USER_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.USER_UID, arg[0], s.Key(s, model.PLACE_UID), arg[1])
} else {
return
}
}
func init() { ice.TeamCtxCmd(userPlace{Table: newTable()}) }
func init() { ice.TeamCtxCmd(userPlace{}) }
type UserPlaceRole int

View File

@ -14,29 +14,22 @@ const (
GROUP_UID = "group_uid"
GROUP_NAME = "group_name"
GROUP_TYPE = "group_type"
ACTIVITY_UID = "_uid"
ACTIVITY_UID = "activity_uid"
COMPANY_UID = "company_uid"
CITY_UID = "city_uid"
)
type UserGroup struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
db.ModelUserPlace
GroupUID string `gorm:"type:char(32);index"`
Role uint8 `gorm:"default:0"`
}
type Group struct {
db.ModelWithUID
db.ModelPlace
CompanyUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:varchar(64)"`
Type uint8 `gorm:"default:0"`
}
type Activity struct {
db.ModelWithUID
db.ModelContent
GroupUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32);index"`
Title string `gorm:"type:varchar(64)"`
Content string
}
func init() { db.CmdModels("", &UserGroup{}, &Group{}, &Activity{}) }

View File

@ -1,7 +1,7 @@
{
"portal": "活动组织",
"activity": "活动安排",
"member": "组织成员",
"activity": "活动安排",
"icons": {
"activity": "https://img.icons8.com/officel/80/activity-grid.png"
},

View File

@ -1,43 +1,8 @@
package huodongzuzhi
import (
"shylinux.com/x/ice"
import "shylinux.com/x/ice"
"shylinux.com/x/community/src/huodongzuzhi/model"
)
type userGroup struct {
Table
group group
}
func (s userGroup) User(m *ice.Message, arg ...string) {
s.FieldsWithCreatedAT(m, s, model.USER_UID, model.ROLE)
if len(arg) == 1 {
s.Select(m, model.GROUP_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.GROUP_UID, arg[0], model.UID, arg[1])
} else {
return
}
m.RenameAppend(model.ROLE, model.USER_GROUP_ROLE)
s.SelectJoinUser(m)
}
func (s userGroup) List(m *ice.Message, arg ...string) {
s.Tables(m, s.group).FieldsWithCreatedAT(m, s,
model.GROUP_NAME, model.GROUP_TYPE, model.USER_GROUP_ROLE,
model.COMPANY_UID, model.GROUP_UID,
)
if len(arg) == 1 {
s.Select(m, model.USER_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.USER_UID, arg[0], s.Key(s, model.GROUP_UID), arg[1])
} else {
return
}
s.SelectJoinCompany(m)
s.SelectJoinCity(m)
}
type userGroup struct{ Table }
func init() { ice.TeamCtxCmd(userGroup{}) }

View File

@ -5,6 +5,7 @@ import (
_ "shylinux.com/x/community/src/gonganxitong"
_ "shylinux.com/x/community/src/huodongzuzhi"
_ "shylinux.com/x/community/src/renzhengshouquan"
_ "shylinux.com/x/community/src/yuehaoxitong"
)

View File

@ -0,0 +1,107 @@
package renzhengshouquan
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong"
"shylinux.com/x/community/src/renzhengshouquan/model"
)
type auth struct {
Table
certList string `name:"certList" role:"leader,worker"`
memberList string `name:"memberList" role:"leader,worker"`
issue string `name:"issue" role:"leader,worker"`
revoke string `name:"revoke" role:"leader,worker"`
}
func (s auth) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
s.Select(m, model.FROM_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.FROM_UID, arg[0], model.UID, arg[1])
m.Action(s.CertList, s.MemberList)
}
m.Table(func(value ice.Maps) {
switch AuthStatus(kit.Int(value[model.STATUS])) {
case AuthCreate:
m.PushButton(s.Issue)
case AuthIssued:
m.PushButton(s.Revoke)
default:
m.PushButton()
}
})
m.RenameAppend(model.TYPE, model.AUTH_TYPE, model.STATUS, model.AUTH_STATUS).Display("")
}
func (s auth) CertList(m *ice.Message, arg ...string) {
m.Cmdy(cert{}, arg[0]).Action()
kit.If(m.Length() == 0, func() { m.Echo("没有上传证件") })
}
func (s auth) MemberList(m *ice.Message, arg ...string) {
// m.Cmdy(userAuth{}, userAuth{}.User, arg[0]).Action()
}
func (s auth) Issue(m *ice.Message, arg ...string) {
msg := m.Cmd(userAuth{}, m.Option(model.USER_UID), m.Option(model.AUTH_UID))
if !m.IsTech() || AuthType(kit.Int(msg.Append(model.AUTH_TYPE))) != AuthRoot {
if m.WarnNotValid(AuthStatus(kit.Int(msg.Append(model.AUTH_STATUS))) != AuthIssued) {
return
}
}
s.Update(m, kit.Dict(model.STATUS, AuthIssued), model.FROM_UID, m.Option(model.AUTH_UID), model.UID, m.Option(model.UID))
s.Select(m, model.UID, m.Option(model.UID))
switch AuthType(kit.Int(m.Append(model.TYPE))) {
case AuthCity:
m.Cmd("web.team.gonganxitong.city", s.UpdateAuth, m.Option(model.UID), model.NAME, m.Append(model.NAME))
case AuthCompany:
m.Cmd("web.team.guanlixitong.company", s.UpdateAuth, m.Option(model.UID), model.NAME, m.Append(model.NAME))
case AuthPersonal:
m.Cmd("web.team.gonganxitong.user", s.UpdateAuth, m.Option(model.UID), model.UID, m.Append(model.CREATOR))
}
}
func (s auth) Revoke(m *ice.Message, arg ...string) {
s.Update(m, kit.Dict(model.STATUS, AuthRevoked), model.FROM_UID, m.Option(model.AUTH_UID), model.UID, m.Option(model.UID))
}
func init() { ice.TeamCtxCmd(auth{}) }
type AuthType int
const (
AuthRoot AuthType = iota
AuthCity
AuthCompany
AuthService
AuthPersonal
)
var AuthTypeList = map[AuthType]string{
AuthRoot: "root",
AuthCity: "city",
AuthCompany: "company",
AuthService: "service",
AuthPersonal: "personal",
}
func (s AuthType) String() string { return AuthTypeList[s] }
func init() { gonganxitong.AuthType = int(AuthService) }
type AuthStatus int
const (
AuthCreate AuthStatus = iota
AuthRequest
AuthIssued
AuthRevoked
)
var AuthStatusList = map[AuthStatus]string{
AuthCreate: "create",
AuthRequest: "request",
AuthIssued: "issued",
AuthRevoked: "revoked",
}
func (s AuthStatus) String() string { return AuthStatusList[s] }

View File

@ -0,0 +1,9 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [value.name||value.title||value.user_name, can.onimport.textView(can, value, "auth_type")]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), can.onimport.textView(can, value, "auth_status")]},
{view: html.OUTPUT, list: [value.info||value.content]},
] })
},
})

View File

@ -0,0 +1,25 @@
package renzhengshouquan
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/renzhengshouquan/model"
)
type cert struct {
Table
auth auth
userAuth userAuth
create string `name:"create title* content*" role:"leader"`
}
func (s cert) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.AUTH_UID))...)
s.recordEventWithName(m, "")
}
func (s cert) List(m *ice.Message, arg ...string) {
s.TablesWithRole(m, arg, s.userAuth, s.auth, s, model.TITLE, model.CONTENT).Display("")
}
func init() { ice.TeamCtxCmd(cert{}) }

View File

@ -0,0 +1,9 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
{view: html.OUTPUT, list: [value.content]},
] })
},
})

View File

@ -0,0 +1,77 @@
package renzhengshouquan
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/renzhengshouquan/model"
"shylinux.com/x/enterprise/src/guanlixitong"
)
type Table struct {
guanlixitong.Table
list string `name:"list auth_uid uid auto" role:"void"`
}
func (s Table) Inputs(m *ice.Message, arg ...string) {
switch arg[0] {
case model.USER_AUTH_ROLE:
s.InputsListRole(m, UserAuthRoleList, arg...)
case model.AUTH_TYPE:
if m.IsTech() {
s.InputsList(m, AuthTypeList, arg...)
} else {
for i, v := range AuthTypeList {
kit.If(i > 0, func() { m.Push(arg[0], i).Push(model.NAME, v) })
}
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
}
case model.AUTH_STATUS:
s.InputsList(m, AuthStatusList, arg...)
case model.FROM_UID:
switch AuthType(kit.Int(m.Option(model.AUTH_TYPE))) {
case AuthRoot:
m.Push(model.UID, "root").Push(model.NAME, "root")
case AuthCity:
m.Cmdy(auth{}, s.Select, model.TYPE, AuthRoot)
case AuthCompany, AuthPersonal:
m.Cmdy(auth{}, s.Select, model.TYPE, AuthCity)
default:
msg := m.Cmd(auth{}, s.Select, model.TYPE, AuthCity, model.NAME, m.Option(model.CITY_NAME))
m.Cmdy(auth{}, s.Select, model.TYPE, AuthCompany, model.FROM_UID, msg.Append(model.UID))
}
m.Cut(model.UID, model.NAME).RenameAppend(model.UID, model.FROM_UID)
m.DisplayInputKeyNameIconTitle()
default:
s.Table.Inputs(m, arg...)
}
}
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
m.RewriteAppend(func(value, key string, index int) string {
switch key {
case model.USER_AUTH_ROLE:
value = UserAuthRole(kit.Int(value)).String()
case model.AUTH_TYPE:
value = AuthType(kit.Int(value)).String()
case model.AUTH_STATUS:
value = AuthStatus(kit.Int(value)).String()
}
return value
})
return s.Table.RewriteAppend(m)
}
func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message {
role := UserAuthRole(kit.Int(m.Cmd(userAuth{}, s.Select, m.OptionSimple(model.AUTH_UID, model.USER_UID)).Append(model.ROLE)))
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserAuthCreator.String())...), role.String())
return m
}
func (s Table) recordEvent(m *ice.Message, info string, arg ...string) {
s.Table.RecordEvent(m, m.Option(model.AUTH_UID), info, kit.Select(m.Option(model.UID), arg, 0))
}
func (s Table) recordEventWithName(m *ice.Message, info string, arg ...string) {
s.Table.RecordEventWithName(m, m.Option(model.AUTH_UID), info)
}
type Tables struct{ Table }
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}

View File

@ -0,0 +1,45 @@
package model
import "shylinux.com/x/mysql-story/src/db"
const (
UID = "uid"
NAME = "name"
TYPE = "type"
ROLE = "role"
STATUS = "status"
TITLE = "title"
CONTENT = "content"
CREATOR = "creator"
USER_UID = "user_uid"
USER_AUTH_ROLE = "user_auth_role"
AUTH_UID = "auth_uid"
AUTH_NAME = "auth_name"
AUTH_TYPE = "auth_type"
AUTH_STATUS = "auth_status"
CERT_UID = "cert_uid"
COMPANY_UID = "company_uid"
COMPANY_NAME = "company_name"
CITY_UID = "city_uid"
CITY_NAME = "city_name"
FROM_UID = "from_uid"
)
type UserAuth struct {
db.ModelUserPlace
AuthUID string `gorm:"type:char(32);index"`
}
type Auth struct {
db.ModelWithUID
CompanyUID string `gorm:"type:char(32);index"`
FromUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:varchar(64)"`
Type uint8 `gorm:"default:0"`
Status uint8 `gorm:"default:0"`
}
type Cert struct {
db.ModelContent
AuthUID string `gorm:"type:char(32);index"`
}
func init() { db.CmdModels("", &UserAuth{}, &Auth{}, &Cert{}) }

View File

@ -0,0 +1,78 @@
package renzhengshouquan
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong"
"shylinux.com/x/community/src/renzhengshouquan/model"
"shylinux.com/x/enterprise/src/guanlixitong"
)
type Portal struct {
gonganxitong.Portal
placeCreate string `name:"placeCreate city_name* company_name* auth_type*:select auth_name* from_uid*:select" role:"void"`
}
func (s Portal) List(m *ice.Message, arg ...string) {
s.Portal.List(m, arg...)
kit.If(len(arg) == 0 && m.Length() > 0, func() { m.PushAction(s.PlaceRemove) })
}
func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
if m.Option(model.FROM_UID) == "auto" {
from := ""
switch AuthType(kit.Int(m.Option(model.AUTH_TYPE))) {
case AuthRoot:
case AuthCity:
from = s.findAuthFrom(m, AuthRoot)
case AuthCompany, AuthPersonal:
from = s.findAuthFrom(m, AuthCity, model.NAME, m.Option(model.CITY_NAME))
case AuthService:
city_uid := s.findAuthFrom(m, AuthCity, model.NAME, m.Option(model.CITY_NAME))
if city_uid == "" {
return
}
from = s.findAuthFrom(m, AuthCompany, model.NAME, m.Option(model.COMPANY_NAME), model.FROM_UID, city_uid)
}
if from == "" {
return
}
arg = append(arg, model.FROM_UID, m.Option(model.FROM_UID, from))
}
if m.WarnNotRight(AuthType(kit.Int(m.Option(model.AUTH_TYPE))) == AuthRoot && !m.IsTech()) {
return
}
if AuthType(kit.Int(m.Option(model.AUTH_TYPE))) == AuthRoot && m.IsTech() {
arg = append(arg, model.STATUS, kit.Format(AuthIssued))
}
s.Portal.PlaceCreate(m, arg...)
}
func (s Portal) PlaceList(m *ice.Message, arg ...string) *ice.Message {
s.Tables(m, "left join auths on user_auths.auth_uid = auths.uid").FieldsWithCreatedAT(m, s.UserPlace,
s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE), s.Keys(s.UserPlace, model.ROLE),
s.Keys(s.Place, model.STATUS),
s.AS(s.Key(s.Place, model.UID), s.Keys(s.Place, model.UID)), s.Keys(s.Street, model.UID),
)
if len(arg) == 1 {
m.Cmdy(s.UserPlace, s.Table.Select, model.USER_UID, arg[0])
} else if len(arg) == 2 {
m.FieldsSetDetail().Cmdy(s.UserPlace, s.Table.Select, model.USER_UID, arg[0], s.Key(s.UserPlace, s.Keys(s.Place, model.UID)), arg[1])
} else {
return m
}
s.SelectJoin(m, s.Street, model.NAME, model.CITY_UID)
s.SelectJoinCity(m)
return m
}
func init() {
gonganxitong.PortalCmd(Portal{Portal: gonganxitong.NewPortal(userAuth{}, auth{}, guanlixitong.Company{})})
}
func (s Portal) findAuthFrom(m *ice.Message, authType AuthType, arg ...string) string {
msg := m.Cmd(auth{}, s.Table.Select, model.TYPE, authType, arg)
if m.WarnNotFound(msg.Length() == 0, authType.String()) {
return ""
}
return msg.Append(model.UID)
}

View File

@ -0,0 +1,61 @@
{
"portal": "认证授权",
"cert": "上传证件",
"auth": "认证授权",
"certList": "证件",
"memberList": "成员",
"issue": "认证",
"revoke": "吊销",
"style": {
"revoke": "danger"
},
"icons": {
"auth": "https://img.icons8.com/officel/80/activity-grid.png",
"cert": "https://img.icons8.com/officel/80/activity-grid.png"
},
"input": {
"My Auth": "我的认证",
"user_auth_role": "用户角色",
"from_uid": "认证机构",
"auth_name": "主体名称",
"auth_type": "主体类型",
"auth_status": "认证状态"
},
"value": {
"user_auth_role": {
"visitor": "访客",
"creator": "创建人",
"leader": "管理人员",
"worker": "工作人员",
"server": "服务人员",
"style": {
"creator": "danger",
"leader": "danger"
}
},
"auth_type": {
"root": "官方",
"city": "城市",
"company": "公司",
"service": "服务",
"personal": "个人",
"style": {
"root": "danger",
"city": "danger"
},
"icons": {
"root": "https://img.icons8.com/officel/80/console.png",
"city": "https://img.icons8.com/officel/80/city-buildings.png",
"company": "https://img.icons8.com/officel/80/organization.png",
"service": "https://img.icons8.com/officel/80/meeting-room.png",
"personal": "https://img.icons8.com/officel/80/identification-documents--v1.png"
}
},
"auth_status": {
"create": "🕑 待认证",
"request": "🕑 待认证",
"issued": "✅ 已认证",
"revoked": "❌ 已吊销"
}
}
}

View File

@ -0,0 +1,27 @@
package renzhengshouquan
import "shylinux.com/x/ice"
type userAuth struct{ Table }
func init() { ice.TeamCtxCmd(userAuth{}) }
type UserAuthRole int
const (
UserAuthVisitor UserAuthRole = iota
UserAuthCreator
UserAuthLeader
UserAuthWorker
UserAuthServer
)
var UserAuthRoleList = map[UserAuthRole]string{
UserAuthVisitor: "visitor",
UserAuthCreator: "creator",
UserAuthLeader: "leader",
UserAuthWorker: "worker",
UserAuthServer: "server",
}
func (s UserAuthRole) String() string { return UserAuthRoleList[s] }

View File

@ -38,17 +38,12 @@ const (
)
type UserQueue struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
db.ModelUserPlace
QueueUID string `gorm:"type:char(32);index"`
Role uint8 `gorm:"default:0"`
Init uint8 `gorm:"default:0"`
}
type Queue struct {
db.ModelWithUID
db.ModelPlace
CompanyUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:varchar(64)"`
Type uint8 `gorm:"default:0"`
}
type Reception struct {
db.ModelWithUID

View File

@ -19,9 +19,8 @@ func (s open) Create(m *ice.Message, arg ...string) {
s.RecordEvent(m, m.Trans("create volume", "创建服务计划")+"\n"+s.joinKV(m, model.AMOUNT, model.BEGIN_TIME, model.END_TIME), m.Result())
}
func (s open) List(m *ice.Message, arg ...string) {
if m.Cmdy(s.volume, arg); m.Length() == 0 {
m.EchoInfoButton("", s.Create)
}
m.Cmdy(s.volume, arg)
kit.If(m.Length() == 0, func() { m.EchoInfoButton("") })
}
func init() { ice.TeamCtxCmd(open{}) }

View File

@ -19,10 +19,9 @@ func (s plan) Create(m *ice.Message, arg ...string) {
func (s plan) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
s.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID))...).PushAction(s.Cancel)
kit.If(m.Length() == 0, func() { m.EchoInfoButton("", s.Create) }, func() { m.Action(s.Create) })
kit.If(m.Length() == 0, func() { m.EchoInfoButton("") }, func() { m.Action(s.Create) })
} else if len(arg) == 2 {
m.FieldsSetDetail()
s.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID), s.Key(s.Schedule, model.UID), arg[1])...).PushAction(s.Cancel)
m.Cmdy(s.Schedule, arg)
}
}

View File

@ -90,6 +90,9 @@ func (s Schedule) List(m *ice.Message, arg ...string) {
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0], model.USER_UID, m.Option(model.USER_UID))
} else if len(arg) == 2 {
s.SelectDetail(m, s.Key(s, model.QUEUE_UID), arg[0], model.USER_UID, m.Option(model.USER_UID), s.Key(s, model.UID), arg[1])
if ScheduleStatus(kit.Int(m.Append(model.SCHEDULE_STATUS))) == ScheduleFinish {
s.DoneMessage(m)
}
}
m.Table(func(value ice.Maps) {
switch ScheduleStatus(kit.Int(value[model.SCHEDULE_STATUS])) {

View File

@ -1,17 +1,17 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) {
var time = {view: html.STATUS, list: [{text: "开始时间:"}, {text: value.begin_time}]}
var time = {view: html.STATUS, list: [{text: can.user.trans(can, "begin_time:", "开始时间:")}, {text: value.begin_time}]}
if (value.finish_time) {
time = {view: html.STATUS, list: [{text: "完成时间:"}, {text: value.finish_time}]}
time = {view: html.STATUS, list: [{text: can.user.trans(can, "finish_time:", "完成时间:")}, {text: value.finish_time}]}
} else if (value.expire_time) {
time = {view: html.STATUS, list: [{text: "过号时间:"}, {text: value.expire_time}]}
time = {view: html.STATUS, list: [{text: can.user.trans(can, "expired_time:", "过号时间:")}, {text: value.expire_time}]}
} else if (value.call_time) {
time = {view: html.STATUS, list: [{text: "叫号时间:"}, {text: value.call_time}]}
time = {view: html.STATUS, list: [{text: can.user.trans(can, "call_time:", "叫号时间:")}, {text: value.call_time}]}
} else if (value.take_time) {
time = {view: html.STATUS, list: [{text: "取号时间:"}, {text: value.take_time}]}
time = {view: html.STATUS, list: [{text: can.user.trans(can, "take_time:", "取号时间:")}, {text: value.take_time}]}
} else {
var _time = {view: html.STATUS, list: [{text: "结束时间:"}, {text: value.end_time}]}
var _time = {view: html.STATUS, list: [{text: can.user.trans(can, "finish_time:", "结束时间:")}, {text: value.end_time}]}
}
return [
{view: html.TITLE, list:[{text: [value.name||value.user_name]}, {text: value.reception_name},

View File

@ -17,8 +17,7 @@ func (s take) List(m *ice.Message, arg ...string) {
s.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID))...).PushAction(s.Take)
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found plan", "没有未取的号")) })
} else if len(arg) == 2 {
m.FieldsSetDetail()
s.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID), s.Key(s.Schedule, model.UID), arg[1])...).PushAction(s.Take)
m.Cmdy(s.Schedule, arg)
}
}

View File

@ -1,46 +1,10 @@
package yuehaoxitong
import (
"shylinux.com/x/ice"
import "shylinux.com/x/ice"
"shylinux.com/x/community/src/yuehaoxitong/model"
)
type userQueue struct{ Table }
type userQueue struct {
Table
queue queue
}
func (s userQueue) User(m *ice.Message, arg ...string) {
s.FieldsWithCreatedAT(m, s, model.USER_UID, model.ROLE)
if len(arg) == 1 {
s.Select(m, model.QUEUE_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.QUEUE_UID, arg[0], model.UID, arg[1])
} else {
return
}
m.RenameAppend(model.ROLE, model.USER_QUEUE_ROLE)
s.SelectJoinUser(m)
}
func (s userQueue) List(m *ice.Message, arg ...string) {
s.Tables(m, s.queue).FieldsWithCreatedAT(m, s,
model.QUEUE_NAME, model.QUEUE_TYPE, model.USER_QUEUE_ROLE,
model.COMPANY_UID, model.QUEUE_UID,
model.INIT,
)
if len(arg) == 1 {
s.Select(m, model.USER_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.USER_UID, arg[0], model.QUEUE_UID, arg[1])
} else {
return
}
s.SelectJoinCompany(m)
s.SelectJoinCity(m)
}
func init() { ice.TeamCtxCmd(userQueue{Table: newTable()}) }
func init() { ice.TeamCtxCmd(userQueue{}) }
type UserQueueRole int

View File

@ -23,6 +23,7 @@ func (s volume) List(m *ice.Message, arg ...string) {
model.BEGIN_TIME, model.END_TIME,
)
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0])
m.Display("")
} else if len(arg) == 2 {
s.Fields(m, model.CREATED_AT, model.UID, model.USER_UID, s.AS(model.STATUS, model.SCHEDULE_STATUS))
m.Cmdy(Schedule{}, s.Select, "volume_uid = ? and status != ?", arg[1], ScheduleCancel)

View File

@ -2,10 +2,10 @@ Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [value.reception_name]},
{view: html.STATUS, list: ["放号量:", value.amount, "预约量:", value.count]},
{view: html.STATUS, list: ["过号量:", value.expire||"0", "完成量: ", value.finish||"0"]},
{view: html.STATUS, list: ["开始时间:", value.begin_time]},
{view: html.STATUS, list: ["结束时间:", value.end_time]},
{view: html.STATUS, list: [can.user.trans(can, "open:", "放号量:"), value.amount, can.user.trans(can, "plan:", "预约量:"), value.count]},
{view: html.STATUS, list: [can.user.trans(can, "expired:", "过号量:"), value.expire||"0", can.user.trans(can, "finish:", "完成量:"), value.finish||"0"]},
{view: html.STATUS, list: [can.user.trans(can, "begin_time:", "开始时间:"), value.begin_time]},
{view: html.STATUS, list: [can.user.trans(can, "end_time:", "结束时间:"), value.end_time]},
] })
},
})

View File

@ -678,6 +678,13 @@
"type": "hash"
}
},
"c14bbc5551aa7569bdfdd98235dcf3ee": {
"meta": {
"index": "web.team.renzhengshouquan.portal",
"time": "2024-08-29 12:42:09.286",
"type": "hash"
}
},
"c2ea40ac2130923b160703e7adea18b6": {
"meta": {
"index": "web.team.jiaoxuexitong2.service",

View File

@ -47,13 +47,13 @@
},
"6cd07a9f9f13fe948ba07a6c4dc51c31": {
"meta": {
"index": "web.team.yuehaoxitong.portal",
"name": "约号系统",
"index": "web.team.huodongzuzhi.portal",
"name": "活动组织",
"river": "1",
"scene": "main",
"space": "20240724-community",
"storm": "4",
"time": "2024-08-09 07:16:47.915",
"storm": "3",
"time": "2024-08-29 16:38:41.517",
"type": "view"
}
},
@ -151,15 +151,27 @@
"type": "view"
}
},
"f2d72a023907511e5317ce9c97e71539": {
"ed15fe2a10642203636ca0ce0922bb66": {
"meta": {
"index": "web.team.huodongzuzhi.portal",
"name": "活动组织",
"index": "web.team.yuehaoxitong.portal",
"name": "约号系统",
"river": "1",
"scene": "main",
"space": "20240724-community",
"storm": "3",
"time": "2024-08-27 19:01:26.564",
"storm": "5",
"time": "2024-08-29 16:39:31.908",
"type": "view"
}
},
"f2d72a023907511e5317ce9c97e71539": {
"meta": {
"index": "web.team.renzhengshouquan.portal",
"name": "认证授权",
"river": "1",
"scene": "main",
"space": "20240724-community",
"storm": "4",
"time": "2024-08-29 16:38:04.352",
"type": "view"
}
},