This commit is contained in:
苏尹岚
2020-10-12 17:19:40 +08:00
parent 9b62c93016
commit 49c149c531
7 changed files with 135 additions and 261 deletions

View File

@@ -1,261 +0,0 @@
package model
import (
"time"
"git.rosy.net.cn/baseapi/utils"
)
const (
ActTypeAll = -1
ActSkuFake = 0 // 假活动,只用于存储活动结算信息
ActSkuDirectDown = 3 // 直降
ActSkuSecKill = 4 // 秒杀
ActSkuDiscount = 5 // 折扣
ActDiscountTypePrice = 1 //折扣类型是最低价
ActDiscountTypePercentage = 2 //折扣类型是最低折扣
TrendTypeUp = 1 //涨价趋势
TrendTypeDown = 2 //降价趋势
TrendTypeNothing = 0 //不变
ActOrderBegin = 10
ActOrderMoneyOff = 11
ActOrderMoneyOffCoupon = 12
ActOrderReduceFreight = 13
ActOrderReduceFreightCoupon = 14
)
const (
ActStatusNA = 0 // 未知
ActStatusCreated = 1 // 需同步
ActStatusCanceled = 2 // 需同步
ActStatusEnded = 3 // 不需要同步,根据活动时间自动刷新的
ActCreateTypeAPI = 1
ActCreateTypeCallback = 2
ActCreateTypeSpider = 3
OverlapRuleNormal = 0 // 不允许重叠(重叠会报错)
OverlapRuleReplace = 1 // 相同活动类型,或秒杀替换直降
)
var (
ActTypeName = map[int]string{
ActSkuFake: "结算",
ActSkuDirectDown: "直降",
ActSkuSecKill: "秒杀",
ActSkuDiscount: "折扣",
}
ActStatusName = map[int]string{
ActStatusNA: "未知",
ActStatusCreated: "正常",
ActStatusCanceled: "取消",
ActStatusEnded: "结束",
}
ActCreateTypeName = map[int]string{
ActCreateTypeAPI: "API",
ActCreateTypeCallback: "回调",
ActCreateTypeSpider: "网页",
}
)
type Act struct {
ModelIDCULD
Name string `orm:"size(64)" json:"name"`
Advertising string `orm:"size(255)" json:"advertising"`
Type int `json:"type"`
Status int `json:"status"`
LimitUser int `json:"limitUser"` // 是否按用户限制
LimitDaily int `json:"limitDaily"` // 每日限购单数
LimitCount int `json:"limitCount"` // 每单限购数量
Source string `orm:"size(255)" json:"source"`
CreateType int `json:"createType"`
IsSpecial int8 `json:"isSpecial"` // 是否是特殊绑定活动
OverlapRule int `json:"overlapRule"`
PricePercentage int `json:"pricePercentage"` // 单品级活动才有效
BeginAt time.Time `orm:"type(datetime);index" json:"beginAt"`
EndAt time.Time `orm:"type(datetime);index" json:"endAt"`
VendorMask int `json:"-"`
Remark string `orm:"size(255)" json:"remark"`
DiscountType int `json:"discountType"` //折扣类型1为最低价2为最低折扣
DiscountValue1 int `json:"DiscountValue1"` //第一档折扣
DiscountValue2 int `json:"DiscountValue2"` //第二档折扣
}
// test
func (*Act) TableUnique() [][]string {
return [][]string{
[]string{"Name", "Type", "DeletedAt"},
}
}
type ActMap struct {
ModelIDCULD
ActID int `orm:"column(act_id)" json:"actID"`
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
VendorActID string `orm:"column(vendor_act_id);size(48)" json:"vendorActID"`
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
Remark string `orm:"size(1024)" json:"remark"`
}
func (*ActMap) TableUnique() [][]string {
return [][]string{
[]string{"ActID", "VendorID", "DeletedAt"},
}
}
func (*ActMap) TableIndex() [][]string {
return [][]string{
[]string{"VendorActID", "VendorID", "DeletedAt"}, // 饿百美团活动的VendorActID统一为空不能设置为唯一索引
}
}
// 不建表
type Act2 struct {
MapID int `orm:"column(map_id)"`
Act
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
VendorActID string `orm:"column(vendor_act_id);size(48)" json:"vendorActID"`
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
}
func (a *Act2) GetRealActName() string {
if IsSyncStatusNeedCreate(a.SyncStatus) {
return a.Name
}
return a.Name + "_" + utils.Int64ToStr(time.Now().Unix())
}
type ActOrderRule struct {
ModelIDCULD
ActID int `orm:"column(act_id)" json:"actID"`
SalePrice int64 `orm:"" json:"salePrice"` // 满的价格
DeductPrice int64 `orm:"" json:"deductPrice"` // 减的价格
}
type ActStoreSku struct {
ModelIDCULD
ActID int `orm:"column(act_id)" json:"actID"`
OriginalPrice int64 `orm:"" json:"originalPrice"` // 单品级活动用,创建活动时商品的原始京西价
// 以下字段API中有效
StoreID int `orm:"column(store_id)" json:"storeID"`
SkuID int `orm:"column(sku_id)" json:"skuID"`
PricePercentage int `orm:"" json:"pricePercentage"` // 单品级活动用SKU级的价格比例非0覆盖Act中的PricePercentage
ActPrice int64 `orm:"" json:"actPrice"` // 单品级活动用SKU级指定的价格非0覆盖CustomPricePercentage与Act中的PricePercentage
EarningPrice int64 `json:"earningPrice"` // 活动商品设置,结算给门店老板的钱
Stock int `orm:"" json:"stock"` // 活动库存
}
func (*ActStoreSku) TableUnique() [][]string {
return [][]string{
[]string{"ActID", "StoreID", "SkuID", "DeletedAt"},
}
}
type ActStoreSkuMap struct {
ModelIDCULD
BindID int `orm:"column(bind_id)" json:"bindID"`
ActID int `orm:"column(act_id)" json:"actID"`
StoreID int `orm:"column(store_id)" json:"storeID"`
SkuID int `orm:"column(sku_id)" json:"skuID"`
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorActID string `orm:"column(vendor_act_id);size(48)" json:"vendorActID"`
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
VendorPrice int64 `json:"vendorPrice"` // 创建活动时的平台价格
ActualActPrice int64 `json:"actualActPrice"` // 单品级活动用,创建活动时商品的活动价格
EarningPrice int64 `json:"earningPrice"` // 活动商品设置,结算给门店老板的钱
TrendType int `json:"trendType"` //折扣活动使用涨跌趋势1为涨2为跌0为不动
TrendPrice int `json:"trendPrice"` //涨跌具体多少
}
func (*ActStoreSkuMap) TableUnique() [][]string {
return [][]string{
[]string{"ActID", "BindID", "VendorID"},
}
}
func (*ActStoreSkuMap) TableIndex() [][]string {
return [][]string{
[]string{"ActID", "StoreID", "SkuID", "VendorID", "DeletedAt"},
}
}
// 不建表
type ActStoreSku2 struct {
MapID int `orm:"column(map_id)"`
Type int `json:"type"`
DiscountType int `json:"discountType"`
DiscountValue1 int `json:"discountValue1"`
DiscountValue2 int `json:"discountValue2"`
ActStoreSku
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorActID string `orm:"column(vendor_act_id);size(48)" json:"vendorActID"`
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
VendorPrice int64 `json:"vendorPrice"` // 创建活动时的平台价格
ActualActPrice int64 `json:"actualActPrice"` // 单品级活动用,创建活动时商品的活动价格
VendorStoreID string `orm:"column(vendor_store_id)" json:"vendorStoreID"`
StoreName string `json:"storeName"`
VendorSkuID string `orm:"column(vendor_sku_id)" json:"vendorSkuID"`
SkuName string `json:"skuName"`
Prefix string `json:"-"`
ExPrefix string
ExPrefixBegin *time.Time
ExPrefixEnd *time.Time
SkuNameName string `orm:"column(sku_name_name)" json:"-"`
Unit string `orm:"size(8)" json:"-"`
SpecQuality float32 `json:"-"`
SpecUnit string `json:"-"`
Comment string `json:"-"`
TrendType int `json:"trendType"` //折扣活动使用涨跌趋势1为涨2为跌0为不动
TrendPrice int `json:"trendPrice"` //涨跌具体多少
}
type StoreSkuAct struct {
ModelIDCUL
StoreID int `orm:"column(store_id)"`
SkuID int `orm:"column(sku_id);index"`
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
ActPercentage int `json:"actPercentage"` // 直降活动百分比
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
// ActID int `orm:"column(act_id);index" json:"actID"`
VendorActID string `orm:"column(vendor_act_id);size(48);index" json:"vendorActID"`
HintActID int `orm:"column(hint_act_id);size(48);index" json:"hintActID"`
VendorActPrice int64 `json:"vendorActPrice"` // 保存数据用,实际的活动价
Remark string `orm:"column(remark);size(1024)" json:"remark"`
// EarningActID int `orm:"column(earning_act_id);index" json:"earningActID"`
// EarningPrice int64 `json:"earningPrice"`
}
func (*StoreSkuAct) TableUnique() [][]string {
return [][]string{
[]string{"StoreID", "SkuID", "VendorID"},
}
}

View File

@@ -0,0 +1,12 @@
package legacymodel
import "time"
type BlackClient struct {
ID int `orm:"column(id)"`
Mobile string `orm:"size(16);unique"`
Name string `orm:"size(8)"`
Note string `orm:"size(256)"`
CreatedAt time.Time `orm:"auto_now_add;type(datetime);null"`
UpdatedAt time.Time `orm:"auto_now;type(datetime);null"`
}

View File

@@ -0,0 +1,9 @@
package legacymodel
type Config struct {
Id int
Thirdparty string `orm:"size(20);unique" json:"key"`
Token string `orm:"size(300)" json:"value"`
Date string `orm:"size(30)" json:"date"`
LastOperator string `orm:"size(32)" json:"lastOperator"` // 最后操作员
}

View File

@@ -0,0 +1,14 @@
package legacymodel
import "git.rosy.net.cn/jx-callback/business/model"
type EbaiShopLicence struct {
model.ModelIDCUL
ShopName string
Licence string
Address string
Owner string
Tel string
LicenceName string
}

View File

@@ -0,0 +1,56 @@
package legacymodel
import "time"
type JxBadComments struct {
Id int `json:"id" orm:"column(id)"`
CreatedAt time.Time `orm:"auto_now_add;type(datetime);null" json:"createdAt"`
OrderId string `json:"order_id" orm:"column(order_id);size(25);unique" description:"订单ID"`
Jxstoreid string `json:"jxstoreid" orm:"column(jxstoreid);size(11);index" description:"京西门店ID"`
Userphone string `json:"userPhone" orm:"column(userphone);size(255);null" description:"评价的用户的联系方式"`
Status int `json:"status" orm:"column(status)" description:"当前评论的状态(0:未解决 1:已解决)"`
Maxmodifytime int `json:"maxModifyTime" orm:"column(maxmodifytime);null" description:"评论可修改的最大时间"`
OrderFlag string `json:"order_flag" orm:"column(order_flag);size(255);null" description:"订单类别(0:京东 1:美团 2:饿了么)"`
Createtime string `json:"createTime" orm:"column(createtime);size(255);null;index" description:"评论的创建时间"`
Score int `json:"score4" orm:"column(score)" description:"评论的星级"`
Scorecontent string `json:"score4Content" orm:"column(scorecontent);size(255);null" description:"评论的内容"`
Vendertags string `json:"venderTags" orm:"column(vendertags);size(255);null" description:"评论的标签"`
Msg string `json:"-" orm:"column(msg);type(text)" description:"未解决差评的原始信息"`
Updatetime string `json:"updateTime" orm:"column(updatetime);size(255);null" description:"评论的修改时间"`
UpdatedScore int `json:"updatedScore" orm:"column(updated_score);null" description:"更改后的分数"`
UpdatedScorecontent string `json:"updatedScoreContent" orm:"column(updated_scorecontent);size(255);null" description:"更改后的评论信息"`
UpdatedVendertags string `json:"updatedVenderTags" orm:"column(updated_vendertags);size(255);null" description:"更改后的标签信息"`
UpdatedMsg string `json:"-" orm:"column(updated_msg);type(text);null" description:"解决后的差评的原始信息"`
LastPushTime string `json:"-" orm:"column(last_push_time);size(255);null" description:"上一次推送的时间"`
PushNo int `json:"-" orm:"column(push_no);null" description:"推送次数"`
}
func (*JxBadComments) TableName() string {
return "jx_bad_comments"
}
// type JxBadComments2 struct {
// Id int `json:"id" orm:"column(id)"`
// CreatedAt time.Time `orm:"auto_now_add;type(datetime);null" json:"createdAt"`
// OrderId string `json:"order_id" orm:"column(order_id);size(25);unique" description:"订单ID"`
// Jxstoreid string `json:"jxstoreid" orm:"column(jxstoreid);size(11);index" description:"京西门店ID"`
// Userphone string `json:"userPhone" orm:"column(userphone);size(255);null" description:"评价的用户的联系方式"`
// Status int `json:"status" orm:"column(status)" description:"当前评论的状态(0:未解决 1:已解决)"`
// Createtime string `json:"createTime" orm:"column(createtime);size(255);null" description:"评论的创建时间"`
// Maxmodifytime int `json:"maxModifyTime" orm:"column(maxmodifytime);null" description:"评论可修改的最大时间"`
// Score int `json:"score4" orm:"column(score)" description:"评论的星级"`
// Scorecontent string `json:"score4Content" orm:"column(scorecontent);size(255);null" description:"评论的内容"`
// Vendertags string `json:"venderTags" orm:"column(vendertags);size(255);null" description:"评论的标签"`
// Updatetime string `json:"updateTime" orm:"column(updatetime);size(255);null" description:"评论的修改时间"`
// UpdatedScore int `json:"updatedScore" orm:"column(updated_score);null" description:"更改后的分数"`
// UpdatedScorecontent string `json:"updatedScoreContent" orm:"column(updated_scorecontent);size(255);null" description:"更改后的评论信息"`
// UpdatedVendertags string `json:"updatedVenderTags" orm:"column(updated_vendertags);size(255);null" description:"更改后的标签信息"`
// OrderFlag string `json:"order_flag" orm:"column(order_flag);size(255);null" description:"订单类别(0:京东 1:美团 2:饿了么)"`
// Msg string `json:"-" orm:"column(msg);type(text)" description:"未解决差评的原始信息"`
// UpdatedMsg string `json:"-" orm:"column(updated_msg);type(text);null" description:"解决后的差评的原始信息"`
// LastPushTime string `json:"-" orm:"column(last_push_time);size(255);null" description:"上一次推送的时间"`
// PushNo int `json:"-" orm:"column(push_no);null" description:"推送次数"`
// }

View File

@@ -0,0 +1,23 @@
package legacymodel
import "time"
type StoreBill struct {
Id int `orm:"column(id);auto" json:"id"`
Date time.Time `orm:"column(date);type(datetime)" json:"date"`
Url string `orm:"column(url);size(255)" json:"url"`
StoreId int `orm:"column(store_id)" json:"storeId"`
BillName string `orm:"column(bill_name);size(30)" json:"billName"`
ShopName string `orm:"size(30)" json:"shopName"`
BillTitle string `orm:"size(255)" json:"billTitle"`
}
func (t *StoreBill) TableName() string {
return "store_bill"
}
func (*StoreBill) TableIndex() [][]string {
return [][]string{
[]string{"StoreId", "Date"},
}
}

View File

@@ -0,0 +1,21 @@
package legacymodel
import "time"
type WeiXins struct {
ID int `orm:"column(id)" json:"id"`
CreatedAt time.Time `orm:"auto_now_add;type(datetime);null" json:"createdAt"`
UpdatedAt time.Time `orm:"auto_now;type(datetime);null" json:"updatedAt"`
LastOperator string `orm:"size(32)" json:"lastOperator"` // 最后操作员
JxStoreID int `orm:"column(jxstoreid);index" json:"storeID"`
OpenID string `orm:"column(openid);size(70);unique;null" json:"openID"`
OpenIDMini string `orm:"column(openid_mini);size(70);unique;null" json:"openIDMini"`
OpenIDUnion string `orm:"column(openid_union);size(70);unique;null" json:"openIDUnion"`
Tel string `orm:"size(15);null;unique" json:"tel"`
ParentID int `orm:"column(parentid);default(-1);index" json:"parentID"`
NickName string `orm:"column(nickname);size(30)" json:"nickname"`
}
func (*WeiXins) TableName() string {
return "weixins"
}