Merge remote-tracking branch 'origin/mark' into don
This commit is contained in:
@@ -3,8 +3,8 @@ package model
|
||||
type CasbinRule struct {
|
||||
ID int `orm:"column(id)" json:"id"`
|
||||
PType string
|
||||
V0 string
|
||||
V1 string
|
||||
V0 string `orm:"index"`
|
||||
V1 string `orm:"index"`
|
||||
V2 string
|
||||
V3 string
|
||||
V4 string
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
package model
|
||||
|
||||
import "strings"
|
||||
|
||||
const (
|
||||
ImgTypeLocal = 0 // 京西自己用的,不需要上传至平台
|
||||
ImgTypeMain = 1 // 商品主图
|
||||
ImgTypeDesc = 2 // 商品描述详情
|
||||
|
||||
MimeTypeJpeg = "image/jpeg"
|
||||
MimeTypePng = "image/png"
|
||||
)
|
||||
|
||||
var (
|
||||
ValidMimeTypes = map[string][]string{
|
||||
"image/jpeg": []string{"jpeg", "jpg"},
|
||||
"image/png": []string{"png"},
|
||||
// "image/gif": []string{"gif"}, // 美团不支持GIF
|
||||
|
||||
"video/mpeg": []string{"mpeg", "mpg"},
|
||||
"video/mp4": []string{"mp4", "m4v"},
|
||||
ValidMimeTypes = map[string]int{
|
||||
MimeTypeJpeg: 1,
|
||||
MimeTypePng: 1,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -33,3 +34,11 @@ type DataResource struct {
|
||||
|
||||
Remark string `orm:"size(1024)" json:"remark"`
|
||||
}
|
||||
|
||||
func GetValidMimeTypeDesc() (desc string) {
|
||||
strList := []string{}
|
||||
for k := range ValidMimeTypes {
|
||||
strList = append(strList, k)
|
||||
}
|
||||
return strings.Join(strList, ",")
|
||||
}
|
||||
|
||||
@@ -150,13 +150,14 @@ func GetStoresOrderSaleInfo(db *DaoDB, storeIDList []int, fromTime time.Time, to
|
||||
}
|
||||
|
||||
// 用int64类型去取float型的数据库返回值,会取不到
|
||||
// order_finished_at
|
||||
sql := fmt.Sprintf(`
|
||||
SELECT IF(t1.jx_store_id > 0, t1.jx_store_id, t1.store_id) store_id, t1.vendor_id, IF(t1.status < ?, 0, t1.status) status,
|
||||
COUNT(*) count, SUM(t1.shop_price) shop_price, SUM(t1.vendor_price) vendor_price, SUM(t1.sale_price) sale_price, SUM(t1.actual_pay_price) actual_pay_price,
|
||||
CAST(SUM(IF(t1.earning_price <> 0, t1.earning_price, IF(t1.shop_price <> 0 && t1.shop_price < t1.sale_price, t1.shop_price, t1.sale_price) * IF(t5.pay_percentage > 0, t5.pay_percentage, %d) / 100)) AS SIGNED) earning_price
|
||||
FROM goods_order t1
|
||||
LEFT JOIN store t5 ON t5.id = IF(t1.jx_store_id <> 0, t1.jx_store_id, t1.store_id)
|
||||
WHERE t1.order_finished_at >= ? AND t1.order_finished_at <= ?
|
||||
WHERE t1.order_created_at >= ? AND t1.order_created_at <= ?
|
||||
`, model.DefaultEarningPricePercentage)
|
||||
sqlParams := []interface{}{
|
||||
model.OrderStatusEndBegin,
|
||||
@@ -228,6 +229,7 @@ func GetAfsOrderSkuInfo(db *DaoDB, vendorOrderID, afsOrderID string, vendorID in
|
||||
}
|
||||
|
||||
func GetStoreOrderSkuList(db *DaoDB, storeIDs []int, finishedAtBegin, finishedAtEnd time.Time, statusList []int) (skuList []*OrderSkuWithActualPayPrice, err error) {
|
||||
// order_finished_at
|
||||
sql := `
|
||||
SELECT t1.*,
|
||||
t2.actual_pay_price, t2.status, IF(t2.jx_store_id > 0, t2.jx_store_id, t2.store_id) store_id,
|
||||
@@ -235,12 +237,15 @@ func GetStoreOrderSkuList(db *DaoDB, storeIDs []int, finishedAtBegin, finishedAt
|
||||
FROM order_sku t1
|
||||
JOIN goods_order t2 ON t2.vendor_order_id = t1.vendor_order_id AND t2.vendor_id = t1.vendor_id
|
||||
LEFT JOIN store t3 ON t3.id = IF(t2.jx_store_id > 0, t2.jx_store_id, t2.store_id)
|
||||
WHERE IF(t2.jx_store_id > 0, t2.jx_store_id, t2.store_id) IN (` + GenQuestionMarks(len(storeIDs)) + `) AND t2.order_finished_at >= ? AND t2.order_finished_at <= ?`
|
||||
WHERE t2.order_created_at >= ? AND t2.order_created_at <= ?`
|
||||
sqlParams := []interface{}{
|
||||
storeIDs,
|
||||
finishedAtBegin,
|
||||
finishedAtEnd,
|
||||
}
|
||||
if len(storeIDs) > 0 {
|
||||
sql += " AND IF(t2.jx_store_id > 0, t2.jx_store_id, t2.store_id) IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
}
|
||||
if len(statusList) > 0 {
|
||||
sql += " AND t2.status IN (" + GenQuestionMarks(len(statusList)) + ")"
|
||||
sqlParams = append(sqlParams, statusList)
|
||||
@@ -276,13 +281,15 @@ func GetStoreAfsOrderSkuList(db *DaoDB, storeIDs []int, finishedAtBegin, finishe
|
||||
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
|
||||
WHERE t1.is_afs_order = 1
|
||||
AND IF(t2.jx_store_id > 0, t2.jx_store_id, t2.store_id) IN (` + GenQuestionMarks(len(storeIDs)) + `) AND t2.afs_finished_at >= ? AND t2.afs_finished_at <= ?`
|
||||
WHERE t1.is_afs_order = 1 AND t2.afs_finished_at >= ? AND t2.afs_finished_at <= ?`
|
||||
sqlParams := []interface{}{
|
||||
storeIDs,
|
||||
finishedAtBegin,
|
||||
finishedAtEnd,
|
||||
}
|
||||
if len(storeIDs) > 0 {
|
||||
sql += " AND IF(t2.jx_store_id > 0, t2.jx_store_id, t2.store_id) IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
}
|
||||
if len(statusList) > 0 {
|
||||
sql += " AND t2.status IN (" + GenQuestionMarks(len(statusList)) + ")"
|
||||
sqlParams = append(sqlParams, statusList)
|
||||
|
||||
@@ -99,7 +99,7 @@ func GetStoreListByMobile(db *DaoDB, mobile string) (storeList []*StoreWithCityN
|
||||
FROM (
|
||||
SELECT *
|
||||
FROM store t1
|
||||
WHERE (t1.market_man_phone = ? OR t1.operator_phone = ?)
|
||||
WHERE (t1.market_man_phone = ? OR t1.operator_phone = ? OR t1.operator_phone2 = ?)
|
||||
UNION DISTINCT
|
||||
SELECT t1.*
|
||||
FROM store t1
|
||||
@@ -111,6 +111,7 @@ func GetStoreListByMobile(db *DaoDB, mobile string) (storeList []*StoreWithCityN
|
||||
WHERE t1.deleted_at = ?
|
||||
ORDER BY t1.name`
|
||||
sqlParams := []interface{}{
|
||||
mobile,
|
||||
mobile,
|
||||
mobile,
|
||||
mobile,
|
||||
@@ -132,8 +133,8 @@ func GetStoreListByMobileOrStoreIDs(db *DaoDB, mobile string, shortRoleNameList
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if mobile != "" {
|
||||
sql += " OR t1.market_man_phone = ? OR t1.operator_phone = ?"
|
||||
sqlParams = append(sqlParams, mobile, mobile)
|
||||
sql += " OR t1.market_man_phone = ? OR t1.operator_phone = ? OR t1.operator_phone2 = ?"
|
||||
sqlParams = append(sqlParams, mobile, mobile, mobile)
|
||||
}
|
||||
if len(shortRoleNameList) > 0 {
|
||||
questionMarks := GenQuestionMarks(len(shortRoleNameList))
|
||||
|
||||
@@ -47,6 +47,12 @@ type StoreDetail2 struct {
|
||||
CityName string `json:"cityName"`
|
||||
}
|
||||
|
||||
type CityBrankBranch struct {
|
||||
CityCode int
|
||||
PayeeBankBranchName string `orm:"size(255)" json:"payeeBankBranchName"` // 开户支行
|
||||
PayeeBankCode string `orm:"size(8)" json:"payeeBankCode"` // 开户行代码
|
||||
}
|
||||
|
||||
func (s *StoreDetail) GetPricePerentage(price int) (pricePercentage int) {
|
||||
return pricePercentage
|
||||
}
|
||||
@@ -484,3 +490,26 @@ func GetStoreList(db *DaoDB, idList []int, mobileList []string, shortRoleName st
|
||||
err = GetRows(db, &storeList, sql, sqlParams...)
|
||||
return storeList, err
|
||||
}
|
||||
|
||||
func GetCityBankBranches(db *DaoDB, cityCode int, bankCode string) (list []*CityBrankBranch, err error) {
|
||||
sql := `
|
||||
SELECT payee_bank_code, city_code, payee_bank_branch_name
|
||||
FROM store
|
||||
WHERE payee_bank_branch_name <> ''`
|
||||
sqlParams := []interface{}{}
|
||||
if cityCode > 0 {
|
||||
sql += " AND city_code = ?"
|
||||
sqlParams = append(sqlParams, cityCode)
|
||||
} else {
|
||||
sql += " AND city_code <> 0"
|
||||
}
|
||||
if bankCode != "" {
|
||||
sql += " AND payee_bank_code = ?"
|
||||
sqlParams = append(sqlParams, bankCode)
|
||||
} else {
|
||||
sql += " AND payee_bank_code <> ''"
|
||||
}
|
||||
sql += " GROUP BY 1,2,3;"
|
||||
err = GetRows(db, &list, sql, sqlParams...)
|
||||
return list, err
|
||||
}
|
||||
|
||||
@@ -301,7 +301,9 @@ type Store struct {
|
||||
// OperatorName string `orm:"size(8)" json:"operatorName"` // 运营人姓名
|
||||
OperatorPhone string `orm:"size(16)" json:"operatorPhone"` // 运营人电话
|
||||
OperatorRole string `orm:"size(32)" json:"operatorRole"` // 京东运营人组(角色)
|
||||
OperatorRole2 string `orm:"size(32)" json:"operatorRole2"` // 非京东运营人组(角色)
|
||||
|
||||
OperatorPhone2 string `orm:"size(16)" json:"operatorPhone2"` // 非京东运营人电话
|
||||
OperatorRole2 string `orm:"size(32)" json:"operatorRole2"` // 非京东运营人组(角色)
|
||||
}
|
||||
|
||||
func (*Store) TableUnique() [][]string {
|
||||
|
||||
Reference in New Issue
Block a user