修改商城权限,让登录用户可以看到数据

This commit is contained in:
邹宗楠
2022-03-28 19:06:01 +08:00
parent 147830ce3b
commit abe967dd8e
6 changed files with 15 additions and 2 deletions

View File

@@ -130,6 +130,9 @@ var (
ErrInvalidParams = errors.New("参数不合法")
)
// 微信小程序商城appid
const WeCartAppID = "wx4b5930c13f8b1170"
func init() {
authers = make(map[string]IAuther)
@@ -297,6 +300,9 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string
authInfo.IsExistOpenID = true
}
}
if WeCartAppID == appID {
authInfo.AuthBindInfo.AppServer = WeCartAppID
}
}
}
}

View File

@@ -84,6 +84,10 @@ func (a *AuthInfo) GetAuthType() string {
return a.AuthBindInfo.Type
}
func (a *AuthInfo) GetIsWeCartApp() string {
return a.AuthBindInfo.AppServer
}
func (a *AuthInfo) GetAuthTypeID() string {
return a.AuthBindInfo.TypeID
}

View File

@@ -736,7 +736,8 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, upcs []strin
func GetStoresSkus(ctx *jxcontext.Context, storeIDs, skuIDs []int, upcs []string, isFocus, isHighPrice bool, priceType int, keyword string, isBySku, isAct bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *dao.StoreSkuNamesInfo, err error) {
//权限
if permission.IsRoled(ctx) { // 管理员不进入
if permission.IsRoled(ctx) || auth2.WeCartAppID != ctx.GetLoginInfo().GetIsWeCartApp() { // 管理员不进入,商城不进入
if storeIDsMap, err := permission.GetUserStoresResultMap(ctx.GetUserID()); err == nil {
var storeIDs2 []int
if len(storeIDs) > 0 {

View File

@@ -15,6 +15,7 @@ type IAuther interface {
GetAuthID() string
GetAuthType() string
GetUserTag() string
GetIsWeCartApp() string
}
type Context struct {

View File

@@ -28,6 +28,7 @@ type AuthBind struct {
AuthSecret2 string `orm:"size(48)" json:"-"`
Remark string `orm:"size(255)" json:"remark"`
DetailData string `orm:"type(text)" json:"detailData"`
AppServer string `json:"appServer"`
}
func (*AuthBind) TableUnique() [][]string {