| | |
| | | import com.yeshi.buwan.exception.order.PayException; |
| | | import com.yeshi.buwan.exception.vip.VIPException; |
| | | import com.yeshi.buwan.exception.vip.VideoBuyRecordException; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeries; |
| | | import com.yeshi.buwan.pptv.entity.VideoPPTVMap; |
| | | import com.yeshi.buwan.videos.pptv.entity.PPTVSeries; |
| | | import com.yeshi.buwan.videos.pptv.entity.VideoPPTVMap; |
| | | import com.yeshi.buwan.service.inter.LoginUserService; |
| | | import com.yeshi.buwan.service.inter.juhe.PPTVService; |
| | | import com.yeshi.buwan.service.inter.order.OrderService; |
| | |
| | | import com.yeshi.buwan.service.inter.vip.VIPPriceService; |
| | | import com.yeshi.buwan.service.inter.vip.VIPService; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.user.VipUtil; |
| | | import com.yeshi.buwan.util.vip.VIPOrderUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.client.user.UserInfoVO; |
| | | import com.yeshi.buwan.vo.order.OrderInfoVO; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | @Controller |
| | | @RequestMapping("api/v2/vip") |
| | |
| | | return JsonUtilV2.loadFalseJson("用户不存在"); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(user.getPhone())) { |
| | | if (StringUtil.isNullOrEmpty(user.getPhone()) && payWay != OrderRecord.PAY_WAY_IAPP) { |
| | | return JsonUtilV2.loadFalseJson(10001, "请绑定电话号码"); |
| | | } |
| | | |
| | |
| | | } catch (VideoBuyRecordException e) { |
| | | return JsonUtilV2.loadFalseJson("单片购买失败"); |
| | | } |
| | | return JsonUtilV2.loadTrueJson(new Gson().toJson(payResult)); |
| | | if (payResult.getPayWay() == OrderRecord.PAY_WAY_IAPP) { |
| | | //苹果内购 |
| | | JSONObject root = new JSONObject(); |
| | | root.put("orderNo", record.getId()); |
| | | root.put("productId", vipPrice.getIosProductId()); |
| | | return JsonUtilV2.loadTrueJson(root.toString()); |
| | | } else { |
| | | return JsonUtilV2.loadTrueJson(new Gson().toJson(payResult)); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 检查是否支付 |
| | |
| | | * @param acceptData |
| | | * @param loginUid |
| | | * @param id |
| | | * @param receipt -ios支付结果receipt |
| | | * @return |
| | | */ |
| | | @RequestMapping("checkPay") |
| | | @ResponseBody |
| | | @RequestSerializableByKey(key = "'vip-checkPay-'+#id") |
| | | public String checkPay(AcceptData acceptData, String loginUid, String id) { |
| | | public String checkPay(AcceptData acceptData, String loginUid, String id, String receipt) { |
| | | OrderRecord record = orderService.getOrderRecord(id); |
| | | if (record == null || !record.getUid().equalsIgnoreCase(loginUid)) { |
| | | return JsonUtilV2.loadFalseJson("记录不存在/不是您的订单"); |
| | | } |
| | | |
| | | record = orderService.checkOrderPayState(id); |
| | | //未支付 |
| | | if (record != null && record.getState() != OrderRecord.STATE_PAY) { |
| | | return JsonUtilV2.loadFalseJson(1, "支付未完成"); |
| | | if (record.getPayWay() == OrderRecord.PAY_WAY_IAPP) { |
| | | try { |
| | | orderService.checkApplePay(record.getId(), receipt); |
| | | JSONObject data = new JSONObject(); |
| | | return JsonUtilV2.loadTrueJson(data.toString()); |
| | | } catch (Exception e) { |
| | | return JsonUtilV2.loadFalseJson(e.getMessage()); |
| | | } |
| | | } else { |
| | | record = orderService.checkOrderPayState(id); |
| | | //未支付 |
| | | if (record != null && record.getState() != OrderRecord.STATE_PAY) { |
| | | return JsonUtilV2.loadFalseJson(1, "支付未完成"); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("money", record.getPayMoney() == null ? record.getMoney() : record.getPayMoney()); |
| | | return JsonUtilV2.loadTrueJson(data.toString()); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("money", record.getPayMoney() == null ? record.getMoney() : record.getPayMoney()); |
| | | |
| | | return JsonUtilV2.loadTrueJson(data.toString()); |
| | | } |
| | | |
| | | |