Merge branch 'dev-lwl/iap' into test
This commit is contained in:
commit
f314affd2b
|
@ -34,6 +34,7 @@ type OpCoinOrderVO struct {
|
|||
Coins int64 `json:"coins"`
|
||||
Ct int64 `json:"ct"`
|
||||
ProductName string `json:"product_name"`
|
||||
RefundType string `json:"refund_type"`
|
||||
}
|
||||
|
||||
type OpCoinOrderListData struct {
|
||||
|
@ -111,6 +112,7 @@ type OpOrderVO struct {
|
|||
Money int64 `json:"money"`
|
||||
Ct int64 `json:"ct"`
|
||||
ProductName string `json:"product_name"`
|
||||
RefundType string `json:"refund_type"`
|
||||
}
|
||||
|
||||
type OpOrderListData struct {
|
||||
|
|
|
@ -186,6 +186,7 @@ type ZoneRefundPageReq struct {
|
|||
|
||||
type ZoneRefundPageData struct {
|
||||
Price int64 `json:"price"` // 退款价格,单位:分
|
||||
CoinPrice int64 `json:"coin_price"` // 推荐价格,单位:金币
|
||||
Name string `json:"name"` // 退款商品名
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ func ZoneRefundPage(ctx *gin.Context) {
|
|||
ReplyErrCodeMsg(ctx, errcode.ErrCodeBadParam)
|
||||
return
|
||||
}
|
||||
name, price, ec, err := service.DefaultService.ZoneGetRefundPage(ctx, req)
|
||||
name, price, payType, ec, err := service.DefaultService.ZoneGetRefundPage(ctx, req)
|
||||
if ec != errcode.ErrCodeVasSrvOk {
|
||||
logger.Error("ZoneGetRefundPage fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||||
if ec == errcode.ErrCodeVasSrvFail && err != nil {
|
||||
|
@ -74,9 +74,13 @@ func ZoneRefundPage(ctx *gin.Context) {
|
|||
return
|
||||
}
|
||||
data := &vasproto.ZoneRefundPageData{
|
||||
Price: price,
|
||||
Name: name,
|
||||
}
|
||||
if payType == vasproto.PayTypeCoin {
|
||||
data.CoinPrice = price
|
||||
} else {
|
||||
data.Price = price
|
||||
}
|
||||
ReplyOk(ctx, data)
|
||||
}
|
||||
|
||||
|
|
|
@ -1563,11 +1563,13 @@ func (v *Vas) PayCallback(ctx *gin.Context, p *vasproto.PayCallbackParamIn) erro
|
|||
ch.SType = goproto.Int32(dbstruct.CHSTypeChargeZoneSuperfanship)
|
||||
ch.Change = goproto.Int64(order.GetPayAmount())
|
||||
}
|
||||
if !(order.GetPayType() == vasproto.PayTypeCoin && product.Id == dbstruct.ProductIdMembership) {
|
||||
err = v.store.CreateConsumeHistory(ctx, tx, ch)
|
||||
if err != nil {
|
||||
logger.Error("CreateConsumeHistory fail, ch: %v, err: %v", util.ToJson(ch), err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
err = v.store.UpdateOrderStatus(ctx, tx, orderId, dbstruct.VasOrderStatusInit, dbstruct.VasOrderStatusPaySuccess)
|
||||
|
@ -2297,7 +2299,11 @@ func (v *Vas) UnlockMembership(ctx *gin.Context, tx *sqlx.Tx, mid int64, product
|
|||
}
|
||||
|
||||
// 增加空间消费
|
||||
_err := v.IncZoneConsume(ctx, tx, zid, mid, order.GetUid(), order.GetPayAmount(), orderId, order.GetProductId())
|
||||
consume := order.GetPayAmount()
|
||||
if order.GetPayType() == vasproto.PayTypeCoin {
|
||||
consume = consume * 10
|
||||
}
|
||||
_err := v.IncZoneConsume(ctx, tx, zid, mid, order.GetUid(), consume, orderId, order.GetProductId())
|
||||
if _err != nil {
|
||||
logger.Error("IncZoneConsume fail, mid: %v, orderId: %v, err: %v", mid, orderId, err)
|
||||
}
|
||||
|
|
|
@ -280,7 +280,6 @@ func (v *Vas) UnlockZoneMoment(ctx *gin.Context, tx *sqlx.Tx, order *dbstruct.Or
|
|||
|
||||
var (
|
||||
orderId = order.GetID()
|
||||
price = order.GetPayAmount()
|
||||
mid = order.GetMid()
|
||||
zid = order.GetZid()
|
||||
momentId = order.GetMomentId()
|
||||
|
@ -316,7 +315,11 @@ func (v *Vas) UnlockZoneMoment(ctx *gin.Context, tx *sqlx.Tx, order *dbstruct.Or
|
|||
}
|
||||
|
||||
// 增加空间消费
|
||||
_err := v.IncZoneConsume(ctx, tx, zid, mid, 0, price, orderId, order.GetProductId())
|
||||
consume := order.GetPayAmount()
|
||||
if order.GetPayType() == vasproto.PayTypeCoin {
|
||||
consume = consume * 10
|
||||
}
|
||||
_err := v.IncZoneConsume(ctx, tx, zid, mid, 0, consume, orderId, order.GetProductId())
|
||||
if _err != nil {
|
||||
logger.Error("IncZoneConsume fail, mid: %v, zid: %v, mmid: %v, orderId: %v, err: %v", mid, zid, momentId, orderId, err)
|
||||
}
|
||||
|
@ -410,7 +413,6 @@ func (v *Vas) UnlockZoneSuperfanship(ctx *gin.Context, tx *sqlx.Tx, order *dbstr
|
|||
|
||||
var (
|
||||
orderId = order.GetID()
|
||||
price = order.GetPayAmount()
|
||||
mid = order.GetMid()
|
||||
zid = order.GetZid()
|
||||
)
|
||||
|
@ -452,7 +454,11 @@ func (v *Vas) UnlockZoneSuperfanship(ctx *gin.Context, tx *sqlx.Tx, order *dbstr
|
|||
}
|
||||
|
||||
// 增加空间消费
|
||||
_err := v.IncZoneConsume(ctx, tx, zid, mid, 0, price, orderId, order.GetProductId())
|
||||
consume := order.GetPayAmount()
|
||||
if order.GetPayType() == vasproto.PayTypeCoin {
|
||||
consume = consume * 10
|
||||
}
|
||||
_err := v.IncZoneConsume(ctx, tx, zid, mid, 0, consume, orderId, order.GetProductId())
|
||||
if _err != nil {
|
||||
logger.Error("IncZoneConsume fail, mid: %v, zid: %v, orderId: %v, err: %v", mid, zid, orderId, err)
|
||||
}
|
||||
|
@ -884,36 +890,36 @@ func (v *Vas) GetZoneMomentUnlockMapByMidMomentIds(ctx *gin.Context, mid int64,
|
|||
}
|
||||
|
||||
// 空间退款页面
|
||||
func (v *Vas) ZoneGetRefundPage(ctx *gin.Context, req *vasproto.ZoneRefundPageReq) (string, int64, error) {
|
||||
func (v *Vas) ZoneGetRefundPage(ctx *gin.Context, req *vasproto.ZoneRefundPageReq) (string, int64, string, error) {
|
||||
zv, err := v.store.GetZoneUnlock(ctx, nil, req.Mid, req.Zid)
|
||||
if err == sql.ErrNoRows || zv == nil {
|
||||
logger.Error("no zone unlock info, mid: %v, zid: %v", req.Mid, req.Zid)
|
||||
return "", 0, fmt.Errorf("没有解锁信息")
|
||||
return "", 0, "", fmt.Errorf("没有解锁信息")
|
||||
}
|
||||
if err != nil {
|
||||
logger.Error("get zone unlock info fail, mid: %v, zid: %v, err: %v", req.Mid, req.Zid, err)
|
||||
return "", 0, err
|
||||
return "", 0, "", err
|
||||
}
|
||||
|
||||
// 判断
|
||||
if zv.GetAdmissionUntil() == 0 || len(zv.GetAdmissionOrderId()) <= 0 {
|
||||
err = fmt.Errorf("无空间解锁记录")
|
||||
logger.Error("no zone unlock info, mid: %v, zid: %v", req.Mid, req.Zid)
|
||||
return "", 0, err
|
||||
return "", 0, "", err
|
||||
}
|
||||
|
||||
// 获取订单
|
||||
order, err := v.store.GetOrderById(ctx, nil, zv.GetAdmissionOrderId())
|
||||
if err == sql.ErrNoRows || order == nil {
|
||||
logger.Error("no zone admission order info, mid: %v, zid: %v, orderId: %v", req.Mid, req.Zid, zv.GetAdmissionOrderId())
|
||||
return "", 0, fmt.Errorf("没有相关订单")
|
||||
return "", 0, "", fmt.Errorf("没有相关订单")
|
||||
}
|
||||
if err != nil {
|
||||
logger.Error("get zone admission order info fail, mid: %v, zid: %v, orderId: %v, err: %v", req.Mid, req.Zid, zv.GetAdmissionOrderId(), err)
|
||||
return "", 0, err
|
||||
return "", 0, "", err
|
||||
}
|
||||
|
||||
return "空间成员权限", order.GetPayAmount(), nil
|
||||
return "空间成员权限", order.GetPayAmount(), order.GetPayType(), nil
|
||||
}
|
||||
|
||||
// 空间退款
|
||||
|
|
|
@ -325,6 +325,7 @@ func (s *Service) chListCharge(ctx *gin.Context, chList []*dbstruct.ConsumeHisto
|
|||
newChange += oldChange[:1]
|
||||
}
|
||||
newChange += fmt.Sprintf("%d金币", chDB.GetChange())
|
||||
item.Change = newChange
|
||||
}
|
||||
|
||||
list = append(list, item)
|
||||
|
@ -677,6 +678,7 @@ func (s *Service) OpCoinOrderList(ctx *gin.Context, req *vasproto.OpCoinOrderLis
|
|||
OrderStatusDesc: dbstruct.CoinOrderStatusDescMap[co.GetOrderStatus()],
|
||||
Coins: co.GetCoins(),
|
||||
Ct: co.GetCt(),
|
||||
RefundType: "退金币",
|
||||
}
|
||||
item.ProductName = dbstruct.ProductIdDescMap[co.GetProductId()]
|
||||
|
||||
|
@ -747,6 +749,7 @@ func (s *Service) OpOrderList(ctx *gin.Context, req *vasproto.OpOrderListReq) (l
|
|||
Money: o.GetPayAmount(),
|
||||
Ct: o.GetCt(),
|
||||
ProductName: dbstruct.ProductIdDescMap[o.GetProductId()],
|
||||
RefundType: "退现金",
|
||||
}
|
||||
list = append(list, item)
|
||||
}
|
||||
|
@ -907,8 +910,8 @@ func (s *Service) ZoneGetCashier(ctx *gin.Context, req *vasproto.ZoneGetCashierR
|
|||
return
|
||||
}
|
||||
|
||||
func (s *Service) ZoneGetRefundPage(ctx *gin.Context, req *vasproto.ZoneRefundPageReq) (name string, price int64, ec errcode.ErrCode, err error) {
|
||||
name, price, err = _DefaultVas.ZoneGetRefundPage(ctx, req)
|
||||
func (s *Service) ZoneGetRefundPage(ctx *gin.Context, req *vasproto.ZoneRefundPageReq) (name string, price int64, payType string, ec errcode.ErrCode, err error) {
|
||||
name, price, payType, err = _DefaultVas.ZoneGetRefundPage(ctx, req)
|
||||
ec, err = errs.DealVasErr(err)
|
||||
if err != nil {
|
||||
logger.Error("ZoneGetRefundPage fail, err: %v", err)
|
||||
|
|
|
@ -17,6 +17,16 @@ const (
|
|||
ProductIdH5Coin18000 = "h5_coin_18000" // H5 18000币
|
||||
ProductIdH5Coin20000 = "h5_coin_20000" // H5 20000币
|
||||
|
||||
ProductIdIosCoin70 = "70_gold"
|
||||
ProductIdIosCoin350 = "350_gold"
|
||||
ProductIdIosCoin686 = "686_gold"
|
||||
ProductIdIosCoin2086 = "2086_gold"
|
||||
ProductIdIosCoin4886 = "4886_gold"
|
||||
ProductIdIosCoin6986 = "6986_gold"
|
||||
ProductIdIosCoin9086 = "9086_gold"
|
||||
ProductIdIosCoin13986 = "13986_gold"
|
||||
ProductIdIosCoin20986 = "20986_gold"
|
||||
|
||||
ProductIdContactWechat = "contact_wechat" // 微信联系方式
|
||||
ProductIdH5ContactWechat = "h5_contact_wechat" // h5的联系方式,rmb直接解锁
|
||||
ProductIdSuperfanGiftContactWechat = "superfan_gift_contact_wechat" // 超粉赠送的联系方式
|
||||
|
@ -50,6 +60,15 @@ var ProductIdDescMap = map[string]string{
|
|||
ProductIdH5ZoneMoment: "空间动态",
|
||||
ProductIdH5ZoneAdmission: "解锁空间",
|
||||
ProductIdH5ZoneSuperfanship: "解锁超粉",
|
||||
ProductIdIosCoin70: "ios_70金币",
|
||||
ProductIdIosCoin350: "ios_350金币",
|
||||
ProductIdIosCoin686: "ios_686金币",
|
||||
ProductIdIosCoin2086: "ios_2086金币",
|
||||
ProductIdIosCoin4886: "ios_4886金币",
|
||||
ProductIdIosCoin6986: "ios_6986金币",
|
||||
ProductIdIosCoin9086: "ios_9086金币",
|
||||
ProductIdIosCoin13986: "ios_13986金币",
|
||||
ProductIdIosCoin20986: "ios_20986金币",
|
||||
}
|
||||
|
||||
var CoinPayValidProductIdMap = map[string]bool{
|
||||
|
|
Loading…
Reference in New Issue