2021-04-27 15:33:49 +08:00
|
|
|
|
package base
|
|
|
|
|
|
|
|
|
|
import (
|
2021-05-16 15:21:52 +08:00
|
|
|
|
"github.com/beego/beego/v2/core/logs"
|
2021-04-27 15:33:49 +08:00
|
|
|
|
"github.com/beego/beego/v2/server/web"
|
|
|
|
|
"legend/models/fast"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
** 基础controller插件,重写一些公共的方法
|
|
|
|
|
*/
|
|
|
|
|
type BasicController struct {
|
|
|
|
|
web.Controller
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *BasicController) Prepare() {
|
|
|
|
|
|
|
|
|
|
userName, ok := c.GetSession("userName").(string)
|
|
|
|
|
if ok {
|
|
|
|
|
logs.Info("该用户已经登录, userName:", userName)
|
2021-04-30 15:55:02 +08:00
|
|
|
|
userInfo := fast.GetMerchantInfoByUserName(userName)
|
|
|
|
|
if userInfo.LoginAccount != "" {
|
|
|
|
|
c.Data["nickName"] = userInfo.MerchantName
|
2021-05-16 15:21:52 +08:00
|
|
|
|
c.Data["merchantUid"] = userInfo.MerchantUid
|
2021-04-27 15:33:49 +08:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
}
|