预警28
This commit is contained in:
parent
b33db300be
commit
4f625560e3
|
|
@ -108,7 +108,14 @@ rdsMQ:
|
||||||
numWorkers: 2 #协程数量,不配置默认为10
|
numWorkers: 2 #协程数量,不配置默认为10
|
||||||
waitTime: 1s #处理完成后等待时间
|
waitTime: 1s #处理完成后等待时间
|
||||||
isOpen: false #是否启动消费 true/false
|
isOpen: false #是否启动消费 true/false
|
||||||
|
|
||||||
|
aliYunSms:
|
||||||
|
accessKeyId:
|
||||||
|
accessKeySecret:
|
||||||
|
endpoint: dysmsapi.aliyuncs.com
|
||||||
|
signName: 蓝色兄弟
|
||||||
|
templateWarning: "SMS_489660721"
|
||||||
|
|
||||||
#配置日志
|
#配置日志
|
||||||
logs:
|
logs:
|
||||||
business: business.log #业务日志路径:如果不写日志,则不配置或配置为空
|
business: business.log #业务日志路径:如果不写日志,则不配置或配置为空
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,14 @@ rdsMQ:
|
||||||
numWorkers: 3 #协程数量,不配置默认为10
|
numWorkers: 3 #协程数量,不配置默认为10
|
||||||
waitTime: 1s #处理完成后等待时间
|
waitTime: 1s #处理完成后等待时间
|
||||||
isOpen: true #是否启动消费 true/false
|
isOpen: true #是否启动消费 true/false
|
||||||
|
|
||||||
|
aliYunSms:
|
||||||
|
accessKeyId: LTAI5tM1X4HuqUwT8D74qXAH
|
||||||
|
accessKeySecret: gxsC1QK12NSKH1HkCqKR1EnMdAy3ad
|
||||||
|
endpoint: dysmsapi.aliyuncs.com
|
||||||
|
signName: 蓝色兄弟
|
||||||
|
templateWarning: "SMS_489660721"
|
||||||
|
|
||||||
#配置日志
|
#配置日志
|
||||||
logs:
|
logs:
|
||||||
business: business.log #业务日志路径:如果不写日志,则不配置或配置为空
|
business: business.log #业务日志路径:如果不写日志,则不配置或配置为空
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@ package mixrepos
|
||||||
import "context"
|
import "context"
|
||||||
|
|
||||||
type SmsMixRepo interface {
|
type SmsMixRepo interface {
|
||||||
Send(ctx context.Context, phoneNumbers []string, params map[string]string) error
|
Send(ctx context.Context, phoneNumbers []string, templateCode string, params map[string]string) error
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ func (this *VoucherBiz) WarningSend(ctx context.Context, product *bo.ProductBo,
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(mobileList) > 0 {
|
if len(mobileList) > 0 {
|
||||||
return this.SmsMixRepo.Send(ctx, mobileList, buildTemplateParams(product, wxResp))
|
return this.SmsMixRepo.Send(ctx, mobileList, this.bc.AliYunSms.TemplateWarning, buildTemplateParams(product, wxResp))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -919,11 +919,11 @@ type AliYunSms struct {
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
AccessKeyId string `protobuf:"bytes,1,opt,name=accessKeyId,proto3" json:"accessKeyId,omitempty"`
|
AccessKeyId string `protobuf:"bytes,1,opt,name=accessKeyId,proto3" json:"accessKeyId,omitempty"`
|
||||||
AccessKeySecret string `protobuf:"bytes,2,opt,name=accessKeySecret,proto3" json:"accessKeySecret,omitempty"`
|
AccessKeySecret string `protobuf:"bytes,2,opt,name=accessKeySecret,proto3" json:"accessKeySecret,omitempty"`
|
||||||
Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
|
Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
|
||||||
SignName string `protobuf:"bytes,4,opt,name=signName,proto3" json:"signName,omitempty"`
|
SignName string `protobuf:"bytes,4,opt,name=signName,proto3" json:"signName,omitempty"`
|
||||||
TemplateSendCode string `protobuf:"bytes,5,opt,name=templateSendCode,proto3" json:"templateSendCode,omitempty"`
|
TemplateWarning string `protobuf:"bytes,5,opt,name=templateWarning,proto3" json:"templateWarning,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AliYunSms) Reset() {
|
func (x *AliYunSms) Reset() {
|
||||||
|
|
@ -986,9 +986,9 @@ func (x *AliYunSms) GetSignName() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AliYunSms) GetTemplateSendCode() string {
|
func (x *AliYunSms) GetTemplateWarning() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.TemplateSendCode
|
return x.TemplateWarning
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
@ -1686,7 +1686,7 @@ var file_conf_conf_proto_rawDesc = []byte{
|
||||||
0x61, 0x69, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e,
|
0x61, 0x69, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e,
|
||||||
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
|
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
|
||||||
0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x77, 0x61, 0x69, 0x74, 0x54, 0x69,
|
0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x77, 0x61, 0x69, 0x74, 0x54, 0x69,
|
||||||
0x6d, 0x65, 0x22, 0xbb, 0x01, 0x0a, 0x09, 0x41, 0x6c, 0x69, 0x59, 0x75, 0x6e, 0x53, 0x6d, 0x73,
|
0x6d, 0x65, 0x22, 0xb9, 0x01, 0x0a, 0x09, 0x41, 0x6c, 0x69, 0x59, 0x75, 0x6e, 0x53, 0x6d, 0x73,
|
||||||
0x12, 0x20, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x18,
|
0x12, 0x20, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x18,
|
||||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79,
|
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79,
|
||||||
0x49, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x53,
|
0x49, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x53,
|
||||||
|
|
@ -1695,15 +1695,15 @@ var file_conf_conf_proto_rawDesc = []byte{
|
||||||
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||||
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x69, 0x67, 0x6e,
|
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x69, 0x67, 0x6e,
|
||||||
0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x69, 0x67, 0x6e,
|
0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x69, 0x67, 0x6e,
|
||||||
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
|
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
|
||||||
0x53, 0x65, 0x6e, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10,
|
0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74,
|
||||||
0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x6f, 0x64, 0x65,
|
0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x22, 0x3a,
|
||||||
0x22, 0x3a, 0x0a, 0x04, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x75, 0x73, 0x69,
|
0x0a, 0x04, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65,
|
||||||
0x6e, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x75, 0x73, 0x69,
|
0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65,
|
||||||
0x6e, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x02,
|
0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x17, 0x5a, 0x15,
|
0x28, 0x09, 0x52, 0x06, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x17, 0x5a, 0x15, 0x76, 0x6f,
|
||||||
0x76, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x63, 0x70, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x66,
|
0x75, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x63, 0x70, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x3b, 0x63,
|
||||||
0x3b, 0x63, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ message AliYunSms {
|
||||||
string accessKeySecret = 2;
|
string accessKeySecret = 2;
|
||||||
string endpoint = 3;
|
string endpoint = 3;
|
||||||
string signName = 4;
|
string signName = 4;
|
||||||
string templateSendCode = 5;
|
string templateWarning = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Logs {
|
message Logs {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type SmsMixRepoImpl struct {
|
type SmsMixRepoImpl struct {
|
||||||
bc *conf.Bootstrap
|
|
||||||
smsService sms.Service
|
smsService sms.Service
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,9 +27,9 @@ func NewSmsMixRepoImpl(bc *conf.Bootstrap) (mixrepos.SmsMixRepo, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &SmsMixRepoImpl{bc: bc, smsService: smsService}, nil
|
return &SmsMixRepoImpl{smsService: smsService}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SmsMixRepoImpl) Send(ctx context.Context, phoneNumbers []string, params map[string]string) error {
|
func (s *SmsMixRepoImpl) Send(ctx context.Context, phoneNumbers []string, templateCode string, params map[string]string) error {
|
||||||
return s.smsService.SendSMS(ctx, phoneNumbers, s.bc.AliYunSms.TemplateSendCode, params)
|
return s.smsService.SendSMS(ctx, phoneNumbers, templateCode, params)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,13 +45,19 @@ func TestSendSMS(t *testing.T) {
|
||||||
|
|
||||||
func TestWarningSend(t *testing.T) {
|
func TestWarningSend(t *testing.T) {
|
||||||
|
|
||||||
warningPersonStr := `[{"tag": "CMB", "name": "李子铭", "mobile": "18666173766"}, {"tag": "LSXD", "name": "赵晋琪", "mobile": "13474987525"}]`
|
//warningPersonStr := `[{"tag": "CMB", "name": "李子铭", "mobile": "18666173766"}, {"tag": "LSXD", "name": "赵晋琪", "mobile": "13474987525"}]`
|
||||||
|
warningPersonStr := `[{"tag": "CMB", "name": "李子铭", "mobile": "18666173766"}, {"tag": "LSXD", "name": "刘子峰", "mobile": "18900966383"}]`
|
||||||
var warningPerson []do.WarningPerson
|
var warningPerson []do.WarningPerson
|
||||||
if err := json.Unmarshal([]byte(warningPersonStr), &warningPerson); err != nil {
|
if err := json.Unmarshal([]byte(warningPersonStr), &warningPerson); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var mobileList []string
|
||||||
|
for _, person := range warningPerson {
|
||||||
|
mobileList = append(mobileList, person.Mobile)
|
||||||
|
}
|
||||||
|
|
||||||
req := &do.WxResp{
|
req := &do.WxResp{
|
||||||
Amount: 2,
|
Amount: 2,
|
||||||
AllBudget: 70010,
|
AllBudget: 70010,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue