This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-12-09 12:24:45 +08:00
parent 884e7ee2b5
commit 0979482309
22 changed files with 84 additions and 41 deletions

View File

@ -9,13 +9,12 @@ import (
type allow struct {
Table
apply apply
order string `data:"503"`
role string `data:"leader"`
create string `name:"create apply_uid* place_uid* user_uid* status*"`
reject string `name:"reject" role:"void"`
approve string `name:"approve" role:"void"`
applyQRCode string `name:"applyQRCode" role:"void"`
apply apply
order string `data:"503"`
role string `data:"leader"`
create string `name:"create apply_uid* place_uid* user_uid* status*"`
reject string `name:"reject" role:"void"`
approve string `name:"approve" role:"void"`
}
func (s allow) Create(m *ice.Message, arg ...string) {
@ -24,9 +23,6 @@ func (s allow) Create(m *ice.Message, arg ...string) {
s.SendMessage(m, m.Option(model.FROM_USER_UID), "")
s.SendTemplate(m, "", "", m.Trans("please allow", "权限审批 请处理"))
}
func (s allow) ApplyQRCode(m *ice.Message, arg ...string) {
m.Cmdy(s.Prefix(m, qrcode{}), m.ActionKey(), arg)
}
func (s allow) List(m *ice.Message, arg ...string) {
s.Tables(m, s.apply).FieldsWithCreatedAT(m, s.apply,
s.Key(s.apply, model.USER_UID),
@ -34,9 +30,9 @@ func (s allow) List(m *ice.Message, arg ...string) {
s.AS(s.Key(s, model.UID), model.ALLOW_UID), model.ALLOW_STATUS,
)
if len(arg) == 1 {
s.Select(m, s.Key(s, model.PLACE_UID), arg[0], s.Key(s, model.USER_UID), m.Option(model.USER_UID)).Action(s.ApplyQRCode)
s.Select(m, s.Key(s, model.PLACE_UID), arg[0], s.Key(s, model.USER_UID), m.Option(model.USER_UID)).Action()
if m.Length() == 0 {
m.Cmdy(s.Prefix(m, qrcode{}), s.ApplyQRCode, arg)
m.Cmdy(s.Prefix(m, qrcode{}), qrcode{}.ApplyQRCode, arg[0]).SetAppend().Action()
return
}
} else if len(arg) == 2 {

View File

@ -36,6 +36,9 @@ func (s apply) List(m *ice.Message, arg ...string) {
)
if len(arg) == 1 {
s.Select(m, model.PLACE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID))
if m.Length() == 0 {
m.Action()
}
} else if len(arg) == 2 {
s.SelectDetail(m, model.PLACE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID), model.UID, arg[1])
switch ApplyStatus(kit.Int(m.Append(model.APPLY_STATUS))) {

View File

@ -441,7 +441,7 @@ func (s Portal) SendTemplate(m *ice.Message, arg ...string) {
s.AutoCmd(m, user{}, s.SendTemplate, arg[1], arg[2], link, kit.JoinWord(m.Option(model.PORTAL_NAME), arg[3]), name, kit.Cut(uid, 6))
}
func (s Table) Button(m *ice.Message, info string, arg ...ice.Any) *ice.Message {
kit.If(!m.IsErr() && m.Length() == 0, func() { m.Options(ctx.STYLE, html.FORM).EchoInfoButton(info, arg...) })
kit.If(!m.IsErr() && m.Length() == 0, func() { m.Options(ctx.STYLE, html.FORM).EchoInfoButton(info, arg...).Action() })
return m
}
func (s Table) DisplayBase(m *ice.Message, file string) *ice.Message {

View File

@ -5,6 +5,7 @@ import "shylinux.com/x/ice"
type contract struct {
Table
order string `data:"95"`
auth string `data:"issued"`
fields string `data:"title"`
create string `name:"create title*" role:"leader"`
remove string `name:"remove" role:"leader"`

View File

@ -9,6 +9,7 @@ import (
type document struct {
Table
order string `data:"94"`
auth string `data:"issued"`
fields string `data:"folder_id,vendor,user_uid"`
open string `name:"open" style:"notice" role:"void"`
}
@ -18,6 +19,9 @@ func (s document) Config(m *ice.Message, arg ...string) {
}
func (s document) List(m *ice.Message, arg ...string) {
s.cmdy(m, DocumentVendor.Folder).PushAction(s.Open).Display("")
if len(arg) == 1 {
s.SpendlistCheck(m, 0)
}
}
func (s document) Open(m *ice.Message, arg ...string) {
m.ProcessOpen(m.Option(model.LINK))

View File

@ -16,6 +16,7 @@ type goodslist struct {
spendlist spendlist
paymentlist paymentlist
order string `data:"91"`
auth string `data:"issued"`
fields string `data:"name,amount,title,content,user_uid"`
create string `name:"create name* amount* title* content*" role:"leader"`
remove string `name:"remove" role:"leader"`
@ -35,6 +36,9 @@ func (s goodslist) AfterMigrate(m *ice.Message, arg ...string) {
s.insert(m, "school", "5-1", "10000", "教育基础版")
s.insert(m, "school", "5-2", "30000", "教育高级版")
s.insert(m, "school", "5-3", "50000", "教育旗舰版")
s.insert(m, "street", "6-1", "10000", "社区基础版")
s.insert(m, "street", "6-2", "30000", "社区高级版")
s.insert(m, "street", "6-3", "50000", "社区旗舰版")
}
}
func (s goodslist) Create(m *ice.Message, arg ...string) {
@ -52,6 +56,8 @@ func (s goodslist) List(m *ice.Message, arg ...string) {
s.Select(m, model.PLACE_UID, "company")
case 5:
s.Select(m, model.PLACE_UID, "school")
case 6:
s.Select(m, model.PLACE_UID, "street")
}
m.PushAction(s.Request).Action()
} else {

View File

@ -9,6 +9,7 @@ import (
type meeting struct {
Table
order string `data:"93"`
auth string `data:"issued"`
role string `data:"leader,worker"`
fields string `data:"user_id,vendor"`
config string `name:"config place_uid* user_uid* user_id* vendor*"`
@ -29,6 +30,7 @@ func (s meeting) List(m *ice.Message, arg ...string) {
if s.cmdy(m, s.MeetingList, arg[1:]...); m.Length() > 0 {
if len(arg) == 1 {
m.PushAction(s.Enter, s.Modify, s.Cancel).Action(s.Create).Display("")
s.SpendlistCheck(m, 0)
} else if m.IsMobileUA() {
m.EchoQRCode(m.Append(model.LINK)).Display("").DisplayCSS("")
} else {

View File

@ -10,6 +10,7 @@ import (
type paymentlist struct {
Table
order string `data:"92"`
auth string `data:"issued"`
fields string `data:"amount,title,content,paymentlist_status,goodslist_uid,user_uid"`
create string `name:"create amount* title* content" role:"leader"`
request string `name:"request" help:"支付" style:"notice" role:"void"`

View File

@ -10,6 +10,7 @@ import (
type photo struct {
Table
order string `data:"96"`
auth string `data:"issued"`
fields string `data:"space_id,access_token,expire_time,vendor"`
upload string `name:"upload" role:"worker"`
trash string `name:"trash" role:"worker"`
@ -21,7 +22,7 @@ func (s photo) Config(m *ice.Message, arg ...string) {
func (s photo) List(m *ice.Message, arg ...string) {
s.cmdy(m, PhotoVendor.Folder, kit.Slice(arg, 1)...)
m.PushAction(s.Trash).Display("")
if len(arg) == 1 && m.Result() == "" {
if len(arg) == 1 {
s.Button(m, "请上传文件", s.Upload)
s.SpendlistCheck(m, 0)
}

View File

@ -25,7 +25,7 @@ type Portal struct {
service service
export string `data:"true"`
short string `data:"index"`
field string `data:"time,icons,name,index,order,enable,init,type,role,view,portal,public"`
field string `data:"time,icons,name,index,order,enable,type,auth,role,view,init,portal,public"`
create string `name:"create index name icons"`
list string `name:"list place_uid index uid auto" role:"void"`
placeCreate string `name:"placeCreate city_name* street_name* place_name* place_type:select address" icon:"bi bi-plus-square-dotted" role:"void"`
@ -350,7 +350,7 @@ func (s Portal) Create(m *ice.Message, arg ...string) {
kit.If(msg.Length() > 0, func() { args = append(args, mdb.TIME, msg.Append(mdb.TIME)) })
m.Search(m.Option(ctx.INDEX), func(key string, cmd *ice.Command) {
args = append(args, mdb.NAME, cmd.Help, mdb.ICONS, cmd.Icon)
kit.For([]string{mdb.ORDER, mdb.TYPE, aaa.ROLE, mdb.VIEW}, func(key string) {
kit.For([]string{mdb.ORDER, mdb.TYPE, aaa.ROLE, aaa.AUTH, mdb.VIEW}, func(key string) {
value := m.Conf(m.Option(ctx.INDEX), kit.Keym(key))
args = append(args, key, kit.Select(value, msg.Append(key)))
})

View File

@ -133,7 +133,7 @@ Volcanos(chat.ONIMPORT, {
}
return {view: [[html.ITEM, ctx.INDEX].concat(
value.type? [mdb.TYPE]: [], can.core.Split(value.type||""), value.role? [aaa.ROLE]: [], can.core.Split(value.role||""),
value.view,
value.auth, value.view,
)], style: {width: width}, list: [
{img: can.misc.ResourceIcons(can, value.icons)}, {text: can.user.trans(can, value.index.split(".").pop(), value.name)},
], onclick: function(event) {
@ -246,7 +246,9 @@ Volcanos(chat.ONEXPORT, {
can.ui.role && can.onmotion.toggle(can, can.ui.role, value._role == "creator")
can.ui.role && can.onmotion.select(can, can.ui.role, html.SPAN, can.page.SelectOne(can, can.ui.role, "span."+role))
can.page.Select(can, can.ui.myindex, html.DIV_ITEM, function(target) { var list = target.className.split(" ")
if (list.indexOf("tech") > -1 && can.user.info.userrole != "tech") {
if (list.indexOf("issued") > -1 && value.auth_status != "issued") {
can.onmotion.toggle(can, target, false)
} else if (list.indexOf("tech") > -1 && can.user.info.userrole != "tech") {
can.onmotion.toggle(can, target, false)
} else if (list.indexOf("debug") > -1 && !can.misc.isDebug(can)) {
can.onmotion.toggle(can, target, false)

View File

@ -85,6 +85,7 @@
"operator": "操作人",
"operate": "操作",
"address": "场景地址",
"auth": "认证",
"init": "初始化",
"info": "详情",
"class": "基类",

View File

@ -13,30 +13,33 @@ type qrcode struct {
portal Portal
order string `data:"501"`
role string `data:"leader"`
applyQRCode string `name:"applyQRCode" role:"void"`
applyQRCode string `name:"applyQRCode" help:"邀请码" role:"void"`
placeQRCode string `name:"placeQRCode" help:"场景码" role:"void"`
}
func (s Table) EchoQRCode(m *ice.Message, arg ...string) *ice.Message {
m.EchoQRCode(s.Link(m, arg...)).Echo("<img class='avatar' src='%s'/>", m.Resource(kit.Select(ice.Info.NodeIcon, m.Option(model.AUTH_AVATAR))))
return m
}
func (s qrcode) ApplyQRCode(m *ice.Message, arg ...string) {
m.Option(ice.MSG_FG, "blue")
s.info(m, arg[0], "apply")
s.EchoQRCode(m, arg[0], s.Prefix(m, s.apply)).Echo("请让申请人扫码,然后审批权限")
}
func (s qrcode) List(m *ice.Message, arg ...string) {
func (s qrcode) PlaceQRCode(m *ice.Message, arg ...string) {
s.info(m, arg[0], "portal")
s.EchoQRCode(m, arg[0])
m.Echo(kit.JoinWord(m.Append(model.CITY_NAME), m.Append(s.Keys(s.Street, model.NAME)), m.Append(s.Keys(s.Place, model.NAME))))
s.EchoQRCode(m, arg[0]).Echo(kit.JoinWord(m.Append(model.CITY_NAME), m.Append(s.Keys(s.Street, model.NAME)), m.Append(s.Keys(s.Place, model.NAME))))
}
func (s qrcode) List(m *ice.Message, arg ...string) {
s.PlaceQRCode(m, arg[0])
}
func init() { ice.TeamCtxCmd(qrcode{Tables: newTables()}) }
func (s Table) EchoQRCode(m *ice.Message, arg ...string) *ice.Message {
m.EchoQRCode(s.Link(m, arg...)).Echo("<img class='avatar' src='%s'/>", m.Resource(kit.Select(ice.Info.NodeIcon, m.Option(model.AUTH_AVATAR))))
return m
}
func (s qrcode) info(m *ice.Message, place_uid, cmd string) *ice.Message {
m.Cmdy(s.Prefix(m, s.portal), s.portal.PlaceList, m.Option(model.USER_UID), place_uid)
m.Option(model.AUTH_AVATAR, m.Append(model.AUTH_AVATAR))
m.Cut(model.CITY_NAME, s.Keys(s.Street, model.NAME), s.Keys(s.Place, model.NAME))
m.Push(model.QRCODE_TYPE, cmd).Action(s.ApplyQRCode)
m.Push(model.QRCODE_TYPE, cmd).Action(s.ApplyQRCode, s.PlaceQRCode)
return m
}

View File

@ -31,6 +31,14 @@ func (s quotalist) AfterMigrate(m *ice.Message, arg ...string) {
s.insert(m, "company", "4-1", 10, "10个", "服务认证数量上限", api.RENZHENGSHOUQUAN_AUTH)
s.insert(m, "company", "4-2", 30, "30个", "服务认证数量上限", api.RENZHENGSHOUQUAN_AUTH)
s.insert(m, "company", "4-3", 50, "50个", "服务认证数量上限", api.RENZHENGSHOUQUAN_AUTH)
s.insert(m, "school", "5-1", 10, "10个", "服务认证数量上限", api.RENZHENGSHOUQUAN_AUTH)
s.insert(m, "school", "5-2", 30, "30个", "服务认证数量上限", api.RENZHENGSHOUQUAN_AUTH)
s.insert(m, "school", "5-3", 50, "50个", "服务认证数量上限", api.RENZHENGSHOUQUAN_AUTH)
s.insert(m, "street", "6-1", 10, "10个", "服务认证数量上限", api.RENZHENGSHOUQUAN_AUTH)
s.insert(m, "street", "6-2", 30, "30个", "服务认证数量上限", api.RENZHENGSHOUQUAN_AUTH)
s.insert(m, "street", "6-3", 50, "50个", "服务认证数量上限", api.RENZHENGSHOUQUAN_AUTH)
}
}
func (s quotalist) Matrix(m *ice.Message, arg ...string) {

View File

@ -1,6 +1,8 @@
package gonganxitong
import (
"strings"
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
@ -23,11 +25,21 @@ func (s spendlist) List(m *ice.Message, arg ...string) {
func init() { ice.TeamCtxCmd(spendlist{Table: newTable()}) }
func (s Table) SpendlistCheck(m *ice.Message, size int) bool {
if size == 0 && m.Length() == 0 {
return true
}
if size == 0 && m.Result() != "" {
return true
}
msg := m.Cmd(s.Prefix(m, spendlist{}), s.Select, m.OptionSimple(model.PLACE_UID), model.VENDOR, m.PrefixKey())
m.Echo("%s / %s", kit.FmtSize(kit.Int(msg.Append(model.COUNT))), kit.FmtSize(kit.Int(msg.Append(model.TOTAL))))
m.Echo("%s / %s",
strings.TrimSuffix(kit.FmtSize(kit.Int(msg.Append(model.COUNT))), "B"),
strings.TrimSuffix(kit.FmtSize(kit.Int(msg.Append(model.TOTAL))), "B"),
)
m.Option(model.SPENDLIST_UID, msg.Option(model.UID))
if kit.Int(msg.Append(model.COUNT))+size >= kit.Int(msg.Append(model.TOTAL)) {
if !m.Warn(size > 0, "存储空间不足,请及时续费或清理空间") {
m.SetResult()
m.Echo("<span style='color:red'>存储空间不足,请及时续费或清理空间</span>").Action()
}
return false

View File

@ -10,7 +10,7 @@ type admin struct {
Tables
auth Auth
userAuth userAuth
order string `data:"4"`
order string `data:"51"`
role string `data:"leader,worker"`
open string `name:"open" role:"void"`
}

View File

@ -22,7 +22,7 @@ type Auth struct {
func (s Auth) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
s.Select(m, model.FROM_UID, arg[0]).Action()
m.Sort("auth_status,created_at", []string{"2"}, "str_r")
defer s.authSort(m)
} else if len(arg) == 2 {
m.Cmdy(s.cert, arg[1]).PushAction().Action()
return

View File

@ -5,7 +5,6 @@ import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/ctx"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/api"
@ -38,7 +37,7 @@ func (s Table) Config(m *ice.Message, arg ...string) {
}
func (s Table) AuthList(m *ice.Message, auth_uid string, cb func(value ice.Maps, auth bool)) {
m.Cmdy(api.RENZHENGSHOUQUAN_AUTH, auth_uid).Table(func(value ice.Maps) {
if AuthStatus(kit.Int(value[model.AUTH_STATUS])) == AuthIssued {
if value[model.AUTH_STATUS] == AuthIssued.String() {
cb(value, true)
} else {
cb(value, false)
@ -66,9 +65,12 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
}
func (s Table) GetAuthUID(m *ice.Message, arg ...string) string {
auth_uid := m.Cmdx(ctx.CONFIG, api.RENZHENGSHOUQUAN_PORTAL, kit.Keym(model.AUTH_UID))
m.Info("default auth_uid %v", auth_uid)
return auth_uid
// auth_uid := m.Cmdx(ctx.CONFIG, api.RENZHENGSHOUQUAN_PORTAL, kit.Keym(model.AUTH_UID))
// m.Info("default auth_uid %v", auth_uid)
// return auth_uid
msg := m.Cmd(Auth{}, s.Select, model.TYPE, AuthRoot)
m.Info("default auth_uid %v", msg.Append(model.UID))
return msg.Append(model.UID)
}
type Tables struct{ Table }

View File

@ -33,8 +33,8 @@ func (s tencentdocument) Inputs(m *ice.Message, arg ...string) {
}
func (s tencentdocument) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
if s.ValueList(m, arg).Action(s.Auth).Display("").Length() == 0 {
s.Button(m.SetResult(), "请授权访问腾讯文档", s.Auth)
if s.ValueList(m, arg).Action().Display("").Length() == 0 {
s.Button(m.SetResult(), "请授权访问腾讯文档", s.Auth).Action()
}
} else if len(arg) == 2 {
s.AuthList(m, arg[0], func(value ice.Maps, auth bool) {

View File

@ -8,6 +8,7 @@
"mch_id": "MchID",
"api_key": "ApiKey",
"cert_no": "CertNo",
"cert_key": "CertKey"
"cert_key": "CertKey",
"cert_file": "CertFile"
}
}

View File

@ -18,7 +18,7 @@ type Portal struct {
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).Action() })
m.Sort("auth_status,auth_type,created_at", []string{"issued"}, []string{"personal", "root", "city", "street", "school", "company", "service"}, ice.STR_R)
Auth{}.authSort(m)
}
func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
switch AuthType(kit.Int(m.Option(model.AUTH_TYPE))) {

View File

@ -113,9 +113,9 @@ func (s profile) Enter(m *ice.Message, arg ...string) {}
func init() { ice.TeamCtxCmd(profile{}) }
func (s profile) authSort(m *ice.Message, arg ...string) {
func (s Table) authSort(m *ice.Message, arg ...string) {
s.RewriteAppend(m)
m.Sort("auth_status,name", []string{AuthIssued.String()}, "str")
m.Sort("auth_status,auth_type,created_at", []string{"issued"}, []string{"personal", "root", "city", "street", "school", "company", "service"}, ice.STR_R)
}
func (s profile) settingProfile(m *ice.Message, arg ...string) *ice.Message {
return s.SettingCmdy(m, s.Select, arg, model.NAME, "profile", model.VALUE, "on")