- 整理partner.ReadStore

This commit is contained in:
gazebo
2019-07-22 15:04:07 +08:00
parent 71f6d0809a
commit a4470e5fb5
13 changed files with 92 additions and 84 deletions

View File

@@ -25,10 +25,8 @@ type StoreDetail struct {
DeliveryCompetition int8 `orm:"default(1)" json:"deliveryCompetition"` // 是否支持配送竞争
IsSync int8 `orm:"default(1)" json:"isSync"` // 是否同步
model.Place // district info
DistrictName string `json:"-"`
CityName string
DistrictName string `json:"districtName"`
CityName string `json:"cityName"`
}
type StoreDetail2 struct {
@@ -48,8 +46,7 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
SELECT t1.*,
t2.vendor_store_id, t2.status vendor_status, t2.delivery_fee, t2.sync_status,
t2.price_percentage, t3.value price_percentage_pack_str, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync,
district.code, district.name district_name, district.parent_code, district.level, district.tel_code,
district.jd_code, district.ebai_code, district.enabled, district.mtps_price,
district.name district_name,
city.name city_name
FROM store t1
JOIN store_map t2 ON t1.id = t2.store_id AND t2.vendor_id = ? AND t2.deleted_at = ?
@@ -75,7 +72,6 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
}
storeDetail = &StoreDetail{}
if err = GetRow(db, storeDetail, sql, sqlParams...); err == nil {
storeDetail.Place.Name = storeDetail.DistrictName
storeDetail.PricePercentagePackObj = PricePercentagePack2Obj(storeDetail.PricePercentagePackStr)
return storeDetail, nil
}

View File

@@ -244,8 +244,6 @@ type Store struct {
Status int `json:"status"`
ChangePriceType int8 `json:"changePriceType"` // 修改价格类型,即是否需要审核
DeliveryType int8 `orm:"-" json:"deliveryType"` // 仅用于传值
PrinterDisabled int8 `orm:"default(0)" json:"printerDisabled"` // 是否禁用网络打印机
PrinterVendorID int `orm:"column(printer_vendor_id);" json:"printerVendorID"`
PrinterSN string `orm:"size(32);column(printer_sn);index" json:"printerSN"`
@@ -300,6 +298,23 @@ func (s *Store) IsPrinterDisabled() bool {
return s.PrinterDisabled != 0
}
func (s *Store) GetOpTimeList() (opTimeList []int16) {
opTimeList = []int16{s.OpenTime1, s.CloseTime1}
if s.OpenTime2 != 0 {
opTimeList = append(opTimeList, s.OpenTime2, s.CloseTime2)
}
return opTimeList
}
func (s *Store) SetOpTime(opTimeList []int16) {
if len(opTimeList) >= 2 {
s.OpenTime1, s.CloseTime1 = opTimeList[0], opTimeList[1]
if len(opTimeList) >= 4 {
s.OpenTime2, s.CloseTime2 = opTimeList[2], opTimeList[3]
}
}
}
type StoreSub struct {
ModelIDCULD