diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index f653406be..617d6d6db 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -243,7 +243,6 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string realAuthID = user.GetID() } if authBindEx, err = handler.VerifySecret(realAuthID, authSecret); err == nil { - globals.SugarLogger.Debugf("testttttttttttttttttttttttttttttttttttt", utils.Format4Output(authBindEx, false)) if authBindEx == nil { // mobile, email会返回nil(表示不会新建AuthBind实体) user = userProvider.GetUser(authID, authIDType) authBindEx = &AuthBindEx{ diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 1db00161e..8d2cb061c 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -372,6 +372,13 @@ func ModifyOrderSkusStock(db *dao.DaoDB, order *model.GoodsOrder, isAdd bool) (e } continue } + dao.Begin(db) + defer func() { + if r := recover(); r != nil { + dao.Rollback(db) + panic(r) + } + }() if isAdd { stock = storeSku.Stock + sku.Count } else { @@ -395,6 +402,7 @@ func ModifyOrderSkusStock(db *dao.DaoDB, order *model.GoodsOrder, isAdd bool) (e if order.VendorID != model.VendorIDJX { dao.SetStoreSkuSyncStatus(db, order.VendorID, []int{jxutils.GetSaleStoreIDFromOrder(order)}, []int{sku.SkuID}, model.SyncFlagStockMask) } + dao.Commit(db) } return err } diff --git a/business/jxutils/jxutils_cms.go b/business/jxutils/jxutils_cms.go index e6d99ceba..ed6c506d8 100644 --- a/business/jxutils/jxutils_cms.go +++ b/business/jxutils/jxutils_cms.go @@ -488,7 +488,7 @@ func GuessVendorIDFromVendorStoreID(vendorStoreID int64) (vendorID int) { vendorID = model.VendorIDJD } else if vendorStoreID > 1234567 && vendorStoreID < 9876543 { // 美团外卖 2461713,7位 vendorID = model.VendorIDMTWM - } else if vendorStoreID > 1234567890 && vendorStoreID < 99876543210 { // 饿百 2167002607,10位,11位 + } else if vendorStoreID > 1234567890 && vendorStoreID < 998765432109 { // 饿百 2167002607,10位,12位 vendorID = model.VendorIDEBAI } else if false { //vendorStoreID > 123456789 && vendorStoreID < 987654321 { // 微盟微商城 132091048,9位 // vendorID = model.VendorIDWSC diff --git a/business/model/user.go b/business/model/user.go index 3d749df82..efc6674d8 100644 --- a/business/model/user.go +++ b/business/model/user.go @@ -226,3 +226,57 @@ func (v *UserMember) TableIndex() [][]string { []string{"CreatedAt"}, } } + +type Role struct { + ModelIDCULD + + Name string `json:"name"` //角色名 +} + +func (*Role) TableUnique() [][]string { + return [][]string{ + []string{"Name"}, + } +} + +type UserRole struct { + ModelIDCULD + + UserID string `orm:"column(user_id)" json:"userID"` //用户ID + RoleID int `orm:"column(role_id)" json:"roleID"` //角色ID +} + +func (*UserRole) TableUnique() [][]string { + return [][]string{ + []string{"UserID", "RoleID"}, + } +} + +type Function struct { + ModelIDCULD + + Name string `json:"name"` //功能名 + URL string `orm:"column(url)" json:"url"` //路径 + ImgURL string `orm:"column(img_url)" json:"imgURL"` //图标 + Level int `json:"level"` //级别 + ParentID int `orm:"column(parent_id)" json:"parentID"` //父功能ID +} + +func (*Function) TableUnique() [][]string { + return [][]string{ + []string{"Name"}, + } +} + +type RoleFunction struct { + ModelIDCULD + + RoleID int `orm:"column(role_id)" json:"roleID"` //角色ID + FunctionID int `orm:"column(function_id)" json:"functionID"` //功能ID +} + +func (*RoleFunction) TableUnique() [][]string { + return [][]string{ + []string{"FunctionID", "RoleID"}, + } +} diff --git a/business/partner/purchase/jd/store.go b/business/partner/purchase/jd/store.go index 14e966040..886d5ce63 100644 --- a/business/partner/purchase/jd/store.go +++ b/business/partner/purchase/jd/store.go @@ -138,16 +138,16 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin if err = dao.GetRows(db, &stores, sql, model.VendorIDJD, utils.DefaultTimeValue, storeID); err == nil { for _, store := range stores { a := getAPI(store.VendorOrgCode) - phone := "" - if store.MarketManPhone != "" { - phone = store.MarketManPhone - } else { - phone = model.VendorStoreTel - } + // phone := "" + // if store.MarketManPhone != "" { + // phone = store.MarketManPhone + // } else { + // phone = model.VendorStoreTel + // } storeParams := &jdapi.OpStoreParams{ StationNo: store.VendorStoreID, Operator: userName, - Phone: phone, + Phone: store.Tel1, Mobile: store.Tel1, } if store.SyncStatus&model.SyncFlagDeletedMask == 0 { diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index 31aa51c5a..4d68373da 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -246,7 +246,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI syncType = "更新商品" } for i, storeSku := range storeSkuList { - isNeedUpdatePrice := isCreate //storeSku.SkuSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 + // isNeedUpdatePrice := isCreate //storeSku.SkuSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 foodData := make(map[string]interface{}) foodDataList[i] = foodData foodData[mtwmapi.KeyAppFoodCode] = utils.Int2Str(storeSku.SkuID) @@ -258,9 +258,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI foodData["skus"] = skus foodData["name"] = utils.LimitUTF8StringLen(utils.FilterEmoji(storeSku.SkuName), mtwmapi.MaxSkuNameCharCount) foodData["description"] = storeSku.Comment - if isNeedUpdatePrice { - foodData["price"] = jxutils.IntPrice2Standard(storeSku.VendorPrice) - } + // if isNeedUpdatePrice { + foodData["price"] = jxutils.IntPrice2Standard(storeSku.VendorPrice) + // } if storeSku.MinOrderCount != 0 { foodData["min_order_count"] = storeSku.MinOrderCount } else { diff --git a/globals/beegodb/beegodb.go b/globals/beegodb/beegodb.go index 2f404080f..bd22b167b 100644 --- a/globals/beegodb/beegodb.go +++ b/globals/beegodb/beegodb.go @@ -86,6 +86,11 @@ func Init() { orm.RegisterModel(&model.FakeJdThingMap{}) + //权限 + orm.RegisterModel(&model.Role{}) + orm.RegisterModel(&model.UserRole{}) + orm.RegisterModel(&model.Function{}) + orm.RegisterModel(&model.RoleFunction{}) // create table orm.RunSyncdb("default", false, true) }