示例#1
0
文件: views.py 项目: whmymt/meeting
 def get_context(self, request, *args, **kwargs):
     if request.params.encrypted_data or request.params.iv:
         try:
             data = biz.decrypt_message(request.user.session_key, request.params.iv, request.params.encrypted_data)
         except Exception:
             utility.reportExceptionByMail("decrypt_message")
             raise CustomError(ErrCode.ERR_SYS_ERROR)
         request.user.set_info(data)
     return serializer.UserSerializer(request.user, request=request).data
示例#2
0
 def get_context(self, request, *args, **kwargs):
     room = models.Room.objects.create(
         name=request.params.name,
         description=request.params.description,
         create_user_id=request.user.pk,
         create_user_manager=request.params.create_user_manager
     )
     try:
         room.qr_code = biz.get_wxa_code_unlimited_file(
             "room_%d.jpg" % room.pk, scene="room_id=%d" % room.pk, page="pages/room/detail"
         )
         room.save(update_fields=['qr_code', ], force_update=True)
     except Exception:
         utility.reportExceptionByMail("get_wxa_code_unlimited_file")
     self.get_room_follow(room.pk, request.user.pk)
     return serializer.RoomSerializer(room, request=request).data