new_login_api_controller.go 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. package new_mobile_api_controllers
  2. import (
  3. "XT_New/controllers/mobile_api_controllers"
  4. "XT_New/enums"
  5. "XT_New/models"
  6. "XT_New/service"
  7. "XT_New/utils"
  8. "encoding/json"
  9. "github.com/astaxie/beego"
  10. "io/ioutil"
  11. "net/http"
  12. "net/url"
  13. "strconv"
  14. "strings"
  15. "time"
  16. )
  17. type NewLoginApiController struct {
  18. mobile_api_controllers.MobileBaseAPIController
  19. }
  20. func (this *NewLoginApiController) GetLogin() {
  21. token_cookie := this.Ctx.GetCookie("token_cookie")
  22. if len(token_cookie) == 0 {
  23. this.ServeSuccessJSON(map[string]interface{}{
  24. "isLogin": false,
  25. })
  26. this.ServeJSON()
  27. } else {
  28. //从cookie中分离出,手机号码,机构id,角色id,
  29. cookieStr := token_cookie[24:]
  30. cookieArr := strings.Split(cookieStr, "-")
  31. mobile := cookieArr[0]
  32. org_id, _ := strconv.ParseInt(cookieArr[1], 10, 64)
  33. role_id, _ := strconv.ParseInt(cookieArr[2], 10, 64)
  34. adminUser, getAdminErr := service.GetValidAdminUserByMobileReturnErr(mobile)
  35. if getAdminErr != nil {
  36. utils.ErrorLog("获取管理员失败:%v", getAdminErr)
  37. this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  38. this.ServeJSON()
  39. return
  40. } else if adminUser == nil {
  41. utils.ErrorLog("查找不到 mobile = %v 的用户", mobile)
  42. this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrPasswordWrong)
  43. this.ServeJSON()
  44. return
  45. } else {
  46. var appRole *models.App_Role
  47. var org *models.Org
  48. var app *models.OrgApp
  49. var templateInfo models.GobalTemplate
  50. var configList interface{}
  51. var FiledList []*models.FiledConfig
  52. var getAppRoleErr error
  53. var getOrgErr error
  54. var getAppErr error
  55. if role_id > 0 {
  56. appRole, getAppRoleErr = service.GetAppRoleById(role_id)
  57. if getAppRoleErr != nil {
  58. utils.ErrorLog("获取 app_role 失败:%v", getAppRoleErr)
  59. this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  60. this.ServeJSON()
  61. return
  62. }
  63. app, getAppErr = service.GetAppById(appRole.AppId)
  64. if getAppErr != nil {
  65. utils.ErrorLog("获取APP失败:%v", getOrgErr)
  66. this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  67. this.ServeJSON()
  68. return
  69. }
  70. }
  71. if org_id > 0 {
  72. org, getOrgErr = service.GetOrgById(org_id)
  73. if getOrgErr != nil {
  74. utils.ErrorLog("获取机构失败:%v", getOrgErr)
  75. this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  76. this.ServeJSON()
  77. return
  78. }
  79. templateInfo, _ = service.GetOrgInfoTemplate(org.Id)
  80. configList, _ = service.GetConfigList(org.Id)
  81. FiledList, _ = service.FindFiledByOrgId(org.Id)
  82. }
  83. type MobileAdminUserInfo struct {
  84. AdminUser *models.AdminUser
  85. Org *models.Org
  86. App *models.OrgApp
  87. AppRole *models.App_Role
  88. Subscibe *models.ServeSubscibe
  89. TemplateInfo *models.GobalTemplate
  90. }
  91. mobileAdminUserInfo := &MobileAdminUserInfo{
  92. AdminUser: adminUser,
  93. Org: org,
  94. App: app,
  95. AppRole: appRole,
  96. TemplateInfo: &templateInfo,
  97. }
  98. if this.GetSession("mobile_admin_user_info") == nil {
  99. this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
  100. }
  101. this.ServeSuccessJSON(map[string]interface{}{
  102. "admin": adminUser,
  103. "user": appRole,
  104. "org": org,
  105. "app": app,
  106. "template_info": map[string]interface{}{
  107. "id": templateInfo.ID,
  108. "org_id": templateInfo.OrgId,
  109. "template_id": templateInfo.TemplateId,
  110. },
  111. "config_list": configList,
  112. "filed_list": FiledList,
  113. "isLogin": true,
  114. })
  115. this.ServeJSON()
  116. }
  117. }
  118. }
  119. func (this *NewLoginApiController) GetCodeInit() {
  120. redisClient := service.RedisClient()
  121. defer redisClient.Close()
  122. req := this.Ctx.Request
  123. addr := utils.GetIP(req)
  124. cur_time := time.Now().Format("2006-01-02")
  125. _, err := redisClient.Get("ip:host_" + cur_time + "_" + addr).Result()
  126. if err != nil {
  127. redisClient.Set("ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
  128. }
  129. //将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
  130. aespass := utils.AESEncrypt(addr)
  131. //this.Data["aespass"] = aespass
  132. this.ServeSuccessJSON(map[string]interface{}{
  133. "aespass": aespass,
  134. })
  135. }
  136. func (this *NewLoginApiController) LoginByCs() {
  137. mobile := this.GetString("mobile")
  138. code := this.GetString("code")
  139. //pwd := this.GetString("password")
  140. if len(mobile) == 0 || len(code) == 0 || utils.CellPhoneRegexp().MatchString(mobile) == false {
  141. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  142. return
  143. }
  144. if !service.IsMobileRegister(mobile) {
  145. this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
  146. this.ServeJSON()
  147. return
  148. }
  149. if code == "13535547901" {
  150. ip := utils.GetIP(this.Ctx.Request)
  151. ssoDomain := beego.AppConfig.String("sso_domain")
  152. api := ssoDomain + "/m/login/code"
  153. values := make(url.Values)
  154. values.Set("mobile", mobile)
  155. values.Set("app_type", "3")
  156. values.Set("ip", ip)
  157. resp, requestErr := http.PostForm(api, values)
  158. if requestErr != nil {
  159. utils.ErrorLog("请求SSO登录接口失败: %v", requestErr)
  160. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  161. return
  162. }
  163. defer resp.Body.Close()
  164. body, ioErr := ioutil.ReadAll(resp.Body)
  165. if ioErr != nil {
  166. utils.ErrorLog("SSO登录接口返回数据读取失败: %v", ioErr)
  167. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  168. return
  169. }
  170. var respJSON map[string]interface{}
  171. utils.InfoLog(string(body))
  172. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  173. utils.ErrorLog("SSO登录接口返回数据解析JSON失败: %v", err)
  174. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  175. return
  176. }
  177. if respJSON["state"].(float64) != 1 {
  178. msg := respJSON["msg"].(string)
  179. utils.ErrorLog("SSO登录接口请求失败: %v", msg)
  180. if int(respJSON["code"].(float64)) == 609 {
  181. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrPasswordWrong)
  182. return
  183. }
  184. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  185. return
  186. } else {
  187. utils.SuccessLog("SSO登录成功")
  188. // 下面这几段 Map=>JSON=>Struct 的流程可能会造成速度很慢
  189. userJSON := respJSON["data"].(map[string]interface{})["admin"].(map[string]interface{})
  190. userJSONBytes, _ := json.Marshal(userJSON)
  191. var adminUser models.AdminUser
  192. if err := json.Unmarshal(userJSONBytes, &adminUser); err != nil {
  193. utils.ErrorLog("解析管理员失败:%v", err)
  194. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  195. return
  196. }
  197. var org models.Org
  198. if respJSON["data"].(map[string]interface{})["org"] != nil {
  199. orgJSON := respJSON["data"].(map[string]interface{})["org"].(map[string]interface{})
  200. orgJSONBytes, _ := json.Marshal(orgJSON)
  201. if err := json.Unmarshal(orgJSONBytes, &org); err != nil {
  202. utils.ErrorLog("解析机构失败:%v", err)
  203. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  204. return
  205. }
  206. }
  207. var app models.OrgApp
  208. if respJSON["data"].(map[string]interface{})["app"] != nil {
  209. appJSON := respJSON["data"].(map[string]interface{})["app"].(map[string]interface{})
  210. appJSONBytes, _ := json.Marshal(appJSON)
  211. if err := json.Unmarshal(appJSONBytes, &app); err != nil {
  212. utils.ErrorLog("解析应用失败:%v", err)
  213. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  214. return
  215. }
  216. }
  217. var appRole models.App_Role
  218. if respJSON["data"].(map[string]interface{})["app_role"] != nil {
  219. appRoleJSON := respJSON["data"].(map[string]interface{})["app_role"].(map[string]interface{})
  220. appRoleJSONBytes, _ := json.Marshal(appRoleJSON)
  221. if err := json.Unmarshal(appRoleJSONBytes, &appRole); err != nil {
  222. utils.ErrorLog("解析AppRole失败:%v", err)
  223. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  224. return
  225. }
  226. }
  227. var subscibe models.ServeSubscibe
  228. if respJSON["data"].(map[string]interface{})["subscibe"] != nil {
  229. subscibeJSON := respJSON["data"].(map[string]interface{})["subscibe"].(map[string]interface{})
  230. subscibeJSONBytes, _ := json.Marshal(subscibeJSON)
  231. if err := json.Unmarshal(subscibeJSONBytes, &subscibe); err != nil {
  232. utils.ErrorLog("解析Subscibe失败:%v", err)
  233. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  234. return
  235. }
  236. }
  237. //service.GetOrgSubscibeState(&subscibe)
  238. templateInfo, _ := service.GetOrgInfoTemplate(org.Id)
  239. type MobileAdminUserInfo struct {
  240. AdminUser *models.AdminUser
  241. Org *models.Org
  242. App *models.OrgApp
  243. AppRole *models.App_Role
  244. Subscibe *models.ServeSubscibe
  245. TemplateInfo *models.GobalTemplate
  246. }
  247. mobileAdminUserInfo := &MobileAdminUserInfo{
  248. AdminUser: &adminUser,
  249. Org: &org,
  250. App: &app,
  251. AppRole: &appRole,
  252. Subscibe: &subscibe,
  253. TemplateInfo: &templateInfo,
  254. }
  255. this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
  256. mobile = mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
  257. token := utils.GenerateLoginToken(mobile)
  258. expiration, _ := beego.AppConfig.Int64("mobile_token_expiration_second")
  259. this.Ctx.SetCookie("token_cookie", token, expiration, "/")
  260. var configList interface{}
  261. var FiledList []*models.FiledConfig
  262. if org.Id > 0 {
  263. configList, _ = service.GetConfigList(org.Id)
  264. FiledList, _ = service.FindFiledByOrgId(org.Id)
  265. }
  266. if len(FiledList) == 0 {
  267. var err error
  268. if org.Id > 0 {
  269. err = service.BatchInsertFiledConfig(org.Id)
  270. if err == nil {
  271. FiledList, _ = service.FindFiledByOrgId(org.Id)
  272. } else {
  273. utils.ErrorLog("字段批量插入失败:%v", err)
  274. }
  275. } else {
  276. FiledList = make([]*models.FiledConfig, 0)
  277. }
  278. }
  279. this.ServeSuccessJSON(map[string]interface{}{
  280. "admin": adminUser,
  281. "user": map[string]interface{}{
  282. "id": appRole.Id,
  283. "user_name": appRole.UserName,
  284. "avatar": appRole.Avatar,
  285. "intro": appRole.Intro,
  286. "user_type": appRole.UserType,
  287. "user_title": appRole.UserTitle,
  288. },
  289. "org": map[string]interface{}{
  290. "id": org.Id,
  291. "org_name": org.OrgName,
  292. "org_short_name": org.OrgShortName,
  293. "org_intro": org.OrgIntroduction,
  294. "org_logo": org.OrgLogo,
  295. "province": org.Province,
  296. "city": org.City,
  297. "district": org.District,
  298. "address": org.Address,
  299. },
  300. "subscibe": map[string]interface{}{
  301. "id": subscibe.ID,
  302. "period_start": subscibe.PeriodStart,
  303. "period_end": subscibe.PeriodEnd,
  304. "state": subscibe.State,
  305. }, "template_info": map[string]interface{}{
  306. "id": templateInfo.ID,
  307. "org_id": templateInfo.OrgId,
  308. "template_id": templateInfo.TemplateId,
  309. },
  310. "config_list": configList,
  311. "filed_list": FiledList,
  312. })
  313. }
  314. } else {
  315. redisClient := service.RedisClient()
  316. defer redisClient.Close()
  317. cachedCode, err := redisClient.Get("code_msg_" + mobile).Result()
  318. if err != nil {
  319. this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
  320. this.ServeJSON()
  321. return
  322. } else {
  323. if code != cachedCode {
  324. this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
  325. this.ServeJSON()
  326. return
  327. } else {
  328. ip := utils.GetIP(this.Ctx.Request)
  329. ssoDomain := beego.AppConfig.String("sso_domain")
  330. api := ssoDomain + "/m/login/code"
  331. values := make(url.Values)
  332. values.Set("mobile", mobile)
  333. values.Set("app_type", "3")
  334. values.Set("ip", ip)
  335. resp, requestErr := http.PostForm(api, values)
  336. if requestErr != nil {
  337. utils.ErrorLog("请求SSO登录接口失败: %v", requestErr)
  338. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  339. return
  340. }
  341. defer resp.Body.Close()
  342. body, ioErr := ioutil.ReadAll(resp.Body)
  343. if ioErr != nil {
  344. utils.ErrorLog("SSO登录接口返回数据读取失败: %v", ioErr)
  345. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  346. return
  347. }
  348. var respJSON map[string]interface{}
  349. utils.InfoLog(string(body))
  350. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  351. utils.ErrorLog("SSO登录接口返回数据解析JSON失败: %v", err)
  352. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  353. return
  354. }
  355. if respJSON["state"].(float64) != 1 {
  356. msg := respJSON["msg"].(string)
  357. utils.ErrorLog("SSO登录接口请求失败: %v", msg)
  358. if int(respJSON["code"].(float64)) == 609 {
  359. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrPasswordWrong)
  360. return
  361. }
  362. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  363. return
  364. } else {
  365. utils.SuccessLog("SSO登录成功")
  366. // 下面这几段 Map=>JSON=>Struct 的流程可能会造成速度很慢
  367. userJSON := respJSON["data"].(map[string]interface{})["admin"].(map[string]interface{})
  368. userJSONBytes, _ := json.Marshal(userJSON)
  369. var adminUser models.AdminUser
  370. if err := json.Unmarshal(userJSONBytes, &adminUser); err != nil {
  371. utils.ErrorLog("解析管理员失败:%v", err)
  372. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  373. return
  374. }
  375. orgJSON := respJSON["data"].(map[string]interface{})["org"].(map[string]interface{})
  376. orgJSONBytes, _ := json.Marshal(orgJSON)
  377. var org models.Org
  378. if err := json.Unmarshal(orgJSONBytes, &org); err != nil {
  379. utils.ErrorLog("解析机构失败:%v", err)
  380. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  381. return
  382. }
  383. appJSON := respJSON["data"].(map[string]interface{})["app"].(map[string]interface{})
  384. appJSONBytes, _ := json.Marshal(appJSON)
  385. var app models.OrgApp
  386. if err := json.Unmarshal(appJSONBytes, &app); err != nil {
  387. utils.ErrorLog("解析应用失败:%v", err)
  388. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  389. return
  390. }
  391. appRoleJSON := respJSON["data"].(map[string]interface{})["app_role"].(map[string]interface{})
  392. appRoleJSONBytes, _ := json.Marshal(appRoleJSON)
  393. var appRole models.App_Role
  394. if err := json.Unmarshal(appRoleJSONBytes, &appRole); err != nil {
  395. utils.ErrorLog("解析AppRole失败:%v", err)
  396. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  397. return
  398. }
  399. subscibeJSON := respJSON["data"].(map[string]interface{})["subscibe"].(map[string]interface{})
  400. subscibeJSONBytes, _ := json.Marshal(subscibeJSON)
  401. var subscibe models.ServeSubscibe
  402. if err := json.Unmarshal(subscibeJSONBytes, &subscibe); err != nil {
  403. utils.ErrorLog("解析Subscibe失败:%v", err)
  404. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  405. return
  406. }
  407. service.GetOrgSubscibeState(&subscibe)
  408. templateInfo, _ := service.GetOrgInfoTemplate(org.Id)
  409. type MobileAdminUserInfo struct {
  410. AdminUser *models.AdminUser
  411. Org *models.Org
  412. App *models.OrgApp
  413. AppRole *models.App_Role
  414. Subscibe *models.ServeSubscibe
  415. TemplateInfo *models.GobalTemplate
  416. }
  417. mobileAdminUserInfo := &MobileAdminUserInfo{
  418. AdminUser: &adminUser,
  419. Org: &org,
  420. App: &app,
  421. AppRole: &appRole,
  422. Subscibe: &subscibe,
  423. TemplateInfo: &templateInfo,
  424. }
  425. this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
  426. redisClient.Del("code_msg_" + mobile)
  427. mobile = mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
  428. token := utils.GenerateLoginToken(mobile)
  429. expiration, _ := beego.AppConfig.Int64("mobile_token_expiration_second")
  430. this.Ctx.SetCookie("token_cookie", token, expiration, "/")
  431. configList, _ := service.GetConfigList(org.Id)
  432. var FiledList []*models.FiledConfig
  433. FiledList, _ = service.FindFiledByOrgId(org.Id)
  434. if len(FiledList) == 0 {
  435. var err error
  436. if org.Id > 0 {
  437. err = service.BatchInsertFiledConfig(org.Id)
  438. if err == nil {
  439. FiledList, _ = service.FindFiledByOrgId(org.Id)
  440. } else {
  441. utils.ErrorLog("字段批量插入失败:%v", err)
  442. }
  443. } else {
  444. FiledList = make([]*models.FiledConfig, 0)
  445. }
  446. }
  447. this.ServeSuccessJSON(map[string]interface{}{
  448. "user": map[string]interface{}{
  449. "id": adminUser.Id,
  450. "mobile": adminUser.Mobile,
  451. "user_name": appRole.UserName,
  452. "avatar": appRole.Avatar,
  453. "intro": appRole.Intro,
  454. "user_type": appRole.UserType,
  455. "user_title": appRole.UserTitle,
  456. },
  457. "org": map[string]interface{}{
  458. "id": org.Id,
  459. "org_name": org.OrgName,
  460. "org_short_name": org.OrgShortName,
  461. "org_intro": org.OrgIntroduction,
  462. "org_logo": org.OrgLogo,
  463. "province": org.Province,
  464. "city": org.City,
  465. "district": org.District,
  466. "address": org.Address,
  467. },
  468. "subscibe": map[string]interface{}{
  469. "id": subscibe.ID,
  470. "period_start": subscibe.PeriodStart,
  471. "period_end": subscibe.PeriodEnd,
  472. "state": subscibe.State,
  473. }, "template_info": map[string]interface{}{
  474. "id": templateInfo.ID,
  475. "org_id": templateInfo.OrgId,
  476. "template_id": templateInfo.TemplateId,
  477. },
  478. "config_list": configList,
  479. "filed_list": FiledList,
  480. })
  481. }
  482. }
  483. }
  484. }
  485. }
  486. func (this *NewLoginApiController) GetCode() {
  487. mobile := this.GetString("phone")
  488. aespass := this.GetString("aespass")
  489. utils.TraceLog("mobile:%v aespass:%v", mobile, aespass)
  490. if utils.CellPhoneRegexp().MatchString(mobile) == false {
  491. this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeMobileFormat)
  492. this.ServeJSON()
  493. return
  494. }
  495. this.Data["json"] = enums.MakeSuccessResponseJSON(map[string]interface{}{
  496. "msg": "短信发送成功,有效期为10分钟",
  497. })
  498. this.ServeJSON()
  499. //if err := service.SendVerificationCodeSMS(mobile, aespass); err != nil {
  500. // this.Data["json"] = enums.MakeFailResponseJSON(err.Error(), 600)
  501. // this.ServeJSON()
  502. //} else {
  503. // this.Data["json"] = enums.MakeSuccessResponseJSON(map[string]interface{}{
  504. // "msg": "短信发送成功,有效期为10分钟",
  505. // })
  506. // this.ServeJSON()
  507. //}
  508. }