diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 975d44180..53346c402 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -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 + } } } } diff --git a/business/auth2/auth_info.go b/business/auth2/auth_info.go index 2cf07072d..5ffe2a09d 100644 --- a/business/auth2/auth_info.go +++ b/business/auth2/auth_info.go @@ -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 } diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 2a96c9c90..011a1f034 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -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 { diff --git a/business/jxutils/jxcontext/jxcontext.go b/business/jxutils/jxcontext/jxcontext.go index 69ad6985a..77e1543d6 100644 --- a/business/jxutils/jxcontext/jxcontext.go +++ b/business/jxutils/jxcontext/jxcontext.go @@ -15,6 +15,7 @@ type IAuther interface { GetAuthID() string GetAuthType() string GetUserTag() string + GetIsWeCartApp() string } type Context struct { diff --git a/business/model/auth2.go b/business/model/auth2.go index 56e485665..cf0aba58a 100644 --- a/business/model/auth2.go +++ b/business/model/auth2.go @@ -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 { diff --git a/conf/app.conf b/conf/app.conf index cb7d5e6d6..575be97fe 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -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"