Example #1
0
 def send_admin_bind_code(self,tel):
     """管理员绑定时候发送验证吗"""
     tel = str(tel)
     if not PublicFunc.tel_regex(tel): return '手机号码不合法' #手机号码不合法
     #该手机号码已经被绑定 reuturn 1 
     if self.cache.exists('admin:bind:tel:' + tel): return '验证码已经发送' #验证码已经发送
     code = PublicFunc.get_random_num(4)
     content = '您要绑定手机号 验证码为' + code + ' 有效期为5分钟'
     self.cache.set('admin:bind:tel:' + tel,code)
     self.cache.expire('admin:bind:tel:' + tel,options.bind_tel_expires)
     if not PublicFunc.send_sms(tel,content): return '发送失败'
     return True
Example #2
0
 def send_wecha_bind_tel_code(self,tel,uid):
     """向待绑定微信的手机号发送验证码 """
     if not PublicFunc.tel_regex(tel): return '手机号码不合法' #手机号码不合法
     if self.get_uid_via_tel(tel) is None: return '该手机号未注册!'#提醒用户去注册
     if self.judge_tel_bind_status(tel): return '该手机号已经被绑定'#该账号已经被绑定
     if self.cache.exists('bind:tel:' + tel): return '验证码已经发送' #验证码已经发送
     code = PublicFunc.get_random_num(4)
     content = '您要绑定手机号 验证码为' + code + ' 有效期为5分钟'
     PublicFunc.send_sms(tel,content)
     self.cache.set('bind:tel:' + tel,code)
     self.cache.expire('bind:tel:' + tel,options.bind_tel_expires)
     return True #验证码发送成功
Example #3
0
 def send_wecha_bind_tel_code(self, tel, uid):
     """向待绑定微信的手机号发送验证码 """
     if not PublicFunc.tel_regex(tel): return '手机号码不合法'  #手机号码不合法
     if self.get_uid_via_tel(tel) is None: return '该手机号未注册!'  #提醒用户去注册
     if self.judge_tel_bind_status(tel): return '该手机号已经被绑定'  #该账号已经被绑定
     if self.cache.exists('bind:tel:' + tel): return '验证码已经发送'  #验证码已经发送
     code = PublicFunc.get_random_num(4)
     content = '您要绑定手机号 验证码为' + code + ' 有效期为5分钟'
     PublicFunc.send_sms(tel, content)
     self.cache.set('bind:tel:' + tel, code)
     self.cache.expire('bind:tel:' + tel, options.bind_tel_expires)
     return True  #验证码发送成功
Example #4
0
 def send_admin_bind_code(self, tel):
     """管理员绑定时候发送验证吗"""
     tel = str(tel)
     if not PublicFunc.tel_regex(tel): return '手机号码不合法'  #手机号码不合法
     #该手机号码已经被绑定 reuturn 1
     if self.cache.exists('admin:bind:tel:' + tel):
         return '验证码已经发送'  #验证码已经发送
     code = PublicFunc.get_random_num(4)
     content = '您要绑定手机号 验证码为' + code + ' 有效期为5分钟'
     self.cache.set('admin:bind:tel:' + tel, code)
     self.cache.expire('admin:bind:tel:' + tel, options.bind_tel_expires)
     if not PublicFunc.send_sms(tel, content): return '发送失败'
     return True