更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -17,7 +17,6 @@ import (
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// PlatformSMSController 短信配置(yz_system_sms),兼容旧前端 /platform/sms/* 接口
|
||||
type PlatformSMSController struct {
|
||||
beego.Controller
|
||||
}
|
||||
@@ -32,8 +31,6 @@ func (c *PlatformSMSController) jsonErr(httpStatus, bizCode int, msg string) {
|
||||
_ = c.ServeJSON()
|
||||
}
|
||||
|
||||
// GetSmsInfo GET /platform/sms/info
|
||||
// 返回 data[0],字段兼容 backend_url/api_key 与 backendUrl/apiKey(沿用旧前端)
|
||||
func (c *PlatformSMSController) GetSmsInfo() {
|
||||
if _, err := c.platformClaims(); err != nil {
|
||||
code := identity.Status(err)
|
||||
@@ -62,8 +59,6 @@ type smsEditPayload struct {
|
||||
APIKey string `json:"api_key"`
|
||||
}
|
||||
|
||||
// EditSmsInfo POST /platform/sms/editinfo
|
||||
// 将旧前端的 backendUrl/apiKey 落到 yz_platform_normal_setting 表中
|
||||
func (c *PlatformSMSController) EditSmsInfo() {
|
||||
if _, err := c.platformClaims(); err != nil {
|
||||
code := identity.Status(err)
|
||||
@@ -160,8 +155,6 @@ type smsTestPayload struct {
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
// SendTestSms POST /platform/sms/sendtest
|
||||
// 调用短信网关入队接口:{backendUrl}/api/v1/business/outbound-tasks,header: X-Api-Key
|
||||
func (c *PlatformSMSController) SendTestSms() {
|
||||
if _, err := c.platformClaims(); err != nil {
|
||||
code := identity.Status(err)
|
||||
@@ -204,7 +197,6 @@ func (c *PlatformSMSController) SendTestSms() {
|
||||
apiKey = strings.TrimSpace(p.APIKey)
|
||||
}
|
||||
|
||||
// 兜底:body 未带时从默认配置取
|
||||
if backendURL == "" || apiKey == "" {
|
||||
if backendURL == "" {
|
||||
backendURL = models.GetPlatformSettingValue("sms_custom_url", "")
|
||||
@@ -268,10 +260,8 @@ func (c *PlatformSMSController) SendTestSms() {
|
||||
reportPtr = &bodyStr
|
||||
}
|
||||
|
||||
// 网关 HTTP 2xx:平台侧视为「已受理并成功提交」;与前端 tasklist 中 status=3「发送成功」对齐
|
||||
taskStatus := 3
|
||||
|
||||
// 若网关返回 JSON 且含通用状态字段,则优先映射(便于以后网关回传异步状态)
|
||||
var gw map[string]interface{}
|
||||
if json.Unmarshal(body, &gw) == nil {
|
||||
if v, ok := gw["status"]; ok {
|
||||
@@ -286,10 +276,9 @@ func (c *PlatformSMSController) SendTestSms() {
|
||||
}
|
||||
}
|
||||
|
||||
// 写入本地任务表(用于前端列表/对账)
|
||||
now := time.Now()
|
||||
task := &models.SystemSMSTask{
|
||||
Tid: p.Tid, // 测试可为空
|
||||
Tid: p.Tid,
|
||||
ApiKey: apiKey,
|
||||
Phone: phone,
|
||||
Content: &content,
|
||||
@@ -301,7 +290,6 @@ func (c *PlatformSMSController) SendTestSms() {
|
||||
}
|
||||
taskID, terr := models.Orm.Insert(task)
|
||||
if terr != nil {
|
||||
// 入队已成功,任务写库失败也不影响短信发送,只返回提示
|
||||
c.Data["json"] = map[string]interface{}{
|
||||
"code": 200,
|
||||
"msg": "短信测试任务入队成功(任务写库失败)",
|
||||
@@ -327,7 +315,6 @@ func (c *PlatformSMSController) SendTestSms() {
|
||||
_ = c.ServeJSON()
|
||||
}
|
||||
|
||||
// GetSmsTaskList GET /platform/sms/taskList
|
||||
func (c *PlatformSMSController) GetSmsTaskList() {
|
||||
if _, err := c.platformClaims(); err != nil {
|
||||
code := identity.Status(err)
|
||||
@@ -393,7 +380,6 @@ func (c *PlatformSMSController) GetSmsTaskList() {
|
||||
_ = c.ServeJSON()
|
||||
}
|
||||
|
||||
// EditSmsTask POST /platform/sms/taskEdit/:id
|
||||
func (c *PlatformSMSController) EditSmsTask() {
|
||||
if _, err := c.platformClaims(); err != nil {
|
||||
code := identity.Status(err)
|
||||
@@ -457,7 +443,6 @@ func (c *PlatformSMSController) EditSmsTask() {
|
||||
}
|
||||
|
||||
func randomDigits6() string {
|
||||
// 生成 6 位数字字符串
|
||||
b := make([]byte, 4)
|
||||
if _, err := rand.Read(b); err != nil {
|
||||
return "123456"
|
||||
@@ -470,7 +455,6 @@ func randomDigits6() string {
|
||||
return strconv.Itoa(code)
|
||||
}
|
||||
|
||||
// mapGatewayStatus 将网关侧 status 粗略映射到前端列表:0待发送 1发送中 2失败 3成功
|
||||
func mapGatewayStatus(st int) int {
|
||||
switch st {
|
||||
case 0:
|
||||
@@ -482,7 +466,6 @@ func mapGatewayStatus(st int) int {
|
||||
case 3:
|
||||
return 3
|
||||
default:
|
||||
// 网关枚举未约定时:HTTP 已 2xx,按「已成功提交」显示为发送成功
|
||||
return 3
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user