Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
|
27be45b5ea | |
|
3fd9995b0f | |
|
b0fc0e3600 | |
|
ca173e57c6 |
35
config.go
35
config.go
|
@ -141,4 +141,39 @@ type (
|
|||
FileName string `json:"fileName,optional"` //文件名称。
|
||||
FileType string `json:"fileType,optional"` //文件类型。
|
||||
}
|
||||
|
||||
FinanceBank struct {
|
||||
Keyword string `json:"keyword"`
|
||||
BankName string `json:"bankName"` // 模糊查询 (bankName,branchName, branchCode, code)
|
||||
Province string `json:"province"`
|
||||
City string `json:"city"`
|
||||
Code string `json:"code"`
|
||||
IsDesc bool `json:"isDesc"` // 是否倒序查询(id)
|
||||
}
|
||||
|
||||
financeBankRequest struct {
|
||||
Keyword string `json:"keyword"`
|
||||
BankName string `json:"bankName"` // 模糊查询 (bankName,branchName, branchCode, code)
|
||||
Province string `json:"province"`
|
||||
City string `json:"city"`
|
||||
Code string `json:"code"`
|
||||
Page uint32 `json:"page"`
|
||||
PageSize uint32 `json:"pageSize"`
|
||||
IsDesc bool `json:"isDesc"` // 是否倒序查询(id)
|
||||
}
|
||||
|
||||
FinanceBankResp struct {
|
||||
Banks []BankItem `json:"banks"`
|
||||
Total uint32 `json:"total"` // 模糊查询 (bankName,branchName, branchCode, code)
|
||||
|
||||
}
|
||||
|
||||
BankItem struct {
|
||||
BranchCode string `json:"branchCode"`
|
||||
Province string `json:"province"`
|
||||
City string `json:"city"`
|
||||
BranchName string `json:"branchName"`
|
||||
Code string `json:"code"`
|
||||
BankName string `json:"bankName"`
|
||||
}
|
||||
)
|
||||
|
|
6
const.go
6
const.go
|
@ -53,3 +53,9 @@ const (
|
|||
Http RequestWay = iota + 1
|
||||
Rpc
|
||||
)
|
||||
|
||||
const financeUrl = "https://financeouter.22233.cn"
|
||||
|
||||
const (
|
||||
financeBanks = "/outer/v1/dingtalk/payment/banks"
|
||||
)
|
||||
|
|
7
go.mod
7
go.mod
|
@ -1,10 +1,14 @@
|
|||
module gitea.cdlsxd.cn/self-tools/l_msg_api
|
||||
|
||||
go 1.22.2
|
||||
go 1.22.10
|
||||
|
||||
toolchain go1.23.6
|
||||
|
||||
require (
|
||||
gitea.cdlsxd.cn/rzy_tools/request v1.0.0
|
||||
github.com/valyala/fasthttp v1.59.0
|
||||
google.golang.org/grpc v1.71.1
|
||||
google.golang.org/protobuf v1.36.4
|
||||
)
|
||||
|
||||
require (
|
||||
|
@ -12,7 +16,6 @@ require (
|
|||
golang.org/x/sys v0.30.0 // indirect
|
||||
golang.org/x/text v0.22.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
|
||||
google.golang.org/protobuf v1.36.4 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
|
|
26
msg.go
26
msg.go
|
@ -4,6 +4,8 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"gitea.cdlsxd.cn/rzy_tools/request"
|
||||
)
|
||||
|
||||
type MessageCenter struct {
|
||||
|
@ -126,3 +128,27 @@ func (m *MessageCenter) OAComment(ctx context.Context, outTradeNo, text, comment
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
// OAComment OA评论,CommentUserId为空则默认审核发起人评论
|
||||
func (m *MessageCenter) FinanceBankList(ctx context.Context, financeBank *FinanceBank, page uint32, pageSize uint32) (data FinanceBankResp, err error) {
|
||||
|
||||
res, err := m.OtherSend(ctx, &request.Request{
|
||||
Method: "GET",
|
||||
Url: fmt.Sprintf("%s%s", financeUrl, financeBanks),
|
||||
Params: mapInterfaceToMapString(structToMap(financeBankRequest{
|
||||
Keyword: financeBank.Keyword,
|
||||
BankName: financeBank.BankName,
|
||||
Province: financeBank.Province,
|
||||
City: financeBank.City,
|
||||
Code: financeBank.Code,
|
||||
Page: page,
|
||||
PageSize: pageSize,
|
||||
IsDesc: financeBank.IsDesc,
|
||||
})),
|
||||
})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = json.Unmarshal(res.Content, &data)
|
||||
return
|
||||
}
|
||||
|
|
83
paramset.go
83
paramset.go
|
@ -4,9 +4,12 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"gitea.cdlsxd.cn/rzy_tools/request"
|
||||
"gitea.cdlsxd.cn/self-tools/l_msg_api/cache"
|
||||
"gitea.cdlsxd.cn/self-tools/l_msg_api/httpclient"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (m *MessageCenter) parseOACreateParam(formModel *FormsData) (out []byte) {
|
||||
|
@ -39,17 +42,19 @@ func (m *MessageCenter) parseSendBlackBoardParam(title, content string, receiver
|
|||
}
|
||||
|
||||
func (m *MessageCenter) getAccessToken() (string, error) {
|
||||
if tokenInterface, exist := cache.InstanceCacheMap().Get(m.ClientKey); exist {
|
||||
return tokenInterface.(string), nil
|
||||
}
|
||||
var data accessTokenResponse
|
||||
|
||||
if tokenInstance, exist := cache.InstanceCacheMap().Get(m.ClientKey); exist {
|
||||
data = tokenInstance.(accessTokenResponse)
|
||||
if int64(data.AccessExpire) >= time.Now().Unix() {
|
||||
return data.AccessToken, nil
|
||||
}
|
||||
}
|
||||
var authParam, _ = json.Marshal(map[string]string{"client_key": m.ClientKey, "client_secret": m.ClientSecret})
|
||||
err := m.accessPost(accessToken, authParam, &data)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
cache.InstanceCacheMap().Put(m.ClientKey, data.AccessToken)
|
||||
cache.InstanceCacheMap().Put(m.ClientKey, data)
|
||||
return data.AccessToken, err
|
||||
}
|
||||
|
||||
|
@ -95,6 +100,11 @@ func (m *MessageCenter) post(ctx context.Context, path string, data []byte, resR
|
|||
return
|
||||
}
|
||||
|
||||
func (m *MessageCenter) OtherSend(ctx context.Context, request *request.Request) (res request.Response, err error) {
|
||||
res, err = request.Send()
|
||||
return
|
||||
}
|
||||
|
||||
func (m *MessageCenter) accessPost(path requestPathIndex, data []byte, resReflect interface{}) (err error) {
|
||||
pathStr := requestPath[path][Http]
|
||||
var body responseBody
|
||||
|
@ -129,3 +139,66 @@ func (m *MessageCenter) setHeader() (err error) {
|
|||
m.header = map[string]string{"Authorization": token, "content-type": "application/json; charset=utf-8"}
|
||||
return
|
||||
}
|
||||
|
||||
// StructToMap 将一个struct转换为map[string]interface{}
|
||||
func structToMap(obj interface{}) map[string]interface{} {
|
||||
// 获取obj的类型
|
||||
val := reflect.ValueOf(obj)
|
||||
if val.Kind() == reflect.Ptr {
|
||||
val = val.Elem()
|
||||
}
|
||||
|
||||
// 确保obj是一个struct
|
||||
if val.Kind() != reflect.Struct {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 创建一个map来保存结果
|
||||
data := make(map[string]interface{})
|
||||
|
||||
// 遍历struct的字段
|
||||
for i := 0; i < val.NumField(); i++ {
|
||||
// 获取字段的类型和值
|
||||
valueField := val.Field(i)
|
||||
typeField := val.Type().Field(i)
|
||||
jsonTag := typeField.Tag.Get("json")
|
||||
if idx := strings.Index(jsonTag, ","); idx != -1 {
|
||||
// 如果有逗号,则取逗号之前的部分
|
||||
jsonTag = jsonTag[:idx]
|
||||
}
|
||||
// 忽略未导出的字段(字段名首字母小写)
|
||||
if !typeField.IsExported() {
|
||||
continue
|
||||
}
|
||||
|
||||
// 将字段名和值添加到map中
|
||||
data[jsonTag] = valueField.Interface()
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
// MapInterfaceToMapString map[string]interface{} to map[string]string
|
||||
func mapInterfaceToMapString(inputMap map[string]interface{}) map[string]string {
|
||||
var mapString = make(map[string]string)
|
||||
for key, value := range inputMap {
|
||||
mapString[key] = fmt.Sprintf("%v", value)
|
||||
}
|
||||
return mapString
|
||||
}
|
||||
|
||||
// ChunkSlice 将一个切片分割成多个子切片,每个子切片最多包含 maxSize 个元素
|
||||
func ChunkSlice[T any](slice []T, maxSize int) [][]T {
|
||||
var chunks [][]T
|
||||
length := len(slice)
|
||||
|
||||
for i := 0; i < length; i += maxSize {
|
||||
end := i + maxSize
|
||||
if end > length {
|
||||
end = length
|
||||
}
|
||||
chunks = append(chunks, slice[i:end])
|
||||
}
|
||||
|
||||
return chunks
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,577 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v3.6.1
|
||||
// source: msg/msg.proto
|
||||
|
||||
package msg
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
Msg_Oauth_FullMethodName = "/msg.Msg/oauth"
|
||||
Msg_CenterSend_FullMethodName = "/msg.Msg/centerSend"
|
||||
Msg_SmsSend_FullMethodName = "/msg.Msg/smsSend"
|
||||
Msg_DingTalkBlackBoardSend_FullMethodName = "/msg.Msg/dingTalkBlackBoardSend"
|
||||
Msg_WxBizSend_FullMethodName = "/msg.Msg/wxBizSend"
|
||||
Msg_CallInfo_FullMethodName = "/msg.Msg/callInfo"
|
||||
Msg_CallCaptcha_FullMethodName = "/msg.Msg/callCaptcha"
|
||||
Msg_DingOACreate_FullMethodName = "/msg.Msg/dingOACreate"
|
||||
Msg_DingOAUpdate_FullMethodName = "/msg.Msg/dingOAUpdate"
|
||||
Msg_DingOAComment_FullMethodName = "/msg.Msg/dingOAComment"
|
||||
Msg_DingOAGet_FullMethodName = "/msg.Msg/dingOAGet"
|
||||
Msg_FinanceNotify_FullMethodName = "/msg.Msg/FinanceNotify"
|
||||
Msg_HsSmsSend_FullMethodName = "/msg.Msg/hsSmsSend"
|
||||
)
|
||||
|
||||
// MsgClient is the client API for Msg service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type MsgClient interface {
|
||||
Oauth(ctx context.Context, in *OauthReq, opts ...grpc.CallOption) (*OauthResp, error)
|
||||
CenterSend(ctx context.Context, in *CenterSendReq, opts ...grpc.CallOption) (*MsgCenterResp, error)
|
||||
SmsSend(ctx context.Context, in *SmsSendReq, opts ...grpc.CallOption) (*SmsSendRes, error)
|
||||
DingTalkBlackBoardSend(ctx context.Context, in *DingTalkBlackBoardSendReq, opts ...grpc.CallOption) (*BaseRes, error)
|
||||
WxBizSend(ctx context.Context, in *WxBizSendReq, opts ...grpc.CallOption) (*BaseRes, error)
|
||||
CallInfo(ctx context.Context, in *CallInfoReq, opts ...grpc.CallOption) (*BaseRes, error)
|
||||
CallCaptcha(ctx context.Context, in *CallCaptchaReq, opts ...grpc.CallOption) (*BaseRes, error)
|
||||
DingOACreate(ctx context.Context, in *DingOACreateReq, opts ...grpc.CallOption) (*DingOACreateResp, error)
|
||||
DingOAUpdate(ctx context.Context, in *DingOAUpdateReq, opts ...grpc.CallOption) (*DingOAUpdateResp, error)
|
||||
DingOAComment(ctx context.Context, in *DingOACommentReq, opts ...grpc.CallOption) (*DingOACommentResp, error)
|
||||
DingOAGet(ctx context.Context, in *DingOAGetReq, opts ...grpc.CallOption) (*DingOAGetResp, error)
|
||||
FinanceNotify(ctx context.Context, in *PaymentCallbackData, opts ...grpc.CallOption) (*PaymentCallbackRes, error)
|
||||
HsSmsSend(ctx context.Context, in *HsSmsSendReq, opts ...grpc.CallOption) (*HsSmsSendRes, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
|
||||
return &msgClient{cc}
|
||||
}
|
||||
|
||||
func (c *msgClient) Oauth(ctx context.Context, in *OauthReq, opts ...grpc.CallOption) (*OauthResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(OauthResp)
|
||||
err := c.cc.Invoke(ctx, Msg_Oauth_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) CenterSend(ctx context.Context, in *CenterSendReq, opts ...grpc.CallOption) (*MsgCenterResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(MsgCenterResp)
|
||||
err := c.cc.Invoke(ctx, Msg_CenterSend_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) SmsSend(ctx context.Context, in *SmsSendReq, opts ...grpc.CallOption) (*SmsSendRes, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SmsSendRes)
|
||||
err := c.cc.Invoke(ctx, Msg_SmsSend_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) DingTalkBlackBoardSend(ctx context.Context, in *DingTalkBlackBoardSendReq, opts ...grpc.CallOption) (*BaseRes, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(BaseRes)
|
||||
err := c.cc.Invoke(ctx, Msg_DingTalkBlackBoardSend_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) WxBizSend(ctx context.Context, in *WxBizSendReq, opts ...grpc.CallOption) (*BaseRes, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(BaseRes)
|
||||
err := c.cc.Invoke(ctx, Msg_WxBizSend_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) CallInfo(ctx context.Context, in *CallInfoReq, opts ...grpc.CallOption) (*BaseRes, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(BaseRes)
|
||||
err := c.cc.Invoke(ctx, Msg_CallInfo_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) CallCaptcha(ctx context.Context, in *CallCaptchaReq, opts ...grpc.CallOption) (*BaseRes, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(BaseRes)
|
||||
err := c.cc.Invoke(ctx, Msg_CallCaptcha_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) DingOACreate(ctx context.Context, in *DingOACreateReq, opts ...grpc.CallOption) (*DingOACreateResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(DingOACreateResp)
|
||||
err := c.cc.Invoke(ctx, Msg_DingOACreate_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) DingOAUpdate(ctx context.Context, in *DingOAUpdateReq, opts ...grpc.CallOption) (*DingOAUpdateResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(DingOAUpdateResp)
|
||||
err := c.cc.Invoke(ctx, Msg_DingOAUpdate_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) DingOAComment(ctx context.Context, in *DingOACommentReq, opts ...grpc.CallOption) (*DingOACommentResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(DingOACommentResp)
|
||||
err := c.cc.Invoke(ctx, Msg_DingOAComment_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) DingOAGet(ctx context.Context, in *DingOAGetReq, opts ...grpc.CallOption) (*DingOAGetResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(DingOAGetResp)
|
||||
err := c.cc.Invoke(ctx, Msg_DingOAGet_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) FinanceNotify(ctx context.Context, in *PaymentCallbackData, opts ...grpc.CallOption) (*PaymentCallbackRes, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(PaymentCallbackRes)
|
||||
err := c.cc.Invoke(ctx, Msg_FinanceNotify_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) HsSmsSend(ctx context.Context, in *HsSmsSendReq, opts ...grpc.CallOption) (*HsSmsSendRes, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(HsSmsSendRes)
|
||||
err := c.cc.Invoke(ctx, Msg_HsSmsSend_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
// All implementations must embed UnimplementedMsgServer
|
||||
// for forward compatibility.
|
||||
type MsgServer interface {
|
||||
Oauth(context.Context, *OauthReq) (*OauthResp, error)
|
||||
CenterSend(context.Context, *CenterSendReq) (*MsgCenterResp, error)
|
||||
SmsSend(context.Context, *SmsSendReq) (*SmsSendRes, error)
|
||||
DingTalkBlackBoardSend(context.Context, *DingTalkBlackBoardSendReq) (*BaseRes, error)
|
||||
WxBizSend(context.Context, *WxBizSendReq) (*BaseRes, error)
|
||||
CallInfo(context.Context, *CallInfoReq) (*BaseRes, error)
|
||||
CallCaptcha(context.Context, *CallCaptchaReq) (*BaseRes, error)
|
||||
DingOACreate(context.Context, *DingOACreateReq) (*DingOACreateResp, error)
|
||||
DingOAUpdate(context.Context, *DingOAUpdateReq) (*DingOAUpdateResp, error)
|
||||
DingOAComment(context.Context, *DingOACommentReq) (*DingOACommentResp, error)
|
||||
DingOAGet(context.Context, *DingOAGetReq) (*DingOAGetResp, error)
|
||||
FinanceNotify(context.Context, *PaymentCallbackData) (*PaymentCallbackRes, error)
|
||||
HsSmsSend(context.Context, *HsSmsSendReq) (*HsSmsSendRes, error)
|
||||
mustEmbedUnimplementedMsgServer()
|
||||
}
|
||||
|
||||
// UnimplementedMsgServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedMsgServer struct{}
|
||||
|
||||
func (UnimplementedMsgServer) Oauth(context.Context, *OauthReq) (*OauthResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Oauth not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) CenterSend(context.Context, *CenterSendReq) (*MsgCenterResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CenterSend not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) SmsSend(context.Context, *SmsSendReq) (*SmsSendRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SmsSend not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) DingTalkBlackBoardSend(context.Context, *DingTalkBlackBoardSendReq) (*BaseRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DingTalkBlackBoardSend not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) WxBizSend(context.Context, *WxBizSendReq) (*BaseRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method WxBizSend not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) CallInfo(context.Context, *CallInfoReq) (*BaseRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CallInfo not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) CallCaptcha(context.Context, *CallCaptchaReq) (*BaseRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CallCaptcha not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) DingOACreate(context.Context, *DingOACreateReq) (*DingOACreateResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DingOACreate not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) DingOAUpdate(context.Context, *DingOAUpdateReq) (*DingOAUpdateResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DingOAUpdate not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) DingOAComment(context.Context, *DingOACommentReq) (*DingOACommentResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DingOAComment not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) DingOAGet(context.Context, *DingOAGetReq) (*DingOAGetResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DingOAGet not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) FinanceNotify(context.Context, *PaymentCallbackData) (*PaymentCallbackRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FinanceNotify not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) HsSmsSend(context.Context, *HsSmsSendReq) (*HsSmsSendRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method HsSmsSend not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
|
||||
func (UnimplementedMsgServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to MsgServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeMsgServer interface {
|
||||
mustEmbedUnimplementedMsgServer()
|
||||
}
|
||||
|
||||
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
|
||||
// If the following call pancis, it indicates UnimplementedMsgServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&Msg_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Msg_Oauth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(OauthReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).Oauth(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_Oauth_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).Oauth(ctx, req.(*OauthReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_CenterSend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CenterSendReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).CenterSend(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_CenterSend_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).CenterSend(ctx, req.(*CenterSendReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_SmsSend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SmsSendReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).SmsSend(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_SmsSend_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).SmsSend(ctx, req.(*SmsSendReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_DingTalkBlackBoardSend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DingTalkBlackBoardSendReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).DingTalkBlackBoardSend(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_DingTalkBlackBoardSend_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).DingTalkBlackBoardSend(ctx, req.(*DingTalkBlackBoardSendReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_WxBizSend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(WxBizSendReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).WxBizSend(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_WxBizSend_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).WxBizSend(ctx, req.(*WxBizSendReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_CallInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CallInfoReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).CallInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_CallInfo_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).CallInfo(ctx, req.(*CallInfoReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_CallCaptcha_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CallCaptchaReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).CallCaptcha(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_CallCaptcha_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).CallCaptcha(ctx, req.(*CallCaptchaReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_DingOACreate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DingOACreateReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).DingOACreate(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_DingOACreate_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).DingOACreate(ctx, req.(*DingOACreateReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_DingOAUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DingOAUpdateReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).DingOAUpdate(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_DingOAUpdate_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).DingOAUpdate(ctx, req.(*DingOAUpdateReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_DingOAComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DingOACommentReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).DingOAComment(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_DingOAComment_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).DingOAComment(ctx, req.(*DingOACommentReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_DingOAGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DingOAGetReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).DingOAGet(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_DingOAGet_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).DingOAGet(ctx, req.(*DingOAGetReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_FinanceNotify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PaymentCallbackData)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).FinanceNotify(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_FinanceNotify_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).FinanceNotify(ctx, req.(*PaymentCallbackData))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_HsSmsSend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(HsSmsSendReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).HsSmsSend(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_HsSmsSend_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).HsSmsSend(ctx, req.(*HsSmsSendReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "msg.Msg",
|
||||
HandlerType: (*MsgServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "oauth",
|
||||
Handler: _Msg_Oauth_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "centerSend",
|
||||
Handler: _Msg_CenterSend_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "smsSend",
|
||||
Handler: _Msg_SmsSend_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "dingTalkBlackBoardSend",
|
||||
Handler: _Msg_DingTalkBlackBoardSend_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "wxBizSend",
|
||||
Handler: _Msg_WxBizSend_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "callInfo",
|
||||
Handler: _Msg_CallInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "callCaptcha",
|
||||
Handler: _Msg_CallCaptcha_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "dingOACreate",
|
||||
Handler: _Msg_DingOACreate_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "dingOAUpdate",
|
||||
Handler: _Msg_DingOAUpdate_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "dingOAComment",
|
||||
Handler: _Msg_DingOAComment_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "dingOAGet",
|
||||
Handler: _Msg_DingOAGet_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "FinanceNotify",
|
||||
Handler: _Msg_FinanceNotify_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "hsSmsSend",
|
||||
Handler: _Msg_HsSmsSend_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "msg/msg.proto",
|
||||
}
|
|
@ -25,6 +25,12 @@ func TestSms(t *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func TestAccess(t *testing.T) {
|
||||
msg, _ := l_msg_api.NewMessageCenter(serverHost, ClientKey, ClientSecret, "sms", "sms")
|
||||
msg2, _ := l_msg_api.NewMessageCenter(serverHost, ClientKey, ClientSecret, "sms", "sms")
|
||||
fmt.Println(msg, msg2)
|
||||
}
|
||||
|
||||
func TestOaCreate(t *testing.T) {
|
||||
msg, err := l_msg_api.NewMessageCenter(local, ClientKey, ClientSecret, "sw_oa", "sw_oa_purchase")
|
||||
if err != nil {
|
||||
|
@ -76,3 +82,15 @@ func TestContext(*testing.T) {
|
|||
c := context.Background()
|
||||
c.Done()
|
||||
}
|
||||
|
||||
func TestFinanceBankList(t *testing.T) {
|
||||
c := context.Background()
|
||||
msg, err := l_msg_api.NewMessageCenter(serverHost, ClientKey, ClientSecret, "sw_oa", "sw_oa_purchase")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
res, err := msg.FinanceBankList(c, &l_msg_api.FinanceBank{
|
||||
Keyword: "招商",
|
||||
}, 1, 50)
|
||||
t.Log(res, err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue