|
@@ -79,13 +79,14 @@ func (m *Member) PromotionPage(v string) error {
|
|
|
|
|
|
//自动审核通过
|
|
|
func autoAuth(uid, uname, s_avatar, entid, promotion_id string) {
|
|
|
- ent := FindById("enterprise", entid, `{"RegNo":1,"EntName":1,"s_action":1}`)
|
|
|
+ ent := FindById("enterprise", entid, `{"RegNo":1,"EntName":1,"s_action":1,"Nb_email":1}`)
|
|
|
if ent != nil {
|
|
|
s_action := ObjToString((*ent)["s_action"])
|
|
|
if len(s_action) == 2 { //已经认证过
|
|
|
return
|
|
|
}
|
|
|
entName := ObjToString((*ent)["EntName"])
|
|
|
+ email := ObjToString((*ent)["Nb_email"])
|
|
|
t := time.Now().Local().Unix()
|
|
|
doc := &map[string]interface{}{
|
|
|
"i_identificationway": 1,
|
|
@@ -96,11 +97,13 @@ func autoAuth(uid, uname, s_avatar, entid, promotion_id string) {
|
|
|
"s_submitname": uname,
|
|
|
"s_submitid": uid,
|
|
|
"s_enterprisename": entName,
|
|
|
+ "s_enterpriseid": entid,
|
|
|
"i_identificationstatus": 1,
|
|
|
"i_identificationtype": 1,
|
|
|
"s_piccard": "",
|
|
|
"s_pic": "",
|
|
|
"l_submitdate": t,
|
|
|
+ "s_mail": email,
|
|
|
"i_comauthenttype": 3,
|
|
|
"l_auditdate": t,
|
|
|
"s_promotion": promotion_id,
|
|
@@ -114,6 +117,7 @@ func autoAuth(uid, uname, s_avatar, entid, promotion_id string) {
|
|
|
data1["freezeremark"] = ""
|
|
|
data1["s_enterprisename"] = entName
|
|
|
data1["s_enterpriseid"] = entid
|
|
|
+ data1["i_comauthenttype"] = 3
|
|
|
data1["i_identificationway"] = 1 //user表默认=0,审核通过标志=1,审核不通过标志=-1,审核中标志=2
|
|
|
data1["i_identificationtype"] = 1
|
|
|
data1["s_role"] = "9" //权限设为企业管理员
|
|
@@ -784,11 +788,43 @@ func (m *Member) Setpwd() error {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//
|
|
|
+
|
|
|
+//验证输入的邮箱是否是没认证的企业邮箱
|
|
|
+func (m *Member) CheckConMail() error {
|
|
|
+ userId := m.GetSession("userId").(string)
|
|
|
+ var smail = m.GetString("checkmail")
|
|
|
+ var EntName = ""
|
|
|
+ var ac = ""
|
|
|
+ var id = ""
|
|
|
+ var uname = ""
|
|
|
+ var s_avatar = ""
|
|
|
+ pk := "1"
|
|
|
+ r := *FindOne("enterprise", M{"s_submitid": userId, "Nb_email": smail})
|
|
|
+ ac = r["s_action"].(string)
|
|
|
+ if len(r) > 0 && ac == "" {
|
|
|
+ EntName = r["EntName"].(string)
|
|
|
+ uname = m.GetSession("loginName").(string)
|
|
|
+ s_avatar = r["s_avatar"].(string)
|
|
|
+ pk = "2"
|
|
|
+ id = strings.Split(fmt.Sprintf("%s", r["_id"]), `"`)[1]
|
|
|
+ }
|
|
|
+ m.ServeJson(map[string]interface{}{
|
|
|
+ "pk": pk,
|
|
|
+ "EntName": EntName,
|
|
|
+ "id": id,
|
|
|
+ "uname": uname,
|
|
|
+ "s_avatar": s_avatar,
|
|
|
+ })
|
|
|
+ return nil
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
//绑定邮箱
|
|
|
func (m *Member) Bindmail() error {
|
|
|
if m.Is("POST") {
|
|
|
var status string = "y"
|
|
|
- var result, encryMail, isSetPwd string
|
|
|
+ var result, encryMail, isSetPwd, contype string
|
|
|
var count int
|
|
|
flag, _ := m.GetInt("flag")
|
|
|
mail := m.GetString("mail")
|
|
@@ -815,6 +851,16 @@ func (m *Member) Bindmail() error {
|
|
|
}
|
|
|
case 2: //校验验证码
|
|
|
if m.GetString("identCode") == m.GetSession("identCodeValue") {
|
|
|
+ //
|
|
|
+ contype = m.GetString("i_automatic")
|
|
|
+ entid := m.GetString("entid")
|
|
|
+ entname := m.GetString("entname")
|
|
|
+ avatar := m.GetString("avatar")
|
|
|
+ uname := m.GetString("uname")
|
|
|
+ usid := m.GetSession("userId").(string)
|
|
|
+ t := time.Now().Unix()
|
|
|
+ proid := fmt.Sprintf("%s", t)
|
|
|
+ //
|
|
|
m.DelSession("identCodeValue")
|
|
|
updateMap := make(M)
|
|
|
updateMap["s_email"] = mail
|
|
@@ -824,6 +870,30 @@ func (m *Member) Bindmail() error {
|
|
|
}
|
|
|
bol := Update("user", M{"_id": ObjectIdHex(m.GetSession("userId").(string))}, M{"$set": updateMap}, false, false)
|
|
|
if bol {
|
|
|
+ //邮箱绑定认证
|
|
|
+ if contype == "1" {
|
|
|
+ r := *FindById("enterprise", entid, nil)
|
|
|
+ ac := r["s_action"].(string)
|
|
|
+ if len(r) > 0 && ac == "" {
|
|
|
+ autoAuth(usid, uname, avatar, entid, proid)
|
|
|
+ //发系统消息
|
|
|
+ msg := &msg.Msg{
|
|
|
+ Msgtype: 1,
|
|
|
+ Title: "年报邮箱绑定认证",
|
|
|
+ Content: "您好,恭喜您的邮箱绑定并同时认证已经通过!",
|
|
|
+ ReceiveId: usid,
|
|
|
+ }
|
|
|
+ msg.SaveMsg()
|
|
|
+ //更改需求名称
|
|
|
+ Update("demand", M{"s_userid": usid}, M{"$set": M{"s_enterprisename": entname, "s_enterpriseid": entid, "i_identtype": 1}}, false, true)
|
|
|
+ demands := *Find("demand", M{"s_userid": usid}, nil, nil, false, -1, -1)
|
|
|
+ if demands != nil && len(demands) > 0 {
|
|
|
+ Try(func() {
|
|
|
+ elastic.UpdateNewDoc("demand", "demand", MapArrToObjArr(demands)...)
|
|
|
+ }, func(e interface{}) {})
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
UpdateCookieSession(m.Action, m.GetSession("loginType").(string), false, *FindById("user", m.GetSession("userId").(string), nil))
|
|
|
result = "y"
|
|
|
} else {
|
|
@@ -833,7 +903,7 @@ func (m *Member) Bindmail() error {
|
|
|
status = "identCode_error" //验证码错误
|
|
|
}
|
|
|
}
|
|
|
- return m.Write(`{"flag":` + strconv.Itoa(int(flag+1)) + `,"status":"` + status + `","result":"` + result + `","encryMail":"` + encryMail + `","isSetPwd":"` + isSetPwd + `","count":` + strconv.Itoa(count) + `}`)
|
|
|
+ return m.Write(`{"flag":` + strconv.Itoa(int(flag+1)) + `,"status":"` + status + `","result":"` + result + `","encryMail":"` + encryMail + `","isSetPwd":"` + isSetPwd + `","contype":"` + contype + `","count":` + strconv.Itoa(count) + `}`)
|
|
|
} else {
|
|
|
return returnFront(m, "bindmail")
|
|
|
}
|