|
@@ -17,248 +17,248 @@ from django.views.generic.base import View
|
|
|
from Model.models import UnicomDeviceInfo, UnicomCombo, Pay_Type
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
from Object.TokenObject import TokenObject
|
|
|
+from Object.UnicomObject import UnicomObjeect
|
|
|
|
|
|
|
|
|
class UnicomComboView(View):
|
|
|
- pass
|
|
|
- # def get(self, request, *args, **kwargs):
|
|
|
- # request.encoding = 'utf-8'
|
|
|
- # operation = kwargs.get('operation')
|
|
|
- # return self.validation(request.GET, request, operation)
|
|
|
- #
|
|
|
- # def post(self, request, *args, **kwargs):
|
|
|
- # request.encoding = 'utf-8'
|
|
|
- # operation = kwargs.get('operation')
|
|
|
- # return self.validation(request.POST, request, operation)
|
|
|
- #
|
|
|
- # def validation(self, request_dict, request, operation):
|
|
|
- # if operation == 'buy-notify':
|
|
|
- # return self.package_callback_notify(request_dict, request)
|
|
|
- # elif operation == 'device-queue-monitoring':
|
|
|
- # return self.device_queue_monitoring_push(request_dict, request)
|
|
|
- # elif operation == 'device-status-change':
|
|
|
- # return self.device_status_change_push(request_dict, request)
|
|
|
- # else:
|
|
|
- # token = TokenObject(request.META.get('HTTP_AUTHORIZATION'))
|
|
|
- # lang = request_dict.get('lang', token.lang)
|
|
|
- # response = ResponseObject(lang)
|
|
|
- # if token.code != 0:
|
|
|
- # return response.json(token.code)
|
|
|
- # user_id = token.userID
|
|
|
- # if operation == 'device-bind':
|
|
|
- # return self.device_add(user_id, request_dict, response)
|
|
|
- # elif operation == 'combo-save':
|
|
|
- # return self.save_unicom_combo(request_dict, response)
|
|
|
- # elif operation == 'combo-list':
|
|
|
- # return self.query_package_list(response)
|
|
|
- #
|
|
|
- # @classmethod
|
|
|
- # def device_add(cls, user_id, request_dict, response):
|
|
|
- # """
|
|
|
- # 设备绑定iccid
|
|
|
- # @param user_id:
|
|
|
- # @param request_dict:
|
|
|
- # @param response:
|
|
|
- # @return:
|
|
|
- # """
|
|
|
- # iccid = request_dict.get('iccid', None)
|
|
|
- # uid = request_dict.get('uid', None)
|
|
|
- # if not all([iccid, uid]):
|
|
|
- # return response.json(444)
|
|
|
- # n_time = int(time.time())
|
|
|
- # try:
|
|
|
- # # 待完善代码 根据uid与用户id验证系统设备
|
|
|
- # unicom_device_qs = UnicomDeviceInfo.objects.filter(iccid=iccid)
|
|
|
- # if unicom_device_qs.exists():
|
|
|
- # return response.json(174)
|
|
|
- # unicom_obj = UnicomObjeect()
|
|
|
- # result = unicom_obj.verify_device(iccid=iccid)
|
|
|
- # if result.status_code == 200 and result.text:
|
|
|
- # res_dict = json.loads(result.text)
|
|
|
- # if res_dict['success']:
|
|
|
- # if res_dict['data']['status'] == 0:
|
|
|
- # return response.json(173)
|
|
|
- # params = {'user_id': user_id, 'iccid': iccid, 'uid': uid, 'updated_time': n_time,
|
|
|
- # 'created_time': n_time}
|
|
|
- # UnicomDeviceInfo.objects.create(**params)
|
|
|
- # return response.json(0)
|
|
|
- # else:
|
|
|
- # return response.json(173)
|
|
|
- # except Exception as e:
|
|
|
- # print(e)
|
|
|
- # return response.json(177, repr(e))
|
|
|
- #
|
|
|
- # @classmethod
|
|
|
- # def save_unicom_combo(cls, request_dict, response):
|
|
|
- # """
|
|
|
- # 联通套餐保存
|
|
|
- # @param request_dict:
|
|
|
- # @param response:
|
|
|
- # @return:
|
|
|
- # """
|
|
|
- # combo_id = request_dict.get('id', None)
|
|
|
- # combo_name = request_dict.get('comboName', None)
|
|
|
- # flow_total = request_dict.get('flowTotal', None)
|
|
|
- # expiration_days = request_dict.get('expirationDays', None)
|
|
|
- # expiration_type = request_dict.get('expirationType', None)
|
|
|
- # price = request_dict.get('price', None)
|
|
|
- # remark = request_dict.get('remark', None)
|
|
|
- # pay_type = request_dict.get('payType', '').split(',')
|
|
|
- # if not all([pay_type, combo_name, flow_total, expiration_days, expiration_type, price]):
|
|
|
- # return response.json(444)
|
|
|
- # try:
|
|
|
- # flow_total = int(flow_total)
|
|
|
- # expiration_days = int(expiration_days)
|
|
|
- # expiration_type = int(expiration_type)
|
|
|
- # with transaction.atomic():
|
|
|
- # re_data = {
|
|
|
- # 'combo_name': combo_name,
|
|
|
- # 'flow_total': flow_total,
|
|
|
- # 'expiration_days': expiration_days,
|
|
|
- # 'expiration_type': expiration_type,
|
|
|
- # 'price': price,
|
|
|
- # }
|
|
|
- # if remark:
|
|
|
- # re_data['remark'] = remark
|
|
|
- # if combo_id:
|
|
|
- # UnicomCombo.objects.filter(id=combo_id).update(**re_data)
|
|
|
- # UnicomCombo.objects.get(id=combo_id).pay_type.set(pay_type)
|
|
|
- # return response.json(0)
|
|
|
- # UnicomCombo.objects.create(**re_data).pay_type.set(pay_type)
|
|
|
- # return response.json(0)
|
|
|
- # except Exception as e:
|
|
|
- # print(e)
|
|
|
- # return response.json(177, repr(e))
|
|
|
- #
|
|
|
- # @classmethod
|
|
|
- # def query_package_list(cls, response):
|
|
|
- # """
|
|
|
- # 查询套餐列表
|
|
|
- # @return:
|
|
|
- # """
|
|
|
- # try:
|
|
|
- # combo_qs = UnicomCombo.objects.filter(is_show=1, status=0, is_del=False) \
|
|
|
- # .order_by('sort').values('id', 'combo_name',
|
|
|
- # 'flow_total',
|
|
|
- # 'expiration_days',
|
|
|
- # 'expiration_type', 'price',
|
|
|
- # 'remark')
|
|
|
- # if not combo_qs.exists():
|
|
|
- # return response.json(0, [])
|
|
|
- # combo_list = []
|
|
|
- # for item in combo_qs:
|
|
|
- # # 获取支付方式列表
|
|
|
- # pay_type_qs = Pay_Type.objects.filter(unicomcombo=item['id']).values('id', 'payment')
|
|
|
- # combo_list.append({
|
|
|
- # 'id': item['id'],
|
|
|
- # 'comboName': item['combo_name'],
|
|
|
- # 'flowTotal': item['flow_total'],
|
|
|
- # 'expirationDays': item['expiration_days'],
|
|
|
- # 'expirationType': item['expiration_type'],
|
|
|
- # 'price': item['price'],
|
|
|
- # 'remark': item['remark'],
|
|
|
- # 'payTypes': list(pay_type_qs),
|
|
|
- # })
|
|
|
- # return response.json(0, combo_list)
|
|
|
- # except Exception as e:
|
|
|
- # print(e)
|
|
|
- # return response.json(177, repr(e))
|
|
|
- #
|
|
|
- # @classmethod
|
|
|
- # def buy_package(cls):
|
|
|
- # """
|
|
|
- # 购买套餐
|
|
|
- # @return:
|
|
|
- # """
|
|
|
- # pass
|
|
|
- #
|
|
|
- # @classmethod
|
|
|
- # def query_device_usage_history(cls):
|
|
|
- # """
|
|
|
- # 查询用量历史
|
|
|
- # @return:
|
|
|
- # """
|
|
|
- #
|
|
|
- # @staticmethod
|
|
|
- # def package_callback_notify(request_dict, request):
|
|
|
- # """
|
|
|
- # 异步套餐订购回调
|
|
|
- # @param request_dict:
|
|
|
- # @param request:
|
|
|
- # @return:
|
|
|
- # """
|
|
|
- # logger = logging.getLogger('info')
|
|
|
- # try:
|
|
|
- # logger.info('联通异步套餐订购回调参数{}'.format(request_dict))
|
|
|
- # body = request.body.decode("utf-8")
|
|
|
- # if body:
|
|
|
- # dict_data = json.loads(body)
|
|
|
- # sign = dict_data['sign']
|
|
|
- # logger.info('设备订购异步回调请求参数{}'.format(dict_data))
|
|
|
- # dict_data.pop('sign')
|
|
|
- # unicom_obj = UnicomObjeect()
|
|
|
- # generate_sign = unicom_obj.createSign(**dict_data)
|
|
|
- # logger.info('设备订购请求签名{}'.format(sign))
|
|
|
- # logger.info('设备订购生成签名{}'.format(generate_sign))
|
|
|
- # r_data = {'success': True, 'msg': '成功'}
|
|
|
- # return HttpResponse(json.dumps(r_data, ensure_ascii=False), content_type="application/json,charset=utf-8")
|
|
|
- # except Exception as e:
|
|
|
- # print(repr(e))
|
|
|
- # r_data = {'success': False, 'msg': '失败'}
|
|
|
- # return HttpResponse(json.dumps(r_data, ensure_ascii=False), content_type="application/json,charset=utf-8")
|
|
|
- #
|
|
|
- # @staticmethod
|
|
|
- # def device_queue_monitoring_push(request_dict, request):
|
|
|
- # """
|
|
|
- # 设备套餐队列用完或者到期推送
|
|
|
- # @param request_dict:
|
|
|
- # @param request:
|
|
|
- # @return:
|
|
|
- # """
|
|
|
- # logger = logging.getLogger('info')
|
|
|
- # try:
|
|
|
- # logger.info('设备套餐队列推送{}'.format(request_dict))
|
|
|
- # body = request.body.decode("utf-8")
|
|
|
- # if body:
|
|
|
- # dict_data = json.loads(body)
|
|
|
- # sign = dict_data['sign']
|
|
|
- # logger.info('设备套餐队列回调请求参数{}'.format(dict_data))
|
|
|
- # dict_data.pop('sign')
|
|
|
- # unicom_obj = UnicomObjeect()
|
|
|
- # generate_sign = unicom_obj.createSign(**dict_data)
|
|
|
- # logger.info('设备套餐队列请求签名{}'.format(sign))
|
|
|
- # logger.info('设备套餐队列生成签名{}'.format(generate_sign))
|
|
|
- # r_data = {'success': True, 'msg': '成功'}
|
|
|
- # return HttpResponse(json.dumps(r_data, ensure_ascii=False), content_type="application/json,charset=utf-8")
|
|
|
- # except Exception as e:
|
|
|
- # print(repr(e))
|
|
|
- # r_data = {'success': False, 'msg': '失败'}
|
|
|
- # return HttpResponse(json.dumps(r_data, ensure_ascii=False), content_type="application/json,charset=utf-8")
|
|
|
- #
|
|
|
- # @staticmethod
|
|
|
- # def device_status_change_push(request_dict, request):
|
|
|
- # """
|
|
|
- # 设备状态变更推送执行场景说明
|
|
|
- # @param request_dict:
|
|
|
- # @param request:
|
|
|
- # @return:
|
|
|
- # """
|
|
|
- # logger = logging.getLogger('info')
|
|
|
- # try:
|
|
|
- # logger.info('设备状态变更推送{}'.format(request_dict))
|
|
|
- # body = request.body.decode("utf-8")
|
|
|
- # if body:
|
|
|
- # dict_data = json.loads(body)
|
|
|
- # sign = dict_data['sign']
|
|
|
- # logger.info('设备状态变更推送请求参数{}'.format(dict_data))
|
|
|
- # dict_data.pop('sign')
|
|
|
- # unicom_obj = UnicomObjeect()
|
|
|
- # generate_sign = unicom_obj.createSign(**dict_data)
|
|
|
- # logger.info('设备状态变更推送请求签名{}'.format(sign))
|
|
|
- # logger.info('设备状态变更推送生成签名{}'.format(generate_sign))
|
|
|
- # r_data = {'success': True, 'msg': '成功'}
|
|
|
- # return HttpResponse(json.dumps(r_data, ensure_ascii=False), content_type="application/json,charset=utf-8")
|
|
|
- # except Exception as e:
|
|
|
- # print(repr(e))
|
|
|
- # r_data = {'success': False, 'msg': '失败'}
|
|
|
- # return HttpResponse(json.dumps(r_data, ensure_ascii=False), content_type="application/json,charset=utf-8")
|
|
|
+ def get(self, request, *args, **kwargs):
|
|
|
+ request.encoding = 'utf-8'
|
|
|
+ operation = kwargs.get('operation')
|
|
|
+ return self.validation(request.GET, request, operation)
|
|
|
+
|
|
|
+ def post(self, request, *args, **kwargs):
|
|
|
+ request.encoding = 'utf-8'
|
|
|
+ operation = kwargs.get('operation')
|
|
|
+ return self.validation(request.POST, request, operation)
|
|
|
+
|
|
|
+ def validation(self, request_dict, request, operation):
|
|
|
+ if operation == 'buy-notify':
|
|
|
+ return self.package_callback_notify(request_dict, request)
|
|
|
+ elif operation == 'device-queue-monitoring':
|
|
|
+ return self.device_queue_monitoring_push(request_dict, request)
|
|
|
+ elif operation == 'device-status-change':
|
|
|
+ return self.device_status_change_push(request_dict, request)
|
|
|
+ else:
|
|
|
+ token = TokenObject(request.META.get('HTTP_AUTHORIZATION'))
|
|
|
+ lang = request_dict.get('lang', token.lang)
|
|
|
+ response = ResponseObject(lang)
|
|
|
+ if token.code != 0:
|
|
|
+ return response.json(token.code)
|
|
|
+ user_id = token.userID
|
|
|
+ if operation == 'device-bind':
|
|
|
+ return self.device_add(user_id, request_dict, response)
|
|
|
+ elif operation == 'combo-save':
|
|
|
+ return self.save_unicom_combo(request_dict, response)
|
|
|
+ elif operation == 'combo-list':
|
|
|
+ return self.query_package_list(response)
|
|
|
+
|
|
|
+ @classmethod
|
|
|
+ def device_add(cls, user_id, request_dict, response):
|
|
|
+ """
|
|
|
+ 设备绑定iccid
|
|
|
+ @param user_id:
|
|
|
+ @param request_dict:
|
|
|
+ @param response:
|
|
|
+ @return:
|
|
|
+ """
|
|
|
+ iccid = request_dict.get('iccid', None)
|
|
|
+ uid = request_dict.get('uid', None)
|
|
|
+ if not all([iccid, uid]):
|
|
|
+ return response.json(444)
|
|
|
+ n_time = int(time.time())
|
|
|
+ try:
|
|
|
+ # 待完善代码 根据uid与用户id验证系统设备
|
|
|
+ unicom_device_qs = UnicomDeviceInfo.objects.filter(iccid=iccid)
|
|
|
+ if unicom_device_qs.exists():
|
|
|
+ return response.json(174)
|
|
|
+ unicom_obj = UnicomObjeect()
|
|
|
+ result = unicom_obj.verify_device(iccid=iccid)
|
|
|
+ if result.status_code == 200 and result.text:
|
|
|
+ res_dict = json.loads(result.text)
|
|
|
+ if res_dict['success']:
|
|
|
+ if res_dict['data']['status'] == 0:
|
|
|
+ return response.json(173)
|
|
|
+ params = {'user_id': user_id, 'iccid': iccid, 'uid': uid, 'updated_time': n_time,
|
|
|
+ 'created_time': n_time}
|
|
|
+ UnicomDeviceInfo.objects.create(**params)
|
|
|
+ return response.json(0)
|
|
|
+ else:
|
|
|
+ return response.json(173)
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return response.json(177, repr(e))
|
|
|
+
|
|
|
+ @classmethod
|
|
|
+ def save_unicom_combo(cls, request_dict, response):
|
|
|
+ """
|
|
|
+ 联通套餐保存
|
|
|
+ @param request_dict:
|
|
|
+ @param response:
|
|
|
+ @return:
|
|
|
+ """
|
|
|
+ combo_id = request_dict.get('id', None)
|
|
|
+ combo_name = request_dict.get('comboName', None)
|
|
|
+ flow_total = request_dict.get('flowTotal', None)
|
|
|
+ expiration_days = request_dict.get('expirationDays', None)
|
|
|
+ expiration_type = request_dict.get('expirationType', None)
|
|
|
+ price = request_dict.get('price', None)
|
|
|
+ remark = request_dict.get('remark', None)
|
|
|
+ pay_type = request_dict.get('payType', '').split(',')
|
|
|
+ if not all([pay_type, combo_name, flow_total, expiration_days, expiration_type, price]):
|
|
|
+ return response.json(444)
|
|
|
+ try:
|
|
|
+ flow_total = int(flow_total)
|
|
|
+ expiration_days = int(expiration_days)
|
|
|
+ expiration_type = int(expiration_type)
|
|
|
+ with transaction.atomic():
|
|
|
+ re_data = {
|
|
|
+ 'combo_name': combo_name,
|
|
|
+ 'flow_total': flow_total,
|
|
|
+ 'expiration_days': expiration_days,
|
|
|
+ 'expiration_type': expiration_type,
|
|
|
+ 'price': price,
|
|
|
+ }
|
|
|
+ if remark:
|
|
|
+ re_data['remark'] = remark
|
|
|
+ if combo_id:
|
|
|
+ UnicomCombo.objects.filter(id=combo_id).update(**re_data)
|
|
|
+ UnicomCombo.objects.get(id=combo_id).pay_type.set(pay_type)
|
|
|
+ return response.json(0)
|
|
|
+ UnicomCombo.objects.create(**re_data).pay_type.set(pay_type)
|
|
|
+ return response.json(0)
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return response.json(177, repr(e))
|
|
|
+
|
|
|
+ @classmethod
|
|
|
+ def query_package_list(cls, response):
|
|
|
+ """
|
|
|
+ 查询套餐列表
|
|
|
+ @return:
|
|
|
+ """
|
|
|
+ try:
|
|
|
+ combo_qs = UnicomCombo.objects.filter(is_show=1, status=0, is_del=False) \
|
|
|
+ .order_by('sort').values('id', 'combo_name',
|
|
|
+ 'flow_total',
|
|
|
+ 'expiration_days',
|
|
|
+ 'expiration_type', 'price',
|
|
|
+ 'remark')
|
|
|
+ if not combo_qs.exists():
|
|
|
+ return response.json(0, [])
|
|
|
+ combo_list = []
|
|
|
+ for item in combo_qs:
|
|
|
+ # 获取支付方式列表
|
|
|
+ pay_type_qs = Pay_Type.objects.filter(unicomcombo=item['id']).values('id', 'payment')
|
|
|
+ combo_list.append({
|
|
|
+ 'id': item['id'],
|
|
|
+ 'comboName': item['combo_name'],
|
|
|
+ 'flowTotal': item['flow_total'],
|
|
|
+ 'expirationDays': item['expiration_days'],
|
|
|
+ 'expirationType': item['expiration_type'],
|
|
|
+ 'price': item['price'],
|
|
|
+ 'remark': item['remark'],
|
|
|
+ 'payTypes': list(pay_type_qs),
|
|
|
+ })
|
|
|
+ return response.json(0, combo_list)
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return response.json(177, repr(e))
|
|
|
+
|
|
|
+ @classmethod
|
|
|
+ def buy_package(cls):
|
|
|
+ """
|
|
|
+ 购买套餐
|
|
|
+ @return:
|
|
|
+ """
|
|
|
+ pass
|
|
|
+
|
|
|
+ @classmethod
|
|
|
+ def query_device_usage_history(cls):
|
|
|
+ """
|
|
|
+ 查询用量历史
|
|
|
+ @return:
|
|
|
+ """
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def package_callback_notify(request_dict, request):
|
|
|
+ """
|
|
|
+ 异步套餐订购回调
|
|
|
+ @param request_dict:
|
|
|
+ @param request:
|
|
|
+ @return:
|
|
|
+ """
|
|
|
+ logger = logging.getLogger('info')
|
|
|
+ try:
|
|
|
+ logger.info('联通异步套餐订购回调参数{}'.format(request_dict))
|
|
|
+ body = request.body.decode("utf-8")
|
|
|
+ if body:
|
|
|
+ dict_data = json.loads(body)
|
|
|
+ sign = dict_data['sign']
|
|
|
+ logger.info('设备订购异步回调请求参数{}'.format(dict_data))
|
|
|
+ dict_data.pop('sign')
|
|
|
+ unicom_obj = UnicomObjeect()
|
|
|
+ generate_sign = unicom_obj.createSign(**dict_data)
|
|
|
+ logger.info('设备订购请求签名{}'.format(sign))
|
|
|
+ logger.info('设备订购生成签名{}'.format(generate_sign))
|
|
|
+ r_data = {'success': True, 'msg': '成功'}
|
|
|
+ return HttpResponse(json.dumps(r_data, ensure_ascii=False), content_type="application/json,charset=utf-8")
|
|
|
+ except Exception as e:
|
|
|
+ print(repr(e))
|
|
|
+ r_data = {'success': False, 'msg': '失败'}
|
|
|
+ return HttpResponse(json.dumps(r_data, ensure_ascii=False), content_type="application/json,charset=utf-8")
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def device_queue_monitoring_push(request_dict, request):
|
|
|
+ """
|
|
|
+ 设备套餐队列用完或者到期推送
|
|
|
+ @param request_dict:
|
|
|
+ @param request:
|
|
|
+ @return:
|
|
|
+ """
|
|
|
+ logger = logging.getLogger('info')
|
|
|
+ try:
|
|
|
+ logger.info('设备套餐队列推送{}'.format(request_dict))
|
|
|
+ body = request.body.decode("utf-8")
|
|
|
+ if body:
|
|
|
+ dict_data = json.loads(body)
|
|
|
+ sign = dict_data['sign']
|
|
|
+ logger.info('设备套餐队列回调请求参数{}'.format(dict_data))
|
|
|
+ dict_data.pop('sign')
|
|
|
+ unicom_obj = UnicomObjeect()
|
|
|
+ generate_sign = unicom_obj.createSign(**dict_data)
|
|
|
+ logger.info('设备套餐队列请求签名{}'.format(sign))
|
|
|
+ logger.info('设备套餐队列生成签名{}'.format(generate_sign))
|
|
|
+ r_data = {'success': True, 'msg': '成功'}
|
|
|
+ return HttpResponse(json.dumps(r_data, ensure_ascii=False), content_type="application/json,charset=utf-8")
|
|
|
+ except Exception as e:
|
|
|
+ print(repr(e))
|
|
|
+ r_data = {'success': False, 'msg': '失败'}
|
|
|
+ return HttpResponse(json.dumps(r_data, ensure_ascii=False), content_type="application/json,charset=utf-8")
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def device_status_change_push(request_dict, request):
|
|
|
+ """
|
|
|
+ 设备状态变更推送执行场景说明
|
|
|
+ @param request_dict:
|
|
|
+ @param request:
|
|
|
+ @return:
|
|
|
+ """
|
|
|
+ logger = logging.getLogger('info')
|
|
|
+ try:
|
|
|
+ logger.info('设备状态变更推送{}'.format(request_dict))
|
|
|
+ body = request.body.decode("utf-8")
|
|
|
+ if body:
|
|
|
+ dict_data = json.loads(body)
|
|
|
+ sign = dict_data['sign']
|
|
|
+ logger.info('设备状态变更推送请求参数{}'.format(dict_data))
|
|
|
+ dict_data.pop('sign')
|
|
|
+ unicom_obj = UnicomObjeect()
|
|
|
+ generate_sign = unicom_obj.createSign(**dict_data)
|
|
|
+ logger.info('设备状态变更推送请求签名{}'.format(sign))
|
|
|
+ logger.info('设备状态变更推送生成签名{}'.format(generate_sign))
|
|
|
+ r_data = {'success': True, 'msg': '成功'}
|
|
|
+ return HttpResponse(json.dumps(r_data, ensure_ascii=False), content_type="application/json,charset=utf-8")
|
|
|
+ except Exception as e:
|
|
|
+ print(repr(e))
|
|
|
+ r_data = {'success': False, 'msg': '失败'}
|
|
|
+ return HttpResponse(json.dumps(r_data, ensure_ascii=False), content_type="application/json,charset=utf-8")
|