def find(self,s): pp_diy = r"^借书\Z" if re.search(pp_diy, str(s.content)): from app.model.dll_library import getLib from app.model.db_user import User temUser = User(s.userName) id = temUser.query("ss_num") password = temUser.query("password_inf") if temUser.query("bind") == 0: return '您还未绑定,请先<a href="' + URL + 'bind'+str(s.userName)+'">绑定</a>' else: book_info, status = getLib(id, password) cnt = 1 if status == '-3': res = '绑定的信息有误,请重新<a href="' + URL + 'bind'+str(s.userName)+'">绑定</a>' return res elif not book_info: res = "你还没有借书哦~~~" return res else: res = "以下是你借的书及到期时间: \n" for i in book_info: res = res + str(cnt) + ". 《" + i['book']+ "》\n" + "到期时间:" + i['duetime'] +'\n' cnt += 1 return res + "回复'xj+序号'(如xj1)即可续借相应书籍~~" else: return 0
def find(self,s): pp_diy = ur"^xj" if re.search(pp_diy, str(s.content)): from app.model.dll_library import getLib from app.model.db_user import User temUser = User(s.userName) id = temUser.query("ss_num") password = temUser.query("password_inf") if temUser.query("bind") == 0: return '您还未绑定,请先<a href="' + URL + 'bind' +str(s.userName)+'">绑定</a>' append = s.content[2:] if append: status = getLib(id, password, append)[1] if status == '1': res = "续借成功,回复[借书]查看详情" elif status == '-1': res = '这本书已达到续借限制,无法续借' elif status == '-2': res = '这本书不能续借哦~~' elif status == '0': res = '请输入正确的序号(如xj1)' elif status == '-3': res = '绑定的信息有误,请重新<a href="http://4.wx4321.sinaapp.com/bind'+str(s.userName)+'">绑定</a>' else: pass else: res = '请输入正确的序号(如xj1)' return res else: return 0