|
@@ -477,6 +477,7 @@ func GetHsbyBuyMyOrderDetails(accountIDs string, myBuyStatus int) ([]HybsMyBuyOr
|
|
|
// 委托状态
|
|
// 委托状态
|
|
|
orderStatus := "0" // 单据状态,为0的时候查询全部
|
|
orderStatus := "0" // 单据状态,为0的时候查询全部
|
|
|
marketIDs := "" // 我的订单包括一二级市场的单据
|
|
marketIDs := "" // 我的订单包括一二级市场的单据
|
|
|
|
|
+ // FIXME: myBuyStatus 目前终端不传
|
|
|
switch myBuyStatus {
|
|
switch myBuyStatus {
|
|
|
case 1: // 抢购中 (一级市场)
|
|
case 1: // 抢购中 (一级市场)
|
|
|
// 获取市场ID
|
|
// 获取市场ID
|
|
@@ -508,7 +509,7 @@ func GetHsbyBuyMyOrderDetails(accountIDs string, myBuyStatus int) ([]HybsMyBuyOr
|
|
|
// 默认取 TradeMode = 16 or 71 的市场
|
|
// 默认取 TradeMode = 16 or 71 的市场
|
|
|
if len(marketIDs) == 0 {
|
|
if len(marketIDs) == 0 {
|
|
|
for _, v := range markets {
|
|
for _, v := range markets {
|
|
|
- if v.Trademode == 16 || v.Trademode == 71 {
|
|
|
|
|
|
|
+ if v.Trademode == 16 || v.Trademode == 71 || v.Trademode == 70 {
|
|
|
if len(marketIDs) == 0 {
|
|
if len(marketIDs) == 0 {
|
|
|
marketIDs = strconv.Itoa(int(v.Marketid))
|
|
marketIDs = strconv.Itoa(int(v.Marketid))
|
|
|
} else {
|
|
} else {
|
|
@@ -1244,7 +1245,7 @@ func GetHsbyBuyMyPayOrders(accountIDs string, buyOrderID, sellOrderID int) ([]Hs
|
|
|
marketIDs := "" // 我的订单包括一二级市场卖方向成交单
|
|
marketIDs := "" // 我的订单包括一二级市场卖方向成交单
|
|
|
// 默认取 TradeMode = 16
|
|
// 默认取 TradeMode = 16
|
|
|
for _, v := range markets {
|
|
for _, v := range markets {
|
|
|
- if v.Trademode == 16 || v.Trademode == 71 {
|
|
|
|
|
|
|
+ if v.Trademode == 16 || v.Trademode == 71 || v.Trademode == 70 {
|
|
|
if len(marketIDs) == 0 {
|
|
if len(marketIDs) == 0 {
|
|
|
marketIDs = strconv.Itoa(int(v.Marketid))
|
|
marketIDs = strconv.Itoa(int(v.Marketid))
|
|
|
} else {
|
|
} else {
|
|
@@ -1412,9 +1413,15 @@ type HsbyMarketGoods struct {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// GetHsbyMarketGoodses 获取商城商品列表(三级商城)
|
|
// GetHsbyMarketGoodses 获取商城商品列表(三级商城)
|
|
|
-func GetHsbyMarketGoodses(marketIDs string, accountID, categoryID int, goodsIDs string) ([]HsbyMarketGoods, error) {
|
|
|
|
|
|
|
+func GetHsbyMarketGoodses(marketIDs string, accountID, categoryID int, goodsIDs string, couponTypeID int) ([]HsbyMarketGoods, error) {
|
|
|
engine := db.GetEngine()
|
|
engine := db.GetEngine()
|
|
|
|
|
|
|
|
|
|
+ // 获取优惠卷类型信息
|
|
|
|
|
+ var couponType Coupontype
|
|
|
|
|
+ if _, err := engine.Where("ISVALID = 1 and COUPONTYPEID = ?", couponTypeID).Get(&couponType); err != nil {
|
|
|
|
|
+ return nil, err
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
orders := make([]HsbyMarketGoods, 0)
|
|
orders := make([]HsbyMarketGoods, 0)
|
|
|
// 与挂牌点选不一样的是商城是以委托单为主表;已经卖完的委托单不显示
|
|
// 与挂牌点选不一样的是商城是以委托单为主表;已经卖完的委托单不显示
|
|
|
session := engine.Table("TRADE_ORDERDETAIL T").
|
|
session := engine.Table("TRADE_ORDERDETAIL T").
|
|
@@ -1438,6 +1445,45 @@ func GetHsbyMarketGoodses(marketIDs string, accountID, categoryID int, goodsIDs
|
|
|
if len(goodsIDs) > 0 {
|
|
if len(goodsIDs) > 0 {
|
|
|
session = session.And(fmt.Sprintf("G.GOODSID in (%s)", goodsIDs))
|
|
session = session.And(fmt.Sprintf("G.GOODSID in (%s)", goodsIDs))
|
|
|
}
|
|
}
|
|
|
|
|
+ if couponTypeID > 0 {
|
|
|
|
|
+ if couponType.Coupontypeid == 0 {
|
|
|
|
|
+ // 没有查询到对应的优惠卷,直接返回空数组
|
|
|
|
|
+ return make([]HsbyMarketGoods, 0), nil
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 优惠卷特定商品
|
|
|
|
|
+ if couponType.Limitedflag == 1 {
|
|
|
|
|
+ // 去掉头尾逗号
|
|
|
|
|
+ limitedGoodsIDs := couponType.Limitedgoodsids
|
|
|
|
|
+ if strings.HasPrefix(limitedGoodsIDs, ",") && strings.HasSuffix(limitedGoodsIDs, ",") {
|
|
|
|
|
+ limitedGoodsIDs = limitedGoodsIDs[1 : len(limitedGoodsIDs)-1]
|
|
|
|
|
+ }
|
|
|
|
|
+ session = session.And(fmt.Sprintf("T.GOODSID in (%s)", limitedGoodsIDs))
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 优惠卷特定卖家
|
|
|
|
|
+ if couponType.Isgeneral == 0 {
|
|
|
|
|
+ // 去掉头尾逗号
|
|
|
|
|
+ userScope := couponType.Userscope
|
|
|
|
|
+ if strings.HasPrefix(userScope, ",") && strings.HasSuffix(userScope, ",") {
|
|
|
|
|
+ userScope = userScope[1 : len(userScope)-1]
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询对应的卖家资金账户信息
|
|
|
|
|
+ taAccounts := make([]Taaccount, 0)
|
|
|
|
|
+ if err := engine.Where(fmt.Sprintf("RELATEDUSERID in (%s)", userScope)).Find(&taAccounts); err != nil {
|
|
|
|
|
+ return nil, err
|
|
|
|
|
+ }
|
|
|
|
|
+ sellAccountIDs := ""
|
|
|
|
|
+ for _, v := range taAccounts {
|
|
|
|
|
+ if len(sellAccountIDs) == 0 {
|
|
|
|
|
+ sellAccountIDs = strconv.Itoa(int(v.Accountid))
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sellAccountIDs += "," + strconv.Itoa(int(v.Accountid))
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ session = session.And(fmt.Sprintf("T.ACCOUNTID in (%s)", sellAccountIDs))
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if err := session.Find(&orders); err != nil {
|
|
if err := session.Find(&orders); err != nil {
|
|
|
return nil, err
|
|
return nil, err
|
|
|
}
|
|
}
|