This commit is contained in:
邹宗楠
2026-03-30 09:11:19 +08:00
parent af8e4a2b74
commit 9c106cd511
4 changed files with 110 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
package dao
import (
"git.rosy.net.cn/jx-callback/business/model"
"time"
)
// StoreInformationStatistics 门店信息统计
func StoreInformationStatistics() (result []*model.EffectiveStores, err error) {
sql := `
SELECT
gs.jx_store_id,
MAX(sm.vendor_org_code) AS vendor_org_code,
MAX(sm.vendor_store_id) AS vendor_store_id,
MAX(sm.mtwm_token) AS mtwm_token
FROM goods_order gs
LEFT JOIN store_map sm ON gs.jx_store_id = sm.store_id AND gs.vendor_id = sm.vendor_id
WHERE gs.order_created_at >= ?
AND gs.vendor_id = ?
GROUP BY gs.jx_store_id;
`
parma := []interface{}{time.Now().AddDate(0, -1, 0), model.VendorIDMTWM}
if err = GetRows(GetDB(), &result, sql, parma...); err != nil {
return nil, err
}
return
}

View File

@@ -0,0 +1,31 @@
package model
type ActivityStation struct {
ModelIDCUL
StoreID int `orm:"column(store_id);size(16)" json:"store_id"` // 门店ID
VendorID int `orm:"column(vendor_id);size(2)" json:"vendor_id"` // 平台ID
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendor_store_id"` // 平台门店ID
BrandID string `orm:"column(brand_id);size(16)" json:"brand_id"` // 品牌ID
Activity1 int64 `orm:"column(activity_1);size(16)" json:"activity_1"` // 活动0-3折商品数量
Activity2 int64 `orm:"column(activity_2);size(16)" json:"activity_2"` // 活动3-9折商品数量
Activity int64 `orm:"column(activity);size(16)" json:"activity"` // 总的活动数量
StoreSkuNum int64 `orm:"column(store_sku_num);size(48)" json:"store_sku_num"` // 门店商品数量
StoreRating string `orm:"column(store_rating);size(16)" json:"store_rating"` // 评分
DeliveryFee string `orm:"column(delivery_fee);size(4)" json:"delivery_fee"` // 超过1.5km起送价不大于20
DeliveryFee2 string `orm:"column(delivery_fee2);size(4)" json:"delivery_fee2"` // 超过1.5km配送费不大于0
PromotionFee string `orm:"column(promotion_fee);size(4)" json:"promotion_fee"` // 推广费超过三十五元
BusinessHours string `orm:"column(business_hours);size(4)" json:"business_hours"` // 营业时间超过11小时
}
type EffectiveStores struct {
JxStoreID int `orm:"column(jx_store_id)" json:"jxStoreID"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid
VendorOrgCode string `orm:"column(vendor_org_code);size(64)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
VendorStoreID string `orm:"column(vendor_store_id);size(64)" json:"vendorStoreID"` // 同一平台下不同的商户代码,如果只有一个,可以为空
MtwmToken string `orm:"column(mtwm_token);size(512)" json:"mtwmToken"` //美团外卖商超token有效期30天每20天刷一次
}
func (o *ActivityStation) TableIndex() [][]string {
return [][]string{
[]string{"CreatedAt"},
[]string{"StoreID"},
}
}