Эх сурвалжийг харах

Merge branch 'dev/v4.8.47_ws' of qmx/jy into feature/v4.8.47

wangshan 2 жил өмнө
parent
commit
632abdc67b

+ 1 - 0
src/jfw/front/dataMarket.go

@@ -36,6 +36,7 @@ func (this *DataMarket) CustomExport() {
 		showA = int(uA[len(uA)-1])/10 < common.IntAll(config.Sysconfig["dataMarketShowAB"])
 	}
 	this.T["AB"] = showA
+	this.T["source"] = this.GetString("source")
 	this.Render("/dataMarket/customExport/index.html")
 }
 

+ 331 - 330
src/jfw/front/structedData.go

@@ -1,379 +1,380 @@
 package front
 
 import (
-    "fmt"
-    "jy/src/jfw/config"
-    "jy/src/jfw/jyutil"
-    "log"
-    "strings"
-    "time"
+	"fmt"
+	"jy/src/jfw/config"
+	"jy/src/jfw/jyutil"
+	"log"
+	"strings"
+	"time"
 
-    "app.yhyue.com/moapp/jypkg/public"
+	"app.yhyue.com/moapp/jypkg/public"
 
-    util "app.yhyue.com/moapp/jybase/common"
-    "app.yhyue.com/moapp/jybase/redis"
+	util "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/redis"
 
-    "app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 )
 
 type StructedData struct {
-    *xweb.Action
-    index      xweb.Mapper `xweb:"/front/structed/index"`     //数据结构化首页
-    writeInfo  xweb.Mapper `xweb:"/front/structed/writeinfo"` //信息填写
-    checkUser  xweb.Mapper `xweb:"/front/structed/checkuser"`
-    success    xweb.Mapper `xweb:"/front/structed/success"`    //信息填写成功
-    saveData   xweb.Mapper `xweb:"/front/structed/savedata"`   //数据结构化保存用户
-    getPreview xweb.Mapper `xweb:"/front/structed/getpreview"` //数据结构化预览
-    //dev2.10.10
-    pc_index       xweb.Mapper `xweb:"/front/structed/pc_index.html"`  //pc端结构化数据首页
-    pc_info        xweb.Mapper `xweb:"/front/structed/pc_info.html"`   //pc端结构化数据信息页面
-    freeSamples    xweb.Mapper `xweb:"/front/structed/freeSamples"`    //数据结构化保存免费样例数据
-    verifyCode     xweb.Mapper `xweb:"/front/structed/verifyCode"`     //数据结构化验证邮箱验证码
-    sendMailVerify xweb.Mapper `xweb:"/front/structed/sendMailVerify"` //数据结构化发送邮箱验证码
-    verifyEmail    xweb.Mapper `xweb:"/front/structed/verifyEmail"`    //数据结构化验证邮箱是否验证过
+	*xweb.Action
+	index      xweb.Mapper `xweb:"/front/structed/index"`     //数据结构化首页
+	writeInfo  xweb.Mapper `xweb:"/front/structed/writeinfo"` //信息填写
+	checkUser  xweb.Mapper `xweb:"/front/structed/checkuser"`
+	success    xweb.Mapper `xweb:"/front/structed/success"`    //信息填写成功
+	saveData   xweb.Mapper `xweb:"/front/structed/savedata"`   //数据结构化保存用户
+	getPreview xweb.Mapper `xweb:"/front/structed/getpreview"` //数据结构化预览
+	//dev2.10.10
+	pc_index       xweb.Mapper `xweb:"/front/structed/pc_index.html"`  //pc端结构化数据首页
+	pc_info        xweb.Mapper `xweb:"/front/structed/pc_info.html"`   //pc端结构化数据信息页面
+	freeSamples    xweb.Mapper `xweb:"/front/structed/freeSamples"`    //数据结构化保存免费样例数据
+	verifyCode     xweb.Mapper `xweb:"/front/structed/verifyCode"`     //数据结构化验证邮箱验证码
+	sendMailVerify xweb.Mapper `xweb:"/front/structed/sendMailVerify"` //数据结构化发送邮箱验证码
+	verifyEmail    xweb.Mapper `xweb:"/front/structed/verifyEmail"`    //数据结构化验证邮箱是否验证过
 }
 
 func init() {
-    xweb.AddAction(&StructedData{})
+	xweb.AddAction(&StructedData{})
 }
 
-//验证邮箱的正确性
+// 验证邮箱的正确性
 func (t *StructedData) VerifyEmail() {
-    defer util.Catch()
-    msg := "请求方式有误"
-    status := false
-    if t.Method() == "POST" {
-        userId := util.ObjToString(t.GetSession("userId"))
-        email := t.GetString("email")
-        msg = "参数有误"
-        if email != "" {
-            msg = "未登录"
-            if userId != "" {
-                emails := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
-                    "user_mail":    email,
-                    "user_id":      userId,
-                    "product_type": "历史数据",
-                }, "user_mail", "")
-                //是否是绑定邮箱或者是数据导出邮箱  验证过的邮箱
-                if (emails != nil && util.ObjToString((*emails)["user_mail"]) != "") || (t.GetSession("s_myemail") != nil && email == t.GetSession("s_myemail").(string)) || (t.GetSession("SMVerifySucess") != nil && t.GetSession("SMVerifySucess").(bool) && email == t.GetSession("DataSMVerifyEmail")) {
-                    status = true
-                    msg = "此邮箱已被验证"
-                    t.SetSession("SMVerifySucess", true)
-                } else {
-                    msg = "未被验证"
-                }
-            }
-        }
-    }
+	defer util.Catch()
+	msg := "请求方式有误"
+	status := false
+	if t.Method() == "POST" {
+		userId := util.ObjToString(t.GetSession("userId"))
+		email := t.GetString("email")
+		msg = "参数有误"
+		if email != "" {
+			msg = "未登录"
+			if userId != "" {
+				emails := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
+					"user_mail":    email,
+					"user_id":      userId,
+					"product_type": "历史数据",
+				}, "user_mail", "")
+				//是否是绑定邮箱或者是数据导出邮箱  验证过的邮箱
+				if (emails != nil && util.ObjToString((*emails)["user_mail"]) != "") || (t.GetSession("s_myemail") != nil && email == t.GetSession("s_myemail").(string)) || (t.GetSession("SMVerifySucess") != nil && t.GetSession("SMVerifySucess").(bool) && email == t.GetSession("DataSMVerifyEmail")) {
+					status = true
+					msg = "此邮箱已被验证"
+					t.SetSession("SMVerifySucess", true)
+				} else {
+					msg = "未被验证"
+				}
+			}
+		}
+	}
 
-    t.ServeJson(map[string]interface{}{
-        "msg":    msg,
-        "status": status,
-    })
+	t.ServeJson(map[string]interface{}{
+		"msg":    msg,
+		"status": status,
+	})
 }
 
-//验证 验证码的正确性
+// 验证 验证码的正确性
 func (t *StructedData) VerifyCode() {
-    defer util.Catch()
-    msg := "请求方式有误"
-    status := false
-    if t.Method() == "POST" {
-        userId := util.ObjToString(t.GetSession("userId"))
-        msg = "未登录"
-        if userId != "" {
-            s_email := t.GetString("s_email")       //邮箱
-            verifyCode := t.GetString("verifyCode") //验证码
-            VerifyEmail := util.ObjToString(t.GetSession("DataSMVerifyEmail"))
-            if verifyCode != "" && s_email != "" && VerifyEmail != "" {
-                if s_email == VerifyEmail {
-                    msg = "验证码正确"
-                    status = true
-                    SMVerifySucess := t.GetSession("SMVerifySucess")
-                    //需验证邮箱
-                    if SMVerifySucess != nil && !SMVerifySucess.(bool) {
-                        //验证码
-                        verifyStr := t.GetSession("DataSMVerify")
-                        //是否超时
-                        lastSendDEVerify := util.Int64All(t.GetSession("CreatSMVerifyTime"))
-                        timeSpaceing := lastSendDEVerify - time.Now().Unix() + 60*5
-                        if lastSendDEVerify == 0 || timeSpaceing < 0 {
-                            msg = "验证码超时"
-                            status = false
-                        } else if verifyStr != verifyCode {
-                            msg = "验证码有误"
-                            status = false
-                        } else {
-                            t.SetSession("SMVerifySucess", true)
-                        }
-                    }
-                } else {
-                    msg = "验证码有误"
-                    status = false
-                }
-            }
-        }
-    }
-    t.ServeJson(map[string]interface{}{
-        "msg":    msg,
-        "status": status,
-    })
+	defer util.Catch()
+	msg := "请求方式有误"
+	status := false
+	if t.Method() == "POST" {
+		userId := util.ObjToString(t.GetSession("userId"))
+		msg = "未登录"
+		if userId != "" {
+			s_email := t.GetString("s_email")       //邮箱
+			verifyCode := t.GetString("verifyCode") //验证码
+			VerifyEmail := util.ObjToString(t.GetSession("DataSMVerifyEmail"))
+			if verifyCode != "" && s_email != "" && VerifyEmail != "" {
+				if s_email == VerifyEmail {
+					msg = "验证码正确"
+					status = true
+					SMVerifySucess := t.GetSession("SMVerifySucess")
+					//需验证邮箱
+					if SMVerifySucess != nil && !SMVerifySucess.(bool) {
+						//验证码
+						verifyStr := t.GetSession("DataSMVerify")
+						//是否超时
+						lastSendDEVerify := util.Int64All(t.GetSession("CreatSMVerifyTime"))
+						timeSpaceing := lastSendDEVerify - time.Now().Unix() + 60*5
+						if lastSendDEVerify == 0 || timeSpaceing < 0 {
+							msg = "验证码超时"
+							status = false
+						} else if verifyStr != verifyCode {
+							msg = "验证码有误"
+							status = false
+						} else {
+							t.SetSession("SMVerifySucess", true)
+						}
+					}
+				} else {
+					msg = "验证码有误"
+					status = false
+				}
+			}
+		}
+	}
+	t.ServeJson(map[string]interface{}{
+		"msg":    msg,
+		"status": status,
+	})
 }
 
-//保存免费样例数据
+// 保存免费样例数据
 func (t *StructedData) FreeSamples() error {
-    defer util.Catch()
-    msg := "请求方式有误"
-    status := false
-    if t.Method() == "POST" {
-        userId := util.ObjToString(t.GetSession("userId"))
-        if userId != "" {
-            name := t.GetString("name")                      //联系人
-            phone_num := t.GetString("phone_num")            //手机号
-            s_email := t.GetString("s_email")                //邮箱
-            SMVerifySucess := t.GetSession("SMVerifySucess") //邮箱是否验证成功
-            if name != "" && phone_num != "" && s_email != "" && SMVerifySucess != nil && SMVerifySucess.(bool) {
-                count := public.Mysql.Count("structed_data", map[string]interface{}{
-                    "name":  name,
-                    "phone": phone_num,
-                    "email": s_email,
-                    "type":  1,
-                })
-                if count >= 1 {
-                    msg = "用户信息已存在"
-                    status = true
-                } else {
-                    source := t.GetString("source")
-                    insertMap := map[string]interface{}{
-                        "name":        name,
-                        "phone":       phone_num,
-                        "email":       s_email,
-                        "submit_time": time.Now().Unix(),
-                        "status":      0,
-                        "type":        1, //用户来源,0:联系客服,1:免费样例,2:自选购买
-                    }
-                    if source != "" {
-                        insertMap["source"] = source
-                    }
-                    stu := public.Mysql.Insert("structed_data", insertMap)
-                    if stu == 0 {
-                        msg = "数据库操作异常"
-                        status = false
-                    } else {
-                        //保存成功后 删除验证成功记录 和 发送验证码时间
-                        t.DelSession("SMVerifySucess")
-                        t.DelSession("CreatSMVerifyTime")
-                        t.DelSession("DataSMVerifyEmail")
-                        msg = "保存成功"
-                        status = true
-                        go public.SendStructedDataByEmail(s_email, config.GmailAuth, config.Sysconfig, config.Seoconfig)
-                    }
-                }
-            } else {
-                msg = "缺少参数"
-                status = false
-            }
-        }
-    }
-    t.ServeJson(map[string]interface{}{
-        "msg":    msg,
-        "status": status,
-    })
-    return nil
+	defer util.Catch()
+	msg := "请求方式有误"
+	status := false
+	if t.Method() == "POST" {
+		userId := util.ObjToString(t.GetSession("userId"))
+		if userId != "" {
+			name := t.GetString("name")                      //联系人
+			phone_num := t.GetString("phone_num")            //手机号
+			s_email := t.GetString("s_email")                //邮箱
+			SMVerifySucess := t.GetSession("SMVerifySucess") //邮箱是否验证成功
+			if name != "" && phone_num != "" && s_email != "" && SMVerifySucess != nil && SMVerifySucess.(bool) {
+				count := public.Mysql.Count("structed_data", map[string]interface{}{
+					"name":  name,
+					"phone": phone_num,
+					"email": s_email,
+					"type":  1,
+				})
+				if count >= 1 {
+					msg = "用户信息已存在"
+					status = true
+				} else {
+					source := t.GetString("source")
+					insertMap := map[string]interface{}{
+						"name":        name,
+						"phone":       phone_num,
+						"email":       s_email,
+						"submit_time": time.Now().Unix(),
+						"status":      0,
+						"type":        1, //用户来源,0:联系客服,1:免费样例,2:自选购买
+					}
+					if source != "" {
+						insertMap["source"] = source
+					}
+					stu := public.Mysql.Insert("structed_data", insertMap)
+					if stu == 0 {
+						msg = "数据库操作异常"
+						status = false
+					} else {
+						//保存成功后 删除验证成功记录 和 发送验证码时间
+						t.DelSession("SMVerifySucess")
+						t.DelSession("CreatSMVerifyTime")
+						t.DelSession("DataSMVerifyEmail")
+						msg = "保存成功"
+						status = true
+						go public.SendStructedDataByEmail(s_email, config.GmailAuth, config.Sysconfig, config.Seoconfig)
+					}
+				}
+			} else {
+				msg = "缺少参数"
+				status = false
+			}
+		}
+	}
+	t.ServeJson(map[string]interface{}{
+		"msg":    msg,
+		"status": status,
+	})
+	return nil
 }
 
-//必须登录
+// 必须登录
 func (t *StructedData) Pc_info() error {
-    defer util.Catch()
-    userId := util.ObjToString(t.GetSession("userId"))
-    if userId != "" {
-        //删除验证成功记录 和 发送验证码时间 邮箱
-        t.DelSession("SMVerifySucess")
-        t.DelSession("CreatSMVerifyTime")
-        t.DelSession("DataSMVerifyEmail")
-        nums := jyutil.Compatible.Select(userId, `{"s_phone":1,"s_myemail":1}`)
-        if nums == nil {
-            return t.Redirect("/front/aboutus.html")
-        }
-        if _, ok := (*nums)["s_phone"]; ok {
-            t.T["phone_num"] = (*nums)["s_phone"].(string)
-        }
-        if _, ok := (*nums)["s_myemail"]; ok {
-            t.T["s_myemail"] = (*nums)["s_myemail"].(string)
-            //验证是否是绑定的邮箱
-            t.SetSession("s_myemail", (*nums)["s_myemail"].(string))
-            t.SetSession("DataSMVerifyEmail", (*nums)["s_myemail"].(string))
-            t.SetSession("SMVerifySucess", true)
-        }
-        return t.Render("/structuredata/pc/info.html", &t.T)
-    } else {
-        return t.Redirect("/front/aboutus.html")
-    }
+	defer util.Catch()
+	userId := util.ObjToString(t.GetSession("userId"))
+	if userId != "" {
+		//删除验证成功记录 和 发送验证码时间 邮箱
+		t.DelSession("SMVerifySucess")
+		t.DelSession("CreatSMVerifyTime")
+		t.DelSession("DataSMVerifyEmail")
+		nums := jyutil.Compatible.Select(userId, `{"s_phone":1,"s_myemail":1}`)
+		if nums == nil {
+			return t.Redirect("/front/aboutus.html")
+		}
+		if _, ok := (*nums)["s_phone"]; ok {
+			t.T["phone_num"] = (*nums)["s_phone"].(string)
+		}
+		if _, ok := (*nums)["s_myemail"]; ok {
+			t.T["s_myemail"] = (*nums)["s_myemail"].(string)
+			//验证是否是绑定的邮箱
+			t.SetSession("s_myemail", (*nums)["s_myemail"].(string))
+			t.SetSession("DataSMVerifyEmail", (*nums)["s_myemail"].(string))
+			t.SetSession("SMVerifySucess", true)
+		}
+		return t.Render("/structuredata/pc/info.html", &t.T)
+	} else {
+		return t.Redirect("/front/aboutus.html")
+	}
 }
 
-//可以不登录
+// 可以不登录
 func (t *StructedData) Pc_index() error {
-    t.T["source"] = "wx_sy_dh_4"
-    return t.Render("/structuredata/pc/index.html", &t.T)
+	//t.T["source"] = "wx_sy_dh_4"
+	//return t.Render("/structuredata/pc/index.html", &t.T)
+	return t.Redirect("/front/dataMarket/customExport?source=wx_sy_dh_4")
 }
 func (t *StructedData) Index() error {
-    t.T["source"] = "wx_sy_dh_4"
-    return t.Render("/structuredata/mobile/marketing_wx.html", &t.T)
+	t.T["source"] = "wx_sy_dh_4"
+	return t.Render("/structuredata/mobile/marketing_wx.html", &t.T)
 }
 
-//信息填写
+// 信息填写
 func (t *StructedData) WriteInfo() error {
-    return t.Render("/structuredata/mobile/write_info.html")
+	return t.Render("/structuredata/mobile/write_info.html")
 }
 
-//结构化数据预览
+// 结构化数据预览
 func (t *StructedData) GetPreview() error {
-    return t.Render("/structuredata/mobile/preview.html")
+	return t.Render("/structuredata/mobile/preview.html")
 }
 func (t *StructedData) Success() error {
-    //删除验证成功记录 和 发送验证码时间 邮箱
-    t.DelSession("SMVerifySucess")
-    t.DelSession("CreatSMVerifyTime")
-    t.DelSession("DataSMVerifyEmail")
-    return t.Render("/structuredata/mobile/write_result.html")
+	//删除验证成功记录 和 发送验证码时间 邮箱
+	t.DelSession("SMVerifySucess")
+	t.DelSession("CreatSMVerifyTime")
+	t.DelSession("DataSMVerifyEmail")
+	return t.Render("/structuredata/mobile/write_result.html")
 }
 func (t *StructedData) CheckUser() error {
-    userId := util.ObjToString(t.GetSession("userId"))
-    if userId != "" {
-        //删除验证成功记录 和 发送验证码时间 邮箱
-        t.DelSession("SMVerifySucess")
-        t.DelSession("CreatSMVerifyTime")
-        t.DelSession("DataSMVerifyEmail")
-        nums := jyutil.Compatible.Select( userId,`{"s_phone":1,"s_phone":1}`)
-        if nums==nil {
-            return t.Redirect("/swordfish/about?source=open_infocontent&o=-130")
-        }
-        if _, ok := (*nums)["s_phone"]; ok {
-            t.T["phone_num"] = (*nums)["s_phone"].(string)
-        }
-        if _, ok := (*nums)["s_myemail"]; ok {
-            t.T["s_myemail"] = (*nums)["s_phone"].(string)
-            //验证是否是绑定的邮箱
-            t.SetSession("s_myemail", (*nums)["s_myemail"].(string))
-            t.SetSession("DataSMVerifyEmail", (*nums)["s_myemail"].(string))
-            t.SetSession("SMVerifySucess", true)
-        }
-        return t.Render("/structuredata/mobile/write_infor_wx.html", &t.T)
-    } else {
-        return t.Redirect("/swordfish/about?source=open_infocontent&o=-130")
-    }
+	userId := util.ObjToString(t.GetSession("userId"))
+	if userId != "" {
+		//删除验证成功记录 和 发送验证码时间 邮箱
+		t.DelSession("SMVerifySucess")
+		t.DelSession("CreatSMVerifyTime")
+		t.DelSession("DataSMVerifyEmail")
+		nums := jyutil.Compatible.Select(userId, `{"s_phone":1,"s_phone":1}`)
+		if nums == nil {
+			return t.Redirect("/swordfish/about?source=open_infocontent&o=-130")
+		}
+		if _, ok := (*nums)["s_phone"]; ok {
+			t.T["phone_num"] = (*nums)["s_phone"].(string)
+		}
+		if _, ok := (*nums)["s_myemail"]; ok {
+			t.T["s_myemail"] = (*nums)["s_phone"].(string)
+			//验证是否是绑定的邮箱
+			t.SetSession("s_myemail", (*nums)["s_myemail"].(string))
+			t.SetSession("DataSMVerifyEmail", (*nums)["s_myemail"].(string))
+			t.SetSession("SMVerifySucess", true)
+		}
+		return t.Render("/structuredata/mobile/write_infor_wx.html", &t.T)
+	} else {
+		return t.Redirect("/swordfish/about?source=open_infocontent&o=-130")
+	}
 
 }
 
 func (t *StructedData) SaveData() {
-    name := t.GetString("name")
-    phone_num := t.GetString("phone_num")
-    source := t.GetString("source")
-    if name != "" && phone_num != "" && isPhone(phone_num) {
-        count := public.Mysql.Count("structed_data", map[string]interface{}{
-            "name":  name,
-            "phone": phone_num,
-            "type":  0,
-        })
-        if count >= 1 {
-            t.ServeJson(map[string]interface{}{
-                "error_code": "0",
-                "data": map[string]interface{}{
-                    "msg":    "用户信息已存在",
-                    "status": true,
-                },
-            })
-        } else {
-            insertMap := map[string]interface{}{
-                "name":        name,
-                "phone":       phone_num,
-                "submit_time": time.Now().Unix(),
-                "status":      0,
-                "type":        0, //用户来源,0:联系客服,1:免费样例,2:自选购买
-            }
-            if source != "" {
-                insertMap["source"] = source
-            }
-            stu := public.Mysql.Insert("structed_data", insertMap)
-            if stu == 0 {
-                t.ServeJson(map[string]interface{}{
-                    "error_code": "1",
-                    "data": map[string]interface{}{
-                        "msg":    "数据库操作异常",
-                        "status": false,
-                    },
-                })
-            } else {
-                t.ServeJson(map[string]interface{}{
-                    "error_code": "0",
-                    "data": map[string]interface{}{
-                        "msg":    "保存成功",
-                        "status": true,
-                    },
-                })
-            }
-        }
-    }
+	name := t.GetString("name")
+	phone_num := t.GetString("phone_num")
+	source := t.GetString("source")
+	if name != "" && phone_num != "" && isPhone(phone_num) {
+		count := public.Mysql.Count("structed_data", map[string]interface{}{
+			"name":  name,
+			"phone": phone_num,
+			"type":  0,
+		})
+		if count >= 1 {
+			t.ServeJson(map[string]interface{}{
+				"error_code": "0",
+				"data": map[string]interface{}{
+					"msg":    "用户信息已存在",
+					"status": true,
+				},
+			})
+		} else {
+			insertMap := map[string]interface{}{
+				"name":        name,
+				"phone":       phone_num,
+				"submit_time": time.Now().Unix(),
+				"status":      0,
+				"type":        0, //用户来源,0:联系客服,1:免费样例,2:自选购买
+			}
+			if source != "" {
+				insertMap["source"] = source
+			}
+			stu := public.Mysql.Insert("structed_data", insertMap)
+			if stu == 0 {
+				t.ServeJson(map[string]interface{}{
+					"error_code": "1",
+					"data": map[string]interface{}{
+						"msg":    "数据库操作异常",
+						"status": false,
+					},
+				})
+			} else {
+				t.ServeJson(map[string]interface{}{
+					"error_code": "0",
+					"data": map[string]interface{}{
+						"msg":    "保存成功",
+						"status": true,
+					},
+				})
+			}
+		}
+	}
 }
 
-//发送邮件
+// 发送邮件
 func (t *StructedData) SendMailVerify() {
-    defer util.Catch()
-    if t.Method() == "POST" {
-        userId := util.ObjToString(t.GetSession("userId"))
-        if userId != "" {
-            email := t.GetString("email")
-            if isEmail(email) {
-                lastSendDEVerify := util.Int64All(t.GetSession("CreatSMVerifyTime"))
-                timeSpaceing := lastSendDEVerify - time.Now().Unix() + 60*5
-                incurKey := fmt.Sprintf("SendSMEmail_%s_%d", t.GetSession("userId"), time.Now().Day())
-                if lastSendDEVerify == 0 || timeSpaceing < 0 {
-                    //每日限制10次
-                    times := util.IntAll(redis.Get("other", incurKey))
-                    if times < 10 {
-                        if times == 0 {
-                            redis.Put("other", incurKey, 1, 24*60*60)
-                        } else {
-                            redis.Incr("other", incurKey)
-                        }
-                        //生成随机数
-                        verifyStr := strings.ToUpper(util.GetComplexRandom(6, 3, 3))
-                        t.SetSession("SMVerifySucess", false)
-                        t.SetSession("DataSMVerify", verifyStr)
-                        t.SetSession("CreatSMVerifyTime", time.Now().Unix())
-                        t.SetSession("DataSMVerifyEmail", email)
-                        log.Println("====================", verifyStr, "====================", t.GetSession("CreatSMVerifyTime"), "====================")
-                        //发送邮箱验证码
-                        go public.SendMailIdentCode(email, verifyStr, config.GmailAuth)
-                        t.T["success"] = true
-                        t.T["errCode"] = 5
-                        t.T["errMsg"] = "已发送邮箱验证码"
-                    } else {
-                        t.T["success"] = false
-                        t.T["errCode"] = 3
-                        t.T["time"] = timeSpaceing
-                        t.T["errMsg"] = "验证码发送次数已达到今日上限"
-                    }
+	defer util.Catch()
+	if t.Method() == "POST" {
+		userId := util.ObjToString(t.GetSession("userId"))
+		if userId != "" {
+			email := t.GetString("email")
+			if isEmail(email) {
+				lastSendDEVerify := util.Int64All(t.GetSession("CreatSMVerifyTime"))
+				timeSpaceing := lastSendDEVerify - time.Now().Unix() + 60*5
+				incurKey := fmt.Sprintf("SendSMEmail_%s_%d", t.GetSession("userId"), time.Now().Day())
+				if lastSendDEVerify == 0 || timeSpaceing < 0 {
+					//每日限制10次
+					times := util.IntAll(redis.Get("other", incurKey))
+					if times < 10 {
+						if times == 0 {
+							redis.Put("other", incurKey, 1, 24*60*60)
+						} else {
+							redis.Incr("other", incurKey)
+						}
+						//生成随机数
+						verifyStr := strings.ToUpper(util.GetComplexRandom(6, 3, 3))
+						t.SetSession("SMVerifySucess", false)
+						t.SetSession("DataSMVerify", verifyStr)
+						t.SetSession("CreatSMVerifyTime", time.Now().Unix())
+						t.SetSession("DataSMVerifyEmail", email)
+						log.Println("====================", verifyStr, "====================", t.GetSession("CreatSMVerifyTime"), "====================")
+						//发送邮箱验证码
+						go public.SendMailIdentCode(email, verifyStr, config.GmailAuth)
+						t.T["success"] = true
+						t.T["errCode"] = 5
+						t.T["errMsg"] = "已发送邮箱验证码"
+					} else {
+						t.T["success"] = false
+						t.T["errCode"] = 3
+						t.T["time"] = timeSpaceing
+						t.T["errMsg"] = "验证码发送次数已达到今日上限"
+					}
 
-                } else {
-                    t.T["success"] = false
-                    t.T["errCode"] = 2
-                    t.T["time"] = timeSpaceing
-                    t.T["errMsg"] = "已发送,5分钟后再尝试"
-                }
-            } else {
-                t.T["success"] = false
-                t.T["errCode"] = 1
-                t.T["errMsg"] = "邮箱格式不正确"
-            }
-        } else {
-            t.T["success"] = false
-            t.T["errCode"] = 7
-            t.T["errMsg"] = "未登录"
-        }
-    } else {
-        t.T["success"] = false
-        t.T["errCode"] = 6
-        t.T["errMsg"] = "请求方式有误"
-    }
-    t.ServeJson(&t.T)
+				} else {
+					t.T["success"] = false
+					t.T["errCode"] = 2
+					t.T["time"] = timeSpaceing
+					t.T["errMsg"] = "已发送,5分钟后再尝试"
+				}
+			} else {
+				t.T["success"] = false
+				t.T["errCode"] = 1
+				t.T["errMsg"] = "邮箱格式不正确"
+			}
+		} else {
+			t.T["success"] = false
+			t.T["errCode"] = 7
+			t.T["errMsg"] = "未登录"
+		}
+	} else {
+		t.T["success"] = false
+		t.T["errCode"] = 6
+		t.T["errMsg"] = "请求方式有误"
+	}
+	t.ServeJson(&t.T)
 }