方法移动到check文件
This commit is contained in:
@@ -1281,3 +1281,14 @@ func GetSimpleOrder(db *DaoDB, vendorOrderID string) (goods *model.GoodsOrder, e
|
||||
err = GetRow(db, &goods, sql, sqlParams)
|
||||
return goods, err
|
||||
}
|
||||
|
||||
func GetSimpleOrderSkus(db *DaoDB, vendorOrderID string) (skus []*model.OrderSku, err error) {
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM order_sku
|
||||
WHERE vendor_order_id = ?
|
||||
`
|
||||
sqlParams := []interface{}{vendorOrderID}
|
||||
err = GetRows(db, &skus, sql, sqlParams)
|
||||
return skus, err
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ func GetStoreCourierList(db *DaoDB, storeIDs []int, status, auditStatus int) (co
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func GetStoresMapList2(db *DaoDB, vendorIDs, storeIDs, storeStatuss []int, status, isSync int, pricePack string, mustDirty bool) (storeMapList []*model.StoreMap, err error) {
|
||||
func GetStoresMapList2(db *DaoDB, vendorIDs, storeIDs, storeStatuss []int, status, isSync int, pricePack, name string, mustDirty bool) (storeMapList []*model.StoreMap, err error) {
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM store_map t1
|
||||
@@ -266,6 +266,10 @@ func GetStoresMapList2(db *DaoDB, vendorIDs, storeIDs, storeStatuss []int, statu
|
||||
sql += " AND t1.price_percentage_pack = ?"
|
||||
sqlParams = append(sqlParams, pricePack)
|
||||
}
|
||||
if name != "" {
|
||||
sql += " AND t2.name LIKE ?"
|
||||
sqlParams = append(sqlParams, "%"+name+"%")
|
||||
}
|
||||
if mustDirty {
|
||||
sql += " AND t1.sync_status <> 0"
|
||||
}
|
||||
@@ -300,8 +304,8 @@ func SetStoresMapSyncStatus(db *DaoDB, vendorIDs, storeIDs []int, syncStatus int
|
||||
return err
|
||||
}
|
||||
|
||||
func GetStoresMapList(db *DaoDB, vendorIDs, storeIDs, storeStatuss []int, status, isSync int, pricePack string) (storeMapList []*model.StoreMap, err error) {
|
||||
return GetStoresMapList2(db, vendorIDs, storeIDs, storeStatuss, status, isSync, pricePack, false)
|
||||
func GetStoresMapList(db *DaoDB, vendorIDs, storeIDs, storeStatuss []int, status, isSync int, pricePack, name string) (storeMapList []*model.StoreMap, err error) {
|
||||
return GetStoresMapList2(db, vendorIDs, storeIDs, storeStatuss, status, isSync, pricePack, name, false)
|
||||
}
|
||||
|
||||
func StoreMapList2Map(storeMapList []*model.StoreMap) (storeMapMap map[int][]*model.StoreMap) {
|
||||
|
||||
@@ -86,6 +86,7 @@ type StoreSkuSyncInfo struct {
|
||||
NameCategoryID int `orm:"column(name_category_id)"`
|
||||
YbNameSuffix string //银豹的商品条码后缀
|
||||
YbBarCode string //银豹的商品条码
|
||||
JdsStockSwitch int
|
||||
|
||||
// 平台相关的图片信息
|
||||
Img string
|
||||
@@ -155,6 +156,7 @@ type StoreSkuNameExt struct {
|
||||
RealMidUnitPrice int `json:"realMidUnitPrice"`
|
||||
Count int `json:"count"`
|
||||
YbSkuName string `json:"ybSkuName"`
|
||||
AuditUnitPrice int `json:"auditUnitPrice"` //审核价格
|
||||
}
|
||||
|
||||
// GetStoreSkus用
|
||||
@@ -402,6 +404,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo
|
||||
t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id,
|
||||
t2.*,
|
||||
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.ex_prefix, t3.ex_prefix_begin, t3.ex_prefix_end, t3.category_id name_category_id, t3.yb_name_suffix,
|
||||
t3.jds_stock_switch,
|
||||
IF(t11.%s <> '', t11.%s, t3.img) img,
|
||||
IF(t12.%s <> '', t12.%s, t3.img2) img2,
|
||||
IF(t13.%s <> '', t13.%s, t3.desc_img) desc_img,
|
||||
@@ -1288,7 +1291,7 @@ func UpdateActPrice4StoreSkuNameNew(db *DaoDB, storeIDs, skuIDs []int, skuNamesI
|
||||
vendorIDs = []int{actVendorID}
|
||||
}
|
||||
} else {
|
||||
storeMapList, err := GetStoresMapList(db, nil, storeIDs, nil, model.StoreStatusAll, model.StoreIsSyncAll, "")
|
||||
storeMapList, err := GetStoresMapList(db, nil, storeIDs, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1534,15 +1537,39 @@ func UpdateJdsWareID(db *DaoDB, storeSkuSyncInfo *StoreSkuSyncInfo) (err error)
|
||||
return err
|
||||
}
|
||||
|
||||
func GetStoreSkuAudit(db *DaoDB, storeIDs, nameIDs, skuIDs []int, status int, name, remark string, applyTimeStart, applyTimeEnd, auditTimeStart, auditTimeEnd time.Time, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) {
|
||||
var requestList []*model.StoreSkuAudit
|
||||
type tStoreSkuAudit struct {
|
||||
model.StoreSkuAudit
|
||||
SkuName string `orm:"size(255)" json:"skuName"`
|
||||
StoreName string `json:"storeName"`
|
||||
Prefix string `orm:"size(255)" json:"prefix"`
|
||||
Unit string `orm:"size(8)" json:"unit"`
|
||||
SpecQuality float32 `json:"-"` // 为份必然为500,这个主要作用只是用于确保SkuName的唯一性
|
||||
SpecUnit string `orm:"size(8)" json:"-"` // 为份必然为克,这个主要作用只是用于确保SkuName的唯一性
|
||||
Img string `orm:"size(512)" json:"img"`
|
||||
Name string `json:"name"`
|
||||
MidUnitPrice int `json:"midUnitPrice"`
|
||||
CityName string `json:"cityName"`
|
||||
PayPercentage int `json:"payPercentage"`
|
||||
}
|
||||
|
||||
func GetStoreSkuAudit(db *DaoDB, storeIDs, nameIDs, skuIDs, statuss, types []int, name, remark, keyword, marketManPhone, cityName string, applyTimeStart, applyTimeEnd, auditTimeStart, auditTimeEnd time.Time, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) {
|
||||
var requestList []*tStoreSkuAudit
|
||||
sql := `
|
||||
SELECT SQL_CALC_FOUND_ROWS a.*
|
||||
FROM store_sku_audit a, user b
|
||||
SELECT SQL_CALC_FOUND_ROWS DISTINCT a.*,
|
||||
c.name sku_name, c.prefix, c.unit, c.spec_quality, c.spec_unit, c.img,
|
||||
d.name store_name, b.name, e.mid_unit_price, f.name city_name, d.pay_percentage
|
||||
FROM store_sku_audit a
|
||||
LEFT JOIN user b ON a.user_id = b.user_id
|
||||
LEFT JOIN sku_name c ON c.id = a.name_id AND c.deleted_at = ?
|
||||
LEFT JOIN store d ON d.id = a.store_id AND d.deleted_at = ?
|
||||
LEFT JOIN place f ON f.code = d.city_code
|
||||
LEFT JOIN price_refer_snapshot e ON e.name_id = c.id AND e.city_code = ? AND e.snapshot_at = ?
|
||||
WHERE a.deleted_at = ?
|
||||
AND a.user_id = b.user_id
|
||||
`
|
||||
sqlParams := []interface{}{utils.DefaultTimeValue}
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue, utils.DefaultTimeValue,
|
||||
0, utils.Time2Date(time.Now().AddDate(0, 0, -1)),
|
||||
utils.DefaultTimeValue}
|
||||
if len(storeIDs) > 0 {
|
||||
sql += " AND a.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
@@ -1551,9 +1578,9 @@ func GetStoreSkuAudit(db *DaoDB, storeIDs, nameIDs, skuIDs []int, status int, na
|
||||
sql += " AND a.name_id IN (" + GenQuestionMarks(len(nameIDs)) + ")"
|
||||
sqlParams = append(sqlParams, nameIDs)
|
||||
}
|
||||
if status != model.StoreAuditStatusAll {
|
||||
sql += " AND a.status = ? "
|
||||
sqlParams = append(sqlParams, status)
|
||||
if len(statuss) > 0 {
|
||||
sql += " AND a.status IN (" + GenQuestionMarks(len(statuss)) + ")"
|
||||
sqlParams = append(sqlParams, statuss)
|
||||
}
|
||||
if remark != "" {
|
||||
sql += " AND a.remark LIKE ? "
|
||||
@@ -1571,7 +1598,23 @@ func GetStoreSkuAudit(db *DaoDB, storeIDs, nameIDs, skuIDs []int, status int, na
|
||||
sql += " AND a.updated_at BETWEEN ? AND ?"
|
||||
sqlParams = append(sqlParams, applyTimeStart, applyTimeEnd)
|
||||
}
|
||||
sql += "LIMIT ? OFFSET ?"
|
||||
if len(types) > 0 {
|
||||
sql += " AND a.type IN (" + GenQuestionMarks(len(types)) + ")"
|
||||
sqlParams = append(sqlParams, types)
|
||||
}
|
||||
if keyword != "" {
|
||||
sql += " AND (b.name LIKE ? OR a.remark LIKE ? OR a.name_id LIKE ? OR a.user_id LIKE ? OR a.store_id LIKE ? OR f.name LIKE ?)"
|
||||
sqlParams = append(sqlParams, "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%")
|
||||
}
|
||||
if marketManPhone != "" {
|
||||
sql += " AND d.market_man_phone LIKE ? "
|
||||
sqlParams = append(sqlParams, "%"+marketManPhone+"%")
|
||||
}
|
||||
if cityName != "" {
|
||||
sql += " AND f.name LIKE ? "
|
||||
sqlParams = append(sqlParams, "%"+cityName+"%")
|
||||
}
|
||||
sql += " ORDER BY a.updated_at DESC LIMIT ? OFFSET ?"
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
Begin(db)
|
||||
@@ -1584,3 +1627,26 @@ func GetStoreSkuAudit(db *DaoDB, storeIDs, nameIDs, skuIDs []int, status int, na
|
||||
}
|
||||
return pagedInfo, err
|
||||
}
|
||||
|
||||
func GetStoreSkuAuditLight(db *DaoDB, storeIDs, nameIDs []int, status int) (storeSkuAudit []*model.StoreSkuAudit, err error) {
|
||||
sql := `
|
||||
SELECT a.*
|
||||
FROM store_sku_audit a
|
||||
WHERE a.deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{utils.DefaultTimeValue}
|
||||
if len(storeIDs) > 0 {
|
||||
sql += " AND a.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
}
|
||||
if len(nameIDs) > 0 {
|
||||
sql += " AND a.name_id IN (" + GenQuestionMarks(len(nameIDs)) + ")"
|
||||
sqlParams = append(sqlParams, nameIDs)
|
||||
}
|
||||
if status != model.StoreAuditStatusAll {
|
||||
sql += " AND a.status = ? "
|
||||
sqlParams = append(sqlParams, status)
|
||||
}
|
||||
err = GetRows(db, &storeSkuAudit, sql, sqlParams...)
|
||||
return storeSkuAudit, err
|
||||
}
|
||||
|
||||
@@ -187,7 +187,8 @@ type SkuName struct {
|
||||
// JdSyncStatus int8 `orm:"default(2)" json:"jdSyncStatus"`
|
||||
|
||||
// LinkID int `orm:"column(link_id);null;index" json:"linkID"`
|
||||
YbNameSuffix string `json:"ybNameSuffix"` //银豹商品后缀
|
||||
YbNameSuffix string `json:"ybNameSuffix"` //银豹商品后缀
|
||||
JdsStockSwitch int8 `orm:"default(1)" json:"jdsStockSwitch"`
|
||||
}
|
||||
|
||||
func (*SkuName) TableUnique() [][]string {
|
||||
|
||||
@@ -25,6 +25,11 @@ const (
|
||||
StoreAuditStatusAll = -9
|
||||
)
|
||||
|
||||
const (
|
||||
StoreSkuAuditTypePrice = 1 //改价
|
||||
StoreSkuAuditTypeFocus = 2 //关注
|
||||
)
|
||||
|
||||
const (
|
||||
MainSubStoreName = "本店"
|
||||
MainSubStoreAddress = "本店"
|
||||
|
||||
@@ -20,8 +20,8 @@ const (
|
||||
|
||||
const (
|
||||
RequestStatusNew = 0
|
||||
RequestStatusRejected = 1
|
||||
RequestStatusAccepted = 2
|
||||
RequestStatusRejected = -1
|
||||
RequestStatusAccepted = 1
|
||||
RequestStatusCanceled = 3
|
||||
)
|
||||
|
||||
@@ -202,19 +202,13 @@ type StoreSkuAudit struct {
|
||||
Status int8 `json:"status"` //
|
||||
UserID string `orm:"size(48);column(user_id)" json:"userID"`
|
||||
OriginUnitPrice int `json:"originPrice"` // 表示原价
|
||||
UnitPrice int `json:"unitPrice"`
|
||||
UnitPrice int `json:"unitPrice"` //老板申请的审核价格
|
||||
AuditPrice int `json:"auditPrice"` //运营录入的审核价格
|
||||
Remark string `orm:"size(255)" json:"remark"`
|
||||
}
|
||||
|
||||
func (*StoreSkuAudit) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"StoreID", "Type", "NameID", "DeletedAt"},
|
||||
}
|
||||
}
|
||||
|
||||
func (*StoreSkuAudit) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"DeletedAt"},
|
||||
[]string{"StoreID", "Status", "Type"},
|
||||
[]string{"StoreID", "Type", "NameID", "Status", "DeletedAt"},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user