From 81e84b7eeced454ae7439d9b9181408a5b34a562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 25 Sep 2020 11:37:55 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BC=9A=E5=91=98=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/auth2/auth2.go | 1 - business/partner/purchase/jx/localjx/user.go | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) 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/partner/purchase/jx/localjx/user.go b/business/partner/purchase/jx/localjx/user.go index 5a4f39d82..653892c6e 100644 --- a/business/partner/purchase/jx/localjx/user.go +++ b/business/partner/purchase/jx/localjx/user.go @@ -48,6 +48,9 @@ func GetJxShopUsers(ctx *jxcontext.Context, keyword string, offset, pageSize int sql += "LIMIT ? OFFSET ?" pageSize = jxutils.FormalizePageSize(pageSize) sqlParams = append(sqlParams, pageSize, offset) + // for _, v := range requestList { + + // } dao.Begin(db) defer dao.Commit(db) if err = dao.GetRows(db, &requestList, sql, sqlParams...); err == nil { From 0e314176644140d674527aa5caa6f79ac8aa5330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 25 Sep 2020 13:53:47 +0800 Subject: [PATCH 2/9] =?UTF-8?q?getvendorstore=20=E9=A5=BF=E7=99=BE12?= =?UTF-8?q?=E6=9C=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/jxutils_cms.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 1d6e2ae9f254007a37b290b46dae9d1af949beee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 25 Sep 2020 13:55:11 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E7=BE=8E=E5=9B=A2=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/mtwm/store_sku2.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index 31aa51c5a..7d4ff6a52 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -301,9 +301,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI // foodData["tag_id"] = utils.Int64ToStr(defVendorCatID) } skus[0]["spec"] = jxutils.ComposeSkuSpec(storeSku.SpecQuality, storeSku.SpecUnit) - // if isNeedUpdatePrice { - skus[0]["price"] = foodData["price"] - // } + if isNeedUpdatePrice { + skus[0]["price"] = foodData["price"] + } skus[0]["stock"] = stockCount2Mtwm(model.MaxStoreSkuStockQty) if storeSku.Upc != "" { skus[0]["upc"] = storeSku.Upc From 9dfab431b8d627ed5937bcebfa28937bd788cdba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 25 Sep 2020 14:02:22 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E7=BE=8E=E5=9B=A2=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/mtwm/store_sku2.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index 7d4ff6a52..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 { @@ -301,9 +301,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI // foodData["tag_id"] = utils.Int64ToStr(defVendorCatID) } skus[0]["spec"] = jxutils.ComposeSkuSpec(storeSku.SpecQuality, storeSku.SpecUnit) - if isNeedUpdatePrice { - skus[0]["price"] = foodData["price"] - } + // if isNeedUpdatePrice { + skus[0]["price"] = foodData["price"] + // } skus[0]["stock"] = stockCount2Mtwm(model.MaxStoreSkuStockQty) if storeSku.Upc != "" { skus[0]["upc"] = storeSku.Upc From 1e019f876744d511c365c58b5140601c53abce96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 25 Sep 2020 17:18:59 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E4=BA=8B=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 8 ++++++++ 1 file changed, 8 insertions(+) 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 } From d6e2c8e405d2b50bf574aa88b06806e6dc16f8c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Sat, 26 Sep 2020 14:45:36 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E7=94=B5=E8=AF=9D?= =?UTF-8?q?=E5=92=8C=E5=90=8E=E5=8F=B0=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jd/store.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 { From f3117c6d38b5885264f8b9f89cf22c0887773a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Sat, 26 Sep 2020 16:12:35 +0800 Subject: [PATCH 7/9] quanxina --- business/model/user.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/business/model/user.go b/business/model/user.go index eedd4962f..950d2c554 100644 --- a/business/model/user.go +++ b/business/model/user.go @@ -210,3 +210,37 @@ func (v *UserMember) TableIndex() [][]string { []string{"CreateAt"}, } } + +type Role struct { + ModelIDCULD + + Name string `json:"name"` //角色名 +} + +func (*Role) TableUnique() [][]string { + return [][]string{ + []string{"Name"}, + } +} + +type UserRole struct { + ModelIDCULD + + Name string `json:"name"` //角色名 +} + +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"}, + } +} From 36c84d494d8fc2cca2da1acd70681f6c8af1d72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Sat, 26 Sep 2020 16:54:30 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=9D=83=E9=99=90=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/user.go | 22 +++++++++++++++++++++- globals/beegodb/beegodb.go | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/business/model/user.go b/business/model/user.go index 950d2c554..00ec3237c 100644 --- a/business/model/user.go +++ b/business/model/user.go @@ -226,7 +226,14 @@ func (*Role) TableUnique() [][]string { type UserRole struct { ModelIDCULD - Name string `json:"name"` //角色名 + 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 { @@ -244,3 +251,16 @@ func (*Function) TableUnique() [][]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/globals/beegodb/beegodb.go b/globals/beegodb/beegodb.go index 8830eb5b1..86d16aa14 100644 --- a/globals/beegodb/beegodb.go +++ b/globals/beegodb/beegodb.go @@ -85,6 +85,8 @@ func Init() { orm.RegisterModel(&model.FakeJdThingMap{}) + //权限 + // orm.RegisterModel(&model) // create table orm.RunSyncdb("default", false, true) } From da9f675b00aa4a6895c1cf8a301770ca709775cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Sun, 27 Sep 2020 09:42:40 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E6=9D=83=E9=99=90=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- globals/beegodb/beegodb.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/globals/beegodb/beegodb.go b/globals/beegodb/beegodb.go index 86d16aa14..a67dad1d9 100644 --- a/globals/beegodb/beegodb.go +++ b/globals/beegodb/beegodb.go @@ -86,7 +86,10 @@ func Init() { orm.RegisterModel(&model.FakeJdThingMap{}) //权限 - // orm.RegisterModel(&model) + orm.RegisterModel(&model.Role{}) + orm.RegisterModel(&model.UserRole{}) + orm.RegisterModel(&model.Function{}) + orm.RegisterModel(&model.RoleFunction{}) // create table orm.RunSyncdb("default", false, true) }