diff --git a/fir_client/src/assets/pay/order-weixin.png b/fir_client/src/assets/pay/order-weixin.png new file mode 100644 index 0000000..ecfca13 Binary files /dev/null and b/fir_client/src/assets/pay/order-weixin.png differ diff --git a/fir_client/src/assets/pay/pay-scan.png b/fir_client/src/assets/pay/pay-scan.png new file mode 100644 index 0000000..f73f50c Binary files /dev/null and b/fir_client/src/assets/pay/pay-scan.png differ diff --git a/fir_client/src/assets/pay/pay_alipay.png b/fir_client/src/assets/pay/pay_alipay.png new file mode 100644 index 0000000..c510f75 Binary files /dev/null and b/fir_client/src/assets/pay/pay_alipay.png differ diff --git a/fir_client/src/assets/pay/pay_selected.png b/fir_client/src/assets/pay/pay_selected.png new file mode 100644 index 0000000..6270850 Binary files /dev/null and b/fir_client/src/assets/pay/pay_selected.png differ diff --git a/fir_client/src/assets/pay/pay_weixin.png b/fir_client/src/assets/pay/pay_weixin.png new file mode 100644 index 0000000..9e9a088 Binary files /dev/null and b/fir_client/src/assets/pay/pay_weixin.png differ diff --git a/fir_client/src/components/apps/FirApps.vue b/fir_client/src/components/apps/FirApps.vue index f728561..c206d13 100644 --- a/fir_client/src/components/apps/FirApps.vue +++ b/fir_client/src/components/apps/FirApps.vue @@ -28,12 +28,10 @@
此套餐 - + -
@@ -44,9 +42,12 @@ :key="pay.name"> xxxxxxxxxxxxxx - - - + + + @@ -543,6 +544,11 @@ show_buy_download_times: false, data_package_prices: [], buy_button_disable: true, + pay_image: { + 'wx': require('@/assets/pay/pay_weixin.png'), + 'ali': require('@/assets/pay/pay_alipay.png'), + 'selected': require('@/assets/pay/pay_selected.png'), + } } }, methods: { show_package_prices() { @@ -565,8 +571,12 @@ this.buy_button_disable = true; my_order(res => { if (res.code === 1000) { - this.$message.success("下订单成功,正在跳转支付页"); - this.$router.push({name: 'FirUserOrders', params: {out_trade_no: res.data.out_trade_no}}) + if (res.data && res.data.url) { + this.$message.success("下订单成功,正在跳转支付页"); + this.$router.push({name: 'FirUserOrders', params: {out_trade_no: res.data.out_trade_no}}) + } else { + this.$message.error("下订单异常,请联系管理员"); + } } else { this.$message.error("异常" + res.msg); this.buy_button_disable = false; @@ -1064,12 +1074,6 @@ } - /*/deep/ .el-dialog__body {*/ - /* background-image: url("@/assets/b6.png");*/ - /* border: 0;*/ - /*}*/ - - .page-apps .card.app .action a, .page-apps .card.app .appname, .page-apps .card.app table tr td, .upload-modal .state-form .release-body .input-addon { font-family: 'Open Sans', sans-serif } @@ -1509,12 +1513,7 @@ z-index: 999; } - .weixin { - background-image: url(https://img.jiguang.cn/app-portal/assets/img/account/pay_weixin.png); - } - .pay-current { - background: url(https://img.jiguang.cn/app-portal/assets/img/account/pay_selected.png) right bottom/100% no-repeat; width: 18px; height: 19px; position: absolute; @@ -1531,8 +1530,4 @@ left: 15px; } - .alipay { - background-image: url(https://img.jiguang.cn/app-portal/assets/img/account/pay_alipay.png); - } - diff --git a/fir_client/src/components/user/FirUserOrders.vue b/fir_client/src/components/user/FirUserOrders.vue index 57addff..cd131ce 100644 --- a/fir_client/src/components/user/FirUserOrders.vue +++ b/fir_client/src/components/user/FirUserOrders.vue @@ -23,7 +23,7 @@
-
+
-
请使用微信扫码支付
+
请使用微信扫码支付

支付完成之后,请刷新该页面,确认支付状态

@@ -255,6 +256,10 @@ return { wx_pay: false, pay_code_url: '', + pay_image: { + 'scan': require('@/assets/pay/pay-scan.png'), + 'order_wx': require('@/assets/pay/order-weixin.png'), + }, qrinfo: { logoScale: 0.3, logoCornerRadius: 12, @@ -293,19 +298,24 @@ my_order(res => { if (res.code === 1000) { let data = res.data; - if (data && data.type === 'WX') { - this.pay_code_url = data.url; - this.wx_pay = true; - this.$message.success("请用微信扫描支付"); - } else if (data && data.type === 'ALI') { - let pay_url = data.url; - if (pay_url && pay_url.length > 10) { - this.$message.success("正在跳转支付宝支付平台"); - window.location.href = pay_url - // window.open(pay_url, '_blank', ''); + if (data && data.url) { + + if (data && data.type === 'WX') { + this.pay_code_url = data.url; + this.wx_pay = true; + this.$message.success("请用微信扫描支付"); + } else if (data && data.type === 'ALI') { + let pay_url = data.url; + if (pay_url && pay_url.length > 10) { + this.$message.success("正在跳转支付宝支付平台"); + window.location.href = pay_url + // window.open(pay_url, '_blank', ''); + } + } else { + this.$message.error("支付获取失败 " + res.msg) } } else { - this.$message.error("支付获取失败 " + res.msg) + this.$message.error("下订单异常,请联系管理员"); } } else { this.$message.error("失败了 " + res.msg) @@ -444,7 +454,6 @@ .icon-weixin { width: 137px; height: 35px; - background: url(https://img.jiguang.cn/app-portal/assets/img/account/order-weixin.png) 0 0/100%; margin-left: 50px; } @@ -465,7 +474,6 @@ .icon { width: 26px; height: 26px; - background-image: url(https://img.jiguang.cn/app-portal/assets/img/account/pay-scan.png); background-size: 100%; display: inline-block; margin-right: 11px; diff --git a/fir_ser/api/utils/pay/ali.py b/fir_ser/api/utils/pay/ali.py index c4bc9f6..fa419b5 100644 --- a/fir_ser/api/utils/pay/ali.py +++ b/fir_ser/api/utils/pay/ali.py @@ -75,7 +75,6 @@ class Alipay(object): def update_order_status(self, out_trade_no): data = self.alipay.api_alipay_trade_query(out_trade_no=out_trade_no) - # (0, '交易成功'), (1, '待支付'), (2, '订单已创建'), (3, '退费申请中'), (4, '已退费'), (5, '主动取消'), (6, '超时取消') code = data.get("code", '') logger.info("out_trade_no: %s info:%s" % (out_trade_no, data)) if code == '10000': diff --git a/fir_ser/api/utils/serializer.py b/fir_ser/api/utils/serializer.py index 5ceb38e..cec12cd 100644 --- a/fir_ser/api/utils/serializer.py +++ b/fir_ser/api/utils/serializer.py @@ -5,7 +5,7 @@ from api.utils.TokenManager import DownloadToken from api.utils.app.supersignutils import get_redirect_server_domain from api.utils.storage.storage import Storage from api.utils.utils import get_developer_udided, get_choices_dict -from api.utils.storage.caches import get_user_free_download_times +from api.utils.storage.caches import get_user_free_download_times, get_user_cert_auth_status import os, json, logging logger = logging.getLogger(__file__) @@ -64,7 +64,7 @@ class UserInfoSerializer(serializers.ModelSerializer): free_download_times = serializers.SerializerMethodField() def get_free_download_times(self, obj): - return get_user_free_download_times(obj.id) + return get_user_free_download_times(obj.id, auth_status=get_user_cert_auth_status(obj.id)) certification = serializers.SerializerMethodField() diff --git a/fir_ser/api/utils/storage/caches.py b/fir_ser/api/utils/storage/caches.py index 5dbdee3..0d65e52 100644 --- a/fir_ser/api/utils/storage/caches.py +++ b/fir_ser/api/utils/storage/caches.py @@ -378,12 +378,17 @@ def add_user_download_times(user_id, download_times=0): return False -def check_user_has_all_download_times(app_obj): - user_id = app_obj.user_id_id +def get_user_cert_auth_status(user_id): user_cert_obj = UserCertificationInfo.objects.filter(user_id=user_id).first() auth_status = False if user_cert_obj and user_cert_obj.status == 1: auth_status = True + return auth_status + + +def check_user_has_all_download_times(app_obj): + user_id = app_obj.user_id_id + auth_status = get_user_cert_auth_status(user_id) return get_user_free_download_times(user_id, auth_status=auth_status) > 0 or check_user_can_download(user_id) diff --git a/fir_ser/api/views/order.py b/fir_ser/api/views/order.py index cd7ab55..590c7c5 100644 --- a/fir_ser/api/views/order.py +++ b/fir_ser/api/views/order.py @@ -140,16 +140,11 @@ class PriceView(APIView): class PaySuccess(APIView): - # authentication_classes = [ExpiringTokenAuthentication] def get(self, request): - alipay = Alipay() - # alipay.update_order_status('1202141610723105226256209') print(request.META) return Response(111) - # return HttpResponseRedirect(PAY_SUCCESS_URL) - def post(self, request, name): pay_obj = get_pay_obj_form_name(name) msg = 'failure'