def send_sms(request): # 开始调用函数校验 form = SendSmsForm(request, data=request.GET) if form.is_valid(): return JsonResponse({'status': True}) return JsonResponse({'status': False, 'error': form.errors})
def send_sms(request): """ 发送短信验证码 """ form = SendSmsForm(request, data=request.GET) # 只是校验手机号:不能为空、格式是否正确 if form.is_valid(): return JsonResponse({'status': True}) return JsonResponse({'status': False, 'error': form.errors})
def send_sms(request): form = SendSmsForm(request, data=request.GET) # 只是校验手机号码:不能为空,格式是否正确 if form.is_valid(): # 发短信,写redis return JsonResponse({'status': True}) return JsonResponse({'status': False, 'error': form.errors})
def send_sms(request): # mobile_phone = request.GET.get('mobile_phone') # tpl = request.GET.get('tpl') form = SendSmsForm(request, data=request.GET) if form.is_valid(): return JsonResponse({'status': True}) return JsonResponse({'status': False, 'error': form.errors})
def send_sms(request): '''发送短信''' form = SendSmsForm(request, data=request.GET) if form.is_valid(): print(1) return JsonResponse({'status': True}) return JsonResponse({'status': False, 'error': form.errors})
def send_sms(request): """发送短信""" form = SendSmsForm(request, data=request.GET) if form.is_valid(): return JsonResponse({'status': True}) # form.errors方法则是返回form中所有的异常结果 return JsonResponse({'status': False, 'error': form.errors})
def send_sms(request): """发送短信""" form = SendSmsForm(data=request.GET) # 只是校验手机号:不能为空和格式是否正确 if form.is_valid(): pass return HttpResponse('成功')
def send_sms(request): """ Send SMS """ form = SendSmsForm(request, data=request.GET) # Check if the phone number is empty or the format is correct if form.is_valid(): return JsonResponse({'status': True}) return JsonResponse({'status': False, 'error': form.errors})
def send_sms(request): #发送短信 mobile_phone = request.GET.get('mobile_phone') tpl = request.GET.get('tpl') #register/login form = SendSmsForm(request, data=request.GET) #只是校验手机号:不能为空,格式是否正确 if form.is_valid(): return JsonResponse({'status': True}) return JsonResponse({'status': False, 'error': form.errors})
def send_sms(request): """发送短信""" form = SendSmsForm(request, data=request.GET) # 校验手机号不能为空 格式是否正确 if form.is_valid(): # 发短信 & 在钩子函数中做 # redis & 在钩子函数中做 return JsonResponse({"status": True}) return JsonResponse({'status': False, 'error': form.errors})
def send_msg(request): """ 对手机号进行校验,通过后发送验证码 :param request: :return: """ form = SendSmsForm(request, data=request.GET) if form.is_valid(): # 完成对手机的校验,发送短信并写入redis data = {"status": True} return JsonResponse(data) return JsonResponse({"status": False, "error": form.errors})
def send_sms(request): """发送短信""" print(request.GET) form = SendSmsForm(request, data=request.GET) # 只是校验手机号:不能为空、格式是否正确 if form.is_valid(): # 发短信 # 写redis return JsonResponse({'status': True}) return JsonResponse({ 'status': False, 'error': form.errors }) # 主要有错误信息都会放到form.errors中
def send_sms(request): """ 发送短信 :param request: :return: """ form = SendSmsForm(request, data=request.GET) # 只是校验手机号,不能为空、格式是否正确 if form.is_valid(): # 发送短信 # 写redis return JsonResponse({'status': True}) return JsonResponse({'status': False, 'error': form.errors})
def sms(request): """发送手机验证码 ?tpl=login --> 914045 ?tpl=register --> 914010 @param request: @return: """ if request.method == 'POST': # 获取内容 form = SendSmsForm(request, request.POST) if form.is_valid(): # 都放在is_valid的钩子中处理 # 数据验证成功,进行短信发送 # 写入到redis return JsonResponse({'code': 200, 'msg': 'ok'}) else: return JsonResponse({'code': 416, 'msg': form.errors})
def send_sms(request): # """发送短信""" # code=random.randrange(1000,9999) # tpl=request.GET.get('tpl') # template_id=settings.TENCENT_SMS_TEMPLATE[tpl] # if not template_id: # return HttpResponse('模板不存在,无法获取模板id') # res=send_sms_single(phone_num=15667362251,template_id=template_id,template_param_list=[code]) # print(res) # if res['result']==0: # return HttpResponse('发送成功') # else: # return HttpResponse(res['errmsg']) form = SendSmsForm(request, data=request.GET) if form.is_valid(): #发送短信redis #写入 return JsonResponse({'status': True}) return JsonResponse({'status': False, 'error': form.errors})
def send_sms(request): """ 发送短信 :param request: ?tpl=login ?tpl=register :return: """ sms_from = SendSmsForm(request, data=request.GET) if sms_from.is_vaild: return JsonResponse({'status': True}) return JsonResponse({'status': False, 'error': sms_from.errors})
def sendSms(request): """发送短信""" form = SendSmsForm(request, data=request.GET) if form.is_valid(): return JsonResponse({"status": True}) return JsonResponse({"status": False, "error": form.errors})