Browse Source

删除测试字段

庄逸洲 5 years ago
parent
commit
7004bf113f
2 changed files with 22 additions and 26 deletions
  1. 13 14
      controllers/mobile_regist_controller.go
  2. 9 12
      controllers/verification_code_controller.go

+ 13 - 14
controllers/mobile_regist_controller.go View File

6
 	"SSO/service"
6
 	"SSO/service"
7
 	"SSO/utils"
7
 	"SSO/utils"
8
 	"encoding/json"
8
 	"encoding/json"
9
-	"strings"
10
 	"time"
9
 	"time"
11
 )
10
 )
12
 
11
 
67
 
66
 
68
 	redisClient := service.RedisClient()
67
 	redisClient := service.RedisClient()
69
 	defer redisClient.Close()
68
 	defer redisClient.Close()
70
-	if strings.HasPrefix(mobile, "12") {
71
-		if code != "123456" {
72
-			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeVerificationCodeWrong)
73
-			this.ServeJSON()
74
-			return
75
-		}
69
+	// if strings.HasPrefix(mobile, "12") {
70
+	// 	if code != "123456" {
71
+	// 		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeVerificationCodeWrong)
72
+	// 		this.ServeJSON()
73
+	// 		return
74
+	// 	}
76
 
75
 
77
-	} else {
78
-		cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
79
-		if cache_code != code {
80
-			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeVerificationCodeWrong)
81
-			this.ServeJSON()
82
-			return
83
-		}
76
+	// } else {
77
+	cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
78
+	if cache_code != code {
79
+		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeVerificationCodeWrong)
80
+		this.ServeJSON()
81
+		return
84
 	}
82
 	}
83
+	// }
85
 
84
 
86
 	admin, err := service.RegisterSuperAdmin(mobile, pwd)
85
 	admin, err := service.RegisterSuperAdmin(mobile, pwd)
87
 	if err != nil {
86
 	if err != nil {

+ 9 - 12
controllers/verification_code_controller.go View File

4
 	"SSO/enums"
4
 	"SSO/enums"
5
 	"SSO/service"
5
 	"SSO/service"
6
 	"SSO/utils"
6
 	"SSO/utils"
7
-	"strings"
8
-
9
-	"github.com/astaxie/beego"
10
 )
7
 )
11
 
8
 
12
 type CodeController struct {
9
 type CodeController struct {
54
 		return
51
 		return
55
 	}
52
 	}
56
 
53
 
57
-	if beego.AppConfig.String("runmode") == "dev" {
58
-		if strings.HasPrefix(mobile, "12") {
59
-			this.Data["json"] = enums.MakeSuccessResponseJSON(map[string]interface{}{
60
-				"msg": "短信发送成功,有效期为10分钟",
61
-			})
62
-			this.ServeJSON()
63
-			return
64
-		}
65
-	}
54
+	// if beego.AppConfig.String("runmode") == "dev" {
55
+	// 	if strings.HasPrefix(mobile, "12") {
56
+	// 		this.Data["json"] = enums.MakeSuccessResponseJSON(map[string]interface{}{
57
+	// 			"msg": "短信发送成功,有效期为10分钟",
58
+	// 		})
59
+	// 		this.ServeJSON()
60
+	// 		return
61
+	// 	}
62
+	// }
66
 
63
 
67
 	if err := service.SendVerificationCodeSMS(mobile, aespass); err != nil {
64
 	if err := service.SendVerificationCodeSMS(mobile, aespass); err != nil {
68
 		this.Data["json"] = enums.MakeFailResponseJSON(err.Error(), 600)
65
 		this.Data["json"] = enums.MakeFailResponseJSON(err.Error(), 600)