def save(self, *args, **kwargs): t = time.mktime(timezone.now().timetuple()) if not self.createtime: self.createtime = t if not self.passwd: self.passwd = md5pass('123456') if not self.pay_passwd: self.pay_passwd = md5pass('123456') return super(Users, self).save(*args, **kwargs)
def requestHandlerForHtml(self): logger.info("向上游请求的值:{}".format(self.request_data)) html=""" <html lang="zh-CN"><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>傲银支付</title> </head> <body> <div class="container"> <div class="row" style="margin:15px;"> <div class="col-md-12"> <form class="form-inline" method="{}" action="{}"> """.format(self.rules['request']['method'],self.rules['request']['url']) for key,value in self.request_data.items(): html+="""<input type="hidden" name="{}" value="{}">""".format(key,value) html += """ </form> </div> </div> </div> <script src="http://47.75.120.33//static/jquery-1.4.1.min.js"></script> <script> $(function(){document.querySelector('form').submit();}) ;</script> </body> </html> """ RedisOrderCreate().redis_insert(md5pass(str(self.data['ordercode'])),html)
def smssend(mobile=None,flag=0,vercode=None): print(mobile) if isinstance(mobile, list): mobiletmp = '' for item in mobile: mobiletmp += '{},'.format(item) print(mobiletmp) mobile = mobiletmp[:-1] if flag==0: content='您现在正在注册众瑞金融账户,您的验证码是{}【众瑞金融】'.format(vercode) elif flag==1: content = '尊敬的会员您好!您的订单已匹配成功, 请登录查询。退订回T【众瑞金融】' print(mobile) print(content) send_request( url="http://dx110.ipyy.net/smsJson.aspx", method='post', data={ 'account': '8MYX00159', 'password': md5pass('8MYX0015998'), 'mobile' : mobile, 'content' : content, 'action' : 'send', } )
def responseHandlerForHtml(self): return url_join("/api_new/business/DownOrder?o={}".format( md5pass(str(self.data['ordercode']))))