This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-12-04 14:39:53 +08:00
parent 261e445908
commit a118f29d5d
22 changed files with 127 additions and 129 deletions

View File

@ -367,6 +367,9 @@ func (s Table) AuthCreate(m *ice.Message, authType int, fromUID string, arg ...s
) )
s.Update(m, kit.Dict(m.OptionSimple(model.AUTH_UID)), arg...) s.Update(m, kit.Dict(m.OptionSimple(model.AUTH_UID)), arg...)
} }
func (s Table) SpideCreate(m *ice.Message, arg ...string) {
m.Cmd(web.SPIDE, mdb.CREATE, arg)
}
func (s Table) PlaceIsAuthed(m *ice.Message, arg ...string) *ice.Message { func (s Table) PlaceIsAuthed(m *ice.Message, arg ...string) *ice.Message {
if msg := m.Cmd(s.Place, s.Select, model.UID, arg[0]); msg.Append(model.AUTH_UID) == "" { if msg := m.Cmd(s.Place, s.Select, model.UID, arg[0]); msg.Append(model.AUTH_UID) == "" {
m.Echo("本服务暂未申请认证,请到<用户名片>申请认证") m.Echo("本服务暂未申请认证,请到<用户名片>申请认证")

View File

@ -11,7 +11,7 @@ type paymentlist struct {
Table Table
order string `data:"91"` order string `data:"91"`
auth_uid string `data:""` auth_uid string `data:""`
fields string `data:"user_uid,paymentlist_status,amount,title,content"` fields string `data:"title,content,amount,paymentlist_status,user_uid"`
create string `name:"create amount* title* content" role:"leader"` create string `name:"create amount* title* content" role:"leader"`
payfor string `name:"payfor" help:"支付" style:"notice" role:"void"` payfor string `name:"payfor" help:"支付" style:"notice" role:"void"`
} }
@ -22,7 +22,7 @@ func (s paymentlist) Create(m *ice.Message, arg ...string) {
arg[i+1] = kit.Format(kit.Int(kit.Float(arg[i+1]) * 100)) arg[i+1] = kit.Format(kit.Int(kit.Float(arg[i+1]) * 100))
} }
} }
m.Option(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID))) m.Option(model.PLACE_UID, m.Option(s.PLACE_UID))
s.Insert(m, kit.Simple(arg, m.OptionSimple(model.PLACE_UID, model.USER_UID))...) s.Insert(m, kit.Simple(arg, m.OptionSimple(model.PLACE_UID, model.USER_UID))...)
s.RecordEventWithName(m, "") s.RecordEventWithName(m, "")
} }
@ -31,7 +31,9 @@ func (s paymentlist) List(m *ice.Message, arg ...string) {
s.Select(m, model.PLACE_UID, arg[0]) s.Select(m, model.PLACE_UID, arg[0])
} else if len(arg) == 2 { } else if len(arg) == 2 {
s.SelectDetail(m, model.PLACE_UID, arg[0], model.UID, arg[1]) s.SelectDetail(m, model.PLACE_UID, arg[0], model.UID, arg[1])
m.EchoQRCode(s.Link(m, arg[0], m.PrefixKey(), arg[1])).Echo("请用微信扫码支付") if PaymentStatus(kit.Int(m.Append(model.PAYMENTLIST_STATUS))) == PaymentCreate {
m.EchoQRCode(s.Link(m, arg[0], m.PrefixKey(), arg[1])).Echo("请用微信扫码支付")
}
} else { } else {
return return
} }

View File

@ -116,8 +116,7 @@ Volcanos(chat.ONIMPORT, {
]) ])
}) })
}, },
myList: function(can, msg, target) { myList: function(can, msg, target) { var width = (can.ConfWidth()-40)/parseInt((can.ConfWidth()-40)/80);
var width = (can.ConfWidth()-40)/parseInt((can.ConfWidth()-40)/80);
(can.page.tagis(document.body, "body.width1") || can.user.isMobile && !can.user.isLandscape()) && (width = (can.ConfWidth()-40)/5) (can.page.tagis(document.body, "body.width1") || can.user.isMobile && !can.user.isLandscape()) && (width = (can.ConfWidth()-40)/5)
can.page.Append(can, target, msg.Table(function(value) { if (value.enable == ice.FALSE) { return } can.page.Append(can, target, msg.Table(function(value) { if (value.enable == ice.FALSE) { return }
if ((value.portal || value.public) && can.page.tagis(can._output, "div.output.public")) { if ((value.portal || value.public) && can.page.tagis(can._output, "div.output.public")) {
@ -134,6 +133,7 @@ Volcanos(chat.ONIMPORT, {
} }
return {view: [[html.ITEM, ctx.INDEX].concat( 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.type? [mdb.TYPE]: [], can.core.Split(value.type||""), value.role? [aaa.ROLE]: [], can.core.Split(value.role||""),
value.view,
)], style: {width: width}, list: [ )], style: {width: width}, list: [
{img: can.misc.ResourceIcons(can, value.icons)}, {text: can.user.trans(can, value.index.split(".").pop(), value.name)}, {img: can.misc.ResourceIcons(can, value.icons)}, {text: can.user.trans(can, value.index.split(".").pop(), value.name)},
], onclick: function(event) { ], onclick: function(event) {
@ -233,7 +233,11 @@ Volcanos(chat.ONEXPORT, {
can.ui.role && can.onmotion.toggle(can, can.ui.role, value._role == "creator") 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.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(" ") can.page.Select(can, can.ui.myindex, html.DIV_ITEM, function(target) { var list = target.className.split(" ")
if (list.indexOf(mdb.TYPE) > -1 && list.indexOf(value._type) == -1) { 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)
} else if (list.indexOf(mdb.TYPE) > -1 && list.indexOf(value._type) == -1) {
can.onmotion.toggle(can, target, false) can.onmotion.toggle(can, target, false)
} else if (list.indexOf(aaa.ROLE) > -1 && (list.indexOf(role) == -1 && role != "creator")) { } else if (list.indexOf(aaa.ROLE) > -1 && (list.indexOf(role) == -1 && role != "creator")) {
can.onmotion.toggle(can, target, false) can.onmotion.toggle(can, target, false)

View File

@ -66,6 +66,9 @@ func (s cert) Verify(m *ice.Message, arg ...string) {
s.Update(m, kit.Dict(model.MOBILE, m.Option(model.MOBILE), model.VERIFY, verify), m.OptionSimple(model.AUTH_UID)...) s.Update(m, kit.Dict(model.MOBILE, m.Option(model.MOBILE), model.VERIFY, verify), m.OptionSimple(model.AUTH_UID)...)
m.Cmd(SmsVendor, SmsVendor.Send, m.Option(model.MOBILE), verify) m.Cmd(SmsVendor, SmsVendor.Send, m.Option(model.MOBILE), verify)
} else { } else {
if m.Option(model.VERIFY) == "" {
return
}
if !m.WarnNotValid(m.Option(model.VERIFY) != msg.Append(model.VERIFY)) { if !m.WarnNotValid(m.Option(model.VERIFY) != msg.Append(model.VERIFY)) {
s.Check(m) s.Check(m)
} }

View File

@ -36,6 +36,15 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
} }
func (s Table) Config(m *ice.Message, arg ...string) { 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 {
cb(value, true)
} else {
cb(value, false)
}
})
}
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message { func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
m.RewriteAppend(func(value, key string, index int) string { m.RewriteAppend(func(value, key string, index int) string {
if _, e := strconv.ParseInt(value, 10, 64); e != nil { if _, e := strconv.ParseInt(value, 10, 64); e != nil {

View File

@ -1,7 +1,10 @@
package ocr package ocr
import ( import (
"encoding/base64"
"shylinux.com/x/ice" "shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/community/src/renzhengshouquan" "shylinux.com/x/community/src/renzhengshouquan"
"shylinux.com/x/community/src/renzhengshouquan/external/tencentcloud" "shylinux.com/x/community/src/renzhengshouquan/external/tencentcloud"
@ -18,13 +21,13 @@ func (s ocr) List(m *ice.Message, arg ...string) {}
func (s ocr) IDCard(m *ice.Message, arg ...string) { func (s ocr) IDCard(m *ice.Message, arg ...string) {
request := sdk.NewIDCardOCRRequest() request := sdk.NewIDCardOCRRequest()
request.ImageBase64 = common.StringPtr(s.ImageData(m, arg...)) request.ImageBase64 = common.StringPtr(s.imageData(m, arg...))
response, err := s.newClient(m).IDCardOCR(request) response, err := s.newClient(m).IDCardOCR(request)
s.ParseResponse(m, response, err) s.ParseResponse(m, response, err)
} }
func (s ocr) BizLicense(m *ice.Message, arg ...string) { func (s ocr) BizLicense(m *ice.Message, arg ...string) {
request := sdk.NewBizLicenseOCRRequest() request := sdk.NewBizLicenseOCRRequest()
request.ImageBase64 = common.StringPtr(s.ImageData(m, arg...)) request.ImageBase64 = common.StringPtr(s.imageData(m, arg...))
response, err := s.newClient(m).BizLicenseOCR(request) response, err := s.newClient(m).BizLicenseOCR(request)
s.ParseResponse(m, response, err) s.ParseResponse(m, response, err)
} }
@ -33,6 +36,9 @@ func init() { ice.TeamCtxCmd(ocr{}) }
func init() { renzhengshouquan.OcrVendor = ocr{} } func init() { renzhengshouquan.OcrVendor = ocr{} }
func (s ocr) imageData(m *ice.Message, arg ...string) string {
return base64.StdEncoding.EncodeToString([]byte(m.Cmdx(nfs.CAT, arg[0])))
}
func (s ocr) newClient(m *ice.Message, arg ...string) *sdk.Client { func (s ocr) newClient(m *ice.Message, arg ...string) *sdk.Client {
c, _ := sdk.NewClient(s.NewCredential(m), "", s.NewProfile(m)) c, _ := sdk.NewClient(s.NewCredential(m), "", s.NewProfile(m))
return c return c

View File

@ -1,5 +1,6 @@
section "图文识别" section "图文识别"
refer ` refer `
后台 https://console.cloud.tencent.com/ocr/overview
文档 https://cloud.tencent.com/document/product/866/45338 文档 https://cloud.tencent.com/document/product/866/45338
调试 https://console.cloud.tencent.com/api/explorer?Product=ocr&Version=2018-11-19&Action=RecognizeEncryptedIDCardOCR 调试 https://console.cloud.tencent.com/api/explorer?Product=ocr&Version=2018-11-19&Action=RecognizeEncryptedIDCardOCR
` `

View File

@ -19,14 +19,14 @@ import (
type realname struct { type realname struct {
renzhengshouquan.Table renzhengshouquan.Table
order string `data:"18"` order string `data:"18"`
fields string `data:"auth_uid,user_uid,source_id,secret_id,secret_key"` fields string `data:"source_id,secret_id,secret_key,user_uid"`
create string `name:"create source_id* secret_id* secret_key*" role:"leader"` create string `name:"create source_id* secret_id* secret_key*" role:"worker"`
remove string `name:"remove" role:"leader"` remove string `name:"remove" role:"worker"`
list string `name:"list auth_uid uid auto" role:"worker"`
} }
func (s realname) List(m *ice.Message, arg ...string) { func (s realname) List(m *ice.Message, arg ...string) {
s.ValueList(m, arg).Display("") s.ValueList(m, arg).Action().Display("")
kit.If(m.Length() > 0, func() { m.Action() })
} }
func init() { ice.TeamCtxCmd(realname{}) } func init() { ice.TeamCtxCmd(realname{}) }
@ -37,7 +37,6 @@ func (s realname) Check(m *ice.Message, arg ...string) {
source := msg.Append("source_id") source := msg.Append("source_id")
secretId := msg.Append("secret_id") secretId := msg.Append("secret_id")
secretKey := msg.Append("secret_key") secretKey := msg.Append("secret_key")
auth, datetime := calcAuthorization(source, secretId, secretKey) auth, datetime := calcAuthorization(source, secretId, secretKey)
m.Option(web.SPIDE_HEADER, map[string]string{"X-Source": source, "Authorization": auth, "X-Date": datetime}) m.Option(web.SPIDE_HEADER, map[string]string{"X-Source": source, "Authorization": auth, "X-Date": datetime})
res := m.Cmdx(web.SPIDE, ice.DEV, web.SPIDE_RAW, http.MethodPost, "https://service-rbgpp2hy-1305308687.gz.apigw.tencentcs.com/release/release/mobile/3-realnameauth", res := m.Cmdx(web.SPIDE, ice.DEV, web.SPIDE_RAW, http.MethodPost, "https://service-rbgpp2hy-1305308687.gz.apigw.tencentcs.com/release/release/mobile/3-realnameauth",

View File

@ -1,7 +1,7 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [ can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.source_id]}, {view: html.TITLE, list: [value.source_id, can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [value.secret_id]}, {view: html.STATUS, list: [value.secret_id]},
] }) ] })
}, },

View File

@ -3,12 +3,3 @@ refer `
后台 https://console.cloud.tencent.com/servicemarket/services/market-2qkoxdj5i 后台 https://console.cloud.tencent.com/servicemarket/services/market-2qkoxdj5i
文档 https://market.cloud.tencent.com/products/30034?keyword=%E6%89%8B%E6%9C%BA%E4%B8%89%E8%A6%81%E7%B4%A0%E5%AE%9E%E5%90%8D%E8%AE%A4%E8%AF%81 文档 https://market.cloud.tencent.com/products/30034?keyword=%E6%89%8B%E6%9C%BA%E4%B8%89%E8%A6%81%E7%B4%A0%E5%AE%9E%E5%90%8D%E8%AE%A4%E8%AF%81
` `
refer `
后台 https://console.cloud.tencent.com/servicemarket/services/market-dw3yg5tm8
文档 https://market.cloud.tencent.com/products/17673
`
refer `
实名 https://market.cloud.tencent.com/products/30034
要素 https://console.cloud.tencent.com/servicemarket/services/market-2qkoxdj5i
要素 https://market.cloud.tencent.com/products/30034?keyword=%E6%89%8B%E6%9C%BA%E4%B8%89%E8%A6%81%E7%B4%A0%E5%AE%9E%E5%90%8D%E8%AE%A4%E8%AF%81
`

View File

@ -6,12 +6,12 @@ const (
UID = "uid" UID = "uid"
NAME = "name" NAME = "name"
INFO = "info" INFO = "info"
PLACE_UID = "place_uid" VENDOR = "vendor"
USER_UID = "user_uid" USER_UID = "user_uid"
PLACE_UID = "place_uid"
AUTH_UID = "auth_uid" AUTH_UID = "auth_uid"
AUTH_STATUS = "auth_status" AUTH_STATUS = "auth_status"
PHOTO_UID = "photo_uid" PHOTO_UID = "photo_uid"
VENDOR = "vendor"
LIBRARY_ID = "library_id" LIBRARY_ID = "library_id"
LIBRARY_SECRET = "library_secret" LIBRARY_SECRET = "library_secret"
ACCESS_TOKEN = "access_token" ACCESS_TOKEN = "access_token"
@ -23,7 +23,7 @@ const (
type Smh struct { type Smh struct {
db.ModelWithUID db.ModelWithUID
AuthUID string `gorm:"type:char(32);index"` AuthUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32);index"` UserUID string `gorm:"type:char(32)"`
Name string `gorm:"type:varchar(32)"` Name string `gorm:"type:varchar(32)"`
Info string `gorm:"type:varchar(64)"` Info string `gorm:"type:varchar(64)"`
LibraryID string `gorm:"type:varchar(32)"` LibraryID string `gorm:"type:varchar(32)"`

View File

@ -6,7 +6,6 @@ import (
"time" "time"
"shylinux.com/x/ice" "shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs" "shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web" "shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
@ -27,15 +26,44 @@ type smh struct {
tencentcloud.Tencentcloud tencentcloud.Tencentcloud
order string `data:"16"` order string `data:"16"`
fields string `data:"name,info,library_id,library_secret,access_token,expire_time,user_uid"` fields string `data:"name,info,library_id,library_secret,access_token,expire_time,user_uid"`
libraryCreate string `name:"libraryCreate" role:"leader"` list string `name:"list auth_uid uid auto" role:"worker"`
libraryRemove string `name:"libraryRemove" role:"leader"` libraryCreate string `name:"libraryCreate" role:"worker"`
spaceCreate string `name:"spaceCreate" role:"leader"` libraryRemove string `name:"libraryRemove" role:"worker"`
spaceRemove string `name:"spaceRemove" role:"leader"` spaceCreate string `name:"spaceCreate" role:"worker"`
spaceRemove string `name:"spaceRemove" role:"worker"`
} }
func (s smh) Init(m *ice.Message, arg ...string) { func (s smh) Init(m *ice.Message, arg ...string) {
s.SpideCreate(m, "https://api.tencentsmh.cn/api/v1/", "tencentsmh")
s.Table.Init(m, arg...) s.Table.Init(m, arg...)
m.Cmd(web.SPIDE, mdb.CREATE, "https://api.tencentsmh.cn/api/v1/", "tencentsmh") }
func (s smh) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
if s.ValueList(m, arg).Display("").Length() == 0 {
s.Button(m.SetResult(), "请创建媒体库", s.LibraryCreate).Action()
} else {
msg := s.token(m)
m.Table(func(value ice.Maps) {
_msg := s.spide(m.Spawn(), kit.MergeURL(kit.Format("usage/%s", msg.Append(model.LIBRARY_ID)), msg.AppendSimple(model.ACCESS_TOKEN)))
m.PushRecord(kit.UnMarshal(_msg.Result()), "totalFileSize")
}).PushAction(s.LibraryRemove).Action()
}
} else if len(arg) == 2 {
s.AuthList(m, arg[0], func(value ice.Maps, auth bool) {
if auth {
msg := s.cmdy(m.Spawn(), s.Select, model.PLACE_UID, value[model.PLACE_UID])
if msg.Append(model.SPACE_ID) == "" {
m.Push(model.SPACE_ID, "").Push(model.PHOTO_UID, "").PushButton(s.SpaceCreate)
} else {
m.Push(model.SPACE_ID, msg.Append(model.SPACE_ID))
m.Push(model.PHOTO_UID, msg.Append(model.UID))
m.PushButton(s.SpaceRemove)
}
} else {
m.Push(model.SPACE_ID, "").Push(model.PHOTO_UID, "").PushButton()
}
})
}
} }
func (s smh) LibraryCreate(m *ice.Message, arg ...string) { func (s smh) LibraryCreate(m *ice.Message, arg ...string) {
msg := m.Cmd(api.RENZHENGSHOUQUAN_AUTH, s.Select, model.UID, m.Option(model.AUTH_UID)) msg := m.Cmd(api.RENZHENGSHOUQUAN_AUTH, s.Select, model.UID, m.Option(model.AUTH_UID))
@ -74,34 +102,6 @@ func (s smh) LibraryRemove(m *ice.Message, arg ...string) {
} }
s.Table.Remove(m, arg...) s.Table.Remove(m, arg...)
} }
func (s smh) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
if s.ValueList(m, arg).Display("").Length() == 0 {
s.Button(m.SetResult(), "请创建媒体库", s.LibraryCreate)
} else {
msg := s.token(m)
m.Table(func(value ice.Maps) {
_msg := s.spide(m.Spawn(), kit.MergeURL(kit.Format("usage/%s", msg.Append(model.LIBRARY_ID)), msg.AppendSimple(model.ACCESS_TOKEN)))
m.PushRecord(kit.UnMarshal(_msg.Result()), "totalFileSize")
}).PushAction(s.LibraryRemove).Action()
}
} else if len(arg) == 2 {
m.Cmdy(api.RENZHENGSHOUQUAN_AUTH, arg[0]).Table(func(value ice.Maps) {
if renzhengshouquan.AuthStatus(kit.Int(value[model.AUTH_STATUS])) == renzhengshouquan.AuthIssued {
msg := s.cmdy(m.Spawn(), s.Select, model.PLACE_UID, value[model.PLACE_UID])
if space_id := msg.Append(model.SPACE_ID); space_id == "" {
m.Push(model.SPACE_ID, "").Push(model.PHOTO_UID, "").PushButton(s.SpaceCreate)
} else {
m.Push(model.SPACE_ID, msg.Append(model.SPACE_ID))
m.Push(model.PHOTO_UID, msg.Append(model.UID))
m.PushButton(s.SpaceRemove)
}
} else {
m.Push(model.SPACE_ID, "").Push(model.PHOTO_UID, "").PushButton()
}
})
}
}
func (s smh) SpaceCreate(m *ice.Message, arg ...string) { func (s smh) SpaceCreate(m *ice.Message, arg ...string) {
msg := s.token(m) msg := s.token(m)
if s.spide(m, http.MethodPost, kit.MergeURL(kit.Format("space/%s", msg.Append(model.LIBRARY_ID)), model.USER_ID, m.Option(model.PLACE_UID), msg.AppendSimple(model.ACCESS_TOKEN)), if s.spide(m, http.MethodPost, kit.MergeURL(kit.Format("space/%s", msg.Append(model.LIBRARY_ID)), model.USER_ID, m.Option(model.PLACE_UID), msg.AppendSimple(model.ACCESS_TOKEN)),

View File

@ -1,14 +1,10 @@
{ {
"smh": "智能媒资托管", "smh": "智能媒资托管",
"libraryCreate": "创建", "libraryCreate": "创建", "libraryRemove": "删除",
"libraryRemove": "删除", "spaceCreate": "分配", "spaceRemove": "清理",
"spaceCreate": "分配",
"spaceRemove": "清理",
"style": { "style": {
"libraryCreate": "notice", "libraryCreate": "notice", "libraryRemove": "danger",
"libraryRemove": "danger", "spaceCreate": "notice", "spaceRemove": "danger"
"spaceCreate": "notice",
"spaceRemove": "danger"
}, },
"icons": { "icons": {
"smh": "https://img.icons8.com/officel/80/stack-of-photos.png" "smh": "https://img.icons8.com/officel/80/stack-of-photos.png"

View File

@ -14,7 +14,7 @@ const (
type Sms struct { type Sms struct {
db.ModelWithUID db.ModelWithUID
AuthUID string `gorm:"type:char(32);index"` AuthUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32);index"` UserUID string `gorm:"type:char(32)"`
SignName string `gorm:"type:varchar(64)"` SignName string `gorm:"type:varchar(64)"`
TemplateID string `gorm:"type:varchar(64)"` TemplateID string `gorm:"type:varchar(64)"`
AppID string `gorm:"type:varchar(32)"` AppID string `gorm:"type:varchar(32)"`

View File

@ -2,7 +2,6 @@ package sms
import ( import (
"shylinux.com/x/ice" "shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/renzhengshouquan" "shylinux.com/x/community/src/renzhengshouquan"
"shylinux.com/x/community/src/renzhengshouquan/external/tencentcloud" "shylinux.com/x/community/src/renzhengshouquan/external/tencentcloud"
@ -16,15 +15,15 @@ type sms struct {
renzhengshouquan.Table renzhengshouquan.Table
tencentcloud.Tencentcloud tencentcloud.Tencentcloud
order string `data:"17"` order string `data:"17"`
fields string `data:"auth_uid,user_uid,sign_name AS sign_name,template_id,app_id"` fields string `data:"sign_name AS sign_name,template_id,app_id,user_uid"`
create string `name:"create sign_name* template_id* app_id*" role:"leader"` create string `name:"create sign_name* template_id* app_id*" role:"worker"`
remove string `name:"remove" role:"leader"` remove string `name:"remove" role:"worker"`
send string `name:"send mobile verify" role:"leader"` list string `name:"list auth_uid uid auto" role:"worker"`
send string `name:"send mobile* verify*" role:"worker"`
} }
func (s sms) List(m *ice.Message, arg ...string) { func (s sms) List(m *ice.Message, arg ...string) {
s.ValueList(m, arg).Display("") s.ValueList(m, arg).Action().Display("")
kit.If(m.Length() > 0, func() { m.Action() })
} }
func (s sms) Send(m *ice.Message, arg ...string) { func (s sms) Send(m *ice.Message, arg ...string) {
msg := s.Select(m.Spawn(), model.AUTH_UID, s.GetAuthUID(m)) msg := s.Select(m.Spawn(), model.AUTH_UID, s.GetAuthUID(m))

View File

@ -1,7 +1,8 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [ can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.sign_name, value.template_id, value.app_id]}, {view: html.TITLE, list: [value.sign_name, can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [value.template_id, value.app_id]},
] }) ] })
}, },
}) })

View File

@ -1,10 +1,8 @@
package tencentcloud package tencentcloud
import ( import (
"encoding/base64"
"shylinux.com/x/ice" "shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/nfs"
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/renzhengshouquan" "shylinux.com/x/community/src/renzhengshouquan"
@ -18,13 +16,13 @@ type tencentcloud struct {
renzhengshouquan.Table renzhengshouquan.Table
order string `data:"15"` order string `data:"15"`
fields string `data:"secret_id,secret_key,user_uid"` fields string `data:"secret_id,secret_key,user_uid"`
create string `name:"create secret_id* secret_key*" role:"leader"` create string `name:"create secret_id* secret_key*" role:"worker"`
remove string `name:"remove" role:"leader"` remove string `name:"remove" role:"worker"`
list string `name:"list auth_uid uid auto" role:"worker"`
} }
func (s tencentcloud) List(m *ice.Message, arg ...string) { func (s tencentcloud) List(m *ice.Message, arg ...string) {
s.ValueList(m, arg).Display("") s.ValueList(m, arg).Action().Display("")
kit.If(m.Length() > 0, func() { m.Action() })
} }
func init() { ice.TeamCtxCmd(tencentcloud{}) } func init() { ice.TeamCtxCmd(tencentcloud{}) }
@ -40,9 +38,6 @@ func (s Tencentcloud) NewCredential(m *ice.Message, arg ...string) *common.Crede
func (s Tencentcloud) NewProfile(m *ice.Message, arg ...string) *profile.ClientProfile { func (s Tencentcloud) NewProfile(m *ice.Message, arg ...string) *profile.ClientProfile {
return profile.NewClientProfile() return profile.NewClientProfile()
} }
func (s Tencentcloud) ImageData(m *ice.Message, arg ...string) string {
return base64.StdEncoding.EncodeToString([]byte(m.Cmdx(nfs.CAT, arg[0])))
}
func (s Tencentcloud) ParseResponse(m *ice.Message, res interface{ ToJsonString() string }, err error, arg ...string) { func (s Tencentcloud) ParseResponse(m *ice.Message, res interface{ ToJsonString() string }, err error, arg ...string) {
if !m.Warn(err) { if !m.Warn(err) {
m.PushDetail(kit.Value(kit.UnMarshal(res.ToJsonString()), kit.Select("Response", arg, 0))) m.PushDetail(kit.Value(kit.UnMarshal(res.ToJsonString()), kit.Select("Response", arg, 0)))

View File

@ -7,7 +7,6 @@ import (
"shylinux.com/x/icebergs/base/web" "shylinux.com/x/icebergs/base/web"
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" "shylinux.com/x/community/src/renzhengshouquan"
"shylinux.com/x/community/src/renzhengshouquan/external/tencentdocument/model" "shylinux.com/x/community/src/renzhengshouquan/external/tencentdocument/model"
@ -19,9 +18,9 @@ type tencentdocument struct {
client_secret string `data:""` client_secret string `data:""`
order string `data:"13"` order string `data:"13"`
fields string `data:"user_id,access_token,expired_time,user_uid"` fields string `data:"user_id,access_token,expired_time,user_uid"`
auth string `name:"auth" help:"授权" role:"void"` auth string `name:"auth" help:"授权" role:"worker"`
remove string `name:"remove" role:"leader"` remove string `name:"remove" role:"worker"`
config string `name:"config folder_id*:select" style:"notice" role:"leader"` config string `name:"config folder_id*:select" style:"notice" role:"worker"`
} }
func (s tencentdocument) Inputs(m *ice.Message, arg ...string) { func (s tencentdocument) Inputs(m *ice.Message, arg ...string) {
@ -33,13 +32,12 @@ func (s tencentdocument) Inputs(m *ice.Message, arg ...string) {
} }
func (s tencentdocument) List(m *ice.Message, arg ...string) { func (s tencentdocument) List(m *ice.Message, arg ...string) {
if len(arg) == 1 { if len(arg) == 1 {
s.ValueList(m, arg).Action(s.Auth).Display("") if s.ValueList(m, arg).Action(s.Auth).Display("").Length() == 0 {
if m.Length() == 0 {
s.Button(m.SetResult(), "请授权访问腾讯文档", s.Auth) s.Button(m.SetResult(), "请授权访问腾讯文档", s.Auth)
} }
} else if len(arg) == 2 { } else if len(arg) == 2 {
m.Cmdy(api.RENZHENGSHOUQUAN_AUTH, arg[0]).Table(func(value ice.Maps) { s.AuthList(m, arg[0], func(value ice.Maps, auth bool) {
if renzhengshouquan.AuthStatus(kit.Int(value[model.AUTH_STATUS])) == renzhengshouquan.AuthIssued { if auth {
m.PushButton(s.Config) m.PushButton(s.Config)
} else { } else {
m.PushButton() m.PushButton()
@ -48,7 +46,6 @@ func (s tencentdocument) List(m *ice.Message, arg ...string) {
} }
} }
func (s tencentdocument) Config(m *ice.Message, arg ...string) { func (s tencentdocument) Config(m *ice.Message, arg ...string) {
// m.Cmdy(api.GONGANXITONG_DOCUMENT, s.Config, m.OptionSimple(model.PLACE_UID, model.USER_UID, "folder_id"), model.VENDOR, m.PrefixKey())
m.Cmdy("web.team.gonganxitong.document", s.Config, m.OptionSimple(model.PLACE_UID, model.USER_UID, model.FOLDER_ID), model.VENDOR, m.PrefixKey()) m.Cmdy("web.team.gonganxitong.document", s.Config, m.OptionSimple(model.PLACE_UID, model.USER_UID, model.FOLDER_ID), model.VENDOR, m.PrefixKey())
} }
func (s tencentdocument) Folder(m *ice.Message, arg ...string) *ice.Message { func (s tencentdocument) Folder(m *ice.Message, arg ...string) *ice.Message {

View File

@ -4,13 +4,13 @@ import "shylinux.com/x/mysql-story/src/db"
const ( const (
UID = "uid" UID = "uid"
LINK = "link"
AVATAR = "avatar"
VENDOR = "vendor"
USER_UID = "user_uid" USER_UID = "user_uid"
PLACE_UID = "place_uid"
AUTH_UID = "auth_uid" AUTH_UID = "auth_uid"
AUTH_STATUS = "auth_status" AUTH_STATUS = "auth_status"
PLACE_UID = "place_uid"
AVATAR = "avatar"
LINK = "link"
VENDOR = "vendor"
USER_ID = "user_id" USER_ID = "user_id"
) )

View File

@ -24,12 +24,11 @@ import (
type tencentmeeting struct { type tencentmeeting struct {
renzhengshouquan.Table renzhengshouquan.Table
order string `data:"12"` order string `data:"12"`
role string `data:"leader"` fields string `data:"app_id,sdk_id,secret_id,secret_key,user_id,user_uid"`
fields string `data:"auth_uid,user_uid,app_id,sdk_id,secret_id,secret_key,user_id"` create string `name:"create app_id* sdk_id* secret_id* secret_key* user_id*" role:"worker"`
create string `name:"create app_id* sdk_id* secret_id* secret_key* user_id*" role:"leader"` remove string `name:"remove" role:"worker"`
remove string `name:"remove" role:"leader"` list string `name:"list auth_uid uid auto" role:"worker"`
list string `name:"list auth_uid uid auto" role:"leader"` config string `name:"config user_id:select" style:"notice" role:"worker"`
config string `name:"config user_id:select" style:"notice" role:"leader"`
} }
func (s tencentmeeting) Init(m *ice.Message, arg ...string) { func (s tencentmeeting) Init(m *ice.Message, arg ...string) {
@ -39,18 +38,16 @@ func (s tencentmeeting) Init(m *ice.Message, arg ...string) {
func (s tencentmeeting) Inputs(m *ice.Message, arg ...string) { func (s tencentmeeting) Inputs(m *ice.Message, arg ...string) {
switch arg[0] { switch arg[0] {
case model.USER_ID: case model.USER_ID:
s.UserList(m, m.Option(model.AUTH_UID)).Cut(arg[0], "username") s.UserList(m, m.Option(model.AUTH_UID)).Cut(arg[0], "username").RenameAppend("username", "name")
m.RenameAppend("username", "name")
m.DisplayInputKeyNameIconTitle() m.DisplayInputKeyNameIconTitle()
} }
} }
func (s tencentmeeting) List(m *ice.Message, arg ...string) { func (s tencentmeeting) List(m *ice.Message, arg ...string) {
if len(arg) == 1 { if len(arg) == 1 {
s.ValueList(m, arg).Display("") s.ValueList(m, arg).Action().Display("")
kit.If(m.Length() > 0, func() { m.Action() })
} else if len(arg) == 2 { } else if len(arg) == 2 {
m.Cmdy(api.RENZHENGSHOUQUAN_AUTH, arg[0]).Table(func(value ice.Maps) { s.AuthList(m, arg[0], func(value ice.Maps, auth bool) {
if renzhengshouquan.AuthStatus(kit.Int(value[model.AUTH_STATUS])) == renzhengshouquan.AuthIssued { if auth {
m.PushButton(s.Config) m.PushButton(s.Config)
} else { } else {
m.PushButton() m.PushButton()

View File

@ -1,8 +1,8 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [ can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.app_id, "/", value.sdk_id, "/", value.user_id]}, {view: html.TITLE, list: [value.app_id, "/", value.sdk_id, "/", value.secret_id]},
{view: html.TITLE, list: [value.secret_id]}, {view: html.TITLE, list: [value.user_id]},
] }) ] })
}, },
}) })

View File

@ -20,11 +20,10 @@ import (
type weixinpayment struct { type weixinpayment struct {
renzhengshouquan.Table renzhengshouquan.Table
order string `data:"11"` order string `data:"11"`
role string `data:"leader"` fields string `data:"app_id,mch_id,api_key,cert_no,cert_key,user_uid"`
fields string `data:"user_uid,app_id,mch_id,api_key,cert_no,cert_key"` create string `name:"create app_id* mch_id* api_key* cert_no* cert_key*:textarea" role:"worker"`
create string `name:"create app_id* mch_id* api_key* cert_no* cert_key*:textarea" role:"leader"` remove string `name:"remove" role:"worker"`
remove string `name:"remove" role:"leader"` list string `name:"list auth_uid uid auto" role:"worker"`
list string `name:"list auth_uid uid auto" role:"leader"`
response string `name:"response" role:"void"` response string `name:"response" role:"void"`
} }
@ -33,18 +32,17 @@ func (s weixinpayment) Init(m *ice.Message, arg ...string) {
s.Table.Init(m, arg...) s.Table.Init(m, arg...)
} }
func (s weixinpayment) List(m *ice.Message, arg ...string) { func (s weixinpayment) List(m *ice.Message, arg ...string) {
s.ValueList(m, arg).Display("") s.ValueList(m, arg).Action().Display("")
kit.If(m.Length() > 0, func() { m.Action() })
} }
func (s weixinpayment) Request(m *ice.Message, arg ...string) { func (s weixinpayment) Request(m *ice.Message, arg ...string) {
msg := s.Select(m.Spawn(), model.AUTH_UID, s.GetAuthUID(m)) msg := s.Select(m.Spawn(), model.AUTH_UID, s.GetAuthUID(m))
svc := jsapi.JsapiApiService{Client: s.newClient(m, msg)} svc := jsapi.JsapiApiService{Client: s.newClient(m, msg)}
resp, result, err := svc.PrepayWithRequestPayment(m, jsapi.PrepayRequest{ resp, _, err := svc.PrepayWithRequestPayment(m, jsapi.PrepayRequest{
Appid: core.String(msg.Append("app_id")), Appid: core.String(msg.Append("app_id")),
Mchid: core.String(msg.Append("mch_id")), Mchid: core.String(msg.Append("mch_id")),
OutTradeNo: core.String(m.Option(model.UID)),
Description: core.String(m.Option(model.TITLE)), Description: core.String(m.Option(model.TITLE)),
Attach: core.String(m.Option(model.CONTENT)), Attach: core.String(m.Option(model.CONTENT)),
OutTradeNo: core.String(m.Option(model.UID)),
Amount: &jsapi.Amount{Total: core.Int64(kit.Int64(m.Option(model.AMOUNT)))}, Amount: &jsapi.Amount{Total: core.Int64(kit.Int64(m.Option(model.AMOUNT)))},
Payer: &jsapi.Payer{Openid: core.String(m.Cmd(api.GONGANXITONG_USER, s.Select, model.UID, m.Option(model.USER_UID)).Append(model.OPEN_ID))}, Payer: &jsapi.Payer{Openid: core.String(m.Cmd(api.GONGANXITONG_USER, s.Select, model.UID, m.Option(model.USER_UID)).Append(model.OPEN_ID))},
NotifyUrl: core.String(strings.Split(m.MergePodCmd("", m.PrefixKey()), "?")[0] + "/action/response/" + m.Option(model.PLACE_UID) + "/" + m.Option(model.UID)), NotifyUrl: core.String(strings.Split(m.MergePodCmd("", m.PrefixKey()), "?")[0] + "/action/response/" + m.Option(model.PLACE_UID) + "/" + m.Option(model.UID)),
@ -52,13 +50,10 @@ func (s weixinpayment) Request(m *ice.Message, arg ...string) {
if !m.Warn(err) { if !m.Warn(err) {
kit.For(kit.UnMarshal(kit.Format(resp)), func(k, v string) { m.Push(kit.LowerCapital(k), v) }) kit.For(kit.UnMarshal(kit.Format(resp)), func(k, v string) { m.Push(kit.LowerCapital(k), v) })
} }
m.Info("what %v %v %v", resp, result, err)
} }
func (s weixinpayment) Response(m *ice.Message, arg ...string) { func (s weixinpayment) Response(m *ice.Message, arg ...string) {
if len(arg) > 1 { if len(arg) > 1 && m.Option("event_type") == "TRANSACTION.SUCCESS" {
if m.Option("event_type") == "TRANSACTION.SUCCESS" { m.Cmdy(api.GONGANXITONG_PAYMENTLIST, s.Response, arg)
m.Cmdy(api.GONGANXITONG_PAYMENTLIST, s.Response, arg)
}
} }
} }