支付后弹出抽奖跳转弹窗

master
yangkai 6 years ago
parent 232c19af7b
commit 0cdbe2add4

@ -76,4 +76,6 @@ public interface TransactionAnalysisMapper {
PageList<JSONObject> getAreaMerchantAmountAnalysis(JSONObject params,PageBounds pagination);
List<JSONObject> getAreaMerchantAmountByCycle(JSONObject params);
JSONObject getOrderClearAmount(@Param("order_id") String order_id);
}

@ -3,6 +3,8 @@ package au.com.royalpay.payment.manage.customers.core;
import au.com.royalpay.payment.manage.customers.beans.GatewayParams;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
/**
* Created by yishuqian on 24/04/2017.
*/
@ -19,4 +21,6 @@ public interface CustomerPointsService {
int getOldPoints(String customer_id, String channel);
int checkPointsAfterPay(String order_id);
BigDecimal checkLotteryAfterPay(String order_id);
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.customers.core.impls;
import au.com.royalpay.payment.core.exceptions.SignInvalidException;
import au.com.royalpay.payment.core.exceptions.SignTimeoutException;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
import au.com.royalpay.payment.manage.customers.beans.GatewayParams;
import au.com.royalpay.payment.manage.customers.core.CustomerPointsService;
import au.com.royalpay.payment.manage.mappers.customers.CustomerMembershipMapper;
@ -21,6 +22,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
@ -49,6 +51,8 @@ public class CustomerPointsServiceImp implements CustomerPointsService {
private CustomerPointsMapper customerPointsMapper;
@Resource
private CustomerMembershipMapper customerMembershipMapper;
@Resource
private TransactionAnalysisMapper transactionAnalysisMapper;
private String auth_code = "w2DgCF2cvlNHo3R6";
@ -276,6 +280,15 @@ public class CustomerPointsServiceImp implements CustomerPointsService {
}
}
@Override
public BigDecimal checkLotteryAfterPay(String order_id) {
JSONObject order = transactionAnalysisMapper.getOrderClearAmount(order_id);
if (order.getIntValue("client_id") != 9) {
return BigDecimal.valueOf(0);
}
return order.getBigDecimal("clearing_amount");
}
/**
*
*

@ -2,12 +2,10 @@ package au.com.royalpay.payment.manage.customers.web;
import au.com.royalpay.payment.manage.customers.core.CustomerPointsService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
@Controller
@RequestMapping(value = "/customers/points")
@ -21,4 +19,10 @@ public class CustomerPointsController {
public int checkPointsAfterPay(@PathVariable String order_id) {
return customerPointsService.checkPointsAfterPay(order_id);
}
@RequestMapping(value = "/lottery/{order_id}/check",method = RequestMethod.GET)
@ResponseBody
public BigDecimal checkLotteryAfterPay(@PathVariable String order_id) {
return customerPointsService.checkLotteryAfterPay(order_id);
}
}

@ -863,4 +863,12 @@
</if>
GROUP BY c.client_id order by old_total desc
</select>
<select id="getOrderClearAmount" resultType="com.alibaba.fastjson.JSONObject">
SELECT clearing_amount,o.client_id
FROM pmt_orders o
INNER JOIN pmt_transactions pt ON o.order_id = pt.order_id
WHERE o.order_id = #{order_id}
LIMIT 1;
</select>
</mapper>

@ -69,6 +69,26 @@ $(function () {
loadPoints();
function loadLottery() {
$.ajax({
url: '/customers/points/lottery/' + window.order_id + '/check',
method: 'GET',
dataType: 'text',
success: function (data) {
if (data >= 1.99) {
$('.points-title').html('恭喜您!获得抽奖奖励');
$('.points-desc').html('使用RoyalPay任意消费满1.99澳币获取1次抽奖机会');
$('.points-dialog .points-value').html('+ ' + 1);
$('.points-dialog a').html('进入抽奖页面');
$('.points-dialog a').attr("href","https://customer.royalpay.com.au/activity/luck_draw");
$('.points-dialog').removeClass('hide');
}
}, error: function () {
}
});
}
loadLottery();
$('.encourage-dialog .close-circle').click(function () {
$('.encourage-dialog').addClass('hide');
});

Loading…
Cancel
Save