This commit is contained in:
IT 老营长 @云轩领航-创始人 2025-05-14 17:40:56 +08:00
parent 1a99c2c96e
commit 6e37730daa
19 changed files with 284 additions and 71 deletions

View File

@ -289,8 +289,12 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
value = AllowStatus(kit.Int(value)).String() value = AllowStatus(kit.Int(value)).String()
case model.MESSAGE_STATUS: case model.MESSAGE_STATUS:
value = MessageStatus(kit.Int(value)).String() value = MessageStatus(kit.Int(value)).String()
case model.SERVICE_STATUS:
value = ServiceStatus(kit.Int(value)).String()
case model.PAYMENTLIST_STATUS: case model.PAYMENTLIST_STATUS:
value = PaymentStatus(kit.Int(value)).String() value = PaymentStatus(kit.Int(value)).String()
case model.PRICE, model.AMOUNT:
value = kit.Format("%.2f", kit.Float(value)/100)
} }
return value return value
}) })

View File

@ -5,6 +5,7 @@ import (
"shylinux.com/x/icebergs/base/web/html" "shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/api"
"shylinux.com/x/community/src/gonganxitong/model" "shylinux.com/x/community/src/gonganxitong/model"
) )
@ -19,6 +20,8 @@ type member struct {
promote string `name:"promote" role:"void"` promote string `name:"promote" role:"void"`
demote string `name:"demote" role:"void"` demote string `name:"demote" role:"void"`
setCookie string `name:"setCookie" help:"切换"` setCookie string `name:"setCookie" help:"切换"`
main string `name:"main" help:"主页" role:"void"`
auth string `name:"auth" help:"认证" role:"void"`
} }
func (s member) Remove(m *ice.Message, arg ...string) { func (s member) Remove(m *ice.Message, arg ...string) {
@ -55,6 +58,13 @@ func (s member) SetCookie(m *ice.Message, arg ...string) {
m.Cmdy(s.UserPlace, s.Select, model.UID, m.Option(model.UID)) m.Cmdy(s.UserPlace, s.Select, model.UID, m.Option(model.UID))
m.ProcessCookie(model.USER_UID, m.Append(model.USER_UID)) m.ProcessCookie(model.USER_UID, m.Append(model.USER_UID))
} }
func (s member) Main(m *ice.Message, arg ...string) {
m.ProcessField(api.RENZHENGSHOUQUAN_PORTAL, []string{m.Option(model.AUTH_UID)})
}
func (s member) Auth(m *ice.Message, arg ...string) {
msg := m.Cmd(city{}, s.Select, model.NAME, m.Option(model.CITY_NAME))
m.Cmdy(user{}, s.AuthCreate, kit.Dict(msg.AppendSimple(model.AUTH_UID)))
}
func (s member) List(m *ice.Message, arg ...string) { func (s member) List(m *ice.Message, arg ...string) {
USER_PLACE_ROLE := s.Keys(s.UserPlace, model.ROLE) USER_PLACE_ROLE := s.Keys(s.UserPlace, model.ROLE)
user_uid, isLeader, isCreator := m.Option(model.USER_UID), s.IsLeader(m), s.IsCreator(m) user_uid, isLeader, isCreator := m.Option(model.USER_UID), s.IsLeader(m), s.IsCreator(m)
@ -68,6 +78,8 @@ func (s member) List(m *ice.Message, arg ...string) {
return return
} }
defer m.Sort(kit.Fields(model.MEMBER_STATUS, USER_PLACE_ROLE, "auth_status", model.CREATED_AT)) defer m.Sort(kit.Fields(model.MEMBER_STATUS, USER_PLACE_ROLE, "auth_status", model.CREATED_AT))
s.SelectJoinUser(m, model.NAME, model.INFO, model.AVATAR, model.AUTH_UID)
s.SelectJoinAuth(m)
m.Table(func(value ice.Maps) { m.Table(func(value ice.Maps) {
if !m.FieldsIsDetail() { if !m.FieldsIsDetail() {
if user_uid == value[model.USER_UID] { if user_uid == value[model.USER_UID] {
@ -78,6 +90,13 @@ func (s member) List(m *ice.Message, arg ...string) {
} }
button := []ice.Any{} button := []ice.Any{}
kit.If(m.IsTech() && value[model.USER_UID] != user_uid, func() { button = append(button, s.SetCookie) }) kit.If(m.IsTech() && value[model.USER_UID] != user_uid, func() { button = append(button, s.SetCookie) })
if value[model.AUTH_UID] == "" {
kit.If(value[model.USER_UID] == user_uid, func() {
button = append(button, s.Auth)
})
} else {
button = append(button, s.Main)
}
if MemberStatus(kit.Int(value[model.MEMBER_STATUS])) == MemberNormal { if MemberStatus(kit.Int(value[model.MEMBER_STATUS])) == MemberNormal {
if isCreator { if isCreator {
switch kit.Int(value[USER_PLACE_ROLE]) { switch kit.Int(value[USER_PLACE_ROLE]) {
@ -105,8 +124,6 @@ func (s member) List(m *ice.Message, arg ...string) {
} }
m.PushButton(button...) m.PushButton(button...)
}) })
s.SelectJoinUser(m, model.NAME, model.INFO, model.AVATAR, model.AUTH_UID)
s.SelectJoinAuth(m)
s.DisplayBase(m, "").DisplayCSS("") s.DisplayBase(m, "").DisplayCSS("")
m.Echo("count: %d", m.Length()) m.Echo("count: %d", m.Length())
} }

View File

@ -336,6 +336,7 @@ type Service struct {
Nodename string `gorm:"type:varchar(32)"` Nodename string `gorm:"type:varchar(32)"`
Pathname string `gorm:"type:varchar(255)"` Pathname string `gorm:"type:varchar(255)"`
Hostname string `gorm:"type:varchar(32)"` Hostname string `gorm:"type:varchar(32)"`
Status uint8 `gorm:"default:0"`
} }
type Support struct { type Support struct {
db.ModelContent db.ModelContent

View File

@ -1,8 +1,5 @@
$body:not(.mobile) { background-color:var(--notice-bg-color); } $body.dark { background-color:var(--notice-bg-color); --plugin-bg-color:#0d1117; --output-bg-color:#171a22; }
$body.dark { --plugin-bg-color:#0d1117; --output-bg-color:#171a22; } $body.light { background-color:#dbe7fe; --plugin-bg-color:#f3f3f4; --output-bg-color:white; --notice-bg-color:#006fff; }
$body.width1.light { --plugin-bg-color:#f4f5f9; --output-bg-color:#fefefd; }
$body.width1.light { --plugin-bg-color:#f4f5f9; --output-bg-color:white; }
$body.width1.light { --plugin-bg-color:#f3f3f4; --output-bg-color:white; --notice-bg-color:#006fff; }
$body.width1 fieldset.Action div.input.float { position:static; } $body.width1 fieldset.Action div.input.float { position:static; }
$body.width1 fieldset.Action div.input.float table { width:100%; } $body.width1 fieldset.Action div.input.float table { width:100%; }
$body.width1 div.upload.float div.action { display:flex; } $body.width1 div.upload.float div.action { display:flex; }
@ -84,6 +81,7 @@ $output div.item.card div.title { width:100%; display:flex; position:relative; }
$output div.item.card div.title span.type { line-height:22px; } $output div.item.card div.title span.type { line-height:22px; }
$output div.item.card div.title span.status { line-height:22px; } $output div.item.card div.title span.status { line-height:22px; }
$output div.item.card div.title span.price { color:var(--danger-bg-color); } $output div.item.card div.title span.price { color:var(--danger-bg-color); }
$output div.item.card div.title span.score { background-color:var(--hover-bg-color); color:var(--danger-bg-color); padding:0 5px; }
body.width1 $output div.item.card div.title span.price { margin-left:auto; } body.width1 $output div.item.card div.title span.price { margin-left:auto; }
$output div.item.card div.title span.auth { font-size:14px; padding:3px; } $output div.item.card div.title span.auth { font-size:14px; padding:3px; }
$output div.item.card div.title span.time { position:absolute; right:0; font-size:12px; color:gray; } $output div.item.card div.title span.time { position:absolute; right:0; font-size:12px; color:gray; }
@ -133,7 +131,7 @@ $output table.content.detail tr.uid { display:none; }
$output table.content.detail input { border:none; } $output table.content.detail input { border:none; }
$output fieldset.story.otherList>div.output { max-height:unset !important; } $output fieldset.story.otherList>div.output { max-height:unset !important; }
$output fieldset.story>div.output>div.tabs { background-color:var(--plugin-bg-color); display:flex; overflow:auto; position:sticky; top:0; z-index:1; } $output fieldset.story>div.output>div.tabs { background-color:var(--plugin-bg-color); display:flex; overflow:auto; position:sticky; top:0; z-index:2; }
$output fieldset.story>div.output>div.tabs>div.item { white-space:pre; line-height:22px; padding:5px; } $output fieldset.story>div.output>div.tabs>div.item { white-space:pre; line-height:22px; padding:5px; }
$output fieldset.story>div.output>div.tabs>div.item.select { border-top:var(--box-notice); background-color:var(--output-bg-color); } $output fieldset.story>div.output>div.tabs>div.item.select { border-top:var(--box-notice); background-color:var(--output-bg-color); }
$output fieldset.story>div.output>div.tabs>div.item.danger.select { border-top:var(--box-danger); background-color:var(--output-bg-color); } $output fieldset.story>div.output>div.tabs>div.item.danger.select { border-top:var(--box-danger); background-color:var(--output-bg-color); }

View File

@ -101,11 +101,9 @@ func (s Portal) Run(m *ice.Message, arg ...string) {
role = action.Role role = action.Role
} else { } else {
m.Option(s.Keys(s.Place, model.UID), arg[1]) m.Option(s.Keys(s.Place, model.UID), arg[1])
defer s.SelectJoinUser(m)
} }
} else {
defer s.SelectJoinUser(m)
} }
defer s.SelectJoinUser(m)
if action, ok := cmd.Actions["beforeAction"]; ok { if action, ok := cmd.Actions["beforeAction"]; ok {
action.Hand(m.Message, arg[1:]...) action.Hand(m.Message, arg[1:]...)
} }

View File

@ -5,9 +5,10 @@ Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) {
can.onappend.style(can, html.OUTPUT), can.onimport.myPortal(can, msg) can.onappend.style(can, html.OUTPUT), can.onimport.myPortal(can, msg)
}, },
otherList: function(can, msg, action) { if (!msg.IsDetail()) { return } typeof action == "string" && (action = [action]) otherList: function(can, msg, action) {
if (!msg.IsDetail()) { return } typeof action == "string" && (action = [action])
can.core.Next(action, function(action, next) { can.core.Next(action, function(action, next) {
can.run(can.request({}, {uid: msg.Append(UID)}), action, function(msg) { if (msg.Length() == 0) { return next() } can.run(can.request({}, {uid: msg.Append(UID)}, msg.TableDetail()), action, function(msg) { if (msg.Length() == 0) { return next() }
can.page.Append(can, can._output, [{view: [[html.ITEM, html.TITLE, action], "", can.user.trans(can, action)]}]) can.page.Append(can, can._output, [{view: [[html.ITEM, html.TITLE, action], "", can.user.trans(can, action)]}])
can.onappend.plugin(can, {index: can.ConfIndex()}, function(sub) { can.onimport.myField(can, sub) can.onappend.plugin(can, {index: can.ConfIndex()}, function(sub) { can.onimport.myField(can, sub)
can.onappend.style(sub, "otherList") can.onappend.style(sub, "otherList")
@ -187,7 +188,7 @@ Volcanos(chat.ONIMPORT, {
}, },
myIndex: function(can, msg, target) { can.onimport.myTitle(can, "My Index", "我的应用", target) myIndex: function(can, msg, target) { can.onimport.myTitle(can, "My Index", "我的应用", target)
var list = ["visitor", "creator", "landlord", "teacher", "leader", "boss", "tenant", "student", "worker", "custom", "admin", "parent", "server"] var list = ["visitor", "creator", "landlord", "teacher", "leader", "boss", "tenant", "student", "worker", "custom", "admin", "parent", "server"]
var _list = can.Conf("_trans.value."+can.Conf("_user_place_role")) var _list = can.Conf("_trans.value."+can.Conf("_user_place_role"))||{}
can.core.Item(_list, function(key) { list.indexOf(key) == -1 && list.push(key) }) can.core.Item(_list, function(key) { list.indexOf(key) == -1 && list.push(key) })
var role = can.page.Append(can, target, [{view: aaa.ROLE, list: can.core.List(list, function(key) { var role = can.page.Append(can, target, [{view: aaa.ROLE, list: can.core.List(list, function(key) {
var value = _list[key]; if (!value) { return } if (can.base.isIn(key, ctx.STYLE, mdb.ICONS)) { return } var value = _list[key]; if (!value) { return } if (can.base.isIn(key, ctx.STYLE, mdb.ICONS)) { return }

View File

@ -27,6 +27,8 @@ type service struct {
oauth string `name:"oauth" icon:"bi bi-shield-fill-check"` oauth string `name:"oauth" icon:"bi bi-shield-fill-check"`
open string `name:"open" role:"void"` open string `name:"open" role:"void"`
conf string `name:"conf" role:"void"` conf string `name:"conf" role:"void"`
online string `name:"online" help:"上架" style:"notice" role:"tech"`
offline string `name:"offline" help:"下架" style:"danger" role:"tech"`
} }
func ServiceUID(m *ice.Message) string { func ServiceUID(m *ice.Message) string {
@ -97,15 +99,26 @@ func (s service) Compile(m *ice.Message, arg ...string) {
} }
func (s service) List(m *ice.Message, arg ...string) { func (s service) List(m *ice.Message, arg ...string) {
if len(arg) < 2 { if len(arg) < 2 {
s.Orders(m, s.Desc(model.UPDATED_AT)).Select(m) s.Orders(m, s.Desc(model.STATUS), s.Desc(model.UPDATED_AT)).Select(m)
} else { } else {
s.SelectDetail(m, model.UID, arg[1]) s.SelectDetail(m, model.UID, arg[1])
} }
if m.IsTech() { m.Table(func(value ice.Maps) {
m.PushAction(s.Open, s.Conf, s.Code, s.Data).Action(s.Oauth, s.Autogen) button := []ice.Any{s.Open}
} else { defer func() { m.PushButton(button...) }()
m.PushAction(s.Open).Action() if m.IsTech() {
} button = append(button, s.Conf, s.Code, s.Data)
switch ServiceStatus(kit.Int(value[model.STATUS])) {
case ServiceOffline:
button = append(button, s.Online)
case ServiceOnline:
button = append(button, s.Offline)
}
m.Action(s.Oauth, s.Autogen)
} else {
m.Action()
}
})
m.RenameAppend(model.NODENAME, model.SPACE, model.NODETYPE, model.SERVICE_TYPE, mdb.STATUS, model.SERVICE_STATUS) m.RenameAppend(model.NODENAME, model.SPACE, model.NODETYPE, model.SERVICE_TYPE, mdb.STATUS, model.SERVICE_STATUS)
s.DisplayBase(m, "") s.DisplayBase(m, "")
} }
@ -121,6 +134,12 @@ func (s service) Code(m *ice.Message, arg ...string) {
func (s service) Data(m *ice.Message, arg ...string) { func (s service) Data(m *ice.Message, arg ...string) {
s.spaceOpen(m, web.CODE_MYSQL_QUERY, aaa.SESS, "mysql", mdb.DATABASE, s.name(m)) s.spaceOpen(m, web.CODE_MYSQL_QUERY, aaa.SESS, "mysql", mdb.DATABASE, s.name(m))
} }
func (s service) Online(m *ice.Message, arg ...string) {
s.Table.Update(m, kit.Simple(model.STATUS, ServiceOnline), m.OptionSimple(model.UID)...)
}
func (s service) Offline(m *ice.Message, arg ...string) {
s.Table.Update(m, kit.Simple(model.STATUS, ServiceOffline), m.OptionSimple(model.UID)...)
}
func init() { ice.TeamCtxCmd(service{}) } func init() { ice.TeamCtxCmd(service{}) }
@ -130,3 +149,17 @@ func (s service) name(m *ice.Message) string {
func (s service) spaceOpen(m *ice.Message, index string, arg ...ice.Any) { func (s service) spaceOpen(m *ice.Message, index string, arg ...ice.Any) {
m.ProcessOpen(kit.MergeURL(web.S(m.Option(web.SPACE))+web.C(index), arg...)) m.ProcessOpen(kit.MergeURL(web.S(m.Option(web.SPACE))+web.C(index), arg...))
} }
type ServiceStatus int
const (
ServiceOffline ServiceStatus = iota
ServiceOnline
)
var ServiceStatusList = map[ServiceStatus]string{
ServiceOffline: "offline",
ServiceOnline: "online",
}
func (s ServiceStatus) String() string { return ServiceStatusList[s] }

View File

@ -1,7 +1,11 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { can.onimport.myView(can, msg, function(value) {
value._style = value.service_status
value.icons = can.misc.Resource(can, value.icon.split("?")[0], value.space) value.icons = can.misc.Resource(can, value.icon.split("?")[0], value.space)
if (value.service_status == "offline" && !msg.IsTech()) {
return
}
return [ return [
{view: html.TITLE, list: [value.name]}, {view: html.TITLE, list: [value.name]},
{view: html.STATUS, list: [value.index]}, {view: html.STATUS, list: [value.index]},

View File

@ -18,6 +18,7 @@ type user struct {
Table Table
setting setting setting setting
template string `data:"4b-Z_r8dZmm1pHdd2h4A10VVYX4OIHvemlLjsHKBj2s"` template string `data:"4b-Z_r8dZmm1pHdd2h4A10VVYX4OIHvemlLjsHKBj2s"`
fields string `data:"name,info,avatar,background,auth_uid"`
create string `name:"create open_id* avatar usernick"` create string `name:"create open_id* avatar usernick"`
modify string `name:"modify info" role:"void"` modify string `name:"modify info" role:"void"`
list string `name:"list uid auto" role:"void"` list string `name:"list uid auto" role:"void"`

View File

@ -0,0 +1,68 @@
package renzhengshouquan
import (
"shylinux.com/x/community/src/renzhengshouquan/model"
"shylinux.com/x/ice"
)
type account struct {
Table
order string `data:"4"`
fields string `data:"type,status,amount"`
create string `name:"create account_type*" role:"leader"`
createDefault string `name:"createDefault" role:"leader" help:"开通默认账户"`
remove string `name:"remove" role:"leader"`
recharge string `name:"recharge amount*" role:"leader" help:"充值"`
transfer string `name:"transfer amount* to_account_uid*:select" role:"leader" help:"转账"`
withdraw string `name:"withdraw amount*" role:"leader" help:"提现"`
}
func (s account) CreateDefault(m *ice.Message, arg ...string) {
s.ValueCreate(m, arg...)
}
func (s account) List(m *ice.Message, arg ...string) {
s.ValueList(m, arg).Display("")
if m.Length() == 0 {
m.SetResult().EchoInfoButton("请开通默认账户", s.CreateDefault)
} else {
m.PushAction(s.Recharge, s.Transfer, s.Withdraw)
}
}
func (s account) Recharge(m *ice.Message, arg ...string) {
s.TransPrice(m, arg)
s.Transaction(m, func() {
s.AddCount(m, model.AMOUNT, arg[1], m.Option(model.UID))
m.Cmdy(transition{}, s.Create, model.TRANSITION_TYPE, TransitionRecharge, model.AMOUNT, m.Option(model.AMOUNT), model.TO_ACCOUNT_UID, m.Option(model.UID))
})
}
func (s account) Transfer(m *ice.Message, arg ...string) {
s.TransPrice(m, arg)
s.Transaction(m, func() {
s.AddCount(m, model.AMOUNT, "-"+arg[1], m.Option(model.UID))
s.AddCount(m, model.AMOUNT, arg[1], m.Option(model.TO_ACCOUNT_UID))
m.Cmdy(transition{}, s.Create, model.TRANSITION_TYPE, TransitionTransfer, model.AMOUNT, m.Option(model.AMOUNT), model.FROM_ACCOUNT_UID, m.Option(model.UID), m.OptionSimple(model.TO_ACCOUNT_UID))
})
}
func (s account) Withdraw(m *ice.Message, arg ...string) {
s.TransPrice(m, arg)
s.Transaction(m, func() {
s.AddCount(m, model.AMOUNT, "-"+arg[1], m.Option(model.UID))
m.Cmd(transition{}, s.Create, model.TRANSITION_TYPE, TransitionWithdraw, model.AMOUNT, m.Option(model.AMOUNT), model.FROM_ACCOUNT_UID, m.Option(model.UID))
})
}
func init() { ice.TeamCtxCmd(account{}) }
type AccountType int
const (
AccountDefault AccountType = iota
AccountBank
)
var AccountTypeList = map[AccountType]string{
AccountDefault: "默认账户",
AccountBank: "银行账户",
}
func (s AccountType) String() string { return AccountTypeList[s] }

View File

@ -0,0 +1,9 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title||value.name||"默认账户", can.onimport.unitView(can, value, "amount", "元"), can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
{view: html.OUTPUT, list: [value.content||value.info]},
] })
},
})

View File

@ -25,6 +25,8 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
s.InputsListSkip(m, AuthTypeList, kit.Select("0", "-1", m.IsTech()), arg...) s.InputsListSkip(m, AuthTypeList, kit.Select("0", "-1", m.IsTech()), arg...)
case model.AUTH_STATUS: case model.AUTH_STATUS:
s.InputsList(m, AuthStatusList, arg...) s.InputsList(m, AuthStatusList, arg...)
case model.ACCOUNT_TYPE:
s.InputsList(m, AccountTypeList, arg...)
case model.FROM_UID: case model.FROM_UID:
if AuthType(kit.Int(m.Option(model.AUTH_TYPE))) == AuthRoot { if AuthType(kit.Int(m.Option(model.AUTH_TYPE))) == AuthRoot {
m.Push(arg[0], aaa.ROOT) m.Push(arg[0], aaa.ROOT)
@ -63,6 +65,8 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
value = AuthStatus(kit.Int(value)).String() value = AuthStatus(kit.Int(value)).String()
case model.CERT_STATUS: case model.CERT_STATUS:
value = CertStatus(kit.Int(value)).String() value = CertStatus(kit.Int(value)).String()
case model.TRANSITION_TYPE:
value = TransitionType(kit.Int(value)).String()
} }
return value return value
}) })

View File

@ -3,51 +3,56 @@ package model
import "shylinux.com/x/mysql-story/src/db" import "shylinux.com/x/mysql-story/src/db"
const ( const (
UID = "uid" UID = "uid"
NAME = "name" NAME = "name"
INFO = "info" INFO = "info"
TYPE = "type" TYPE = "type"
ROLE = "role" ROLE = "role"
STATUS = "status" STATUS = "status"
SCORE = "score" AMOUNT = "amount"
TITLE = "title" SCORE = "score"
CONTENT = "content" TITLE = "title"
AVATAR = "avatar" CONTENT = "content"
BACKGROUND = "background" AVATAR = "avatar"
USER_UID = "user_uid" BACKGROUND = "background"
USER_AUTH_ROLE = "user_auth_role" USER_UID = "user_uid"
AUTH_UID = "auth_uid" USER_AUTH_ROLE = "user_auth_role"
AUTH_NAME = "auth_name" AUTH_UID = "auth_uid"
AUTH_INFO = "auth_info" AUTH_NAME = "auth_name"
AUTH_TYPE = "auth_type" AUTH_INFO = "auth_info"
AUTH_STATUS = "auth_status" AUTH_TYPE = "auth_type"
AUTH_AVATAR = "auth_avatar" AUTH_STATUS = "auth_status"
CERT_UID = "cert_uid" AUTH_AVATAR = "auth_avatar"
CERT_STATUS = "cert_status" CERT_UID = "cert_uid"
PLACE_NAME = "place_name" CERT_STATUS = "cert_status"
STREET_NAME = "street_name" ACCOUNT_TYPE = "account_type"
COMPANY_UID = "company_uid" FROM_ACCOUNT_UID = "from_account_uid"
COMPANY_NAME = "company_name" TO_ACCOUNT_UID = "to_account_uid"
CITY_UID = "city_uid" TRANSITION_TYPE = "transition_type"
CITY_NAME = "city_name" PLACE_NAME = "place_name"
FROM_UID = "from_uid" STREET_NAME = "street_name"
SERVICE_UID = "service_uid" COMPANY_UID = "company_uid"
PLACE_UID = "place_uid" COMPANY_NAME = "company_name"
STORAGE_UID = "storage_uid" CITY_UID = "city_uid"
DASHBOARD_UID = "dashboard_uid" CITY_NAME = "city_name"
SPACE = "space" FROM_UID = "from_uid"
INDEX = "index" SERVICE_UID = "service_uid"
VALUE = "value" PLACE_UID = "place_uid"
PATH = "path" STORAGE_UID = "storage_uid"
NUMBER = "number" DASHBOARD_UID = "dashboard_uid"
BIRTH = "birth" SPACE = "space"
PERIOD = "period" INDEX = "index"
PERSON = "person" VALUE = "value"
AUTHOR = "author" PATH = "path"
ADDRESS = "address" NUMBER = "number"
MOBILE = "mobile" BIRTH = "birth"
VERIFY = "verify" PERIOD = "period"
VENDOR = "vendor" PERSON = "person"
AUTHOR = "author"
ADDRESS = "address"
MOBILE = "mobile"
VERIFY = "verify"
VENDOR = "vendor"
) )
type UserAuth struct { type UserAuth struct {
@ -83,5 +88,23 @@ type Cert struct {
Mobile string `gorm:"type:varchar(16)"` Mobile string `gorm:"type:varchar(16)"`
Verify string `gorm:"type:varchar(16)"` Verify string `gorm:"type:varchar(16)"`
} }
type Account struct {
db.ModelWithUID
AuthUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32);index"`
Type uint8 `gorm:"default:0"`
Status uint8 `gorm:"default:0"`
Amount int `gorm:"default:0"`
}
type Transition struct {
db.ModelWithUID
AuthUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32);index"`
Type uint8 `gorm:"default:0"`
Status uint8 `gorm:"default:0"`
Amount int `gorm:"default:0"`
FromAccountUID string `gorm:"type:char(32);index"`
ToAccountUID string `gorm:"type:char(32);index"`
}
func init() { db.CmdModels("", &UserAuth{}, &Auth{}, &Cert{}) } func init() { db.CmdModels("", &UserAuth{}, &Auth{}, &Cert{}, &Account{}, &Transition{}) }

View File

@ -5,6 +5,7 @@ import (
"shylinux.com/x/icebergs/base/aaa" "shylinux.com/x/icebergs/base/aaa"
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/api"
"shylinux.com/x/community/src/gonganxitong" "shylinux.com/x/community/src/gonganxitong"
"shylinux.com/x/community/src/renzhengshouquan/model" "shylinux.com/x/community/src/renzhengshouquan/model"
"shylinux.com/x/enterprise/src/guanlixitong" "shylinux.com/x/enterprise/src/guanlixitong"
@ -31,7 +32,8 @@ func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
case AuthCity: case AuthCity:
arg = append(arg, model.FROM_UID, s.findAuthFrom(m, AuthRoot)) arg = append(arg, model.FROM_UID, s.findAuthFrom(m, AuthRoot))
case AuthPersonal: case AuthPersonal:
arg = append(arg, model.USER_UID, m.Option(model.USER_UID)) msg := m.Cmd(api.GONGANXITONG_USER, s.Table.Select, model.UID, m.Option(model.USER_UID))
arg = append(arg, model.USER_UID, m.Option(model.USER_UID), model.AVATAR, msg.Append(model.AVATAR))
} }
arg = kit.TransArgKeys(arg, model.AUTH_NAME, model.NAME, model.AUTH_INFO, model.INFO, model.AUTH_TYPE, model.TYPE) arg = kit.TransArgKeys(arg, model.AUTH_NAME, model.NAME, model.AUTH_INFO, model.INFO, model.AUTH_TYPE, model.TYPE)
if m.Options(arg).Cmdy(s.Place, s.Insert, arg).IsErr() { if m.Options(arg).Cmdy(s.Place, s.Insert, arg).IsErr() {

View File

@ -1,6 +1,7 @@
{ {
"portal": "认证授权", "portal": "认证授权",
"cert": "上传证件", "auth": "认证授权", "admin": "管理后台", "profile": "用户名片", "cert": "上传证件", "auth": "认证授权", "admin": "管理后台", "profile": "用户名片",
"account": "账户", "transition": "账单",
"certList": "证件", "memberList": "成员", "certList": "证件", "memberList": "成员",
"issue": "认证", "revoke": "吊销", "enter": "进入", "issue": "认证", "revoke": "吊销", "enter": "进入",
"verify": "验证", "verify": "验证",
@ -13,6 +14,8 @@
"icons": { "icons": {
"cert": "https://img.icons8.com/officel/80/identification-documents--v2.png", "cert": "https://img.icons8.com/officel/80/identification-documents--v2.png",
"auth": "https://img.icons8.com/officel/80/id-verified.png", "auth": "https://img.icons8.com/officel/80/id-verified.png",
"account": "https://img.icons8.com/officel/80/id-verified.png",
"transition": "https://img.icons8.com/officel/80/id-verified.png",
"admin": "https://img.icons8.com/officel/80/structured-document-data.png", "admin": "https://img.icons8.com/officel/80/structured-document-data.png",
"profile": "https://img.icons8.com/officel/80/passport.png" "profile": "https://img.icons8.com/officel/80/passport.png"
}, },

View File

@ -36,13 +36,13 @@ func (s profile) List(m *ice.Message, arg ...string) {
s.Select(m, model.UID, arg[0]).Action() s.Select(m, model.UID, arg[0]).Action()
name := m.Append(model.NAME) name := m.Append(model.NAME)
button := []ice.Any{} button := []ice.Any{}
button = append(button, s.Enter)
kit.If(s.IsWorker(m), func() { button = append(button, s.Modify) }) kit.If(s.IsWorker(m), func() { button = append(button, s.Modify) })
switch AuthType(kit.Int(m.Append(model.AUTH_TYPE))) { switch AuthType(kit.Int(m.Append(model.AUTH_TYPE))) {
case AuthService: case AuthService:
s.SelectJoinRecent(m, "") s.SelectJoinRecent(m, "")
s.SelectJoinService(m) s.SelectJoinService(m)
name = kit.JoinWord(m.Append(model.CITY_NAME), m.Append(model.STREET_NAME), m.Append(model.PLACE_NAME)) name = kit.JoinWord(m.Append(model.CITY_NAME), m.Append(model.STREET_NAME), m.Append(model.PLACE_NAME))
kit.If(s.IsWorker(m), func() { button = append(button, s.Enter) })
case AuthCompany: case AuthCompany:
// kit.If(s.IsWorker(m), func() { m.PushAction(s.Modify, s.Enter) }, func() { m.PushAction() }) // kit.If(s.IsWorker(m), func() { m.PushAction(s.Modify, s.Enter) }, func() { m.PushAction() })
case AuthPersonal: case AuthPersonal:
@ -78,9 +78,10 @@ func (s profile) MemberList(m *ice.Message, arg ...string) {
s.SelectJoinAuth(m) s.SelectJoinAuth(m)
m.Table(func(value ice.Maps) { m.Table(func(value ice.Maps) {
if value[model.AUTH_STATUS] == "" && value[model.USER_UID] == user_uid { if value[model.AUTH_STATUS] == "" && value[model.USER_UID] == user_uid {
// m.PushButton(s.AuthPersonal, s.Enter)
m.PushButton(s.AuthPersonal) m.PushButton(s.AuthPersonal)
} else { } else {
m.PushButton() // m.PushButton(s.Enter)
} }
}) })
s.authSort(m) s.authSort(m)
@ -110,6 +111,7 @@ func (s profile) FromList(m *ice.Message, arg ...string) {
break break
} }
} }
// m.PushAction(s.Enter)
} }
func (s profile) AuthPersonal(m *ice.Message, arg ...string) { func (s profile) AuthPersonal(m *ice.Message, arg ...string) {
s.CreditCmdy(m, m.ActionKey(), arg) s.CreditCmdy(m, m.ActionKey(), arg)

View File

@ -60,10 +60,13 @@ Volcanos(chat.ONIMPORT, {
Volcanos(chat.ONACTION, { Volcanos(chat.ONACTION, {
enter: function(event, can) { var msg = can.request(event) enter: function(event, can) { var msg = can.request(event)
if (msg.Option("auth_type") == "company") { if (msg.Option("auth_type") == "company") {
can.user.open(can.misc.MergePodCmd(can, {pod: "20240724-community", cmd: "web.team.renzhengshouquan.admin", auth_uid: msg.Option("auth_uid"), view: "admin"})) can.onimport.myStory(can, {index: "web.team.renzhengshouquan.portal", args: [msg.Option(UID)]})
} else { // can.user.open(can.misc.MergePodCmd(can, {pod: "20240724-community", cmd: "web.team.renzhengshouquan.admin", auth_uid: msg.Option("auth_uid"), view: "admin"}))
} else if (msg.Option("auth_type") == "service") {
can.onimport.myStory(can, {space: msg.Option("nodename"), index: msg.Option(ctx.INDEX), args: [msg.Option(PLACE_UID)]}) can.onimport.myStory(can, {space: msg.Option("nodename"), index: msg.Option(ctx.INDEX), args: [msg.Option(PLACE_UID)]})
// can.onimport.myPlugin(can, {space: msg.Option("nodename"), index: msg.Option(ctx.INDEX), args: [msg.Option(PLACE_UID)]}) // can.onimport.myPlugin(can, {space: msg.Option("nodename"), index: msg.Option(ctx.INDEX), args: [msg.Option(PLACE_UID)]})
} else {
can.onimport.myStory(can, {index: "web.team.renzhengshouquan.portal", args: [msg.Option(UID)||msg.Option(AUTH_UID)]})
} }
can.page.ClassList.del(can, can._fields, "_process") can.page.ClassList.del(can, can._fields, "_process")
}, },

View File

@ -0,0 +1,33 @@
package renzhengshouquan
import "shylinux.com/x/ice"
type transition struct {
Table
order string `data:"5"`
fields string `data:"transition_type,status,amount,from_account_uid,to_account_uid"`
create string `name:"create transition_type* amount* from_account_uid to_account_uid" role:"leader"`
remove string `name:"remove" role:"leader"`
}
func (s transition) List(m *ice.Message, arg ...string) {
s.ValueList(m, arg).Display("")
}
func init() { ice.TeamCtxCmd(transition{}) }
type TransitionType int
const (
TransitionRecharge TransitionType = iota
TransitionTransfer
TransitionWithdraw
)
var TransitionTypeList = map[TransitionType]string{
TransitionRecharge: "充值",
TransitionTransfer: "转账",
TransitionWithdraw: "提现",
}
func (s TransitionType) String() string { return TransitionTypeList[s] }

View File

@ -0,0 +1,9 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title||value.name||value.user_name, value.transition_type, value.amount, can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
{view: html.OUTPUT, list: [value.content||value.info]},
] })
},
})