Compare commits
8 Commits
Author | SHA1 | Date |
---|---|---|
|
ca173e57c6 | |
|
a8520b547a | |
|
5b12078be4 | |
|
9bd21cf288 | |
|
761b8371d8 | |
|
f0afe45aad | |
|
877a9e10d3 | |
|
84ae733098 |
|
@ -31,7 +31,7 @@ type (
|
|||
}
|
||||
|
||||
FormsData struct {
|
||||
FormBase
|
||||
formBase
|
||||
FormComponentValues []FormComponentValues `json:"form_component_values"` // 审批表单数据
|
||||
Finance *Finance `json:"finance"` // 财务模块调用
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ type (
|
|||
TaxAmount string `json:"taxAmount"` //税率
|
||||
CallbackUrl string `json:"callbackUrl"` //回调地址
|
||||
Remark string `json:"remark"`
|
||||
Purpose string `json:"purpose"`
|
||||
SystemName string `json:"systemName"` //业务系统名称
|
||||
SubjectName string `json:"subjectName"` //户名
|
||||
BankInfo BankInfo `json:"bankInfo"`
|
||||
|
@ -65,7 +66,7 @@ type (
|
|||
}
|
||||
|
||||
// 创建OA基础数据
|
||||
FormBase struct {
|
||||
formBase struct {
|
||||
OutTradeNo string `json:"out_trade_no"` // 流水号
|
||||
OriginatorUserId string `json:"originator_user_id"` // 钉钉申请人id
|
||||
}
|
||||
|
|
43
const.go
43
const.go
|
@ -1,5 +1,7 @@
|
|||
package l_msg_api
|
||||
|
||||
import "gitea.cdlsxd.cn/self-tools/l_msg_api/protoc/msg"
|
||||
|
||||
const (
|
||||
serverHost = "http://127.0.0.1:8001"
|
||||
timeOut = 60
|
||||
|
@ -13,10 +15,41 @@ const (
|
|||
DDDateField = "DDDateField"
|
||||
)
|
||||
|
||||
type requestPathIndex int32
|
||||
|
||||
const (
|
||||
accessToken = "/oauth/v1/accesstoken"
|
||||
oaCreat = "/msg/v1/dingtalk/oa/create"
|
||||
oaGet = "/msg/v1/dingtalk/oa/get"
|
||||
oaComment = "/msg/v1/dingtalk/oa/comment"
|
||||
sendSms = "/msg/v1/sms/send"
|
||||
accessToken requestPathIndex = iota + 1
|
||||
oaCreat
|
||||
oaGet
|
||||
oaComment
|
||||
sendSms
|
||||
sendSmsHs
|
||||
)
|
||||
|
||||
var requestPath = map[requestPathIndex]map[RequestWay]string{
|
||||
accessToken: {Http: "/oauth/v1/accesstoken", Rpc: msg.Msg_Oauth_FullMethodName},
|
||||
oaCreat: {Http: "/msg/v1/dingtalk/oa/create", Rpc: msg.Msg_DingOACreate_FullMethodName},
|
||||
oaGet: {Http: "/msg/v1/dingtalk/oa/get", Rpc: msg.Msg_DingOAGet_FullMethodName},
|
||||
oaComment: {Http: "/msg/v1/dingtalk/oa/comment", Rpc: msg.Msg_DingOAComment_FullMethodName},
|
||||
sendSms: {Http: "/msg/v1/sms/send", Rpc: msg.Msg_SmsSend_FullMethodName},
|
||||
sendSmsHs: {Http: "/msg/v1/sms/send/hs", Rpc: msg.Msg_HsSmsSend_FullMethodName},
|
||||
}
|
||||
|
||||
type SmsBusiness string
|
||||
|
||||
const (
|
||||
SmsBusinessHs SmsBusiness = "hs"
|
||||
SmsBusinessDefault SmsBusiness = "aliyun"
|
||||
)
|
||||
|
||||
var smsBusinessWithRequestPath = map[SmsBusiness]requestPathIndex{
|
||||
SmsBusinessHs: sendSms,
|
||||
SmsBusinessDefault: sendSmsHs,
|
||||
}
|
||||
|
||||
type RequestWay int8
|
||||
|
||||
const (
|
||||
Http RequestWay = iota + 1
|
||||
Rpc
|
||||
)
|
||||
|
|
13
go.mod
13
go.mod
|
@ -2,7 +2,18 @@ module gitea.cdlsxd.cn/self-tools/l_msg_api
|
|||
|
||||
go 1.22.2
|
||||
|
||||
require github.com/valyala/fasthttp v1.59.0
|
||||
require (
|
||||
github.com/valyala/fasthttp v1.59.0
|
||||
google.golang.org/grpc v1.71.1
|
||||
)
|
||||
|
||||
require (
|
||||
golang.org/x/net v0.35.0 // indirect
|
||||
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 (
|
||||
github.com/andybalholm/brotli v1.1.1 // indirect
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
)
|
||||
|
||||
func FastHttpPost(url string, header map[string]string, body []byte, timeout int) ([]byte, error) {
|
||||
|
||||
req := fasthttp.AcquireRequest()
|
||||
defer fasthttp.ReleaseRequest(req) // 用完需要释放资源
|
||||
|
||||
|
|
67
msg.go
67
msg.go
|
@ -1,7 +1,9 @@
|
|||
package l_msg_api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type MessageCenter struct {
|
||||
|
@ -9,10 +11,11 @@ type MessageCenter struct {
|
|||
ClientKey string // 客户端id,获取授权token需要
|
||||
ClientSecret string
|
||||
header map[string]string
|
||||
option *mesOptionData
|
||||
base
|
||||
}
|
||||
|
||||
func NewMessageCenter(host, clientKey, clientSecret, serverIndex, tempIndex string) (*MessageCenter, error) {
|
||||
func NewMessageCenter(host, clientKey, clientSecret, serverIndex, tempIndex string, args ...MesOption) (*MessageCenter, error) {
|
||||
msg := &MessageCenter{
|
||||
Host: host,
|
||||
ClientKey: clientKey,
|
||||
|
@ -21,19 +24,25 @@ func NewMessageCenter(host, clientKey, clientSecret, serverIndex, tempIndex stri
|
|||
ServerIndex: serverIndex,
|
||||
TempIndex: tempIndex,
|
||||
},
|
||||
option: new(mesOptionData),
|
||||
}
|
||||
err := msg.setHeader()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, arg := range args {
|
||||
arg(msg.option)
|
||||
}
|
||||
msg.header = map[string]string{"content-type": "application/json; charset=utf-8"}
|
||||
accessToken, err := msg.getAccessToken()
|
||||
msg.header = map[string]string{"Authorization": accessToken, "content-type": "application/json; charset=utf-8"}
|
||||
|
||||
return msg, err
|
||||
}
|
||||
|
||||
// OACreate 发起OA审批
|
||||
func (m *MessageCenter) OACreate(dTalkUserId, treadNo string, formModel *FormsData) (data OAResponse, err error) {
|
||||
formModel.FormBase.OutTradeNo = treadNo
|
||||
formModel.FormBase.OriginatorUserId = dTalkUserId
|
||||
err = m.post(oaCreat, m.parseOACreateParam(formModel), &data)
|
||||
func (m *MessageCenter) OACreate(ctx context.Context, dTalkUserId, treadNo string, formModel *FormsData) (data OAResponse, err error) {
|
||||
formModel.formBase = formBase{
|
||||
OutTradeNo: treadNo,
|
||||
OriginatorUserId: dTalkUserId,
|
||||
}
|
||||
err = m.send(ctx, oaCreat, m.parseOACreateParam(formModel), &data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -41,12 +50,12 @@ func (m *MessageCenter) OACreate(dTalkUserId, treadNo string, formModel *FormsDa
|
|||
}
|
||||
|
||||
// OAGetDetail OA详情
|
||||
func (m *MessageCenter) OAGetDetail(outTradeNo string) (data OAGetDetailData, err error) {
|
||||
func (m *MessageCenter) OAGetDetail(ctx context.Context, outTradeNo string) (data OAGetDetailData, err error) {
|
||||
param, _ := json.Marshal(oAGetDetailRequest{
|
||||
Base: m.base,
|
||||
OutTradeNo: outTradeNo,
|
||||
})
|
||||
err = m.post(oaGet, param, &data)
|
||||
err = m.send(ctx, oaGet, param, &data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -54,26 +63,44 @@ func (m *MessageCenter) OAGetDetail(outTradeNo string) (data OAGetDetailData, er
|
|||
}
|
||||
|
||||
// SendSms 短信
|
||||
func (m *MessageCenter) SendSms(tels []string, jsonParam string) (data SmsSend, err error) {
|
||||
// business SmsBusiness
|
||||
func (m *MessageCenter) SendSms(ctx context.Context, tels []string, jsonParam string, args ...SmsOption) (data SmsSend, err error) {
|
||||
var (
|
||||
e = new(smsOptionData)
|
||||
)
|
||||
if len(tels) == 0 {
|
||||
err = errors.New("手机号不能为空")
|
||||
return
|
||||
}
|
||||
for _, arg := range args {
|
||||
arg(e)
|
||||
}
|
||||
if e.Business != "" {
|
||||
if _, ex := smsBusinessWithRequestPath[e.Business]; !ex {
|
||||
err = errors.New("business参数错误")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
e.Business = SmsBusinessDefault
|
||||
}
|
||||
path := smsBusinessWithRequestPath[e.Business]
|
||||
|
||||
param := m.parseSmsSendParam(tels, jsonParam)
|
||||
err = m.post(sendSms, param, &data)
|
||||
err = m.send(ctx, path, param, &data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// BlackboardReceiverView struct {
|
||||
|
||||
// }
|
||||
// SendBlackBoard 钉钉公告
|
||||
// deptidList //接收部门ID列表,最大的列表长度为20。
|
||||
// UseridList //接收部用户ID列表,最大的列表长度为20。
|
||||
func (m *MessageCenter) SendBlackBoard(title, content string, deptidList []int, useridList []string) (data Default, err error) {
|
||||
func (m *MessageCenter) SendBlackBoard(ctx context.Context, title, content string, deptidList []int, useridList []string) (data Default, err error) {
|
||||
receiver := blackboardReceiverView{
|
||||
deptidList, useridList,
|
||||
}
|
||||
err = m.post(sendSms, m.parseSendBlackBoardParam(title, content, receiver), &data)
|
||||
err = m.send(ctx, sendSms, m.parseSendBlackBoardParam(title, content, receiver), &data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -81,7 +108,7 @@ func (m *MessageCenter) SendBlackBoard(title, content string, deptidList []int,
|
|||
}
|
||||
|
||||
// OAComment OA评论,CommentUserId为空则默认审核发起人评论
|
||||
func (m *MessageCenter) OAComment(outTradeNo, text, commentUserId string, file *DingOACommentReqFile) (data OAResponse, err error) {
|
||||
func (m *MessageCenter) OAComment(ctx context.Context, outTradeNo, text, commentUserId string, file *DingOACommentReqFile) (data OAResponse, err error) {
|
||||
req := &oACommentRequest{
|
||||
Base: m.base,
|
||||
OutTradeNo: outTradeNo,
|
||||
|
@ -93,7 +120,7 @@ func (m *MessageCenter) OAComment(outTradeNo, text, commentUserId string, file *
|
|||
}
|
||||
param, _ := json.Marshal(req)
|
||||
|
||||
err = m.post(oaComment, param, &data)
|
||||
err = m.send(ctx, oaComment, param, &data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package l_msg_api
|
||||
|
||||
type (
|
||||
SmsOption func(*smsOptionData)
|
||||
smsOptionData struct {
|
||||
Business SmsBusiness
|
||||
}
|
||||
)
|
||||
|
||||
func WithBusiness(business SmsBusiness) SmsOption {
|
||||
|
||||
return func(OptionData *smsOptionData) {
|
||||
OptionData.Business = business
|
||||
}
|
||||
}
|
||||
|
||||
type (
|
||||
MesOption func(*mesOptionData)
|
||||
mesOptionData struct {
|
||||
RequestWay RequestWay
|
||||
}
|
||||
)
|
||||
|
||||
func WithRequestWay(RequestWay RequestWay) MesOption {
|
||||
return func(OptionData *mesOptionData) {
|
||||
OptionData.RequestWay = RequestWay
|
||||
}
|
||||
}
|
71
paramset.go
71
paramset.go
|
@ -1,6 +1,7 @@
|
|||
package l_msg_api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"gitea.cdlsxd.cn/self-tools/l_msg_api/cache"
|
||||
|
@ -14,7 +15,7 @@ func (m *MessageCenter) parseOACreateParam(formModel *FormsData) (out []byte) {
|
|||
}
|
||||
req.FormComponentValues = formModel.FormComponentValues
|
||||
req.Finance = formModel.Finance
|
||||
req.FormBase = formModel.FormBase
|
||||
req.formBase = formModel.formBase
|
||||
out, _ = json.Marshal(req)
|
||||
return
|
||||
}
|
||||
|
@ -38,7 +39,6 @@ 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
|
||||
}
|
||||
|
@ -53,7 +53,25 @@ func (m *MessageCenter) getAccessToken() (string, error) {
|
|||
return data.AccessToken, err
|
||||
}
|
||||
|
||||
func (m *MessageCenter) post(path string, data []byte, resReflect interface{}) (err error) {
|
||||
func (m *MessageCenter) send(ctx context.Context, path requestPathIndex, data []byte, resReflect interface{}) (err error) {
|
||||
switch m.option.RequestWay {
|
||||
case Rpc:
|
||||
//return m.rpc(ctx, requestAddr, data, resReflect)
|
||||
default:
|
||||
requestAddr := requestPath[path][Http]
|
||||
return m.post(ctx, requestAddr, data, resReflect)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//func (m *MessageCenter) rpc(ctx context.Context, path string, data []byte, resReflect interface{}) (err error) {
|
||||
//
|
||||
// client := protoc.InstanceMsgClient(m.Host)
|
||||
// client.FinanceNotify(ctx, a)
|
||||
// return
|
||||
//}
|
||||
|
||||
func (m *MessageCenter) post(ctx context.Context, path string, data []byte, resReflect interface{}) (err error) {
|
||||
var body responseBody
|
||||
res, err := httpclient.FastHttpPost(fmt.Sprintf("%s%s", m.Host, path), m.header, data, timeOut)
|
||||
if err != nil {
|
||||
|
@ -66,6 +84,31 @@ func (m *MessageCenter) post(path string, data []byte, resReflect interface{}) (
|
|||
return fmt.Errorf("请求失败:%s", body.Msg)
|
||||
}
|
||||
|
||||
dataByte, err := json.Marshal(body.Data)
|
||||
if err != nil {
|
||||
return fmt.Errorf("未知的返回格式:%s", string(dataByte))
|
||||
}
|
||||
if err = json.Unmarshal(dataByte, resReflect); err != nil {
|
||||
return fmt.Errorf("未知的返回格式:%s", string(dataByte))
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (m *MessageCenter) accessPost(path requestPathIndex, data []byte, resReflect interface{}) (err error) {
|
||||
pathStr := requestPath[path][Http]
|
||||
var body responseBody
|
||||
res, err := httpclient.FastHttpPost(fmt.Sprintf("%s%s", m.Host, pathStr), m.header, data, timeOut)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if err = json.Unmarshal(res, &body); err != nil {
|
||||
return fmt.Errorf("请求失败:%s", string(res))
|
||||
}
|
||||
if body.Code != 0 {
|
||||
return fmt.Errorf("请求失败:%s", body.Msg)
|
||||
}
|
||||
|
||||
dataByte, err := json.Marshal(body.Data)
|
||||
if err != nil {
|
||||
return fmt.Errorf("未知的返回格式:%s", string(dataByte))
|
||||
|
@ -77,26 +120,12 @@ func (m *MessageCenter) post(path string, data []byte, resReflect interface{}) (
|
|||
return
|
||||
}
|
||||
|
||||
func (m *MessageCenter) accessPost(path string, data []byte, resReflect interface{}) (err error) {
|
||||
var body responseBody
|
||||
res, err := httpclient.FastHttpPost(fmt.Sprintf("%s%s", m.Host, path), m.header, data, timeOut)
|
||||
func (m *MessageCenter) setHeader() (err error) {
|
||||
m.header = map[string]string{"content-type": "application/json; charset=utf-8"}
|
||||
token, err := m.getAccessToken()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if err = json.Unmarshal(res, &body); err != nil {
|
||||
return fmt.Errorf("请求失败:%s", string(res))
|
||||
}
|
||||
if body.Code != 0 {
|
||||
return fmt.Errorf("请求失败:%s", body.Msg)
|
||||
}
|
||||
|
||||
dataByte, err := json.Marshal(body.Data)
|
||||
if err != nil {
|
||||
return fmt.Errorf("未知的返回格式:%s", string(dataByte))
|
||||
}
|
||||
if err = json.Unmarshal(dataByte, &resReflect); err != nil {
|
||||
return fmt.Errorf("未知的返回格式:%s", string(dataByte))
|
||||
}
|
||||
|
||||
m.header = map[string]string{"Authorization": token, "content-type": "application/json; charset=utf-8"}
|
||||
return
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,274 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package msg;
|
||||
option go_package = "/msg;msg";
|
||||
|
||||
|
||||
message Empty{}
|
||||
|
||||
message BaseRes{
|
||||
bool isSuccess = 1;
|
||||
string Msg = 2;
|
||||
}
|
||||
|
||||
|
||||
message MsgCenterResp{
|
||||
oneof Resp{
|
||||
SmsSendRes smsSendRes = 1;
|
||||
HsSmsSendRes HsSmsSendRes = 2;
|
||||
BaseRes baseRes = 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
message OauthReq {
|
||||
string clientKey = 1;
|
||||
string clientSecret = 2;
|
||||
}
|
||||
|
||||
message OauthResp {
|
||||
string accessToken = 2;
|
||||
int64 AccessExpire = 3;
|
||||
}
|
||||
|
||||
|
||||
message CenterSendReq{
|
||||
string severType = 1;
|
||||
string msgType = 2;
|
||||
BaseReq base = 3;
|
||||
string config = 4;
|
||||
}
|
||||
|
||||
message BaseReq{
|
||||
string serverIndex = 1;
|
||||
string tempIndex = 2;
|
||||
}
|
||||
|
||||
message SmsSendReq{
|
||||
BaseReq base = 1;
|
||||
string param = 2;
|
||||
string tels = 3;
|
||||
}
|
||||
|
||||
|
||||
message SmsSendRes{
|
||||
repeated SmsSendResItem sendList = 1;
|
||||
message SmsSendResItem{
|
||||
string tel = 1;
|
||||
uint32 isSuccess = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message DingdingOASendReq {
|
||||
BaseReq base = 1;
|
||||
string originatorUserId = 2; //审批实例发起人的userId
|
||||
FormComponentValuesView formComponentValues = 3;
|
||||
message FormComponentValuesView {
|
||||
string id = 1;
|
||||
string bizAlias = 2;
|
||||
string name = 3;
|
||||
string value = 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
message DingTalkBlackBoardSendReq {
|
||||
BaseReq base = 1;
|
||||
BlackboardReceiverView blackboardReceiver = 3;
|
||||
message BlackboardReceiverView {
|
||||
repeated int32 deptidList = 1;
|
||||
repeated string useridList = 2;
|
||||
}
|
||||
string title = 4;
|
||||
string content = 5;
|
||||
}
|
||||
|
||||
|
||||
message wxBizSendReq {
|
||||
BaseReq base = 1;
|
||||
string page = 2;//跳转页面
|
||||
string touser = 3; //用户open_id
|
||||
string data = 4; //模板内容,格式形如 { "key1": { "value": any }, "key2": { "value": any } }的object
|
||||
string miniprogram = 5; //跳转小程序时填写,格式如{ "appid": ,"pagepath": { "value": any } }
|
||||
}
|
||||
|
||||
message callInfoReq {
|
||||
BaseReq base = 1;
|
||||
string calledNumber = 3; //接收语音通知的被叫号码
|
||||
int32 playTimes = 4; //播放次数1->3
|
||||
int32 volume = 5; //音量1->100
|
||||
int32 speed = 6; //语速,-500->500
|
||||
string outId = 8; //预留给调用方的 ID,最终会通过回执消息将此 ID 带回给调用方。
|
||||
}
|
||||
|
||||
message callCaptchaReq {
|
||||
BaseReq base = 1;
|
||||
string calledNumber = 3; //接收语音通知的被叫号码
|
||||
string ttsParam = 4; //{"AckNum":"123456"}
|
||||
int32 playTimes = 5; //播放次数1->3
|
||||
int32 volume = 6; //音量1->100
|
||||
int32 speed = 7; //语速,-500->500
|
||||
string outId = 8; //预留给调用方的 ID,最终会通过回执消息将此 ID 带回给调用方。
|
||||
}
|
||||
|
||||
// DingTalk OA 审批创建
|
||||
message DingOACreateReq {
|
||||
BaseReq base = 1;
|
||||
string outTradeNo = 2; //下游流水号
|
||||
string originatorUserId = 3; //审批实例发起人的userId
|
||||
|
||||
repeated FormComponentValuesView formComponentValues = 5; //审批表单的参数
|
||||
message FormComponentValuesView {
|
||||
string name = 1; //表单参数的名称
|
||||
string value = 2; //表单参数的值
|
||||
string ComponentType = 3; //表单参数的类型
|
||||
string extValue = 5; //表单扩展值
|
||||
string Id = 4; //控件的id
|
||||
}
|
||||
Finance finance = 6; //财务组件
|
||||
message Finance {
|
||||
string checkUserId = 1; //审核人
|
||||
int64 sync =2;//是否是异步,如果为异步,付款申请和业务申请是同时进行
|
||||
string amount = 3; //金额
|
||||
string systemName = 13; //业务系统名称
|
||||
string goodsInfo = 4; //商品信息
|
||||
string paymentAccount=5; //付款方账户
|
||||
string taxAmount=6 ;//税率
|
||||
string callbackUrl=7; //回调地址
|
||||
string orderNo=8; //订单号
|
||||
string remark=9; //备注
|
||||
string purpose=12;//用途
|
||||
string subjectName=11; //户名
|
||||
BankInfo bankInfo=10;
|
||||
message BankInfo {
|
||||
string resellerName = 1; //供应商名称
|
||||
string bankName = 2; //银行名称
|
||||
string accountBankName = 3; //开户行名称
|
||||
string subjectName = 4; //户名
|
||||
string bankAccount = 5; //银行卡号
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
message DingOACreateResp {
|
||||
bool isSuccess = 1;
|
||||
string Msg = 2;
|
||||
string instanceId = 3; // 审批实例的id
|
||||
}
|
||||
|
||||
// DingTalk OA 审批实例修改
|
||||
message DingOAUpdateReq {
|
||||
BaseReq base = 1;
|
||||
string outTradeNo = 2; //下游流水号
|
||||
repeated FormComponentValuesView formComponentValues = 5; //审批表单的参数
|
||||
message FormComponentValuesView {
|
||||
string name = 1; //表单参数的名称
|
||||
string value = 2; //表单参数的值
|
||||
string ComponentType = 3; //表单参数的类型
|
||||
string extValue = 5; //表单扩展值
|
||||
string Id = 4; //控件的id
|
||||
}
|
||||
}
|
||||
|
||||
message DingOAUpdateResp {
|
||||
bool isSuccess = 1;
|
||||
string Msg = 2;
|
||||
string instanceId = 3; // 审批实例的id
|
||||
}
|
||||
|
||||
// DingTalk OA 审批实例修改
|
||||
message DingOACommentReq {
|
||||
BaseReq base = 1;
|
||||
string outTradeNo = 2; //下游流水号
|
||||
string text = 3; //评论的内容
|
||||
string commentUserId = 4; //评论的内容
|
||||
File file = 5; //文件
|
||||
message File{ //文件名
|
||||
repeated string photos = 1; //图片URL地址
|
||||
repeated Attachments attachments = 2; //图片URL地址
|
||||
message Attachments{ //文件名
|
||||
string spaceId =1; //钉盘空间ID。
|
||||
string fileSize =2; //文件大小。
|
||||
string fileId =3; //文件ID。
|
||||
string fileName =4; //文件名称。
|
||||
string fileType =5; //文件类型。
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
message DingOACommentResp {
|
||||
bool isSuccess = 1;
|
||||
string Msg = 2;
|
||||
string instanceId = 3; // 审批实例的id
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
message DingOAGetReq {
|
||||
BaseReq base = 1;
|
||||
string processInstanceId = 2; //审批实例的id
|
||||
string outTradeNo = 3; //下游流水号
|
||||
}
|
||||
|
||||
message DingOAGetResp {
|
||||
string OutTradeNo = 1; //下游流水号
|
||||
string processInstanceId = 2; //审批实例的id
|
||||
string Title = 3; //审批实例的标题
|
||||
int64 Result = 4; //审批结果 0 进行中 1:同意 2:拒绝
|
||||
string Type = 5; //审批任务状态变更类型
|
||||
string Remarks = 6; //审批备注
|
||||
string CreateTime = 7; //审批任务创建时间
|
||||
string UpdateTime = 8; //审批任务更新时间
|
||||
}
|
||||
|
||||
message PaymentCallbackData {
|
||||
string sign=1;
|
||||
string instanceId=2;
|
||||
string corpId=3;
|
||||
string failReason =4;
|
||||
string paymentTime=5; //付款时间
|
||||
string userId=6;
|
||||
string paymentStatus=7;
|
||||
|
||||
}
|
||||
|
||||
message PaymentCallbackRes {
|
||||
bool isSuccess=1;
|
||||
}
|
||||
|
||||
|
||||
message HsSmsSendReq{
|
||||
BaseReq base = 1;
|
||||
string param = 2;
|
||||
string tels = 3;
|
||||
}
|
||||
|
||||
|
||||
message HsSmsSendRes{
|
||||
repeated SmsSendResItem sendList = 1;
|
||||
message SmsSendResItem{
|
||||
string tel = 1;
|
||||
uint32 isSuccess = 2;
|
||||
}
|
||||
}
|
||||
|
||||
service Msg {
|
||||
rpc oauth(OauthReq) returns(OauthResp);
|
||||
rpc centerSend(CenterSendReq) returns(MsgCenterResp);
|
||||
rpc smsSend(SmsSendReq) returns(SmsSendRes);
|
||||
rpc dingTalkBlackBoardSend(DingTalkBlackBoardSendReq) returns(BaseRes);
|
||||
rpc wxBizSend(wxBizSendReq) returns(BaseRes);
|
||||
rpc callInfo(callInfoReq) returns(BaseRes);
|
||||
rpc callCaptcha(callCaptchaReq) returns(BaseRes);
|
||||
rpc dingOACreate(DingOACreateReq) returns(DingOACreateResp);
|
||||
rpc dingOAUpdate(DingOAUpdateReq) returns(DingOAUpdateResp);
|
||||
rpc dingOAComment(DingOACommentReq) returns(DingOACommentResp);
|
||||
rpc dingOAGet(DingOAGetReq) returns(DingOAGetResp);
|
||||
rpc FinanceNotify(PaymentCallbackData) returns(PaymentCallbackRes);
|
||||
rpc hsSmsSend(HsSmsSendReq) returns(HsSmsSendRes);
|
||||
}
|
|
@ -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",
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package protoc
|
||||
|
||||
import (
|
||||
"gitea.cdlsxd.cn/self-tools/l_msg_api/protoc/msg"
|
||||
"google.golang.org/grpc"
|
||||
"log"
|
||||
)
|
||||
|
||||
var rpcMsgClient msg.MsgClient
|
||||
|
||||
func InstanceMsgClient(host string) msg.MsgClient {
|
||||
if rpcMsgClient != nil {
|
||||
return rpcMsgClient
|
||||
}
|
||||
conn, err := grpc.NewClient(host)
|
||||
if err != nil {
|
||||
log.Fatalf("did not connect: %v", err)
|
||||
}
|
||||
rpcMsgClient = msg.NewMsgClient(conn)
|
||||
return rpcMsgClient
|
||||
}
|
|
@ -10,22 +10,23 @@ import (
|
|||
const (
|
||||
ClientKey = "ymt"
|
||||
ClientSecret = "ymt"
|
||||
serverHost = "http://127.0.0.1:8001"
|
||||
serverHost = "http://121.199.38.107:8000"
|
||||
local = "http://127.0.0.1:8001"
|
||||
)
|
||||
|
||||
func TestSms(t *testing.T) {
|
||||
msg, err := l_msg_api.NewMessageCenter(serverHost, ClientKey, ClientSecret, "smssass", "sasssms")
|
||||
msg, err := l_msg_api.NewMessageCenter(serverHost, ClientKey, ClientSecret, "sms", "sms")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
res, err := msg.SendSms([]string{"15082245107"}, `{"content": "测试"}`)
|
||||
res, err := msg.SendSms(context.TODO(), []string{"15082245107"}, `{"content": "测试"}`)
|
||||
fmt.Println(res, err)
|
||||
|
||||
}
|
||||
|
||||
func TestOaCreate(t *testing.T) {
|
||||
msg, err := l_msg_api.NewMessageCenter(serverHost, ClientKey, ClientSecret, "sw_oa", "sw_oa_purchase")
|
||||
msg, err := l_msg_api.NewMessageCenter(local, ClientKey, ClientSecret, "sw_oa", "sw_oa_purchase")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -37,7 +38,7 @@ func TestOaCreate(t *testing.T) {
|
|||
{Name: "采购总金额", Value: "11.22"},
|
||||
{Name: "预计到货时间", Value: "2025-03-21"},
|
||||
}
|
||||
res, err := msg.OACreate("17101201090101570", "123456789123bgff", &l_msg_api.FormsData{
|
||||
res, err := msg.OACreate(context.TODO(), "17101201090101570", "cxvxvxcgfgfvxvxv", &l_msg_api.FormsData{
|
||||
FormComponentValues: form,
|
||||
Finance: &l_msg_api.Finance{
|
||||
Amount: "11.22",
|
||||
|
@ -48,6 +49,8 @@ func TestOaCreate(t *testing.T) {
|
|||
CallbackUrl: "www.baidu.com",
|
||||
Remark: "测试备注",
|
||||
Sync: 1,
|
||||
SystemName: "货易通",
|
||||
SubjectName: "成都蓝色兄弟网络科技有限公司(0802)",
|
||||
BankInfo: l_msg_api.BankInfo{
|
||||
BankName: "中国银行",
|
||||
BankAccount: "43243243434",
|
||||
|
@ -65,7 +68,7 @@ func TestOaComment(t *testing.T) {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
res, err := msg.OAComment("P24110515152043136-20250318181554", "sdk测试", "", nil)
|
||||
res, err := msg.OAComment(context.TODO(), "P24110515152043136-20250318181554", "sdk测试", "", nil)
|
||||
fmt.Println(res, err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue