This commit is contained in:
苏尹岚
2019-10-31 13:55:29 +08:00
42 changed files with 647 additions and 454 deletions

View File

@@ -59,7 +59,7 @@ type Act struct {
Status int `json:"status"`
LimitUser int `json:"limitUser"` // 是否按用户限制
LimitDaily int `json:"limitDaily"` // 每日限购单数
LimitCount int `json:"limitCount"` // 单限购数量
LimitCount int `json:"limitCount"` // 单限购数量
Source string `orm:"size(255)" json:"source"`
CreateType int `json:"createType"`
PricePercentage int `json:"pricePercentage"` // 单品级活动才有效

View File

@@ -36,6 +36,7 @@ type GoodsOrderExt struct {
type OrderSkuExt struct {
OrderSku
NameID int `orm:"column(name_id)" json:"nameID"`
FullSkuName string `json:"fullSkuName"`
Image string `json:"image"`
RealEarningPrice int64 `json:"realEarningPrice"` // 实际单品结算给门店老板钱

View File

@@ -101,6 +101,10 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
if err = GetRow(db, storeDetail, sql, sqlParams...); err == nil {
storeDetail.PricePercentagePackObj = PricePercentagePack2Obj(storeDetail.PricePercentagePackStr)
storeDetail.FreightDeductionPackObj = FreightDeductionPack2Obj(storeDetail.FreightDeductionPackStr)
if vendorID == model.VendorIDJX {
storeDetail.VendorStatus = storeDetail.Status
storeDetail.PricePercentage = 100
}
return storeDetail, nil
}
return nil, err
@@ -114,16 +118,8 @@ func GetStoreDetailByVendorStoreID(db *DaoDB, vendorStoreID string, vendorID int
if vendorID != model.VendorIDJX {
return getStoreDetail(db, 0, vendorID, vendorStoreID)
}
store := &model.Store{}
store.ID = int(utils.Str2Int64WithDefault(vendorStoreID, 0))
if err = GetEntity(db, store); err == nil {
// todo 还要补全其它参数
storeDetail = &StoreDetail{
Store: *store,
VendorStoreID: vendorStoreID,
VendorStatus: store.Status,
PricePercentage: 100,
}
if storeDetail, err = getStoreDetail(db, int(utils.Str2Int64WithDefault(vendorStoreID, 0)), vendorID, ""); err == nil {
storeDetail.VendorStoreID = vendorStoreID
}
return storeDetail, err
}

View File

@@ -164,7 +164,7 @@ func GetSkusCategories(db *DaoDB, vendorID, storeID int, skuIDs []int, level int
// 单门店模式厂商适用
// 单纯的从已经创建的store_sku_category_map中得到相关的同步信息
func GetStoreCategories(db *DaoDB, vendorID, storeID int, level int, isDirty bool) (cats []*SkuStoreCatInfo, err error) {
func GetStoreCategories(db *DaoDB, vendorID, storeID int, level int, mustDirty bool) (cats []*SkuStoreCatInfo, err error) {
fieldPrefix := ConvertDBFieldPrefix(model.VendorNames[vendorID])
sql := `
SELECT t4.*,
@@ -183,7 +183,7 @@ func GetStoreCategories(db *DaoDB, vendorID, storeID int, level int, isDirty boo
storeID,
utils.DefaultTimeValue,
}
if isDirty {
if mustDirty {
sql += " AND t5.%s_sync_status <> 0"
fieldPrefixParams = append(fieldPrefixParams, fieldPrefix)
}
@@ -204,7 +204,7 @@ func GetDirtyStoreCategories(db *DaoDB, vendorID, storeID int, level int) (cats
// 以store_sku_bind为基础来做同步正常情况下使用
// !!! 此函数不要将store_sku_bind中的vendor_price取出来放到StoreSkuSyncInfo.VendorPrice中因为之后会依赖这个VendorPrice进行重算
// 单多门店模式厂商通用
func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, isDirty bool) (skus []*StoreSkuSyncInfo, err error) {
func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty bool) (skus []*StoreSkuSyncInfo, err error) {
if vendorID < 0 {
panic("vendorID<0")
}
@@ -275,7 +275,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, isDirty bool)
sql += " AND t1.store_id = ?"
sqlParams = append(sqlParams, storeID)
}
if isDirty {
if mustDirty {
sql += " AND (t1.%s_sync_status <> 0 OR (%s.%s_id <> 0 AND t3.id IS NULL))"
fmtParams = append(fmtParams, fieldPrefix, tableName, fieldPrefix)
} else {

View File

@@ -116,9 +116,10 @@ type UserDeliveryAddress struct {
Tag string `orm:"size(32)" json:"tag"`
ConsigneeName string `orm:"size(32)" json:"consigneeName"`
ConsigneeMobile string `orm:"size(32)" json:"consigneeMobile"`
Address string `orm:"size(255)" json:"address"` // 这个是用户手输入的详细地址
Lng float64 `orm:"digits(10);decimals(6)" json:"lng"` // 乘了10的6次方
Lat float64 `orm:"digits(10);decimals(6)" json:"lat"` // 乘了10的6次方
Address string `orm:"size(255)" json:"address"` // 地址(区县以下,门牌号以上的地址信息)
DetailAddress string `orm:"size(255)" json:"detailAddress"` // 门牌号
Lng float64 `orm:"digits(10);decimals(6)" json:"lng"`
Lat float64 `orm:"digits(10);decimals(6)" json:"lat"`
AutoAddress string `orm:"size(255)" json:"autoAddress"` // 这个是通过坐标自动获取的结构化的地址
CityCode int `orm:"default(0);null" json:"cityCode"` // 根据坐标获得
@@ -142,11 +143,12 @@ type UserCartItem struct {
UserID string `orm:"size(48);column(user_id)" json:"userID"`
StoreID int `orm:"column(store_id)" json:"storeID"`
SkuID int `orm:"column(sku_id)"`
SkuID int `orm:"column(sku_id)" json:"skuID"`
ActID int `orm:"column(act_id)" json:"actID"`
Count int `json:"count"`
Price int `json:"price"`
Count int `json:"count"`
Price int `json:"price"`
IsChecked int8 `json:"isChecked"`
}
func (*UserCartItem) TableUnique() [][]string {