|
|
@@ -152,6 +152,30 @@ func (Couponhold) TableName() string {
|
|
|
return "COUPONHOLD"
|
|
|
}
|
|
|
|
|
|
+// Tradeordercoupon 交易委托优惠券表
|
|
|
+type Tradeordercoupon struct {
|
|
|
+ Orderid string `json:"orderid" xorm:"'ORDERIDSTR'" binding:"required"` // 委托单号(100+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
|
|
|
+ Coupontypeid string `json:"coupontypeid" xorm:"'COUPONTYPEIDSTR'" binding:"required"` // 优惠券类型ID(买方)
|
|
|
+ Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'"` // 资金账户ID(买方)
|
|
|
+ Usedqty int64 `json:"usedqty" xorm:"'USEDQTY'"` // 使用数量
|
|
|
+ Couponcategroy int32 `json:"couponcategroy" xorm:"'COUPONCATEGROY'"` // 种类 - 1:现金券 2:折扣券
|
|
|
+ Conditionvalue float64 `json:"conditionvalue" xorm:"'CONDITIONVALUE'"` // 条件阈值(可为0)
|
|
|
+ Couponvalue float64 `json:"couponvalue" xorm:"'COUPONVALUE'"` // 面值[1:现金券 - 抵扣值 2:折扣券-折扣值(0-100)]
|
|
|
+ Sellaccountid int64 `json:"sellaccountid" xorm:"'SELLACCOUNTID'"` // 资金账户ID(卖方)
|
|
|
+ Marketid int32 `json:"marketid" xorm:"'MARKETID'"` // 市场ID
|
|
|
+ Goodsid int32 `json:"goodsid" xorm:"'GOODSID'"` // 商品ID
|
|
|
+ Tradeid string `json:"tradeid" xorm:"'TRADEIDSTR'"` // 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
|
|
|
+ Tradeamount float64 `json:"tradeamount" xorm:"'TRADEAMOUNT'"` // 成交金额
|
|
|
+ Offamount float64 `json:"offamount" xorm:"'OFFAMOUNT'"` // 优惠金额
|
|
|
+ Handlestatus int32 `json:"handlestatus" xorm:"'HANDLESTATUS'"` // 处理状态
|
|
|
+ Createtime time.Time `json:"createtime" xorm:"'CREATETIME'"` // 创建时间
|
|
|
+}
|
|
|
+
|
|
|
+// TableName is TRADE_ORDERCOUPON
|
|
|
+func (Tradeordercoupon) TableName() string {
|
|
|
+ return "TRADE_ORDERCOUPON"
|
|
|
+}
|
|
|
+
|
|
|
// HsbyTopGoods 热卖商品(二级市场挂牌点选)
|
|
|
type HsbyTopGoods struct {
|
|
|
Goodsid int64 `json:"goodsid" xorm:"'GOODSID'" binding:"required"` // 商品ID(自增ID SEQ_GOODS)
|
|
|
@@ -1755,3 +1779,42 @@ func GetMyCouponHolds(accountIDs string, holdStatus string) ([]MyCouponHold, err
|
|
|
|
|
|
return myCouponHolds, nil
|
|
|
}
|
|
|
+
|
|
|
+// MyUsedCoupon 已使用优惠卷
|
|
|
+type MyUsedCoupon struct {
|
|
|
+ Orderid string `json:"orderid" xorm:"'ORDERIDSTR'" binding:"required"` // 委托单号(100+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
|
|
|
+ Coupontypeid string `json:"coupontypeid" xorm:"'COUPONTYPEIDSTR'" binding:"required"` // 优惠券类型ID(买方)
|
|
|
+ Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'"` // 资金账户ID(买方)
|
|
|
+ Usedqty int64 `json:"usedqty" xorm:"'USEDQTY'"` // 使用数量
|
|
|
+ Couponcategroy int32 `json:"couponcategroy" xorm:"'COUPONCATEGROY'"` // 种类 - 1:现金券 2:折扣券
|
|
|
+ Conditionvalue float64 `json:"conditionvalue" xorm:"'CONDITIONVALUE'"` // 条件阈值(可为0)
|
|
|
+ Couponvalue float64 `json:"couponvalue" xorm:"'COUPONVALUE'"` // 面值[1:现金券 - 抵扣值 2:折扣券-折扣值(0-100)]
|
|
|
+ Sellaccountid int64 `json:"sellaccountid" xorm:"'SELLACCOUNTID'"` // 资金账户ID(卖方)
|
|
|
+ Marketid int32 `json:"marketid" xorm:"'MARKETID'"` // 市场ID
|
|
|
+ Goodsid int32 `json:"goodsid" xorm:"'GOODSID'"` // 商品ID
|
|
|
+ Tradeid string `json:"tradeid" xorm:"'TRADEIDSTR'"` // 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
|
|
|
+ Tradeamount float64 `json:"tradeamount" xorm:"'TRADEAMOUNT'"` // 成交金额
|
|
|
+ Offamount float64 `json:"offamount" xorm:"'OFFAMOUNT'"` // 优惠金额
|
|
|
+ Handlestatus int32 `json:"handlestatus" xorm:"'HANDLESTATUS'"` // 处理状态
|
|
|
+ Createtime time.Time `json:"createtime" xorm:"'CREATETIME'"` // 创建时间
|
|
|
+
|
|
|
+ Couponname string `json:"couponname" xorm:"'COUPONNAME'"` // 优惠券名称
|
|
|
+}
|
|
|
+
|
|
|
+// GetMyUsedCoupon 获取已使用优惠卷
|
|
|
+func GetMyUsedCoupon(accountIDs string) ([]MyUsedCoupon, error) {
|
|
|
+ engine := db.GetEngine()
|
|
|
+
|
|
|
+ myUsedCoupons := make([]MyUsedCoupon, 0)
|
|
|
+ if err := engine.Table("TRADE_ORDERCOUPON T").
|
|
|
+ Select(`to_char(T.ORDERID) ORDERIDSTR, to_char(T.COUPONTYPEID) COUPONTYPEIDSTR, to_char(T.TRADEID) TRADEIDSTR, T.*,
|
|
|
+ C.COUPONNAME`).
|
|
|
+ Join("INNER", "COUPONTYPE C", "C.COUPONTYPEID = T.COUPONTYPEID").
|
|
|
+ Where(fmt.Sprintf("T.ACCOUNTID in (%s)", accountIDs)).
|
|
|
+ Desc("T.CREATETIME").
|
|
|
+ Find(&myUsedCoupons); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return myUsedCoupons, nil
|
|
|
+}
|