diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 975d44180..0ca029b9f 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -61,6 +61,7 @@ const ( UpdateUserTypeAdd = 1 UpdateUserTypeDelete = 2 UpdateUserTypeUpdate = 3 + WeCartAppID = "wx4b5930c13f8b1170" ) type IUserProvider interface { @@ -296,6 +297,9 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string } else { authInfo.IsExistOpenID = true } + if WeCartAppID == appID { + authInfo.AppID = WeCartAppID + } } } } diff --git a/business/auth2/auth_info.go b/business/auth2/auth_info.go index 2cf07072d..2ae716a50 100644 --- a/business/auth2/auth_info.go +++ b/business/auth2/auth_info.go @@ -74,6 +74,7 @@ type AuthInfo struct { Token string `json:"token"` TokenType int `json:"tokenType"` // TOKEN类型, IsExistOpenID bool `json:"isExistOpenID"` + AppID string `json:"appId"` // appId } func (a *AuthInfo) GetAuthID() string { diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 4334feeb1..d10588cba 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -736,7 +736,13 @@ 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) || ("weixinmini" == strings.Split(ctx.GetToken(), ".")[4]) { + cc, _ := ctx.GetV2AuthInfo() + fmt.Println("111111111111111111", cc.AppID) + fmt.Println("111111111111111111", cc.Token) + fmt.Println("111111111111111111", cc.TokenType) + fmt.Println("111111111111111111", permission.IsRoled(ctx)) + fmt.Println("111111111111111111", cc.Name, cc.Mobile) + if permission.IsRoled(ctx) { if storeIDsMap, err := permission.GetUserStoresResultMap(ctx.GetUserID()); err == nil { var storeIDs2 []int if len(storeIDs) > 0 { @@ -746,7 +752,6 @@ func GetStoresSkus(ctx *jxcontext.Context, storeIDs, skuIDs []int, upcs []string } } if len(storeIDs2) == 0 { - // todo 可能有问题 storeIDs2 = append(storeIDs2, storeIDs...) } } else { diff --git a/business/jxstore/permission/permission.go b/business/jxstore/permission/permission.go index f59d5f042..bc1de35d4 100644 --- a/business/jxstore/permission/permission.go +++ b/business/jxstore/permission/permission.go @@ -419,6 +419,7 @@ func GetUserStoresResultMap(userID string) (resultMap map[int]int, err error) { func IsRoled(ctx *jxcontext.Context) bool { if ctx.GetUserName() != "jxadmin" { if user, err := dao.GetUserByID(dao.GetDB(), "user_id", ctx.GetUserID()); err == nil { + fmt.Println("user111111111111111", user.Type) if user.Type&model.UserTypeRole != 0 { return true } diff --git a/controllers/cms_store_sku.go b/controllers/cms_store_sku.go index 7be612dd4..2387ff3d4 100644 --- a/controllers/cms_store_sku.go +++ b/controllers/cms_store_sku.go @@ -1,6 +1,7 @@ package controllers import ( + "fmt" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/baseapi/platformapi/jdapi" @@ -101,6 +102,7 @@ func (c *StoreSkuController) GetStoresSkus() { if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.SkuIDs, &skuIDs, params.Upcs, &upcs); err == nil { retVal, err = cms.GetStoresSkus(params.Ctx, storeIDs, skuIDs, upcs, params.IsFocus, params.IsHighPrice, params.PriceType, params.Keyword, params.IsBySku, params.IsAct, params.MapData, params.Offset, params.PageSize) } + fmt.Println("==================", retVal) return retVal, "", err }) }