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

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 {

View File

@@ -320,7 +320,7 @@ dbConnectStr = "root:WebServer@1@tcp(127.0.0.1:3306)/jxgy?charset=utf8mb4&loc=Lo
jdOrgCode = "339032"
jdLoginName = "jd_jxgy"
jdToken = "9fd1424e-3a2c-4c2a-a794-f5b6782524e1"
jdToken = "b1138139-9610-4b80-9a63-a63da4773885"
jdAppKey = "5d5577a2506f41b8b4ec520ba83490f5"
jdSecret = "0b01b9eeb15b41dab1c3d05d95c17a26"
jdStorePageCookie = "YDYCWYUGKSROMV3MKJQIFINJ5CLPYH6IRVFUMFJD3JI6VQKHX3YPHTWDIDBNMCBUKSY3P7SKAHHKR7PHQDSFRXZEWXA4XOUTALIQDGDYIEUCMDPWSYGDVT42DJ27CD27QKCR3UN7KF7EPIHGPR7GCRTBD5YGNZW4AIACY4HXDMCETEWCPFKOTM4HRJBSMMQJ77SR62PYMP6RCG33IRQGP6PRCKAO4M7FUA7G2ZM2SFQ6F6WUNO5GXDJSVUELLBJT"