def auth(req, data): username = data.get('username') password = data.get('password') utype = data.get('utype') sql = '''select password,id,nickname,username,utype,email,bgmusic,credits,logo from ww_member where site_id=%s and (username='******' or email='%s' or phone='%s') ''' % (fun.get_site_id(req), username, username, username) # print sql r = unio().fetchOne(sql) # print r if not r: if utype=='gyq': sql = '''select password,ww_member.id,nickname,username,utype,email,bgmusic,credits,logo from ww_member, ww_member_normal where site_id=%s and ww_member.id=ww_member_normal.id and ww_member_normal.shoujihao='%s' ''' % (fun.get_site_id(req), username) # print sql r = unio().fetchOne(sql) if not r: sql = '''select password,ww_member.id,nickname,username,utype,email,bgmusic,credits,logo from ww_member, ww_member_vip where site_id=%s and ww_member.id=ww_member_vip.id and ww_member_vip.lianxifangshi='%s' ''' % (fun.get_site_id(req), username) # print sql r = unio().fetchOne(sql) if r and r.pop('password')==fun.mk_md5(password): sql = '''update ww_member set credits=credits+1 where id=%s''' % r['id'] unio().execute(sql) return fun.convert_dengji_list(r)[0]
def auth_3rd(req, openid, utype): sql = '''select password,id,nickname,username,utype,email,bgmusic,credits,logo from ww_member where site_id=%s and 3rd_id='%s' and 3rd_type='%s';''' % (fun.get_site_id(req), openid, utype) # print sql r = unio().fetchOne(sql) if r: sql = '''update ww_member set credits=credits+1 where id=%s''' % r['id'] unio().execute(sql) return fun.convert_dengji_list(r)[0]
def get_ktq_list(req, n, zhuanye=None, page=1): index = (page-1)*n if zhuanye: sql = '''select vip.id, ww_member.logo, utype, zhuti, qiyeming, qiyewangzhi as url,qiyejianjie,ww_zhuanye.desc as zhuanye, ww_member.credits, vip.qiyejianjie from ww_member_vip vip, ww_member, ww_zhuanye where ww_member.status=1 and ww_member.site_id=%s and vip.zhuanye='%s' and vip.id=ww_member.id and ww_zhuanye.name=vip.zhuanye order by id desc limit %s,%s''' % (fun.get_site_id(req), zhuanye, index, n) else: sql = '''select vip.id, ww_member.logo, utype, zhuti, qiyeming, qiyewangzhi as url,qiyejianjie,ww_zhuanye.desc as zhuanye, ww_member.credits, vip.qiyejianjie from ww_member_vip vip, ww_member, ww_zhuanye where ww_member.status=1 and ww_member.site_id=%s and vip.id=ww_member.id and ww_zhuanye.name=vip.zhuanye order by vip.id desc limit %s,%s''' % (fun.get_site_id(req), index, n) # print sql rs = unio().fetchAll(sql) return fun.convert_dengji_list(*rs)
def get_gyq_list(req, n, zhiwei=None, page=1): index = (page-1)*n if zhiwei: sql = '''select ww_member.id, utype,ww_zhiwei.desc as zhiwei,ww_member.logo,ww_member.nickname, ww_member.credits, normal.zuoyouming from ww_member_normal normal,ww_member,ww_zhiwei where ww_member.status=1 and ww_member.site_id=%s and normal.zhiwei='%s' and ww_member.id=normal.id and ww_zhiwei.name=normal.zhiwei order by normal.id desc limit %s,%s''' % (fun.get_site_id(req), zhiwei, index, n) else: sql = '''select ww_member.id, utype,ww_zhiwei.desc as zhiwei,ww_member.logo,ww_member.nickname, ww_member.credits, normal.zuoyouming from ww_member_normal normal,ww_member,ww_zhiwei where ww_member.status=1 and ww_member.site_id=%s and ww_member.id=normal.id and ww_zhiwei.name=normal.zhiwei order by normal.id desc limit %s,%s''' % (fun.get_site_id(req), index, n) # print sql rs = unio().fetchAll(sql) return fun.convert_dengji_list(*rs)
def get_ktq_list(req, n, zhuanye=None, page=1): index = (page-1)*n if zhuanye: sql = '''select vip.id, ww_member.logo, utype, zhuti, qiyeming, qiyewangzhi as url,qiyejianjie,ww_zhuanye.desc as zhuanye, ww_member.credits, vip.qiyejianjie from ww_member_vip vip, ww_member, ww_zhuanye where ww_member.status=1 and ww_member.site_id=%s and vip.zhuanye='%s' and vip.id=ww_member.id and ww_zhuanye.name=vip.zhuanye order by ww_member.credits desc limit %s,%s''' % (fun.get_site_id(req), zhuanye, index, n) else: sql = '''select vip.id, ww_member.logo, utype, zhuti, qiyeming, qiyewangzhi as url,qiyejianjie,ww_zhuanye.desc as zhuanye, ww_member.credits, vip.qiyejianjie from ww_member_vip vip, ww_member, ww_zhuanye where ww_member.status=1 and ww_member.site_id=%s and vip.id=ww_member.id and ww_zhuanye.name=vip.zhuanye order by ww_member.credits desc limit %s,%s''' % (fun.get_site_id(req), index, n) # print sql rs = unio().fetchAll(sql) return fun.convert_dengji_list(*rs)
def get_gyq_list(req, n, zhiwei=None, page=1): index = (page-1)*n if zhiwei: sql = '''select ww_member.id, utype,ww_zhiwei.desc as zhiwei,ww_member.logo,ww_member.nickname, ww_member.credits, normal.zuoyouming from ww_member_normal normal,ww_member,ww_zhiwei where ww_member.status=1 and ww_member.site_id=%s and normal.zhiwei='%s' and ww_member.id=normal.id and ww_zhiwei.name=normal.zhiwei order by ww_member.credits desc limit %s,%s''' % (fun.get_site_id(req), zhiwei, index, n) else: sql = '''select ww_member.id, utype,ww_zhiwei.desc as zhiwei,ww_member.logo,ww_member.nickname, ww_member.credits, normal.zuoyouming from ww_member_normal normal,ww_member,ww_zhiwei where ww_member.status=1 and ww_member.site_id=%s and ww_member.id=normal.id and ww_zhiwei.name=normal.zhiwei order by ww_member.credits desc limit %s,%s''' % (fun.get_site_id(req), index, n) # print sql rs = unio().fetchAll(sql) return fun.convert_dengji_list(*rs)
def auth(req, data): username = data.get('username') password = data.get('password') sql = '''select password,id,nickname,username,utype,email,bgmusic,credits,logo from ww_member where site_id=%s and (username='******' or email='%s') ''' % (fun.get_site_id(req), username, username) # print sql r = unio().fetchOne(sql) # print r if not r: sql = '''select password,ww_member.id,nickname,username,utype,email,bgmusic,credits,logo from ww_member, ww_member_normal where site_id=%s and ww_member.id=ww_member_normal.id and ww_member_normal.shoujihao='%s' ''' % (fun.get_site_id(req), username) # print sql r = unio().fetchOne(sql) if r and r.pop('password')==fun.mk_md5(password): sql = '''update ww_member set credits=credits+1 where id=%s''' % r['id'] unio().execute(sql) return fun.convert_dengji_list(r)[0]
def get_user_info(data): uid = data.get('userid') t = data.get('t') if not uid or not t: return {} # print t if t=='gyq': sql = '''select ww_member.id, username, utype, nickname,email,credits,ww_member.logo,ww_member_normal.xingming as name from ww_member, ww_member_normal where ww_member.id=%s and ww_member.id=ww_member_normal.id''' % uid elif t=='ktq': sql = '''select ww_member.id, username, utype, nickname,email,credits,vip.qiyejianjie,ww_member.logo, vip.qiyeming as name from ww_member,ww_member_vip vip where ww_member.id=%s and ww_member.id=vip.id''' % uid # print sql r = unio().fetchOne(sql) # print r if r: return fun.convert_dengji_list(r)[0] else: return {}
def get_user_info(data): uid = data.get('userid') t = data.get('t') if not uid or not t: return {} # print t if t=='gyq': sql = '''select ww_member.id, qq, weixin, linkedin,username, utype, nickname,email,credits,ww_member.logo,ww_member_normal.xingming as name,shoujihao as phone,zhiwei as zhuanye,sex from ww_member, ww_member_normal where ww_member.id=%s and ww_member.id=ww_member_normal.id''' % uid elif t=='ktq': sql = '''select ww_member.id, username, qiyewangzhi, utype, nickname,email,credits,vip.qiyejianjie,ww_member.logo, vip.qiyeming as name from ww_member,ww_member_vip vip where ww_member.id=%s and ww_member.id=vip.id''' % uid # print sql r = unio().fetchOne(sql) # print r if r: return fun.convert_dengji_list(r)[0] else: return {}