mirror of
https://shylinux.com/x/community
synced 2025-07-01 21:21:19 +08:00
add some
This commit is contained in:
parent
d73ed5b838
commit
8518a5d9bc
@ -19,6 +19,7 @@ type goodslist struct {
|
||||
|
||||
func (s goodslist) AfterMigrate(m *ice.Message, arg ...string) {
|
||||
s.Table.AfterMigrate(m, arg...)
|
||||
if s.PrefixPortal(m) == api.RENZHENGSHOUQUAN_PORTAL {
|
||||
s.insert(m, "service", "3-1", "1000", "初级版")
|
||||
s.insert(m, "service", "3-2", "3000", "高级版")
|
||||
s.insert(m, "service", "3-3", "5000", "旗舰版")
|
||||
@ -29,6 +30,7 @@ func (s goodslist) AfterMigrate(m *ice.Message, arg ...string) {
|
||||
s.insert(m, "school", "5-2", "30000", "教育高级版")
|
||||
s.insert(m, "school", "5-3", "50000", "教育旗舰版")
|
||||
}
|
||||
}
|
||||
func (s goodslist) Create(m *ice.Message, arg ...string) {
|
||||
s.ValueCreate(m, s.TransPrice(m, arg, model.PRICE)...)
|
||||
}
|
||||
@ -59,13 +61,26 @@ func (s goodslist) List(m *ice.Message, arg ...string) {
|
||||
m.Copy(msg)
|
||||
s.SelectJoinUser(m)
|
||||
}
|
||||
m.Action(s.Matrix)
|
||||
} else if len(arg) == 2 {
|
||||
m.Cmdy(quotalist{}, s.Select, model.GOODSLIST_UID, arg[1])
|
||||
m.Action(s.Payfor)
|
||||
// m.Action(s.Payfor)
|
||||
m.EchoInfoButton("请购买会员", s.Payfor).Action()
|
||||
}
|
||||
m.Display("")
|
||||
}
|
||||
func (s goodslist) Matrix(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(quotalist{}, m.ActionKey())
|
||||
}
|
||||
func (s goodslist) Payfor(m *ice.Message, arg ...string) {
|
||||
m.Cmd(quotalist{}, s.Select, model.GOODSLIST_UID, m.Option(model.UID)).Table(func(value ice.Maps) {
|
||||
m.Cmd(spendlist{}, s.Insert, model.QUOTALIST_UID, value[model.UID],
|
||||
model.PLACE_UID, m.Option(s.PLACE_UID),
|
||||
model.VENDOR, value[model.VENDOR],
|
||||
model.TOTAL, value[model.TOTAL],
|
||||
model.COUNT, "0",
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(goodslist{Table: newTable()}) }
|
||||
|
@ -2,8 +2,8 @@ Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
if (can.Option(UID)) {
|
||||
can.onimport.myView(can, msg, function(value) { return [
|
||||
{view: html.TITLE, list: [value.vendor]},
|
||||
{view: html.OUTPUT, list: [value.total+"M"]},
|
||||
{view: html.TITLE, list: [value.title]},
|
||||
{view: html.OUTPUT, list: [value.content]},
|
||||
] }, function() {
|
||||
|
||||
})
|
||||
|
@ -113,7 +113,10 @@ const (
|
||||
EXPIRE_TIME = "expire_time"
|
||||
PRICE = "price"
|
||||
TOTAL = "total"
|
||||
COUNT = "count"
|
||||
GOODSLIST_UID = "goodslist_uid"
|
||||
QUOTALIST_UID = "quotalist_uid"
|
||||
SPACE_ID = "space_id"
|
||||
)
|
||||
|
||||
type Sess struct {
|
||||
@ -160,6 +163,8 @@ type Quotalist struct {
|
||||
PlaceUID string `gorm:"type:char(32);index"`
|
||||
UserUID string `gorm:"type:char(32)"`
|
||||
GoodslistUID string `gorm:"type:char(32);index"`
|
||||
Title string `gorm:"type:varchar(64)"`
|
||||
Content string `gorm:"type:varchar(128)"`
|
||||
Vendor string `gorm:"type:varchar(128)"`
|
||||
Total int
|
||||
}
|
||||
|
@ -32,8 +32,10 @@ func (s paymentlist) List(m *ice.Message, arg ...string) {
|
||||
} else if len(arg) == 2 {
|
||||
s.SelectDetail(m, model.PLACE_UID, arg[0], model.UID, arg[1])
|
||||
if PaymentStatus(kit.Int(m.Append(model.PAYMENTLIST_STATUS))) == PaymentCreate {
|
||||
if !m.IsWeixinUA() {
|
||||
m.EchoQRCode(s.Link(m, arg[0], m.PrefixKey(), arg[1])).Echo("请用微信扫码支付")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ type photo struct {
|
||||
Table
|
||||
order string `data:"96"`
|
||||
fields string `data:"space_id,access_token,expire_time,vendor"`
|
||||
remove string `name:"remove" role:"worker"`
|
||||
upload string `name:"upload" role:"worker"`
|
||||
trash string `name:"trash" role:"worker"`
|
||||
}
|
||||
@ -21,28 +20,37 @@ 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).Action(s.Upload).Display("")
|
||||
if m.Result() == "" {
|
||||
m.PushAction(s.Trash).Display("")
|
||||
if len(arg) == 1 && m.Result() == "" {
|
||||
s.Button(m, "请上传文件", s.Upload)
|
||||
s.SpendlistCheck(m, 0)
|
||||
m.Action(s.Upload)
|
||||
}
|
||||
}
|
||||
func (s photo) Upload(m *ice.Message, arg ...string) { s.cmdy(m, "") }
|
||||
func (s photo) Trash(m *ice.Message, arg ...string) { s.cmdy(m, "") }
|
||||
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])) {
|
||||
s.cmdy(m, "")
|
||||
}
|
||||
}
|
||||
func (s photo) Trash(m *ice.Message, arg ...string) {
|
||||
s.cmdy(m, "")
|
||||
s.SpendlistUpdate(m, m.Append("size"))
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(photo{Table: newTable()}) }
|
||||
|
||||
func (s photo) cmdy(m *ice.Message, action ice.Any, arg ...string) {
|
||||
const SPACE_ID = "space_id"
|
||||
if m.Option(model.AUTH_UID, s.StreetAuthUID(m, m.Option(s.PLACE_UID))) == "" {
|
||||
return
|
||||
}
|
||||
if msg := s.Select(m.Spawn(), model.PLACE_UID, m.Option(s.PLACE_UID)); msg.Append(SPACE_ID) == "" {
|
||||
if msg := s.Select(m.Spawn(), model.PLACE_UID, m.Option(s.PLACE_UID)); msg.Append(model.SPACE_ID) == "" {
|
||||
m.Echo("本服务暂未配置,请联系公司管理员配置")
|
||||
} else {
|
||||
kit.If(action == "", func() { action = m.ActionKey() })
|
||||
m.Option(model.PLACE_UID, m.Option(s.PLACE_UID))
|
||||
_msg := m.Cmd(msg.Append(model.VENDOR), PhotoVendor.Token, msg.Append(SPACE_ID), msg.Append(model.ACCESS_TOKEN), msg.Append(model.EXPIRE_TIME))
|
||||
m.Cmdy(msg.Append(model.VENDOR), action, m.Option(model.AUTH_UID), msg.Append(SPACE_ID), _msg.Append(model.ACCESS_TOKEN), arg)
|
||||
_msg := m.Cmd(msg.Append(model.VENDOR), PhotoVendor.Token, msg.Append(model.SPACE_ID), msg.Append(model.ACCESS_TOKEN), msg.Append(model.EXPIRE_TIME))
|
||||
m.Cmdy(msg.Append(model.VENDOR), action, m.Option(model.AUTH_UID), msg.Append(model.SPACE_ID), _msg.Append(model.ACCESS_TOKEN), arg)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,7 @@ $output div.item.card img { border-radius:5px; padding:0; margin:0; margin-right
|
||||
$output div.item.card div.container img { margin-right:0; height:100%; width:100%; }
|
||||
$output div.item.card.sticky>div.output { background-color:var(--plugin-bg-color); color:var(--notice-bg-color); }
|
||||
$action div.item.notice input[type=button] { border:var(--box-notice); color:var(--notice-bg-color); }
|
||||
body:not(.mobile) $action div.item.notice input[type=button]:hover { background-color:var(--notice-bg-color); color:var(--notice-fg-color); }
|
||||
$action div.item.danger input[type=button] { border:var(--box-danger); color:var(--danger-bg-color); }
|
||||
$output input.notice[type=button]:not(:hover) { background-color:var(--notice-bg-color); color:var(--notice-fg-color); }
|
||||
$output input.danger[type=button]:not(:hover) { color:var(--danger-bg-color); }
|
||||
@ -106,8 +107,11 @@ $output fieldset.story>div.output table.content td img { max-width:100%; }
|
||||
$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>input[type=button] { background-color:var(--notice-bg-color); color:var(--notice-fg-color); margin-right:10px; float:right; }
|
||||
// $output fieldset.story>div.output>div.code>input[type=button] { background-color:var(--notice-bg-color); color:var(--notice-fg-color); margin-right:10px; float:right; }
|
||||
$output fieldset.story>div.output>div.code>input[type=button] { background-color:var(--notice-bg-color); color:var(--notice-fg-color); float:right; }
|
||||
body:not(.mobile) $output fieldset.story>div.output>div.code>input[type=button]:hover { border:var(--box-notice); background-color:transparent; color:var(--notice-bg-color); }
|
||||
$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; }
|
||||
$output fieldset.story>div.output>div.code div.item.button input[type=button] { background-color:var(--notice-bg-color); color:var(--notice-fg-color); font-size:18px; min-width:240px; height:36px; }
|
||||
|
@ -10,17 +10,50 @@ import (
|
||||
|
||||
type quotalist struct {
|
||||
Table
|
||||
fields string `data:"vendor,total"`
|
||||
fields string `data:"title,content,vendor,total"`
|
||||
}
|
||||
|
||||
func (s quotalist) AfterMigrate(m *ice.Message, arg ...string) {
|
||||
s.Table.AfterMigrate(m, arg...)
|
||||
s.insert(m, "service", "3-1", "1000", api.GONGANXITONG_DOCUMENT)
|
||||
s.insert(m, "service", "3-1", "1000", api.GONGANXITONG_PHOTO)
|
||||
s.insert(m, "service", "3-1", 10, "10人", "在线会议人数上限", api.GONGANXITONG_MEETING)
|
||||
s.insert(m, "service", "3-2", 30, "30人", "在线会议人数上限", api.GONGANXITONG_MEETING)
|
||||
s.insert(m, "service", "3-3", 50, "50人", "在线会议人数上限", api.GONGANXITONG_MEETING)
|
||||
|
||||
s.insert(m, "service", "3-1", 100*1024*1024, "100M", "在线文档存储容量", api.GONGANXITONG_DOCUMENT)
|
||||
s.insert(m, "service", "3-2", 300*1024*1024, "300M", "在线文档存储容量", api.GONGANXITONG_DOCUMENT)
|
||||
s.insert(m, "service", "3-3", 500*1024*1024, "500M", "在线文档存储容量", api.GONGANXITONG_DOCUMENT)
|
||||
|
||||
s.insert(m, "service", "3-1", 1024*1024*1024, "1G", "在线相册存储容量", api.GONGANXITONG_PHOTO)
|
||||
s.insert(m, "service", "3-2", 3*1024*1024*1024, "3G", "在线相册存储容量", api.GONGANXITONG_PHOTO)
|
||||
s.insert(m, "service", "3-3", 5*1024*1024*1024, "5G", "在线相册存储容量", api.GONGANXITONG_PHOTO)
|
||||
|
||||
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)
|
||||
}
|
||||
func (s quotalist) insert(m *ice.Message, auth, level, total string, arg ...string) {
|
||||
s.Insert(m, model.UID, kit.Hashs(auth, level, kit.Select(m.PrefixKey(), arg, 0)), model.GOODSLIST_UID, kit.Hashs(auth, level), model.PLACE_UID, auth,
|
||||
model.TOTAL, total, model.VENDOR, kit.Select(m.PrefixKey(), arg, 0))
|
||||
func (s quotalist) insert(m *ice.Message, auth, level string, total int, content, title string, arg ...string) {
|
||||
s.Insert(m, model.UID, kit.Hashs(auth, level, kit.Select(m.PrefixKey(), arg, 0)), model.PLACE_UID, auth,
|
||||
model.GOODSLIST_UID, kit.Hashs(auth, level), model.TITLE, title, model.CONTENT, content,
|
||||
model.TOTAL, kit.Format(total), model.VENDOR, kit.Select(m.PrefixKey(), arg, 0))
|
||||
}
|
||||
func (s quotalist) Matrix(m *ice.Message, arg ...string) {
|
||||
// s.Select(m)
|
||||
m.Push("应用", "在线会议")
|
||||
m.Push("初级版", "10人")
|
||||
m.Push("中级版", "30人")
|
||||
m.Push("高级版", "50人")
|
||||
|
||||
m.Push("应用", "在线文档")
|
||||
m.Push("初级版", "100M")
|
||||
m.Push("中级版", "300M")
|
||||
m.Push("高级版", "500M")
|
||||
|
||||
m.Push("应用", "在线相册")
|
||||
m.Push("初级版", "1000M")
|
||||
m.Push("中级版", "3000M")
|
||||
m.Push("高级版", "5000M")
|
||||
|
||||
m.Display("/plugin/story/table.js")
|
||||
}
|
||||
func (s quotalist) List(m *ice.Message, arg ...string) {
|
||||
s.Select(m, model.PLACE_UID, arg[0])
|
||||
|
@ -1,15 +1,42 @@
|
||||
package gonganxitong
|
||||
|
||||
import "shylinux.com/x/ice"
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
|
||||
"shylinux.com/x/community/src/gonganxitong/model"
|
||||
)
|
||||
|
||||
type spendlist struct {
|
||||
Table
|
||||
fields string `data:"title,content,user_uid"`
|
||||
create string `name:"create title* content*" role:"leader"`
|
||||
remove string `name:"remove" role:"leader"`
|
||||
fields string `data:"vendor,total,count,user_uid"`
|
||||
}
|
||||
|
||||
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 {
|
||||
msg := m.Cmd(s.Prefix(m, spendlist{}), s.Select, model.PLACE_UID, m.Option(s.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.Option("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.Echo("<span style='color:red'>存储空间不足,请及时续费或清理空间</span>").Action()
|
||||
}
|
||||
return false
|
||||
}
|
||||
if size > 0 {
|
||||
s.SpendlistCount(m, size)
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (s Table) SpendlistCount(m *ice.Message, size int) {
|
||||
m.Cmd(s.Prefix(m, spendlist{}), s.AddCount, model.COUNT, size, m.Option("spendlist_uid"))
|
||||
}
|
||||
func (s Table) SpendlistUpdate(m *ice.Message, size string) {
|
||||
msg := m.Cmd(s.Prefix(m, spendlist{}), s.Select, model.PLACE_UID, m.Option(s.PLACE_UID), model.VENDOR, m.PrefixKey())
|
||||
m.Option(model.UID, msg.Append(model.UID))
|
||||
m.Cmd(s.Prefix(m, spendlist{}), s.Modify, model.COUNT, size)
|
||||
}
|
||||
|
@ -154,6 +154,8 @@ func (s smh) Upload(m *ice.Message, arg ...string) {
|
||||
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"))
|
||||
}
|
||||
func (s smh) Token(m *ice.Message, arg ...string) {
|
||||
if arg[1] == "" || arg[2] < m.Time() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user