diff --git a/business/model/act.go b/business/model/act.go deleted file mode 100644 index 2eb89d230..000000000 --- a/business/model/act.go +++ /dev/null @@ -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"}, - } -} diff --git a/business/model/casbin_rule.go b/business/model/casbin_rule.go deleted file mode 100644 index 2dcdffcaf..000000000 --- a/business/model/casbin_rule.go +++ /dev/null @@ -1,12 +0,0 @@ -package model - -type CasbinRule struct { - ID int `orm:"column(id)" json:"id"` - PType string - V0 string `orm:"index"` - V1 string `orm:"index"` - V2 string - V3 string - V4 string - V5 string -} diff --git a/business/model/legacymodel/blackclient.go b/business/model/legacymodel/blackclient.go deleted file mode 100644 index 439c477f2..000000000 --- a/business/model/legacymodel/blackclient.go +++ /dev/null @@ -1,12 +0,0 @@ -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"` -} diff --git a/business/model/legacymodel/config.go b/business/model/legacymodel/config.go deleted file mode 100644 index b0ab1ef26..000000000 --- a/business/model/legacymodel/config.go +++ /dev/null @@ -1,9 +0,0 @@ -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"` // 最后操作员 -} diff --git a/business/model/legacymodel/ebaishoplicence.go b/business/model/legacymodel/ebaishoplicence.go deleted file mode 100644 index bfe9dd3d1..000000000 --- a/business/model/legacymodel/ebaishoplicence.go +++ /dev/null @@ -1,14 +0,0 @@ -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 -} diff --git a/business/model/legacymodel/jxbadcomments.go b/business/model/legacymodel/jxbadcomments.go deleted file mode 100644 index b5ab82c35..000000000 --- a/business/model/legacymodel/jxbadcomments.go +++ /dev/null @@ -1,56 +0,0 @@ -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:"推送次数"` -// } diff --git a/business/model/legacymodel/storebill.go b/business/model/legacymodel/storebill.go deleted file mode 100644 index d227e1a9c..000000000 --- a/business/model/legacymodel/storebill.go +++ /dev/null @@ -1,23 +0,0 @@ -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"}, - } -} diff --git a/business/model/legacymodel/weixins.go b/business/model/legacymodel/weixins.go deleted file mode 100644 index 765a2fc33..000000000 --- a/business/model/legacymodel/weixins.go +++ /dev/null @@ -1,21 +0,0 @@ -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" -} diff --git a/business/model/order.go b/business/model/order.go deleted file mode 100644 index eb2b393f1..000000000 --- a/business/model/order.go +++ /dev/null @@ -1,183 +0,0 @@ -package model - -import "time" - -const ( - PayTypeWX = 1 // 微信支付 - PayTypeTL = 2 // 通联宝支付 - - PayStatusNo = 0 - PayStatusYes = 1 - PayStatusFailed = 2 - PayStatusCanceled = 3 - PayStatusRefund = 4 - - RefundStatusNo = 0 - RefundStatusYes = 1 - RefundStatusFailed = 2 - - VendorPayTypeCompanyPay = "companyPay" //企业付款 - VendorPayTypeTransferAccount = "transferAccount" //手动转账 -) - -const ( - OrderTypePay = 1 //支付 - OrderTypeCash = 2 //提现 - - OrderTypePublishJob = 1 //发布任务 - OrderTpyeMember = 2 //充值会员 - OrderTypeDelivery = 3 //发快递 - OrderTpyeDropShipping = 4 //一件代发交钱 -) - -var ( - PayStatusName = map[int]string{ - PayStatusNo: "待支付", - PayStatusYes: "已支付", - PayStatusFailed: "支付失败", - PayStatusCanceled: "支付取消", - PayStatusRefund: "已退款", - } - - RefundStatusName = map[int]string{ - RefundStatusNo: "待退款", - RefundStatusYes: "已退款", - RefundStatusFailed: "退款失败", - } -) - -type Order struct { - ModelIDCUL - - OrderID string `orm:"column(order_id)" json:"orderID"` //订单号 - UserID string `orm:"column(user_id);size(48)" json:"userID"` //用户ID - Type int `json:"type"` - OrderType int `json:"orderType"` //订单类型 - Way string `json:"way"` //weixinapp ,weixinmini - Status int `json:"status"` //订单状态,待支付2,已支付5,支付成功110,支付失败115 - PayPrice int `json:"payPrice"` //支付金额 - TransactionID string `orm:"column(transaction_id);size(48)" json:"transactionID"` // 支付成功后,支付方生成的事务ID - PayFinishedAt time.Time `orm:"type(datetime);null" json:"payFinishedAt"` - PrepayID string `orm:"column(prepay_id);size(48)" json:"prepayID"` // 下单后,支付前,支付方生成的事务ID - OriginalData string `orm:"type(text)" json:"-"` - Comment string `orm:"size(255)" json:"comment"` //备注 - Lng float64 `json:"lng"` - Lat float64 `json:"lat"` - CityCode int `orm:"default(0)" json:"cityCode"` //提交订单时用户所在城市 - DistrictCode int `orm:"default(0)" json:"districtCode"` - Address string `orm:"size(255)" json:"address"` -} - -func (v *Order) TableUnique() [][]string { - return [][]string{ - []string{"OrderID"}, - } -} - -func (v *Order) TableIndex() [][]string { - return [][]string{ - []string{"CreatedAt"}, - []string{"UserID"}, - } -} - -type DeliveryOrder struct { - ModelIDCUL - - VendorWaybillID string `orm:"column(vendor_waybill_id)" json:"vendorWaybillID"` //运单号 - UserID string `orm:"column(user_id);size(48)" json:"userID"` //用户ID - DeliverySendID int `orm:"column(delivery_send_id)" json:"deliverySendID"` //寄件人地址ID - SendName string `json:"sendName"` - SendMobile string `json:"sendMobile"` - SendAddress string `json:"sendAddress"` - SendDetailAddress string `json:"sendDetailAddress"` - SendLng float64 `json:"sendLng"` - SendLat float64 `json:"sendLat"` - SendAutoAddress string `json:"sendAutoAddress"` - SendCityCode int `json:"sendCityCode"` - SendDistrictCode int `json:"sendDistrictCode"` - DeliveryReceiveID int `orm:"column(delivery_receive_id)" json:"deliveryReceiveID"` //取件人地址ID(收货人)\ - ReceiveName string `json:"receiveName"` - ReceiveMobile string `json:"receiveMobile"` - ReceiveAddress string `json:"receiveAddress"` - ReceiveDetailAddress string `json:"receiveDetailAddress"` - ReceiveLng float64 `json:"receiveLng"` - ReceiveLat float64 `json:"receiveLat"` - ReceiveAutoAddress string `json:"receiveAutoAddress"` - ReceiveCityCode int `json:"receiveCityCode"` - ReceiveDistrictCode int `json:"receiveDistrictCode"` - Status int `json:"status"` //运单状态 - PayPrice int `json:"payPrice"` //支付金额 - OrderFinishedAt time.Time `json:"orderFinishedAt"` //订单完成时间 - Weight float64 `json:"weight"` //订单重量,单位kg - Vloumn float64 `json:"vloumn"` //订单体积,单位立方cm - Description string `json:"description"` //订单商品描述 - PickUpStartTime time.Time `json:"pickUpStartTime"` //预约取件开始时间 - PickUpEndTime time.Time `json:"pickUpEndTime"` //预约取件结束时间 - PackageCount int `json:"packageCount"` //包裹数 - ActualWeight float64 `json:"actualWeight"` //实际重量 - IsWeight int `json:"isWeight"` //0代表未验重,1代表验重通过,2代表不通过 - DiffPrice int `json:"diffPrice"` //如果超重了,扣除的差额 - Comment string `orm:"size(255)" json:"comment"` //备注 - JobOrderID string `orm:"column(job_order_id)" json:"jobOrderID"` -} - -func (v *DeliveryOrder) TableUnique() [][]string { - return [][]string{ - []string{"VendorWaybillID"}, - } -} - -func (v *DeliveryOrder) TableIndex() [][]string { - return [][]string{ - []string{"CreatedAt"}, - []string{"UserID"}, - } -} - -//联盟订单 -type UnionOrder struct { - ModelIDCUL - - VendorOrderID string `orm:"column(vendor_order_id)" json:"vendorOrderID"` //订单号 - VendorID int `orm:"column(vendor_id)" json:"vendorID"` //平台ID - UserID string `orm:"column(user_id);size(48)" json:"userID"` //用户ID - Status int `json:"status"` //订单状态 - PayPrice int `json:"payPrice"` //支付金额 - PromotionAmount int `json:"promotionAmount"` //佣金金额 - GoodsName string `orm:"size(255)" json:"goodsName"` //商品名 - GoodsID string `orm:"column(goods_id)" json:"goodsID"` //商品ID - GoodsImg string `json:"goodsImg"` //商品图 - OrderCreateAt time.Time `json:"orderCreateAt"` //下单时间 - OrderPayAt time.Time `json:"orderPayAt"` //支付时间 - OrderReceiveAt time.Time `json:"orderReceiveAt"` //收货时间 - OrderSettleAt time.Time `json:"orderSettleAt"` //结算时间 - PID string `orm:"column(p_id)" json:"pID"` //推广位ID - IsEarning int `json:"isEarning"` //是否结算此订单,1表示已结算了 - Comment string `orm:"size(255)" json:"comment"` //备注 -} - -func (v *UnionOrder) TableUnique() [][]string { - return [][]string{ - []string{"VendorOrderID", "VendorID"}, - } -} - -func (v *UnionOrder) TableIndex() [][]string { - return [][]string{ - []string{"OrderCreateAt"}, - []string{"UserID"}, - } -} - -//联盟订单轨迹 -type UnionOrderStatus struct { - ModelIDCUL - - VendorOrderID string `orm:"column(vendor_order_id)" json:"vendorOrderID"` //订单号 - VendorID int `orm:"column(vendor_id)" json:"vendorID"` //平台ID - Status int `json:"status"` //订单状态 - VendorStatus string `json:"vendorStatus"` //平台状态 - OrderStatusAt time.Time `json:"orderStatusAt"` //更新时间 - Comment string `orm:"size(255)" json:"comment"` //备注 -} diff --git a/business/model/order_financial.go b/business/model/order_financial.go deleted file mode 100644 index 2fd772fa1..000000000 --- a/business/model/order_financial.go +++ /dev/null @@ -1,188 +0,0 @@ -package model - -import "time" - -type OrderFinancial struct { - ModelIDCUL - - VendorID int `orm:"column(vendor_id)" json:"vendorID"` // 平台id - VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 订单ID - VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);index" json:"vendorOrderID2"` // 订单ID2,饿百独有 - // DeliveryConfirmTime time.Time `orm:"type(datetime);index" json:"deliveryConfirmTime"` // 订单妥投/完成时间 - ShopPriceMoney int64 `json:"shopPriceMoney"` // 门店价-左右商品在京西的价格总和(报价模式会用到)0 - SalePriceMoney int64 `json:"salePriceMoney"` // 商品标价总额(用户下单满减之前的商品售价)+ - ActualPayMoney int64 `json:"actualPayMoney"` // 用户实际支付金额0 - TotalDiscountMoney int64 `json:"totalDiscountMoney"` // 订单总优惠(订单主体+运费)- - DiscountMoney int64 `json:"discountMoney"` // 订单主体优惠0 - PointsDeductionMoney int64 `json:"pointsDeductionMoney"` // 积分抵扣金额0 - ReceivableFreight int64 `json:"receivableFreight"` // 订单应收运费0 - FreightMoney int64 `json:"freightMoney"` // 用户支付运费0 - FreightDiscountMoney int64 `json:"freightDiscountMoney"` // 订单运费优惠(商家设置满减discountType == 8)0 - PmFreightDiscountMoney int64 `json:"pmFreightDiscountMoney"` // 订单运费优惠(平台运费优惠discountType == 7/12/15)+ - DistanceFreightMoney int64 `json:"distanceFreightMoney"` // 订单远距离费- - FreightTipsMoney int64 `json:"freightTipsMoney"` // 订单小费- - DonationMoney int64 `json:"donationMoney"` // 公益捐款- - SelfDeliveryDiscountMoney int64 `json:"selfDeliveryDiscountMoney"` // 平台承担运费补贴(商家自送)+ - PmSkuSubsidyMoney int64 `json:"pmSkuSubsidyMoney"` // 平台对单条sku补贴的金额 - PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台活动补贴(订单主体活动补贴+订单单条sku补贴)1+ - BoxMoney int64 `json:"boxMoney"` // order餐盒费1+ - SkuBoxMoney int64 `json:"skuBoxMoney"` // sku餐盒费 - PmMoney int64 `json:"pmMoney"` // 平台费1- - ShopMoney int64 `json:"shopMoney"` // 应结金额-第三方平台结算给京西的金额M - ShopMoneyByCal int64 `json:"shopMoneyByCal"` // 应结金额-通过公式计算平台结给京西的金额M - JxPmMoney int64 `json:"jxPmMoney"` // 京西平台费- - JxFreightMoney int64 `json:"jxFreightMoney"` // 转自送-->美团/达达订单产生运费0 - JxFreightMoneyByShop int64 `json:"jxFreightMoneyByShop"` // 转自送-->美团/达达订单产生运费,由商家承担的部分- - JxSubsidyMoney int64 `json:"jxSubsidyMoney"` // 京西总补贴 - JxSkuSubsidyMoney int64 `json:"jxSkuSubsidyMoney"` // 京西补贴给单条sku的金额 - JxShopMoney int64 `json:"jxShopMoney"` // 店铺应结金额-京西结算给店铺的金额M - DownFlag int8 `json:"downFlag"` // 0--正常单, 1--降级单 - Skus []*OrderSkuFinancial `orm:"-" json:"skus"` // 正向订单购买商品列表 - Discounts []*OrderDiscountFinancial `orm:"-" json:"discounts"` // 正向订单享受优惠列表 -} - -func (o *OrderFinancial) TableUnique() [][]string { - return [][]string{ - []string{"VendorOrderID", "VendorID"}, - } -} - -type OrderDiscountFinancial struct { - ModelIDCUL - - VendorID int `orm:"column(vendor_id)" json:"vendorID"` - VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 订单ID - VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);index" json:"vendorOrderID2"` // 订单ID2,饿百独有 - VendorActivityID string `orm:"column(vendor_activity_id);size(48)" json:"vendorActivityID"` // 活动ID 活动ID的存在,使原本的通过城市/下单时间-活动时间/金额……一系列匹配来确认活动归属的费时且准确度低的行为有了改变的可能--通过编码精确定位 - Type string `orm:"size(48)" json:"type"` // 活动type 美团订单存在不同的活动,活动ID是一样的,type不一样 如订单34399553040365354 - // ActivityName string `orm:"size(255)" json:"activityName"` // 活动名 - // ActivityMoney int64 `json:"activityMoney"` // 优惠金额 - // Remark string `orm:"size(255)" json:"remark"` // 备注 -} - -// 设置主键 "VendorOrderID", "DiscountCode", "VendorID" 一个订单不可能享受同一优惠2次 -func (o *OrderDiscountFinancial) TableUnique() [][]string { - return [][]string{ - []string{"VendorOrderID", "VendorActivityID", "Type", "VendorID"}, - } -} - -type AfsOrder struct { - ModelIDCUL - - VendorID int `orm:"column(vendor_id)" json:"vendorID"` - VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 关联原始订单ID - VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);index" json:"vendorOrderID2"` // 关联原始订单ID2,饿百独有 - AfsOrderID string `orm:"column(afs_order_id);size(48)" json:"afsOrderID"` // 售后订单ID - AfsCreatedAt time.Time `orm:"type(datetime);null;index" json:"afsCreatedAt"` // 售后单生成时间 - AfsFinishedAt time.Time `orm:"type(datetime);null;index" json:"afsFinishedAt"` // 售后单结束时间 - VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"` // 外部系统里记录的storeid - StoreID int `orm:"column(store_id)" json:"storeID"` // 接口返回的京西门店ID - JxStoreID int `orm:"column(jx_store_id)" json:"jxStoreID"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid - - // IsNeedApprove int8 `json:"isNeedApprove"` // 售后单是否需要商家审核 - Status int `json:"status"` - VendorStatus string `orm:"size(255)" json:"vendorStatus"` - ReasonType int8 `json:"reasonType"` // 售后原因 - VendorReasonType string `orm:"size(255)" json:"vendorReasonType"` // 原始售后原因 - ReasonDesc string `orm:"size(1024)" json:"reasonDesc"` // 售后原因描述 - ReasonImgList string `orm:"size(1024)" json:"reasonImgList"` // 售后描述图片 - AppealType int8 `json:"appealType"` // 售后方式 - VendorAppealType string `orm:"size(255)" json:"vendorAppealType"` // 原始售后方式 - Flag int `json:"flag"` - RefundType int8 `json:"refundType"` - RefuseReason string `orm:"size(1024)" json:"refuseReason"` - - SkuUserMoney int64 `json:"skuUserMoney"` // 用户支付菜品金额 - FreightUserMoney int64 `json:"freightUserMoney"` // 用户支付运费金额 - AfsFreightMoney int64 `json:"afsFreightMoney"` // 退货取件费 - BoxMoney int64 `json:"boxMoney"` // 应退包装费金额 - TongchengFreightMoney int64 `json:"tongchengFreightMoney"` // 退货单产生的同城送费用 - SkuBoxMoney int64 `json:"skuBoxMoney"` // 应退订单餐盒费 - PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台总补贴金额 - PmSkuSubsidyMoney int64 `json:"pmSkuSubsidyMoney"` // 平台sku补贴金额 - PmRefundMoney int64 `json:"pmRefundMoney"` // 订单取消后可能存在佣金减少,平台退回部分金额的情况 - RefundMoney int64 `json:"refundMoney"` // 平台扣款总额 1 - RefundMoneyByCal int64 `json:"refundMoneyByCal"` // 平台扣款总额-通过公式计算平台扣除京西的金额M - // JxSkuMoney int64 `json:"jxSkuMoney"` // 京西补贴金额,现阶段是平台扣京西多少钱,京西扣商家多少钱,暂不考虑撤回京西补贴 - Skus []*OrderSkuFinancial `orm:"-" json:"skus"` - VendorOrgCode string `orm:"size(64)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空 -} - -func (o *AfsOrder) TableUnique() [][]string { - return [][]string{ - []string{"AfsOrderID", "VendorID"}, - } -} - -type OrderSkuFinancial struct { - ModelIDCUL - - VendorID int `orm:"column(vendor_id)" json:"vendorID"` // 平台id - VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 关联原始订单ID - AfsOrderID string `orm:"column(afs_order_id);size(48)" json:"afsOrderID"` // 售后单ID - IsAfsOrder int8 `json:"isAfsOrder"` // 0--正向单, 1--售后单 - - // ConfirmTime time.Time `orm:"type(datetime)" json:"confirmTime"` // 订单生成/完成时间 - VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"` // 外部系统里记录的storeid - StoreID int `orm:"column(store_id)" json:"storeID"` // 接口返回的京西门店ID - JxStoreID int `orm:"column(jx_store_id)" json:"jxStoreID"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid - VendorSkuID string `orm:"column(vendor_sku_id);size(48)" json:"vendorSkuID"` // 平台skuid - SkuID int `orm:"column(sku_id)" json:"skuID"` // 平台返回的京西skuid - JxSkuID int `orm:"column(jx_sku_id)" json:"jxSkuID"` // 京西skuid - PromotionType int `json:"promotionType"` // 商品级别促销类型 (1、无优惠;2、秒杀(已经下线);3、单品直降;4、限时抢购;1202、加价购;1203、满赠(标识商品);6、买赠(买A送B,标识B);9999、表示一个普通商品参与捆绑促销,设置的捆绑类型;9998、表示一个商品参与了捆绑促销,并且还参与了其他促销类型;9997、表示一个商品参与了捆绑促销,但是金额拆分不尽,9996:组合购,8001:轻松购会员价,8:第二件N折,9:拼团促销) - Name string `orm:"size(255)" json:"name"` // 商品名 - ShopPrice int64 `json:"shopPrice"` // 门店标价 - SalePrice int64 `json:"salePrice"` // 售卖价 - Count int `json:"count"` // 订单下单数量 - SkuBoxMoney int64 `json:"skuBoxMoney"` // sku餐盒费(美团/饿百的单条sku存在这个概念) - UserMoney int64 `json:"userMoney"` // 用户支付金额 - PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台补贴总金额 - PmSkuSubsidyMoney int64 `json:"pmSkuSubsidyMoney"` // 平台补贴sku金额 - PmDeductionsMoney int64 `json:"pmDeductionsMoney"` // 单条sku需要承担的平台扣费金额 - ShopMoney int64 `json:"shopMoney"` // 应结金额-第三方平台结算给京西的金额M - ShopMoneyByCal int64 `json:"shopMoneyByCal"` // 应结金额-通过公式计算平台结给京西的金额M - - JxSubsidyMoney int64 `json:"jxSubsidyMoney"` // 京西总补贴 - JxSkuSubsidyMoney int64 `json:"jxSkuSubsidyMoney"` // 京西补贴,针对单品活动补贴 - JxDeductionsMoney int64 `json:"jxDeductionsMoney"` // 单条sku需要承担的京西扣费金额 - JxShopMoney int64 `json:"jxShopMoney"` // 店铺应结金额-京西结算给店铺的金额M - RefundMoney int64 `json:"refundMoney"` // 平台扣款总额 暂时无用 - RefundMoneyByCal int64 `json:"refundMoneyByCal"` // 平台扣款总额-通过公式计算平台扣除京西的金额M - // CreatedAt time.Time `orm:"type(datetime);index" json:"createdAt"` // 订单创建时间 - // JxSkuMoney int64 `json:"jxSkuMoney"` // 京西补贴金额,现阶段是平台扣京西多少钱,京西扣商家多少钱,暂不考虑撤回京西补贴 - // SkuType int `json:"-"` // 当前如果为gift就为1,否则缺省为0 - StoreSubID int `orm:"column(store_sub_id)" json:"storeSubID"` // 当前这个字段被当成活动ID用 - StoreSubName string `orm:"size(64)" json:"storeSubName"` // 当前这个字段被用作vendorActType -} - -// todo -// func (o *OrderSkuFinancial) TableUnique() [][]string { -// return [][]string{ -// []string{"AfsOrderID", "VendorSkuID", "VendorID", "IsAfsOrder"}, -// } -// } - -func (o *OrderSkuFinancial) TableIndex() [][]string { - return [][]string{ - []string{"VendorOrderID", "VendorSkuID"}, - []string{"AfsOrderID", "VendorSkuID"}, - []string{"AfsOrderID", "JxSkuID"}, - } -} - -// type ActivityForSku struct { -// ModelIDCUL - -// CityName string `json:"cityName"` // 活动所在城市 -// VendorID int `orm:"column(vendor_id)" json:"vendorID"` // 平台id -// ActivityCreatedAt time.Time `orm:"type(datetime);index" json:"activityCreatedAt"` // 活动开始时间时间 -// ActivityEndAt time.Time `orm:"type(datetime);index" json:"activityEndAt"` // 活动结束时间 -// VendorSkuID string `orm:"column(vendor_sku_id)" json:"vendorSkuID"` // 平台skuid -// SkuID int `orm:"column(sku_id)" json:"skuID"` // 平台返回的京西skuid -// JxSkuID int `orm:"column(jx_sku_id)" json:"jxSkuID"` // 京西本地系统查询到的skuid -// ActivityPrice int64 `json:"activityPrice"` // 活动价格 -// JxSubsidy int64 `json:"jxSubsidy"` // 京西补贴 -// ManagerSubsidy int64 `json:"managerSubsidy"` // 城市经理补贴 -// Remark string `json:"remark"` // 备注 -// } diff --git a/globals/beegodb/beegodb.go b/globals/beegodb/beegodb.go index e22f146dc..2b64585ea 100644 --- a/globals/beegodb/beegodb.go +++ b/globals/beegodb/beegodb.go @@ -1,6 +1,7 @@ package beegodb import ( + "git.rosy.net.cn/jx-callback/business/model" beego "github.com/astaxie/beego/adapter" "github.com/astaxie/beego/adapter/orm" ) @@ -10,6 +11,7 @@ func Init() { orm.RegisterDataBase("default", "mysql", beego.AppConfig.String("dbConnectStr"), 30) // orm.RegisterDataBase("c4", "mysql", "root:WebServer@1@tcp(gold1.jxc4.com:3306)/jxd_dev_0?charset=utf8mb4&loc=Local&parseTime=true", 30) + orm.RegisterModel(&model.NewConfig{}) // create table orm.RunSyncdb("default", false, true) }