Ver código fonte

后台分享的研选报告添加token验证

xingzai 2 anos atrás
pai
commit
4b712bbc49

+ 156 - 24
controllers/article.go

@@ -33,6 +33,10 @@ type ArticleCommonController struct {
 	BaseCommonController
 }
 
+type ArticleControllerMobile struct {
+	BaseAuthMobileController
+}
+
 // @Title 获取报告详情
 // @Description 获取报告详情接口
 // @Param   ArticleId   query   int  true       "报告ID"
@@ -536,12 +540,20 @@ func (this *ArticleController) InterviewApply() {
 // @Param   ArticleIdMd5   query   int  true       "报告ID"
 // @Success 200 {object} models.ArticleDetailResp
 // @router /look/detail [get]
-func (this *ArticleCommonController) Detail() {
+func (this *ArticleControllerMobile) DetailMd5() {
 	br := new(models.BaseResponse).Init()
 	defer func() {
 		this.Data["json"] = br
 		this.ServeJSON()
 	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+	uid := user.UserId
 
 	articleIdMd5 := this.GetString("ArticleIdMd5")
 	if articleIdMd5 == "" {
@@ -556,32 +568,152 @@ func (this *ArticleCommonController) Detail() {
 		br.ErrMsg = "获取信息失败,Err:" + err.Error()
 		return
 	}
+	articleId := detail.ArticleId
 	detail.Body = html.UnescapeString(detail.Body)
-	//detail.Abstract = html.UnescapeString(detail.Abstract)
-	sellerList, err := models.GetSellerList(detail.ArticleId)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取销售数据失败,Err:" + err.Error() + ";articleId" + strconv.Itoa(detail.ArticleId)
-		return
+
+	hasPermission := 2
+	//`description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,4:潜在客户,未提交过申请,5:潜在客户,已提交过申请"`
+	if user.CompanyId > 1 {
+		companyPermission, err := models.GetCompanyPermission(user.CompanyId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取公司权限失败,Err:" + err.Error()
+			return
+		}
+		detail.Body = html.UnescapeString(detail.Body)
+		detail.Body = strings.Replace(detail.Body, "<p data-f-id=\"pbf\" style=\"text-align: center; font-size: 14px; margin-top: 30px; opacity: 0.65; font-family: sans-serif;\">Powered by <a href=\"https://www.froala.com/wysiwyg-editor?pb=1\" title=\"Froala Editor\">Froala Editor</a></p>", "", -1)
+		detail.Body = strings.Replace(detail.Body, "pre", "div", -1)
+		detail.Abstract, _ = services.GetReportContentTextSubNew(detail.Abstract)
+		if companyPermission == "" {
+			hasPermission = 2
+		} else {
+			var articlePermissionPermissionName string
+			if detail.CategoryId > 0 {
+				articlePermission, err := models.GetArticlePermission(detail.CategoryId)
+				if err != nil {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "获取报告权限失败,Err:" + err.Error() + articleIdMd5
+					return
+				}
+				if articlePermission == nil {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "报告权限不存在,Err:" + articleIdMd5
+					return
+				}
+				articlePermissionPermissionName = articlePermission.PermissionName
+			} else {
+				articlePermissionPermissionName = detail.CategoryName
+			}
+			var hasPersion bool
+			slice := strings.Split(articlePermissionPermissionName, ",")
+			for _, v := range slice {
+				if strings.Contains(companyPermission, v) {
+					hasPersion = true
+				}
+			}
+			userType, _, err := services.GetUserType(user.CompanyId)
+			if err != nil {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
+				return
+			}
+			if userType == 1 && strings.Contains(detail.CategoryName, "研选") {
+				hasPersion = false
+			}
+			if detail.IsReport == 1 {
+				detailCategory, err := models.GetdetailByCategoryIdSando(detail.CategoryId)
+				if err != nil && err.Error() != utils.ErrNoRow() {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "获取信息失败,Err:" + err.Error() + "categoryID 不存在:" + strconv.Itoa(detail.CategoryId)
+					return
+				}
+				permissionStr, err := models.GetCompanyPermissionByUser(user.CompanyId)
+				if err != nil {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+					return
+				}
+				if detailCategory != nil {
+					if detailCategory.PermissionType == 1 {
+						if !strings.Contains(permissionStr, detailCategory.ChartPermissionName+"(主观)") {
+							hasPersion = false
+						}
+					} else if detailCategory.PermissionType == 2 {
+						if !strings.Contains(permissionStr, detailCategory.ChartPermissionName+"(客观)") {
+							hasPersion = false
+						}
+					}
+				}
+			}
+			if hasPersion {
+				hasPermission = 1
+				historyRecord := new(models.CygxArticleHistoryRecord)
+				historyRecord.UserId = uid
+				historyRecord.ArticleId = articleId
+				historyRecord.CreateTime = time.Now()
+				historyRecord.Mobile = user.Mobile
+				historyRecord.Email = user.Email
+				historyRecord.CompanyId = user.CompanyId
+				historyRecord.CompanyName = user.CompanyName
+				recordCount, _ := models.GetNoAddStoptimeArticleCount(uid, articleId)
+				if recordCount == 0 {
+					go models.AddCygxArticleHistoryRecord(historyRecord)
+				} else {
+					detailNew, err := models.GetNewArticleHistoryRecord(uid, articleId)
+					if err != nil {
+						br.Msg = "获取信息失败"
+						br.ErrMsg = "获取信息失败,Err:" + err.Error()
+						return
+					}
+					if detailNew.StopTime > 0 {
+						go models.AddCygxArticleHistoryRecord(historyRecord)
+					}
+				}
+				//30分钟之内阅读同一篇文章不错二次推送
+				key := "CYGX_ARTICLE_READ" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid)
+				if !utils.Rc.IsExist(key) {
+					go services.ArticleUserRemind(user, detail, 1)
+					utils.Rc.Put(key, 1, 30*time.Second)
+				}
+			}
+			if hasPermission == 1 {
+				key := "CYGX_ARTICLE_" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid)
+				if !utils.Rc.IsExist(key) {
+					//新增浏览记录
+					record := new(models.CygxArticleViewRecord)
+					record.UserId = uid
+					record.ArticleId = articleId
+					record.CreateTime = time.Now()
+					record.Mobile = user.Mobile
+					record.Email = user.Email
+					record.CompanyId = user.CompanyId
+					record.CompanyName = user.CompanyName
+					go models.AddCygxArticleViewRecord(record)
+					utils.Rc.Put(key, 1, 5*time.Second)
+					models.ModifyReportLastViewTime(uid)
+				}
+			}
+		}
+		//作者头像
+		if detail.DepartmentId > 0 {
+			departmentDetail, err := models.GetArticleDepartmentDateilById(detail.DepartmentId)
+			if err == nil {
+				detail.DepartmentImgUrl = departmentDetail.ImgUrl
+			}
+		}
 	}
-	//if detail.ArticleId > 1000000 {
-	//	var hrefRegexp = regexp.MustCompile("[0-9]\\d*")
-	//	match := hrefRegexp.FindAllString(detail.SellerAndMobile, -1)
-	//	if match != nil {
-	//		for _, v := range match {
-	//			sellerAndMobile := &models.SellerRep{
-	//				SellerMobile: v,
-	//				SellerName:   strings.Replace(detail.SellerAndMobile, v, "", -1),
-	//			}
-	//			sellerList = append(sellerList, sellerAndMobile)
-	//		}
-	//	}
-	//}
 	detail.SellerAndMobile = "" //业务需要强制处理为空
-	resp.HasPermission = 1
-	detail.Abstract, _ = services.GetReportContentTextSub(detail.Abstract)
-	detail.SellerList = sellerList
-	resp.Detail = detail
+	resp.HasPermission = hasPermission
+	if hasPermission == 1 {
+		detail.Abstract, _ = services.GetReportContentTextSub(detail.Abstract)
+		resp.Detail = detail
+	} else {
+		if user.Mobile != "" {
+			resp.Mobile = user.Mobile
+		} else {
+			resp.Mobile = user.Email
+		}
+	}
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"

+ 137 - 0
controllers/base_auth_mobile.go

@@ -0,0 +1,137 @@
+package controllers
+
+import (
+	"encoding/json"
+	"fmt"
+	beego "github.com/beego/beego/v2/adapter"
+	"hongze/hongze_cygx/services"
+	"net/http"
+	"net/url"
+	"strconv"
+
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+
+	"github.com/rdlucklib/rdluck_tools/log"
+)
+
+func init() {
+	if utils.RunMode == "release" {
+		logDir := `/data/rdlucklog/hongze_cygx`
+		apiLog = log.Init("20060102.api", logDir)
+	} else {
+		apiLog = log.Init("20060102.api")
+	}
+}
+
+type BaseAuthMobileController struct {
+	beego.Controller
+	User  *models.WxUserItem
+	Token string
+}
+
+func (this *BaseAuthMobileController) Prepare() {
+	fmt.Println("enter prepare")
+	method := this.Ctx.Input.Method()
+	uri := this.Ctx.Input.URI()
+	fmt.Println("Url:", uri)
+	if method != "HEAD" {
+		if method == "POST" || method == "GET" {
+			authorization := this.Ctx.Input.Header("Authorization")
+			if authorization == "" {
+				authorization = this.GetString("Authorization")
+			}
+			this.Token = authorization
+			if authorization == "" {
+				this.JSON(models.BaseResponse{Ret: 408, Msg: "请重新授权!", ErrMsg: "请重新授权:Token is empty or account is empty"}, false, false)
+				this.StopRun()
+				return
+			}
+			session, err := models.GetCygxSessionMobile(authorization)
+			if err != nil {
+				if err.Error() == utils.ErrNoRow() {
+					this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "Token 信息已变更:Token: " + authorization}, false, false)
+					this.StopRun()
+					return
+				}
+				this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "获取用户信息异常,Eerr:" + err.Error()}, false, false)
+				this.StopRun()
+				return
+			}
+			if session == nil {
+				this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "sesson is empty "}, false, false)
+				this.StopRun()
+				return
+			}
+			//wxUser, err := models.GetWxUserItemByUserId(session.UserId)
+			wxUser, err := models.GetWxUserAouthByMobile(session.Mobile)
+			if err != nil && err != services.ERR_USER_NOT_BIND {
+				if err.Error() == utils.ErrNoRow() {
+					this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "获取信息失败 " + strconv.Itoa(session.UserId)}, false, false)
+					this.StopRun()
+					return
+				}
+				this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "获取wx_user信息异常,Eerr:" + err.Error()}, false, false)
+				this.StopRun()
+				return
+			}
+			if wxUser == nil {
+				this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "admin is empty "}, false, false)
+				this.StopRun()
+				return
+			}
+			this.User = wxUser
+		} else {
+			this.JSON(models.BaseResponse{Ret: 408, Msg: "请求异常,请联系客服!", ErrMsg: "POST之外的请求,暂不支持"}, false, false)
+			this.StopRun()
+			return
+		}
+	}
+}
+
+func (c *BaseAuthMobileController) ServeJSON(encoding ...bool) {
+	var (
+		hasIndent   = false
+		hasEncoding = false
+	)
+	if beego.BConfig.RunMode == beego.PROD {
+		hasIndent = false
+	}
+	if len(encoding) > 0 && encoding[0] == true {
+		hasEncoding = true
+	}
+	if c.Data["json"] == nil {
+		go utils.SendEmail(utils.APPNAME+" "+utils.RunMode+"异常提醒:", "接口:"+"URI:"+c.Ctx.Input.URI()+";无返回值", utils.EmailSendToUsers)
+		return
+	}
+	baseRes := c.Data["json"].(*models.BaseResponse)
+	if baseRes != nil && baseRes.Ret != 200 && baseRes.Ret != 408 && baseRes.IsSendEmail {
+		body, _ := json.Marshal(baseRes)
+		msgBody := "URI:" + c.Ctx.Input.URI() + "<br/> ErrMsg:" + baseRes.ErrMsg + ";<br/>Msg:" + baseRes.Msg + ";<br/> Body:" + string(body) + ";<br/>" + c.Token
+		go utils.SendEmail(utils.APPNAME+" "+utils.RunMode+" 失败提醒", msgBody, utils.EmailSendToUsers)
+	}
+
+	c.JSON(c.Data["json"], hasIndent, hasEncoding)
+}
+
+func (c *BaseAuthMobileController) JSON(data interface{}, hasIndent bool, coding bool) error {
+	c.Ctx.Output.Header("Content-Type", "application/json; charset=utf-8")
+	var content []byte
+	var err error
+	if hasIndent {
+		content, err = json.MarshalIndent(data, "", "  ")
+	} else {
+		content, err = json.Marshal(data)
+	}
+	if err != nil {
+		http.Error(c.Ctx.Output.Context.ResponseWriter, err.Error(), http.StatusInternalServerError)
+		return err
+	}
+	ip := c.Ctx.Input.IP()
+	requestBody, _ := url.QueryUnescape(string(c.Ctx.Input.RequestBody))
+	apiLog.Println("请求地址:", c.Ctx.Input.URI(), "Authorization:", c.Ctx.Input.Header("Authorization"), "RequestBody:", requestBody, "ResponseBody", string(content), "IP:", ip)
+	if coding {
+		content = []byte(utils.StringsToJSON(string(content)))
+	}
+	return c.Ctx.Output.Body(content)
+}

+ 87 - 0
controllers/user.go

@@ -17,6 +17,10 @@ type UserController struct {
 	BaseAuthController
 }
 
+type UserCommonController struct {
+	BaseCommonController
+}
+
 // @Title 登录
 // @Description 登录接口
 // @Param	request	body models.LoginReq true "type json string"
@@ -1274,3 +1278,86 @@ func (this *UserController) HeadimgurlUpdate() {
 	br.Success = true
 	br.Msg = "操作成功"
 }
+
+// @Title 登录 (无需token)
+// @Description 登录接口 (无需token)
+// @Param	request	body models.LoginReq true "type json string"
+// @Success 200 {object} models.LoginResp
+// @router /loginPublic [post]
+func (this *UserCommonController) LoginPublic() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req models.LoginReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	mobile := strings.Trim(req.Mobile, " ")
+	if req.Mobile == "" {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误,手机号为空 为空"
+		return
+	}
+
+	item, err := models.GetMsgCode(req.Mobile, req.VCode)
+	if err != nil {
+		if err.Error() == utils.ErrNoRow() {
+			br.Msg = "验证码错误,请重新输入"
+			br.ErrMsg = "校验验证码失败,Err:" + err.Error()
+			return
+		} else {
+			br.Msg = "验证码错误,请重新输入"
+			br.ErrMsg = "校验验证码失败,Err:" + err.Error()
+			return
+		}
+	}
+	if item == nil {
+		br.Msg = "验证码错误,请重新输入"
+		return
+	}
+
+	if len(req.Mobile) >= 11 && req.CountryCode == "" {
+		req.CountryCode = "86"
+	}
+	var token string
+	tokenItem, err := models.GetSessionMobileTokenByOpenId(mobile)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "登录失败"
+		br.ErrMsg = "登录失败,获取token失败:" + err.Error()
+		return
+	}
+	if tokenItem == nil || (err != nil && err.Error() == utils.ErrNoRow()) {
+		timeUnix := time.Now().Unix()
+		timeUnixStr := strconv.FormatInt(timeUnix, 10)
+		token = utils.MD5(mobile) + utils.MD5(timeUnixStr)
+		//新增session
+		{
+			session := new(models.CygxSessionMobile)
+			session.Mobile = mobile
+			session.CreatedTime = time.Now()
+			session.LastUpdatedTime = time.Now()
+			session.ExpireTime = time.Now().AddDate(0, 1, 0)
+			session.AccessToken = token
+			err = models.AddCygxSessionMobile(session)
+			if err != nil {
+				br.Msg = "登录失败"
+				br.ErrMsg = "登录失败,新增用户session信息失败:" + err.Error()
+				return
+			}
+		}
+	} else {
+		token = tokenItem.AccessToken
+	}
+	resp := new(models.LoginResp)
+	resp.Authorization = token
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+	br.Msg = "登录成功"
+}

+ 48 - 0
controllers/wechat.go

@@ -559,3 +559,51 @@ func (this *WechatController) ShareImage() {
 	br.Success = true
 	br.Msg = "提交成功"
 }
+
+// @Title 获取短信验证码(无需token)
+// @Description 获取短信验证码接口(无需token)
+// @Param   Mobile   query   string  true       "手机号码"
+// @Param   AreaNum   query   string  true       "地区编码"
+// @Success Ret=200 获取成功
+// @router /getSmsCodePublic [get]
+func (this *WechatCommonController) GetSmsCode() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	mobile := this.GetString("Mobile")
+	if mobile == "" {
+		br.Msg = "请输入手机号"
+		return
+	}
+	areaNum := this.GetString("AreaNum")
+	msgCode := utils.GetRandDigit(4)
+	var result bool
+	if areaNum == "86" || areaNum == "" || areaNum == "0" {
+		result = services.SendSmsCode(mobile, msgCode)
+	} else {
+		result = services.SendSmsCodeGj(mobile, msgCode, areaNum)
+	}
+	//发送成功
+	if result {
+		item := new(models.MsgCode)
+		item.OpenId = ""
+		item.Code = msgCode
+		item.Mobile = mobile
+		item.ExpiredIn = time.Now().Add(15 * time.Minute).Unix()
+		item.Enabled = 1
+		item.CreatedTime = time.Now()
+		err := models.AddMsgCode(item)
+		if err != nil {
+			br.Msg = "发送失败"
+			br.ErrMsg = "发送失败,Err:" + err.Error()
+			return
+		}
+		br.Msg = "发送成功"
+	} else {
+		br.Msg = "发送失败"
+	}
+	br.Ret = 200
+	br.Success = true
+}

+ 1 - 0
models/db.go

@@ -110,6 +110,7 @@ func init() {
 		new(CygxChartCollectByCygx),
 		new(CygxCompanyInteractionNum),
 		new(CygxChartAll),
+		new(CygxSessionMobile),
 	)
 	// 记录ORM查询日志
 	orm.Debug = true

+ 45 - 0
models/session_mobile.go

@@ -0,0 +1,45 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxSessionMobile struct {
+	SessionId       int `orm:"column(session_id);pk"`
+	Mobile          string
+	UserId          int
+	AccessToken     string
+	ExpireTime      time.Time
+	CreatedTime     time.Time
+	LastUpdatedTime time.Time
+}
+
+func GetCygxSessionMobile(token string) (item *CygxSessionMobile, err error) {
+	sql := `SELECT * FROM cygx_session_mobile WHERE access_token=? AND expire_time> NOW() ORDER BY session_id DESC LIMIT 1 `
+	o := orm.NewOrm()
+	err = o.Raw(sql, token).QueryRow(&item)
+	return
+}
+
+func GetSessionMobileCountByToken(token string) (count int, err error) {
+	sql := `SELECT COUNT(1) AS count FROM cygx_session_mobile WHERE access_token=? AND expire_time> NOW() ORDER BY session_id DESC LIMIT 1 `
+	o := orm.NewOrm()
+	err = o.Raw(sql, token).QueryRow(&count)
+	return
+}
+
+//添加用户session信息
+func AddCygxSessionMobile(item *CygxSessionMobile) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+//根据用户id获取token
+func GetSessionMobileTokenByOpenId(openId string) (item *CygxSession, err error) {
+	sql := `SELECT * FROM cygx_session_mobile WHERE mobile=? AND expire_time> NOW() ORDER BY session_id DESC LIMIT 1 `
+	o := orm.NewOrm()
+	err = o.Raw(sql, openId).QueryRow(&item)
+	return
+}

+ 19 - 0
models/wx_user.go

@@ -194,6 +194,25 @@ func GetWxUserItemByMobile(mobile string) (item *WxUserItem, err error) {
 	return
 }
 
+//根据用户手机号获取相关信息
+func GetWxUserAouthByMobile(mobile string) (item *WxUserItem, err error) {
+	sql := `SELECT
+			a.*,
+			s.mobile,
+			b.company_name 
+		FROM
+			cygx_session_mobile AS s
+			LEFT JOIN wx_user AS a ON a.mobile = s.mobile
+			LEFT JOIN company AS b ON a.company_id = b.company_id 
+		WHERE
+			s.mobile = ?
+		ORDER BY
+			a.company_id DESC 
+			LIMIT 1`
+	err = orm.NewOrm().Raw(sql, mobile).QueryRow(&item)
+	return
+}
+
 func GetWxUserItemByEmail(email string) (item *WxUserItem, err error) {
 	sql := `SELECT * FROM wx_user WHERE email=? `
 	err = orm.NewOrm().Raw(sql, email).QueryRow(&item)

+ 27 - 9
routers/commentsRouter_controllers.go

@@ -259,15 +259,6 @@ func init() {
             Filters: nil,
             Params: nil})
 
-    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleCommonController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleCommonController"],
-        beego.ControllerComments{
-            Method: "Detail",
-            Router: "/look/detail",
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleCommonController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleCommonController"],
         beego.ControllerComments{
             Method: "PageHistoryPublic",
@@ -331,6 +322,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleControllerMobile"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleControllerMobile"],
+        beego.ControllerComments{
+            Method: "DetailMd5",
+            Router: "/look/detail",
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseChartController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseChartController"],
         beego.ControllerComments{
             Method: "Patg",
@@ -808,6 +808,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserCommonController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserCommonController"],
+        beego.ControllerComments{
+            Method: "LoginPublic",
+            Router: "/loginPublic",
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"],
         beego.ControllerComments{
             Method: "ApplyTryOut",
@@ -952,6 +961,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:WechatCommonController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:WechatCommonController"],
+        beego.ControllerComments{
+            Method: "GetSmsCode",
+            Router: "/getSmsCodePublic",
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:WechatCommonController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:WechatCommonController"],
         beego.ControllerComments{
             Method: "WechatLogin",

+ 2 - 0
routers/router.go

@@ -40,6 +40,7 @@ func init() {
 		web.NSNamespace("/user",
 			web.NSInclude(
 				&controllers.UserController{},
+				&controllers.UserCommonController{},
 			),
 		),
 		web.NSNamespace("/permission",
@@ -52,6 +53,7 @@ func init() {
 			web.NSInclude(
 				&controllers.ArticleController{},
 				&controllers.ArticleCommonController{},
+				&controllers.ArticleControllerMobile{},
 			),
 		),
 		web.NSNamespace("/config",