You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
792 B
35 lines
792 B
package gys
|
|
|
|
import (
|
|
"errors"
|
|
"github.com/gin-gonic/gin"
|
|
"recook/internal/dbc"
|
|
"strconv"
|
|
)
|
|
|
|
type base struct {
|
|
}
|
|
|
|
// @Style 供应商品牌列表
|
|
func (b *base) GetGysId(c *gin.Context) (uint, error) {
|
|
gys_token := c.Request.Header.Get("X-Recook-GYSToken")
|
|
gysId, _ := dbc.Rds.Get(gys_token).Result()
|
|
if gysId == "" {
|
|
return 0, errors.New("未登录")
|
|
}
|
|
myGysId, _ := strconv.ParseUint(gysId, 10, 64)
|
|
return uint(myGysId), nil
|
|
}
|
|
|
|
// @Style 供应商品牌列表
|
|
func (b *base) GetGysIdByWs(c *gin.Context) (uint, error) {
|
|
userId := c.GetInt64("gysId")
|
|
return uint(userId), nil
|
|
}
|
|
|
|
// @Style 供应商品牌列表
|
|
func (b *base) GetManageId(c *gin.Context) (uint, error) {
|
|
userId, _ := strconv.ParseUint(c.Request.Header.Get("X-Recook-ID"), 10, 674)
|
|
return uint(userId), nil
|
|
}
|