Exemple #1
0
 def get_current_temp_state(self, user_id):
     if not user_id:
         self.stderr.write('Invalid User ID')
         return
     res = TempChargeManagement.get_max_charges(user_id[0])
     print("Credit : %s" % res[0])
     print("Days : %s" % res[1])
     print("Credit Price : %s" % res[2])
     print("Service Price : %s" % res[3])
Exemple #2
0
def temp_recharge(request):
    x = TempChargeManagement(request)
    try:
        user = x.get_target_user()
        if not check_ajax(request):
            res = x.get_max_charges(user.pk)
            return render(request, 'service/TempCharge/TempCharge.html', {'credit': res[0],
                                                                          'days': res[1],
                                                                          'uid': user.pk,
                                                                          'day_price': res[2],
                                                                          'gig_price': res[3]})
        z = x.update()
        if z[1] > 0:
            address = '%s?f=%s' % (reverse('e_payment'), z[1])
        # Utils.kill_user_by_request(user.pk, request=request)
            return HttpResponse(address)
        else:
            res = '200'
            return HttpResponse(res)
    except RequestProcessException as e:
        return e.get_response()