Merge remote-tracking branch 'origin/mark' into su
This commit is contained in:
@@ -188,7 +188,7 @@ func GetStoreOrderAfterTime(db *DaoDB, storeID int, orderTime time.Time, lastOrd
|
||||
t2.actual_fee, t2.desired_fee, t2.waybill_created_at, t2.waybill_finished_at
|
||||
FROM goods_order t1
|
||||
LEFT JOIN waybill t2 ON t1.vendor_waybill_id = t2.vendor_waybill_id AND t1.waybill_vendor_id = t2.waybill_vendor_id
|
||||
WHERE IF(t1.jx_store_id <> 0, t1.jx_store_id, t1.store_id) = ? AND t1.order_created_at >= ? AND t1.id > ? AND t1.status < ?
|
||||
WHERE IF(t1.jx_store_id <> 0, t1.jx_store_id, t1.store_id) = ? AND t1.order_created_at >= ? AND t1.id > ? AND t1.status >= ? AND t1.status < ?
|
||||
AND (t1.flag & ?) = 0
|
||||
ORDER BY t1.order_created_at DESC, t1.id DESC;
|
||||
`
|
||||
@@ -196,6 +196,7 @@ func GetStoreOrderAfterTime(db *DaoDB, storeID int, orderTime time.Time, lastOrd
|
||||
storeID,
|
||||
orderTime,
|
||||
lastOrderSeqID,
|
||||
model.OrderStatusNew,
|
||||
model.OrderStatusEndBegin,
|
||||
model.OrderFlagMaskFake,
|
||||
}
|
||||
@@ -403,7 +404,7 @@ func GetStoreAfsOrderSkuList(db *DaoDB, storeIDs []int, finishedAtBegin, finishe
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM order_sku_financial t1
|
||||
JOIN afs_order t2 ON t2.vendor_order_id = t1.vendor_order_id AND t2.vendor_id = t1.vendor_id
|
||||
JOIN afs_order t2 ON t2.vendor_order_id = t1.vendor_order_id AND t2.vendor_id = t1.vendor_id AND t2.afs_order_id = t1.afs_order_id
|
||||
WHERE t1.is_afs_order = 1 AND t2.afs_finished_at >= ? AND t2.afs_finished_at <= ?`
|
||||
sqlParams := []interface{}{
|
||||
finishedAtBegin,
|
||||
@@ -1186,7 +1187,7 @@ func GetJxOrderCount(db *DaoDB, storeID int, orderID string, date time.Time) (co
|
||||
}
|
||||
|
||||
if orderID != "" {
|
||||
sql += " AND t1.vendor_order_id = ?"
|
||||
sql += " AND t1.vendor_order_id != ?"
|
||||
sqlParams = append(sqlParams, orderID)
|
||||
}
|
||||
err = GetRow(db, &count, sql, sqlParams...)
|
||||
|
||||
@@ -142,8 +142,8 @@ func GetStoreListByMobileOrStoreIDs(db *DaoDB, mobile string, shortRoleNameList
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if mobile != "" {
|
||||
sql += " OR t1.market_man_phone = ? OR t1.operator_phone = ? OR t1.operator_phone2 = ?"
|
||||
sqlParams = append(sqlParams, mobile, mobile, mobile)
|
||||
sql += " OR t1.tel1 = ? OR t1.tel2 = ? OR t1.market_man_phone = ? OR t1.operator_phone = ? OR t1.operator_phone2 = ?"
|
||||
sqlParams = append(sqlParams, mobile, mobile, mobile, mobile, mobile)
|
||||
}
|
||||
if len(shortRoleNameList) > 0 {
|
||||
questionMarks := GenQuestionMarks(len(shortRoleNameList))
|
||||
|
||||
@@ -32,6 +32,10 @@ type StatisticsReportForOrdersList struct {
|
||||
MarketManName string `json:"marketManName"` //市场负责人
|
||||
OperatorName string `json:"operatorName"` //运营负责人
|
||||
OperatorName2 string `json:"operatorName2"`
|
||||
|
||||
CityName string `json:"cityName"`
|
||||
Status int `json:"status"`
|
||||
Tel1 string `orm:"size(32);index" json:"tel1"`
|
||||
}
|
||||
|
||||
type PriceReferSnapshotExt struct {
|
||||
@@ -63,10 +67,13 @@ func GetStatisticsReportForOrders(db *DaoDB, storeIDs []int, fromDate time.Time,
|
||||
s.total_gross_profit,
|
||||
IF(c.jx_brand_fee_factor = 0 AND c.market_add_fee_factor = 0,total_gross_profit,(total_gross_profit*c.jx_brand_fee_factor)/(c.jx_brand_fee_factor+market_add_fee_factor)) com_gross_profit,
|
||||
IF(c.jx_brand_fee_factor = 0 AND c.market_add_fee_factor = 0,0,(total_gross_profit*c.market_add_fee_factor)/(c.jx_brand_fee_factor+market_add_fee_factor)) city_manager_gross_profit,
|
||||
c.status, c.tel1,
|
||||
IF(mm.name <> '', mm.name, mm.user_id2) market_man_name,
|
||||
IF(om.name <> '', om.name, om.user_id2) operator_name,
|
||||
IF(om2.name <> '', om2.name, om2.user_id2) operator_name2
|
||||
IF(om2.name <> '', om2.name, om2.user_id2) operator_name2,
|
||||
p.name city_name
|
||||
FROM store c
|
||||
LEFT JOIN place p ON p.code = c.city_code
|
||||
LEFT JOIN user mm ON mm.mobile <> '' AND mm.mobile = c.market_man_phone
|
||||
LEFT JOIN user om ON om.mobile <> '' AND om.mobile = c.operator_phone
|
||||
LEFT JOIN user om2 ON om2.mobile <> '' AND om2.mobile = c.operator_phone2
|
||||
@@ -136,10 +143,13 @@ func GetGetStatisticsReportForAfsOrders(db *DaoDB, storeIDs []int, fromDate time
|
||||
s.total_gross_profit,
|
||||
IF(c.jx_brand_fee_factor = 0 AND c.market_add_fee_factor = 0,total_gross_profit,(total_gross_profit*c.jx_brand_fee_factor)/(c.jx_brand_fee_factor+market_add_fee_factor)) com_gross_profit,
|
||||
IF(c.jx_brand_fee_factor = 0 AND c.market_add_fee_factor = 0,0,(total_gross_profit*c.market_add_fee_factor)/(c.jx_brand_fee_factor+market_add_fee_factor)) city_manager_gross_profit,
|
||||
c.status, c.tel1,
|
||||
IF(mm.name <> '', mm.name, mm.user_id2) market_man_name,
|
||||
IF(om.name <> '', om.name, om.user_id2) operator_name,
|
||||
IF(om2.name <> '', om2.name, om2.user_id2) operator_name2
|
||||
IF(om2.name <> '', om2.name, om2.user_id2) operator_name2,
|
||||
p.name city_name
|
||||
FROM store c
|
||||
LEFT JOIN place p ON p.code = c.city_code
|
||||
LEFT JOIN user mm ON mm.mobile <> '' AND mm.mobile = c.market_man_phone
|
||||
LEFT JOIN user om ON om.mobile <> '' AND om.mobile = c.operator_phone
|
||||
LEFT JOIN user om2 ON om2.mobile <> '' AND om2.mobile = c.operator_phone2
|
||||
|
||||
@@ -682,3 +682,17 @@ func GetOrderNotifyPhones(db *DaoDB, storeID int) (phoneList []string) {
|
||||
}
|
||||
return phoneList
|
||||
}
|
||||
|
||||
func GetStoreLinkStores(db *DaoDB, storeID int) (storeList []*model.Store, err error) {
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM store t1
|
||||
WHERE t1.link_store_id = ? AND t1.deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
storeID,
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
err = GetRows(db, &storeList, sql, sqlParams...)
|
||||
return storeList, err
|
||||
}
|
||||
|
||||
@@ -272,11 +272,11 @@ type Store struct {
|
||||
DeliveryRangeType int8 `json:"deliveryRangeType"` // 参见相关常量定义
|
||||
DeliveryRange string `orm:"type(text)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon,则为逗号分隔坐标,分号分隔的坐标点(坐标与Lng和Lat一样,都是整数),比如 121361504,31189308;121420555,31150238。否则为半径,单位为米
|
||||
Status int `json:"status"`
|
||||
AutoEnableAt *time.Time `orm:"type(datetime);null" json:"autoEnableAt"` // 自动营业时间(临时休息用)
|
||||
ChangePriceType int8 `json:"changePriceType"` // 修改价格类型,即是否需要审核
|
||||
SMSNotify int8 `orm:"column(sms_notify);" json:"smsNotify"` // 是否通过短信接收订单消息
|
||||
AutoReplyType int8 `json:"autoReplyType"` // 订单评价自动回复类型
|
||||
LinkStoreID int `orm:"column(link_store_id);default(0)" json:"linkStoreID"` // 关联门店ID
|
||||
AutoEnableAt *time.Time `orm:"type(datetime);null" json:"autoEnableAt"` // 自动营业时间(临时休息用)
|
||||
ChangePriceType int8 `json:"changePriceType"` // 修改价格类型,即是否需要审核
|
||||
SMSNotify int8 `orm:"column(sms_notify);" json:"smsNotify"` // 是否通过短信接收订单消息
|
||||
AutoReplyType int8 `json:"autoReplyType"` // 订单评价自动回复类型
|
||||
LinkStoreID int `orm:"column(link_store_id);default(0);index" json:"linkStoreID"` // 关联门店ID
|
||||
|
||||
PrinterDisabled int8 `orm:"default(0)" json:"printerDisabled"` // 是否禁用网络打印机
|
||||
PrinterFontSize int8 `orm:"default(0)" json:"printerFontSize"` // 打印字体-1:小,0:正常,1:大
|
||||
@@ -436,6 +436,11 @@ type StoreCourierMap struct {
|
||||
func (*StoreCourierMap) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"StoreID", "VendorID", "DeletedAt"},
|
||||
}
|
||||
}
|
||||
|
||||
func (*StoreCourierMap) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"VendorStoreID", "VendorID", "DeletedAt"},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user