This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-12-14 18:35:27 +08:00
parent 0979482309
commit 15bc07af13
16 changed files with 140 additions and 40 deletions

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...).Action() })
kit.If(!m.IsErr() && m.Length() == 0, func() { m.Options(ctx.STYLE, html.FORM).EchoInfoButton(info, arg...).Action() }, func() { m.Action(arg...) })
return m
}
func (s Table) DisplayBase(m *ice.Message, file string) *ice.Message {

View File

@ -15,6 +15,7 @@ const (
BACKGROUND = "background"
CREATED_AT = "created_at"
UPDATED_AT = "updated_at"
DELETED_AT = "deleted_at"
USER_UID = "user_uid"
USER_NAME = "user_name"
USER_INFO = "user_info"
@ -119,6 +120,7 @@ const (
PAYMENTLIST_UID = "paymentlist_uid"
SPENDLIST_UID = "spendlist_uid"
SPACE_ID = "space_id"
SIZE = "size"
)
type Sess struct {

View File

@ -13,6 +13,7 @@ type photo struct {
auth string `data:"issued"`
fields string `data:"space_id,access_token,expire_time,vendor"`
upload string `name:"upload" role:"worker"`
rename string `name:"rename newname" role:"worker"`
trash string `name:"trash" role:"worker"`
}
@ -21,21 +22,24 @@ 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("")
m.PushAction(s.Rename, s.Trash).Display("")
if len(arg) == 1 {
s.Button(m, "请上传文件", s.Upload)
s.SpendlistCheck(m, 0)
}
}
func (s photo) Upload(m *ice.Message, arg ...string) {
up := kit.Simple(m.Optionv(ice.MSG_UPLOAD))
if s.SpendlistCheck(m, kit.Int(up[2])) {
if up := kit.Simple(m.Optionv(ice.MSG_UPLOAD)); s.SpendlistCheck(m, kit.Int(up[2])) {
s.cmdy(m, "")
s.SpendlistUpdate(m, m.Append(model.SIZE))
}
}
func (s photo) Rename(m *ice.Message, arg ...string) {
s.cmdy(m, "")
}
func (s photo) Trash(m *ice.Message, arg ...string) {
s.cmdy(m, "")
s.SpendlistUpdate(m, m.Append("size"))
s.SpendlistUpdate(m, m.Append(model.SIZE))
}
func init() { ice.TeamCtxCmd(photo{Table: newTable()}) }
@ -56,6 +60,7 @@ func (s photo) cmdy(m *ice.Message, action ice.Any, arg ...string) {
var PhotoVendor interface {
Folder(m *ice.Message, arg ...string)
Upload(m *ice.Message, arg ...string)
Rename(m *ice.Message, arg ...string)
Trash(m *ice.Message, arg ...string)
Token(m *ice.Message, arg ...string)
}

View File

@ -1,6 +1,8 @@
package gonganxitong
import (
"strings"
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/ctx"
@ -197,6 +199,45 @@ func (s Portal) PlaceRemove(m *ice.Message, arg ...string) {
m.Cmd("", s.BeforePlaceRemove, m.OptionSimple(model.USER_UID, model.UID))
m.Cmdy(s.UserPlace, s.Delete, m.OptionSimple(model.USER_UID, model.UID))
}
func (s Portal) PlaceCheck(m *ice.Message, arg ...string) {
s.Tables(m, kit.Format("LEFT JOIN %s ON %s = %s and %s IS NULL",
s.TableNames(s.UserPlace),
s.Key(s.UserPlace, s.Keys(s.Place, model.UID)),
s.Key(s.Place, model.UID),
s.Key(s.UserPlace, model.DELETED_AT),
)).Fields(m,
s.Key(s.Place, model.UID),
s.Key(s.Place, model.NAME),
s.Key(s.Place, model.INFO),
s.Key(s.Place, model.AUTH_UID),
)
m.Cmdy(s.Place, s.Table.Select, kit.Format("%s IS NULL", model.USER_UID))
m.PushAction(s.PlaceTrash)
}
func (s Portal) PlaceTrash(m *ice.Message, arg ...string) {
for key, _ := range m.Target().Commands {
if strings.HasPrefix(key, "_") {
continue
}
if key == m.CommandKey() {
continue
}
if key == "portal" {
continue
}
m.Cmd(key, s.PlaceTrash)
}
}
func (s Table) PlaceTrash(m *ice.Message, arg ...string) {
m.Push("key", m.PrefixKey())
if s.Place == nil {
m.Push("table", "")
m.Push("place_uid", "")
} else {
m.Push("table", s.TableNames(s.Place))
m.Push("place_uid", s.Keys(s.Place, 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.UID),
s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE), s.Keys(s.UserPlace, model.ROLE),

View File

@ -9,15 +9,16 @@ import (
type setting struct {
Table
recent recent
service service
order string `data:"103"`
role string `data:"leader,worker,server"`
short string `data:"name"`
field string `data:"name,type,help"`
fields string `data:"name,value"`
create string `name:"create name* type* help" role:"tech"`
update string `name:"update" role:"void"`
recent recent
service service
order string `data:"103"`
role string `data:"leader,worker,server"`
short string `data:"name"`
field string `data:"name,type,help"`
fields string `data:"name,value"`
create string `name:"create name* type* help" role:"tech"`
update string `name:"update" role:"void"`
placeTrash string `name:"placeTrash" help:"删除数据" style:"danger" role:"leader"`
}
func (s setting) Init(m *ice.Message, arg ...string) {
@ -41,11 +42,17 @@ func (s setting) List(m *ice.Message, arg ...string) {
msg := s.Select(m.Spawn(), model.PLACE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID))
msg.Table(func(value ice.Maps) { data[value[model.NAME]] = value[model.VALUE] })
s.Hash.List(m).Table(func(value ice.Maps) { m.Push(model.VALUE, data[value[model.NAME]]) }).Action()
m.Action(s.PlaceTrash)
} else if len(arg) == 2 {
s.SelectDetail(m, model.PLACE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID), model.NAME, arg[1])
}
s.DisplayBase(m, "").DisplayCSS("")
}
func (s setting) PlaceTrash(m *ice.Message, arg ...string) {
// m.Cmdy(s.UserPlace, s.Select, model.PLACE_UID, m.Option(model.PLACE_UID))
m.Cmdy(s.Place, s.Select, model.UID, m.Option(model.PLACE_UID))
m.DisplayTable()
}
func init() { ice.TeamCtxCmd(setting{Table: newTable()}) }

View File

@ -3,4 +3,5 @@ $output fieldset.story>form.option>div.item.text { display:none; }
$output fieldset.story>form.option>div.item.icon.delete { display:none; }
$output fieldset.story>div.output>div.item>div.output div.title>div.action { display:none; }
$output fieldset.story>div.status { display:none; }
$output fieldset.story>div.output>div.code { display:flex; flex-direction:column; align-items:center; }
$output>div.project div.list { padding-left:10px; margin-left:20px; clear:both; }

View File

@ -17,7 +17,7 @@ type admin struct {
func (s admin) List(m *ice.Message, arg ...string) {
if m.Option("view") == "admin" {
m.Cmdy(s.auth, arg[0]).Cut(model.SERVICE_UID, model.PLACE_UID)
m.Cmdy(s.auth, s.Select, model.FROM_UID, arg[0], model.STATUS, AuthIssued).Cut(model.SERVICE_UID, model.PLACE_UID)
s.SelectJoinRecent(m, "")
s.SelectJoinService(m)
m.Display("").DisplayCSS("").Sort("service_name,place_name")

View File

@ -19,6 +19,7 @@ Volcanos(chat.ONIMPORT, {
index: function(can, msg, value, target) {
can.onimport.itemlist(can, msg.Table(function(item) {
item._hash = [value.service_name.split(" ")[0], item.name], item.__title = item.name
if (item.enable == "false" || can.base.isIn(item.index, "web.team.gonganxitong.credit", "web.team.gonganxitong.setting") || item.order > 500) { return }
return item
}), function(event, item, show, target) {
if (show) { return }

View File

@ -19,6 +19,9 @@ type Auth struct {
revoke string `name:"revoke" role:"leader,worker"`
}
func (s Auth) Remove(m *ice.Message, arg ...string) {
s.Delete(m)
}
func (s Auth) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
s.Select(m, model.FROM_UID, arg[0]).Action()
@ -31,11 +34,11 @@ func (s Auth) List(m *ice.Message, arg ...string) {
m.Table(func(value ice.Maps) {
switch AuthStatus(kit.Int(value[model.AUTH_STATUS])) {
case AuthCreate:
m.PushButton(s.Issue)
m.PushButton(s.Issue, s.Remove)
case AuthIssued:
m.PushButton(s.Revoke)
case AuthRevoked:
m.PushButton(s.Issue)
m.PushButton(s.Issue, s.Remove)
default:
m.PushButton()
}

View File

@ -44,6 +44,10 @@ func (s Table) AuthList(m *ice.Message, auth_uid string, cb func(value ice.Maps,
}
})
}
func (s Table) authSort(m *ice.Message, arg ...string) {
s.RewriteAppend(m)
m.Sort("auth_status,auth_type,created_at", []string{"issued"}, []string{"personal", "root", "city", "street", "school", "company", "service"}, ice.STR_R)
}
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
m.RewriteAppend(func(value, key string, index int) string {
if _, e := strconv.ParseInt(value, 10, 64); e != nil {

View File

@ -31,6 +31,7 @@ type smh struct {
libraryRemove string `name:"libraryRemove" role:"worker"`
spaceCreate string `name:"spaceCreate" role:"worker"`
spaceRemove string `name:"spaceRemove" role:"worker"`
rename string `name:"rename"`
}
func (s smh) Init(m *ice.Message, arg ...string) {
@ -150,12 +151,21 @@ func (s smh) Upload(m *ice.Message, arg ...string) {
}
s.spide(m, http.MethodPost, kit.MergeURL(kit.Format("file/%s/%s/%s", msg.Append(model.LIBRARY_ID), arg[1], kit.Value(res, "confirmKey")),
"confirm", "confirm", "conflict_resolution_strategy", "rename", msg.AppendSimple(model.ACCESS_TOKEN)))
s.spaceSize(m, msg, arg...)
}
func (s smh) spaceSize(m, msg *ice.Message, arg ...string) {
s.spide(m, http.MethodGet, kit.MergeURL(kit.Format("space/%s/%s/size", msg.Append(model.LIBRARY_ID), arg[1]), msg.AppendSimple(model.ACCESS_TOKEN)))
m.Push("size", kit.Value(kit.UnMarshal(m.Result()), "size"))
}
func (s smh) Rename(m *ice.Message, arg ...string) {
msg := s.token(m)
m.Info("what %v", m.FormatChain())
s.spide(m, http.MethodPut, kit.MergeURL(kit.Format("file/%s/%s/%s", msg.Append(model.LIBRARY_ID), arg[1], m.Option("newname")), msg.AppendSimple(model.ACCESS_TOKEN)), "from", m.Option(model.NAME))
}
func (s smh) Trash(m *ice.Message, arg ...string) {
msg := s.token(m)
s.spide(m, http.MethodDelete, kit.MergeURL(kit.Format("file/%s/%s/%s", msg.Append(model.LIBRARY_ID), arg[1], m.Option(model.NAME)), msg.AppendSimple(model.ACCESS_TOKEN)))
s.spide(m, http.MethodGet, kit.MergeURL(kit.Format("space/%s/%s/size", msg.Append(model.LIBRARY_ID), arg[1]), msg.AppendSimple(model.ACCESS_TOKEN)))
m.Push("size", kit.Value(kit.UnMarshal(m.Result()), "size"))
s.spaceSize(m, msg, arg...)
}
func (s smh) Token(m *ice.Message, arg ...string) {
if arg[1] == "" || arg[2] < m.Time() {

View File

@ -3,6 +3,7 @@ package model
import "shylinux.com/x/mysql-story/src/db"
const (
UID = "uid"
NAME = "name"
LINK = "link"
VENDOR = "vendor"
@ -17,6 +18,7 @@ const (
REFRESH_TOKEN = "refresh_token"
EXPIRED_TIME = "expired_time"
FOLDER_ID = "folder_id"
DOCUMENT_UID = "document_uid"
)
type Tencentdocument struct {

View File

@ -7,7 +7,6 @@ import (
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/api"
"shylinux.com/x/community/src/gonganxitong"
"shylinux.com/x/community/src/renzhengshouquan"
"shylinux.com/x/community/src/renzhengshouquan/external/tencentdocument/model"
@ -21,7 +20,8 @@ type tencentdocument struct {
fields string `data:"user_id,access_token,expired_time,user_uid"`
auth string `name:"auth" help:"授权" role:"worker"`
remove string `name:"remove" role:"worker"`
config string `name:"config folder_id*:select" style:"notice" role:"worker"`
folderBind string `name:"folderBind folder_id*:select" help:"绑定" style:"notice" role:"worker"`
folderUnbind string `name:"folderUnbind" help:"解绑" style:"danger" role:"worker"`
}
func (s tencentdocument) Inputs(m *ice.Message, arg ...string) {
@ -39,15 +39,25 @@ func (s tencentdocument) List(m *ice.Message, arg ...string) {
} else if len(arg) == 2 {
s.AuthList(m, arg[0], func(value ice.Maps, auth bool) {
if auth {
m.PushButton(s.Config)
msg := s.cmdy(m.Spawn(), s.Select, model.PLACE_UID, value[model.PLACE_UID])
if msg.Append(model.FOLDER_ID) == "" {
m.Push(model.FOLDER_ID, "").Push(model.DOCUMENT_UID, "").PushButton(s.FolderBind)
} else {
m.Push(model.FOLDER_ID, msg.Append(model.FOLDER_ID))
m.Push(model.DOCUMENT_UID, msg.Append(model.UID))
m.PushButton(s.FolderUnbind)
}
} else {
m.PushButton()
m.Push(model.FOLDER_ID, "").Push(model.DOCUMENT_UID, "").PushButton()
}
})
}
}
func (s tencentdocument) Config(m *ice.Message, arg ...string) {
m.Cmdy(api.GONGANXITONG_DOCUMENT, s.Config, m.OptionSimple(model.PLACE_UID, model.USER_UID, model.FOLDER_ID), model.VENDOR, m.PrefixKey())
func (s tencentdocument) FolderBind(m *ice.Message, arg ...string) {
s.cmdy(m, s.Config, m.OptionSimple(model.PLACE_UID, model.USER_UID, model.FOLDER_ID), model.VENDOR, m.PrefixKey())
}
func (s tencentdocument) FolderUnbind(m *ice.Message, arg ...string) {
s.cmdy(m.Options(model.UID, m.Option(model.DOCUMENT_UID)), s.Delete)
}
func (s tencentdocument) Folder(m *ice.Message, arg ...string) *ice.Message {
msg := s.Select(m.Spawn(), model.AUTH_UID, arg[0])
@ -96,3 +106,7 @@ func (s tencentdocument) Auth(m *ice.Message, arg ...string) {
func init() { ice.TeamCtxCmd(tencentdocument{}) }
func init() { gonganxitong.DocumentVendor = tencentdocument{} }
func (s tencentdocument) cmdy(m *ice.Message, arg ...ice.Any) *ice.Message {
return m.Cmdy(append([]ice.Any{"web.team.gonganxitong.document"}, arg...)...)
}

View File

@ -12,6 +12,7 @@ const (
AUTH_UID = "auth_uid"
AUTH_STATUS = "auth_status"
USER_ID = "user_id"
MEETING_UID = "meeting_uid"
)
type Tencentmeeting struct {

View File

@ -15,7 +15,6 @@ import (
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/api"
"shylinux.com/x/community/src/gonganxitong"
"shylinux.com/x/community/src/renzhengshouquan"
"shylinux.com/x/community/src/renzhengshouquan/external/tencentmeeting/model"
@ -23,12 +22,13 @@ import (
type tencentmeeting struct {
renzhengshouquan.Table
order string `data:"12"`
fields string `data:"app_id,sdk_id,secret_id,secret_key,user_id,user_uid"`
create string `name:"create app_id* sdk_id* secret_id* secret_key* user_id*" role:"worker"`
remove string `name:"remove" role:"worker"`
list string `name:"list auth_uid uid auto" role:"worker"`
config string `name:"config user_id:select" style:"notice" role:"worker"`
order string `data:"12"`
fields string `data:"app_id,sdk_id,secret_id,secret_key,user_id,user_uid"`
create string `name:"create app_id* sdk_id* secret_id* secret_key* user_id*" role:"worker"`
remove string `name:"remove" role:"worker"`
list string `name:"list auth_uid uid auto" role:"worker"`
userBind string `name:"folderBind user_id*:select" help:"绑定" style:"notice" role:"worker"`
userUnbind string `name:"folderUnbind" help:"解绑" style:"danger" role:"worker"`
}
func (s tencentmeeting) Inputs(m *ice.Message, arg ...string) {
@ -44,15 +44,25 @@ func (s tencentmeeting) List(m *ice.Message, arg ...string) {
} else if len(arg) == 2 {
s.AuthList(m, arg[0], func(value ice.Maps, auth bool) {
if auth {
m.PushButton(s.Config)
msg := s.cmdy(m.Spawn(), s.Select, model.PLACE_UID, value[model.PLACE_UID])
if msg.Append(model.USER_ID) == "" {
m.Push(model.USER_ID, "").Push(model.MEETING_UID, "").PushButton(s.UserBind)
} else {
m.Push(model.USER_ID, msg.Append(model.USER_ID))
m.Push(model.MEETING_UID, msg.Append(model.UID))
m.PushButton(s.UserUnbind)
}
} else {
m.PushButton()
m.Push(model.USER_ID, "").Push(model.MEETING_UID, "").PushButton()
}
})
}
}
func (s tencentmeeting) Config(m *ice.Message, arg ...string) {
m.Cmdy(api.GONGANXITONG_MEETING, s.Config, m.OptionSimple(model.PLACE_UID, model.USER_UID, model.USER_ID), model.VENDOR, m.PrefixKey())
func (s tencentmeeting) UserBind(m *ice.Message, arg ...string) {
s.cmdy(m, s.Config, m.OptionSimple(model.PLACE_UID, model.USER_UID, model.USER_ID), model.VENDOR, m.PrefixKey())
}
func (s tencentmeeting) UserUnbind(m *ice.Message, arg ...string) {
s.cmdy(m.Options(model.UID, m.Option(model.MEETING_UID)), s.Delete)
}
func (s tencentmeeting) UserList(m *ice.Message, arg ...string) *ice.Message {
s.spide(m, "", "users/list", "operator_id", "$user_id", "operator_id_type", "1", "page", "1", "page_size", "10")
@ -100,6 +110,9 @@ func init() { ice.TeamCtxCmd(tencentmeeting{}) }
func init() { gonganxitong.MeetingVendor = tencentmeeting{} }
func (s tencentmeeting) cmdy(m *ice.Message, arg ...ice.Any) *ice.Message {
return m.Cmdy(append([]ice.Any{"web.team.gonganxitong.meeting"}, arg...)...)
}
func (s tencentmeeting) spide(m *ice.Message, method, api string, arg ...ice.Any) *ice.Message {
msg := s.Select(m.Spawn(), m.OptionSimple(model.AUTH_UID)...)
if msg.Length() == 0 {

View File

@ -113,10 +113,6 @@ func (s profile) Enter(m *ice.Message, arg ...string) {}
func init() { ice.TeamCtxCmd(profile{}) }
func (s Table) authSort(m *ice.Message, arg ...string) {
s.RewriteAppend(m)
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")
}