This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-11-26 09:11:01 +08:00
parent 3f3d9dc654
commit 096798dabf
10 changed files with 77 additions and 6 deletions

2
go.mod
View File

@ -25,6 +25,8 @@ require (
github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect github.com/jinzhu/now v1.1.5 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1046 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ocr v1.0.1046 // indirect
github.com/wechatpay-apiv3/wechatpay-go v0.2.20 // indirect github.com/wechatpay-apiv3/wechatpay-go v0.2.20 // indirect
golang.org/x/text v0.16.0 // indirect golang.org/x/text v0.16.0 // indirect
gorm.io/driver/mysql v1.5.7 // indirect gorm.io/driver/mysql v1.5.7 // indirect

4
go.sum
View File

@ -65,6 +65,10 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tdakkota/win32metadata v0.1.0/go.mod h1:77e6YvX0LIVW+O81fhWLnXAxxcyu/wdZdG7iwed7Fyk= github.com/tdakkota/win32metadata v0.1.0/go.mod h1:77e6YvX0LIVW+O81fhWLnXAxxcyu/wdZdG7iwed7Fyk=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1046 h1:0FvA5Rw9dGqK5CTbWlgyE1HbiND1hLsoIfne4jzWuRI=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1046/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ocr v1.0.1046 h1:P8TrTPEWu4GjnEMyNgdYmV5jXigGtDMn+sVTLJJvW0c=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ocr v1.0.1046/go.mod h1:ifVagKrjnvy/ibrvLZjsELEh5WdRtchM8xyUlF88BNg=
github.com/tinygo-org/cbgo v0.0.4/go.mod h1:7+HgWIHd4nbAz0ESjGlJ1/v9LDU1Ox8MGzP9mah/fLk= github.com/tinygo-org/cbgo v0.0.4/go.mod h1:7+HgWIHd4nbAz0ESjGlJ1/v9LDU1Ox8MGzP9mah/fLk=
github.com/tinygo-org/pio v0.0.0-20231216154340-cd888eb58899/go.mod h1:LU7Dw00NJ+N86QkeTGjMLNkYcEYMor6wTDpTCu0EaH8= github.com/tinygo-org/pio v0.0.0-20231216154340-cd888eb58899/go.mod h1:LU7Dw00NJ+N86QkeTGjMLNkYcEYMor6wTDpTCu0EaH8=
github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0=

View File

@ -285,7 +285,7 @@ func (s Table) UploadCreate(m *ice.Message, field, uid string, arg ...string) {
return return
} }
p := m.UploadSave(path.Join(nfs.USR, kit.Select(field, m.Option(model.FIELD)), uid) + nfs.PS) p := m.UploadSave(path.Join(nfs.USR, kit.Select(field, m.Option(model.FIELD)), uid) + nfs.PS)
s.Create(m, kit.Select(m.Option(model.FIELD), field), p, model.UID, uid) s.Create(m, kit.Select(m.Option(model.FIELD), field), p, model.UID, uid, model.USER_UID, m.Option(model.USER_UID))
} }
func (s Table) ChangeStatus(m *ice.Message, place_uid, uid string, from, to int, arg ...string) *ice.Message { func (s Table) ChangeStatus(m *ice.Message, place_uid, uid string, from, to int, arg ...string) *ice.Message {
msg := s.ValueList(m.Spawn(), []string{place_uid, uid}, model.STATUS) msg := s.ValueList(m.Spawn(), []string{place_uid, uid}, model.STATUS)
@ -531,6 +531,9 @@ func PortalCmd(portal ice.Any) {
tables := Tables{Table: table} tables := Tables{Table: table}
cmd := func(name string, data ice.Any) { cmd := func(name string, data ice.Any) {
_, cmd := ice.Cmd(kit.Keys(p, name), data) _, cmd := ice.Cmd(kit.Keys(p, name), data)
if cmd == nil {
return
}
cmd.RawHand = path.Join(path.Dir(h), name+".go") cmd.RawHand = path.Join(path.Dir(h), name+".go")
cmd.Actions[ice.CTX_INIT].Hand = icebergs.MergeHand(func(m *icebergs.Message, arg ...string) { cmd.Actions[ice.CTX_INIT].Hand = icebergs.MergeHand(func(m *icebergs.Message, arg ...string) {
m.Design(mdb.LIST, "", kit.JoinWord(table.Keys(table.Place, model.UID), model.UID, ice.AUTO)) m.Design(mdb.LIST, "", kit.JoinWord(table.Keys(table.Place, model.UID), model.UID, ice.AUTO))

View File

@ -7,6 +7,8 @@ import (
_ "shylinux.com/x/community/src/huodongzuzhi" _ "shylinux.com/x/community/src/huodongzuzhi"
_ "shylinux.com/x/community/src/renzhengshouquan" _ "shylinux.com/x/community/src/renzhengshouquan"
_ "shylinux.com/x/community/src/yuehaoxitong" _ "shylinux.com/x/community/src/yuehaoxitong"
_ "shylinux.com/x/community/src/renzhengshouquan/external/tencentcloud/model"
) )
func main() { print(ice.Run()) } func main() { print(ice.Run()) }
@ -14,4 +16,4 @@ func main() { print(ice.Run()) }
func init() { func init() {
ice.Info.CodeMain = "src/gonganxitong/portal.go" ice.Info.CodeMain = "src/gonganxitong/portal.go"
ice.Info.NodeMain = "web.team.gonganxitong.portal" ice.Info.NodeMain = "web.team.gonganxitong.portal"
} }

View File

@ -1,10 +1,17 @@
package renzhengshouquan package renzhengshouquan
import ( import (
"encoding/base64"
"shylinux.com/x/ice" "shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
// "shylinux.com/x/icebergs/base/web"
"shylinux.com/x/toolkits" "shylinux.com/x/toolkits"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
cloudprofile "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
ocr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ocr/v20181119"
"shylinux.com/x/community/src/renzhengshouquan/model" "shylinux.com/x/community/src/renzhengshouquan/model"
) )
@ -25,6 +32,25 @@ func (s cert) List(m *ice.Message, arg ...string) {
s.Select(m, model.AUTH_UID, arg[0]).PushAction(s.Remove).Action(s.Upload).Display("").DisplayCSS("") s.Select(m, model.AUTH_UID, arg[0]).PushAction(s.Remove).Action(s.Upload).Display("").DisplayCSS("")
s.Button(m, "", s.Upload) s.Button(m, "", s.Upload)
} }
// _msg := m.Cmd(web.CHAT_WX_OCR, "", m.Append(model.PATH), "bizlicense")
// m.Echo(kit.Formats(_msg))
s.BizLicenseOCR(m)
}
func (s cert) newClient(m *ice.Message, arg ...string) *ocr.Client {
msg := m.Cmd("web.team.renzhengshouquan.external.tencentcloud.tencentcloud", "4c6a8ccf186816b332ad9dc5655255dd")
credential := common.NewCredential(msg.Append("secret_id"), msg.Append("secret_key"))
client, _ := ocr.NewClient(credential, "", cloudprofile.NewClientProfile())
return client
}
func (s cert) BizLicenseOCR(m *ice.Message, arg ...string) *ice.Message {
request := ocr.NewBizLicenseOCRRequest()
request.ImageBase64 = common.StringPtr(base64.StdEncoding.EncodeToString([]byte(m.Cmdx(nfs.CAT, m.Append(model.PATH)))))
response, err := s.newClient(m).BizLicenseOCR(request)
m.Warn(err)
m.SetAppend()
m.PushDetail(kit.Value(kit.UnMarshal(response.ToJsonString()), "Response"))
return m
} }
func init() { ice.TeamCtxCmd(cert{}) } func init() { ice.TeamCtxCmd(cert{}) }

View File

@ -0,0 +1,13 @@
package model
import "shylinux.com/x/mysql-story/src/db"
type Tencentcloud struct {
db.ModelWithUID
AuthUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32)"`
SecretID string `gorm:"type:varchar(64)"`
SecretKey string `gorm:"type:varchar(64)"`
}
func init() { db.CmdModels("", &Tencentcloud{}) }

View File

@ -2,18 +2,22 @@ package tencentcloud
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"
) )
type tencentcloud struct { type tencentcloud struct {
renzhengshouquan.Tables renzhengshouquan.Table
fields string `data:"title,content,user_uid"` order string `data:"13"`
create string `name:"create title* content*" role:"leader"` fields string `data:"secret_id,secret_key,user_uid"`
create string `name:"create secret_id* secret_key*" role:"leader"`
remove string `name:"remove" role:"leader"` remove string `name:"remove" role:"leader"`
} }
func (s tencentcloud) List(m *ice.Message, arg ...string) { func (s tencentcloud) List(m *ice.Message, arg ...string) {
s.ValueList(m, arg).Display("")
kit.If(m.Length() > 0, func() { m.Action() })
} }
func init() { ice.TeamCtxCmd(tencentcloud{}) } func init() { ice.TeamCtxCmd(tencentcloud{}) }

View File

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

View File

@ -0,0 +1,10 @@
{
"tencentcloud": "腾讯云",
"icons": {
"tencentcloud": "https://img.icons8.com/officel/80/cloud.png"
},
"input": {
"secret_id": "SecretID",
"secret_key": "SecretKey"
}
}

View File

@ -23,7 +23,7 @@ import (
type tencentmeeting struct { type tencentmeeting struct {
renzhengshouquan.Table renzhengshouquan.Table
order string `data:"10"` order string `data:"12"`
role string `data:"leader"` role string `data:"leader"`
fields string `data:"auth_uid,user_uid,app_id,sdk_id,secret_id,secret_key,user_id"` 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:"leader"` create string `name:"create app_id* sdk_id* secret_id* secret_key* user_id*" role:"leader"`