|
@@ -6,7 +6,7 @@ import time
|
|
import itunesiap
|
|
import itunesiap
|
|
from django.db.models import Q
|
|
from django.db.models import Q
|
|
from django.views import View
|
|
from django.views import View
|
|
-
|
|
|
|
|
|
+from Ansjer.config import LOGGER
|
|
from Controller.CheckUserData import DataValid
|
|
from Controller.CheckUserData import DataValid
|
|
from Model.models import Order_Model, Store_Meal, Device_Info, UID_Bucket, Unused_Uid_Meal, AiService, Device_User, \
|
|
from Model.models import Order_Model, Store_Meal, Device_Info, UID_Bucket, Unused_Uid_Meal, AiService, Device_User, \
|
|
SysMsgModel
|
|
SysMsgModel
|
|
@@ -29,11 +29,11 @@ class InAppPurchaseView(View):
|
|
|
|
|
|
def validation(self, request_dict, request, operation):
|
|
def validation(self, request_dict, request, operation):
|
|
if operation == 'AppStoreServerNotifications': # App Store服务器通知
|
|
if operation == 'AppStoreServerNotifications': # App Store服务器通知
|
|
- pass
|
|
|
|
|
|
+ return self.app_store_server_notifications(request_dict)
|
|
token_code, user_id, response = CommonService.verify_token_get_user_id(request_dict, request)
|
|
token_code, user_id, response = CommonService.verify_token_get_user_id(request_dict, request)
|
|
if token_code != 0:
|
|
if token_code != 0:
|
|
return response.json(token_code)
|
|
return response.json(token_code)
|
|
- if operation == 'verifyTransaction': # 获取商品列表
|
|
|
|
|
|
+ if operation == 'verifyTransaction': # 认证交易
|
|
return self.verify_transaction(user_id, request_dict, response)
|
|
return self.verify_transaction(user_id, request_dict, response)
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
@@ -51,6 +51,9 @@ class InAppPurchaseView(View):
|
|
lang = request_dict.get('lang', 'en')
|
|
lang = request_dict.get('lang', 'en')
|
|
channel = request_dict.get('channel', None)
|
|
channel = request_dict.get('channel', None)
|
|
|
|
|
|
|
|
+ if not all([receipt, uid, channel]):
|
|
|
|
+ return response.json(444)
|
|
|
|
+
|
|
# redis加锁,防止订单重复
|
|
# redis加锁,防止订单重复
|
|
redis_obj = RedisObject()
|
|
redis_obj = RedisObject()
|
|
redis_key = uid + 'in_app_purchase'
|
|
redis_key = uid + 'in_app_purchase'
|
|
@@ -83,7 +86,7 @@ class InAppPurchaseView(View):
|
|
product_id=product_id, lang__lang=lang, is_show=0).\
|
|
product_id=product_id, lang__lang=lang, is_show=0).\
|
|
values(
|
|
values(
|
|
'id', 'currency', 'price', 'lang__content', 'day', 'commodity_type', 'lang__title', 'expire',
|
|
'id', 'currency', 'price', 'lang__content', 'day', 'commodity_type', 'lang__title', 'expire',
|
|
- 'commodity_code', 'discount_price', 'bucket__mold', 'cycle_config_id', 'is_ai')
|
|
|
|
|
|
+ 'commodity_code', 'discount_price', 'bucket_id', 'bucket__mold', 'cycle_config_id', 'is_ai')
|
|
if not store_qs.exists():
|
|
if not store_qs.exists():
|
|
return response.json(173)
|
|
return response.json(173)
|
|
|
|
|
|
@@ -230,3 +233,7 @@ class InAppPurchaseView(View):
|
|
sign_ms = '周视'
|
|
sign_ms = '周视'
|
|
ali_sms = AliSmsObject()
|
|
ali_sms = AliSmsObject()
|
|
ali_sms.send_code_sms_cloud(phone=phone, params=params, sign_name=sign_ms, temp_msg=temp_msg)
|
|
ali_sms.send_code_sms_cloud(phone=phone, params=params, sign_name=sign_ms, temp_msg=temp_msg)
|
|
|
|
+
|
|
|
|
+ @staticmethod
|
|
|
|
+ def app_store_server_notifications(request_dict):
|
|
|
|
+ LOGGER.info('App Store服务器通知参数:{}'.format(request_dict))
|