|
@@ -48,20 +48,29 @@ func (this *SubscribeChange) GetSubBuyMsg() {
|
|
|
if vipStatus == 2 { //查询是否有未执行的续费订单
|
|
|
renewList, _ = util.MQFW.Find("vip_upgrade", &bson.M{"s_userid": userId, "i_isvalid": 0}, `{"l_validtime":"1"}`, `{"o_buyset":1,"l_validtime":1}`, false, -1, -1)
|
|
|
}
|
|
|
+ //优惠码
|
|
|
+ isUsedActiveCode := false
|
|
|
+ nowTime := time.Now().Unix()
|
|
|
+ liveActiveStartTime := config.Config.LiveActiveStartTime
|
|
|
+ liveActiveEndTime := config.Config.LiveActiveEndTime
|
|
|
+ if nowTime >= liveActiveStartTime && nowTime < liveActiveEndTime {
|
|
|
+ isUsedActiveCode = entity.JyVipSubStruct.GetVipLiveActive(userId)
|
|
|
+ }
|
|
|
return &entity.FuncResult{true, nil, map[string]interface{}{
|
|
|
- "isTrial": vipStatus == 1,
|
|
|
- "area": (*o_vipjy)["o_area"],
|
|
|
- "industry": (*o_vipjy)["a_buyerclass"],
|
|
|
- "buyset": buyset,
|
|
|
- "renewList": renewList,
|
|
|
- "infotype": (*o_vipjy)["a_infotype"],
|
|
|
- "items": (*o_vipjy)["a_items"],
|
|
|
- "projectmatch": (*o_vipjy)["i_projectmatch"],
|
|
|
- "ratemode": (*o_vipjy)["i_ratemode"],
|
|
|
- "startTime": (*rData)["l_vip_starttime"],
|
|
|
- "endTime": (*rData)["l_vip_endtime"],
|
|
|
- "otherbuyerclass": (*o_vipjy)["i_matchbuyerclass_other"],
|
|
|
- "isread": isread,
|
|
|
+ "isTrial": vipStatus == 1,
|
|
|
+ "area": (*o_vipjy)["o_area"],
|
|
|
+ "industry": (*o_vipjy)["a_buyerclass"],
|
|
|
+ "buyset": buyset,
|
|
|
+ "renewList": renewList,
|
|
|
+ "infotype": (*o_vipjy)["a_infotype"],
|
|
|
+ "items": (*o_vipjy)["a_items"],
|
|
|
+ "projectmatch": (*o_vipjy)["i_projectmatch"],
|
|
|
+ "ratemode": (*o_vipjy)["i_ratemode"],
|
|
|
+ "startTime": (*rData)["l_vip_starttime"],
|
|
|
+ "endTime": (*rData)["l_vip_endtime"],
|
|
|
+ "otherbuyerclass": (*o_vipjy)["i_matchbuyerclass_other"],
|
|
|
+ "isread": isread,
|
|
|
+ "isUsedActiveCode": isUsedActiveCode,
|
|
|
}}
|
|
|
}()
|
|
|
if r.Err != nil {
|
|
@@ -78,6 +87,7 @@ func (this *SubscribeChange) SaveChange() {
|
|
|
timeRenew := this.GetString("time")
|
|
|
payWay := this.GetString("payWay")
|
|
|
req_price, _ := this.GetInteger("price")
|
|
|
+ activeCode := this.GetString("activeCode") //优惠码
|
|
|
openId := qutil.ObjToString(this.GetSession("s_m_openid"))
|
|
|
r := func() *entity.FuncResult {
|
|
|
if len(industry) == 1 && industry[0] == "" { //去掉[""]
|
|
@@ -188,6 +198,9 @@ func (this *SubscribeChange) SaveChange() {
|
|
|
final_price = int(float64(final_price) * 0.6)
|
|
|
log.Println("final_price", final_price)
|
|
|
}
|
|
|
+ if activeCode == "jianyu360" {
|
|
|
+ endTime = endTime.AddDate(0, 0, 30)
|
|
|
+ }
|
|
|
//
|
|
|
if req_price != final_price {
|
|
|
log.Println(userId+" 前台计算", req_price, "后台计算", final_price)
|
|
@@ -278,6 +291,20 @@ func (this *SubscribeChange) SaveChange() {
|
|
|
if orderid == -1 {
|
|
|
return &entity.FuncResult{false, errors.New("数据库操作异常"), nil}
|
|
|
}
|
|
|
+ //优惠码
|
|
|
+ if activeCode == "jianyu360" {
|
|
|
+ activeInsertMap := map[string]interface{}{
|
|
|
+ "order_code": ordercode,
|
|
|
+ "create_time": qutil.FormatDate(&now, qutil.Date_Full_Layout),
|
|
|
+ "active_type": "VIP订阅",
|
|
|
+ "user_id": userId,
|
|
|
+ "active_code": activeCode,
|
|
|
+ }
|
|
|
+ activeOrderId := util.Mysql.Insert("prefer_active", activeInsertMap)
|
|
|
+ if activeOrderId == -1 {
|
|
|
+ return &entity.FuncResult{false, errors.New("优惠码存库异常"), nil}
|
|
|
+ }
|
|
|
+ }
|
|
|
//支付提醒
|
|
|
util.MsgRemind.Add(qutil.IntAll(orderid), final_price, qutil.If(filter.OrderType == 5, 1, -1).(int), 0, ordercode, userId, now.Unix())
|
|
|
return &entity.FuncResult{true, nil, map[string]interface{}{"code": ordercode, "res": payStr, "needPay": true}}
|