作者 yangfu

审核短信通知修改

... ... @@ -11,6 +11,8 @@ import (
type AuditCompanyCommand struct {
// 企业id
CompanyId int64 `cname:"企业id" json:"companyId" valid:"Required"`
// 手机号
Phone string `cname:"手机号" json:"phone" valid:"Required"`
// 审核状态
Status int `cname:"审核状态" json:"status" valid:"Required"`
// 备注
... ...
... ... @@ -8,6 +8,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/background/company/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/sms_serve"
)
// 企业
... ... @@ -54,10 +55,18 @@ func (companyService *CompanyService) AuditCompany(cmd *command.AuditCompanyComm
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
smsServe := sms_serve.NewHttplibHttplibSmsServe()
if cmd.Status == domain.CompanyAuthenticated {
var tmpPhone []rune = []rune(cmd.Phone)
for i := 0; i < 4; i++ {
tmpPhone[i+3] = rune('*')
}
err = smsServe.SendNoticeSms(cmd.Phone, 5007040, map[string]interface{}{"phone": string(tmpPhone)})
} else if cmd.Status == domain.CompanyUnauthenticated {
err = smsServe.SendNoticeSms(cmd.Phone, 5006964, map[string]interface{}{"reason": cmd.Remark})
}
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return struct{}{}, nil
}
... ...
... ... @@ -64,7 +64,7 @@ func (smsServe HttplibSmsServe) SendSms(phone string) error {
}
//SendSms 公共短信验证码服务 发送验证码
func (smsServe HttplibSmsServe) SendNoticeSms(phone string, tplId int, tplValues []string) error {
func (smsServe HttplibSmsServe) SendNoticeSms(phone string, tplId int, tplValues map[string]interface{}) error {
url := smsServe.baseUrL + "/service/sendNoticeSms"
method := "post"
req := smsServe.CreateRequest(url, method)
... ...
... ... @@ -4,10 +4,11 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/background/company/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/background/company/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/background/company/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers"
)
type CompanyController struct {
baseController
controllers.BaseController
}
// func (controller *CompanyController) CreateCompany() {
... ... @@ -51,7 +52,7 @@ func (controller *CompanyController) SearchCompany() {
listCompanyQuery := &query.ListCompanyQuery{}
controller.Unmarshal(listCompanyQuery)
cnt, data, err := companyService.ListCompany(listCompanyQuery)
controller.returnPageListData(cnt, data, err, listCompanyQuery.PageNumber)
controller.ReturnPageListData(cnt, data, err, listCompanyQuery.PageNumber)
}
func (controller *CompanyController) AuditCompany() {
... ...