:
133 try:
134 # conn = MySQLdb.connect(host='localhost', user='root', passwd='123456', db='shang', port=3306)
135 cur = self.conn.cursor()
136 cur.execute('select * from register WHERE Openid=%s ' % self.openid)
137 rows = cur.fetchall()
138 if rows:
139 return True
140 else:
141 print "Please register with the registration page"
142 cur.close()
143 self.conn.close()
144 except MySQLdb.Error, e:
145 print "Mysql Error %d: %s" % (e.args[0], e.args[1])
146
147 def Judge_tel(self):
148 try:
149 # conn = MySQLdb.connect(host='localhost', user='root', passwd='123456', db='shang', port=3306)
150 cur = self.conn.cursor()
151 cur.execute('select * from register WHERE Tel=%s ' % self.tel)
152 rows = cur.fetchall()
153 if rows:
154 return True
155 else:
156 print "Please enter the telephone number again"
157 cur.close()
158 self.conn.close()
159 except MySQLdb.Error, e:
160 print "Mysql Error %d: %s" % (e.args[0], e.args[1])
View Code
一开始我是以为所有步骤都要走一遍,后来发现在我所做的实际操作里我只需要获取到openid就可以,换而言之就是我只需要用过code换区网页授权access_token,从中拿到openid,从而验证的这个验证或者绑定的过程就可以完成。
当然,如果你想要更加合理无误的话,却是需要更加复杂和完善的操作。
|