|
@@ -2,6 +2,7 @@ package controller
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "errors"
|
|
|
"fmt"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"hongze/hongze_yb/controller/response"
|
|
@@ -9,6 +10,9 @@ import (
|
|
|
"hongze/hongze_yb/logic"
|
|
|
"hongze/hongze_yb/models/request"
|
|
|
respond "hongze/hongze_yb/models/response"
|
|
|
+ "hongze/hongze_yb/models/tables/banner_view_history"
|
|
|
+ "hongze/hongze_yb/models/tables/company"
|
|
|
+ "hongze/hongze_yb/models/tables/wx_user"
|
|
|
"hongze/hongze_yb/models/tables/yb_config"
|
|
|
"hongze/hongze_yb/models/tables/yb_resource"
|
|
|
"hongze/hongze_yb/models/tables/yb_suncode_pars"
|
|
@@ -348,3 +352,78 @@ func GetTelAreaList(c *gin.Context) {
|
|
|
}
|
|
|
response.OkData("获取成功", respList, c)
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+// BannerMark banner图埋点
|
|
|
+// @Tags 公共模块
|
|
|
+// @Summary banner图埋点
|
|
|
+// @Description banner图埋点
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @securityDefinitions.basic BasicAuth
|
|
|
+// @Param email query string true "电子邮箱账号"
|
|
|
+// @Accept json
|
|
|
+// @Product json
|
|
|
+// @Success 200 {string} string 获取验证码成功
|
|
|
+// @Failure 400 {string} string 请输入邮箱地址
|
|
|
+// @Router /banner/mark [post]
|
|
|
+func BannerMark(c *gin.Context) {
|
|
|
+ userInfo := user.GetInfoByClaims(c)
|
|
|
+ var req request.BannerMarkReq
|
|
|
+ if err := c.Bind(&req); err != nil {
|
|
|
+ response.Fail("参数有误:"+err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if req.BannerUrl == "" {
|
|
|
+ response.FailMsg("参数有误", "BannerUrl不能为空", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if req.FirstSource <= 0 {
|
|
|
+ response.FailMsg("参数有误", "FirstSource不能为空", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if req.SecondSource <= 0 {
|
|
|
+ response.FailMsg("参数有误", "SecondSource", c)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 联系人信息
|
|
|
+ strInt64 := strconv.FormatUint(userInfo.UserID, 10)
|
|
|
+ id, _ := strconv.Atoi(strInt64)
|
|
|
+ wxUserInfo, err := wx_user.GetByUserId(id)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("GetByUserId:", err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ companyInfo, tmpErr := company.GetByCompanyId(wxUserInfo.CompanyID)
|
|
|
+ if tmpErr != nil {
|
|
|
+ err = tmpErr
|
|
|
+ if tmpErr == utils.ErrNoRow {
|
|
|
+ err = errors.New("找不到该客户")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //新增userViewHistory记录
|
|
|
+ banner_view_history := &banner_view_history.BannerViewHistory{
|
|
|
+ UserID: userInfo.UserID,
|
|
|
+ Mobile: wxUserInfo.Mobile,
|
|
|
+ Email: wxUserInfo.Email,
|
|
|
+ RealName: wxUserInfo.RealName,
|
|
|
+ CompanyName: companyInfo.CompanyName,
|
|
|
+ CreatedTime: time.Now(),
|
|
|
+ LastUpdatedTime: time.Now(),
|
|
|
+ FirstSource: req.FirstSource,
|
|
|
+ SecondSource: req.SecondSource,
|
|
|
+ BannerUrl: req.BannerUrl,
|
|
|
+ }
|
|
|
+ err = banner_view_history.AddBannerViewHistory()
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("AddUserViewHistory err", err.Error())
|
|
|
+ }
|
|
|
+
|
|
|
+ response.Ok("成功", c)
|
|
|
+}
|