def auth(): i = ctx.request.input(phoneid='') phoneid = i.phoneid.strip() contact = Contact.find_first('where tel=?',phoneid) contact1 = Contact.find_first('where work_tel=?',phoneid) if contact: return dict(contact) elif contact1: return dict(contact1) else : raise APIResourceNotFoundError(phoneid,'failed')
def contactlist(id): contact = Contact.find_first('where id=?',id) if contact is None: raise notfound() contactlist = Contact.find_by('where groupid=?',contact.groupid) if contactlist: return dict(contactlist=contactlist,group=contact.groupid) else: raise APIResourceNotFoundError(contact.groupid,'failed')
def contactlist(id): contact = Contact.find_first("where id=?", id) if contact is None: raise notfound() contactlist = Contact.find_by("where groupid=? and year=? order by headman desc", contact.groupid, contact.year) print("------++++++--") if contactlist: print("----------------") return dict(contactlist=contactlist, group=contact.groupid) else: print("+++++++++++++++++") raise APIResourceNotFoundError(contact.groupid, "failed")
def welcome(id): contact = Contact.find_first("where id=?", id) if contact: return dict(contact=contact) else: raise APIResourceNotFoundError(phoneid, "failed")