解决冲突
This commit is contained in:
@@ -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{
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user