def get_own_info(): ret_obj = ReturnInfo() if not utils.util.verification_args(['userId', 'token'], request): ret_obj.msg = u'参数不正确' ret_obj.msg_code = 'ARGUEMENTDONOTFIND' else: ret, msg = user_service.get_own_info(request.form['userId'], request.form['token']) if ret: ret_obj.msg_code = 'SUCCESS' ret_obj.msg = u'获取个人信息成功' ret_obj.data = [{'user': msg}] else: ret_obj.msg = u'获取个人信息失败' ret_obj.msg_code = 'FAILED' return jsonify(ret_obj.todict())
def changepwd(): ret_obj = ReturnInfo() if not utils.util.verification_args(['userId', 'oldPassword', 'newPassword', 'confirmPassword', 'token'], request): ret_obj.msg = u'参数不正确' ret_obj.msg_code = 'ARGUMENTSDONOTFIND' else: ret, msg = user_service.change_password(request.form['userId'], request.form['newPassword'], request.form['token']) if ret: ret_obj.msg_code = 'SUCCESS' ret_obj.msg = u'修改密码成功' ret_obj.data = [{'token': msg}] else: ret_obj.msg = 'FAILED' ret_obj.msg = msg return jsonify(ret_obj.todict())
def get_all_express(): ret_obj = ReturnInfo() arg_list = [ 'userId', 'token' ] if not utils.util.verification_args(arg_list,request): ret_obj.msg = u'参数不正确' ret_obj.msg_code = 'ARGUEMENTSDONOTFIND' else: ret,msg = express_service.waitacceptedexpress(request.form['userId'],request.form['token']) if ret: ret_obj.msg = '' ret_obj.msg_code = 'SUCCESS' ret_obj.data = [{'result':msg}] else: ret_obj.msg = u'获取待接单信息失败,请重试' ret_obj.msg_code = 'FAILED' return jsonify(ret_obj.todict())
def login(): ''' 登陆 :return: ''' ret_obj = ReturnInfo() if not utils.util.verification_args(['userId', 'password', 'token'], request): ret_obj.msg_code = 'ARGUEMENTSDONOTFIND' ret_obj.msg = u'参数不正确' else: ret, msg = user_service.login(request.form['userId'], request.form['password'], request.form['token']) if ret: ret_obj.msg_code = 'SUCCESS' ret_obj.msg = u'登陆成功' ret_obj.data = [{'token': msg}] else: ret_obj.msg_code = 'FAILED' ret_obj.msg = msg return jsonify(ret_obj.todict())
def register(): ''' 注册 :return: ''' ret_obj = ReturnInfo() if not utils.util.verification_args(['userId', 'password'], request): ret_obj.msg_code = 'ARGUMENTDONOTFIND' ret_obj.msg = u'参数不正确' userId = request.form['userId'] password = request.form['password'] ret, msg = user_service.register(userId, password) if ret: ret_obj.msg_code = 'SUCCESS' ret_obj.msg = u'注册成功' ret_obj.data = [{'token': msg}] else: ret_obj.msg_code = 'FAILED' ret_obj.msg = msg return jsonify(ret_obj.todict())