fix(internal): 优化手机号空格处理
- 在添加商户时,对手机号进行空格处理,避免因前后空格导致的验证错误 - 移除了 addController.go 和 addService.go 中的多余空行,提高代码可读性
This commit is contained in:
@@ -198,7 +198,6 @@ func (c *AddController) AddMerchant() {
|
||||
verifyPassword := strings.TrimSpace(c.GetString("verifyPassword"))
|
||||
merchantStatus := strings.TrimSpace(c.GetString("merchantStatus"))
|
||||
remark := strings.TrimSpace(c.GetString("remark"))
|
||||
|
||||
se := new(service.AddService)
|
||||
keyDataJSON := se.AddMerchant(merchantName, phone, loginPassword, verifyPassword, merchantStatus, remark)
|
||||
c.GenerateJSON(keyDataJSON)
|
||||
|
||||
@@ -605,7 +605,6 @@ func (c *AddService) AddAgent(agentName, agentPhone, agentLoginPassword,
|
||||
}
|
||||
func (c *AddService) AddMerchant(merchantName, phone, loginPassword,
|
||||
verifyPassword, merchantStatus, remark string) *datas.KeyDataJSON {
|
||||
|
||||
keyDataJSON := new(datas.KeyDataJSON)
|
||||
keyDataJSON.Code = 200
|
||||
if merchantName == "" {
|
||||
@@ -620,7 +619,7 @@ func (c *AddService) AddMerchant(merchantName, phone, loginPassword,
|
||||
keyDataJSON.Code = -1
|
||||
keyDataJSON.Key = "#merchant-phone-error"
|
||||
keyDataJSON.Msg = "手机号为空"
|
||||
} else if merchant.IsExistByMerchantPhone(phone) {
|
||||
} else if merchant.IsExistByMerchantPhone(strings.TrimSpace(phone)) {
|
||||
keyDataJSON.Code = -1
|
||||
keyDataJSON.Key = "#merchant-phone-error"
|
||||
keyDataJSON.Msg = "该手机号已经注册"
|
||||
|
||||
Reference in New Issue
Block a user