|
@@ -40,6 +40,7 @@ type Info struct {
|
|
|
applicants xweb.Mapper `xweb:"/applicants"` //删除带报名人信息
|
|
|
exhSignIn xweb.Mapper `xweb:"/exhibition/sign"` //签到码签到
|
|
|
successInfo xweb.Mapper `xweb:"/exhibition/successInfo"` //报名 签到成功后的信息
|
|
|
+ clue xweb.Mapper `xweb:"/portrait/clue"` //画像收集信息
|
|
|
}
|
|
|
|
|
|
var (
|
|
@@ -53,6 +54,69 @@ func init() {
|
|
|
xweb.AddAction(&Info{})
|
|
|
}
|
|
|
|
|
|
+func (i *Info) Clue() {
|
|
|
+ defer qu.Catch()
|
|
|
+ r := func() entity.NewResultSales {
|
|
|
+ infoMap := map[string]interface{}{}
|
|
|
+ if string(i.Body()) == "" {
|
|
|
+ return entity.NewResultSales{Data: nil, Error_msg: Error_msg_1003}
|
|
|
+ }
|
|
|
+ body := xweb.FilterXSS(string(i.Body()))
|
|
|
+ //接收参数
|
|
|
+ _ = json.Unmarshal([]byte(body), &infoMap)
|
|
|
+ if len(infoMap) == 0 {
|
|
|
+ return entity.NewResultSales{Data: nil, Error_msg: Error_msg_1002}
|
|
|
+ }
|
|
|
+ //必填项
|
|
|
+ if infoMap["source"] == nil {
|
|
|
+ return entity.NewResultSales{Data: nil, Error_msg: Error_msg_1002}
|
|
|
+ }
|
|
|
+ //验证
|
|
|
+ phone := qu.ObjToString(infoMap["phone"]) //手机号
|
|
|
+ if !phoneReg.MatchString(phone) {
|
|
|
+ return entity.NewResultSales{Error_code: -1, Error_msg: "手机号格式有误", Data: false}
|
|
|
+ }
|
|
|
+ mail := qu.ObjToString(infoMap["mail"]) //邮箱
|
|
|
+ if mail != "" && !emailReg.MatchString(mail) {
|
|
|
+ return entity.NewResultSales{Error_code: -1, Error_msg: "邮箱格式有误", Data: false}
|
|
|
+ }
|
|
|
+ //获取用户id
|
|
|
+ sessVal := i.Session().GetMultiple()
|
|
|
+ if phone == "" {
|
|
|
+ infoMap["phone"] = sessVal["phone"]
|
|
|
+ }
|
|
|
+ userId := qu.ObjToString(sessVal["userId"])
|
|
|
+ if userId != "" {
|
|
|
+ infoMap["userid"] = userId
|
|
|
+ }
|
|
|
+ mgoUserId := qu.ObjToString(sessVal["mgoUserId"])
|
|
|
+ if mgoUserId != "" {
|
|
|
+ infoMap["mgoUserId"] = mgoUserId
|
|
|
+ }
|
|
|
+ if infoMap["code"] != nil {
|
|
|
+ phoneCode := qu.ObjToString(infoMap["code"])
|
|
|
+ i.Session().Set("sales_MsgCode", phoneCode)
|
|
|
+ }
|
|
|
+ if publishId := qu.ObjToString(infoMap["publish_id"]); publishId != "" {
|
|
|
+ infoMap["publish_id"] = strings.Join(encrypt.DecodeArticleId2ByCheck(publishId), ",")
|
|
|
+ }
|
|
|
+ source := qu.ObjToString(infoMap["source"]) //来源
|
|
|
+ infoMap["createtime"] = time.Now().Unix()
|
|
|
+ infoMap["client"] = i.Header("user-agent")
|
|
|
+ if id := MQFW.Save("saleLeads", infoMap); id != "" {
|
|
|
+ Whether.AfterRetainedCapital(userId)
|
|
|
+ //免费用户留资 获取采购单位画像、企业画像、附件下载的权益(一次)
|
|
|
+ //判断免费用户留资,无需在更改留资情况 已留资将不在留资
|
|
|
+ if PortraitExperience(source) && len(strings.Split(source, "_")) > 2 && Free_users(source, userId) {
|
|
|
+ FreeuserManage(source, userId)
|
|
|
+ }
|
|
|
+ return entity.NewResultSales{Error_code: 1, Error_msg: "", Data: true}
|
|
|
+ }
|
|
|
+ return entity.NewResultSales{Error_code: -1, Error_msg: "保存失败", Data: false}
|
|
|
+ }()
|
|
|
+ i.ServeJson(r)
|
|
|
+}
|
|
|
+
|
|
|
// 签到 报名 成功后的信息
|
|
|
func (i *Info) SuccessInfo() {
|
|
|
defer qu.Catch()
|