Beispiel #1
0
def add_express():
    arg_list = [
        'name',
        'sourceAddress',
        'destinationAddress',
        'publisherId',
        'phone',
        'sexLimited',
        'creditLimited',
        'freeTime',
        'price',
        'token'
    ]
    ret_obj = ReturnInfo()
    if not utils.util.verification_args(arg_list,request):
        ret_obj.msg_code = 'ARGUEMENTSDONOTFIND'
        ret_obj.msg = u'参数不正确'
    else:
        ret,mst = express_service.add_express(request.form)
        if ret:
            ret_obj.msg_code = 'SUCCESS'
            ret_obj.msg = u'添加订单成功'
        else:
            ret_obj.msg_code = 'FAILED'
            ret_obj.msg = u'添加订单失败'
    return jsonify(ret_obj.todict())
Beispiel #2
0
def update_own_info():
    ret_obj = ReturnInfo()
    ret,msg = user_service.update_own_info(request.form)
    if ret:
        ret_obj.msg = u'更新成功'
        ret_obj.msg_code = 'SUCCESS'
    else:
        ret_obj.msg = u'更新失败'
        ret_obj.msg_code = 'FAILED'

    return jsonify(ret_obj.todict())
Beispiel #3
0
def get_express():
    ret_obj = ReturnInfo()
    arg_list = ['userId','expressId','token']
    if not utils.util.verification_args(arg_list,request):
        ret_obj.msg_code = 'ARGUEMENTSDONOTFIND'
        ret_obj.msg = u'参数不正确'
    else:
        ret,msg = express_service.get_express(request.form['userId'],request.form['expressId'],request.form['token'])
        if ret:
            ret_obj.msg = u'接单成功,轻尽快派送'
            ret_obj.msg_code = 'SUCCESS'
        else:
            ret_obj.msg = u'接单失败'
            ret_obj.msg_code = 'FAILED'
    return jsonify(ret_obj.todict())
Beispiel #4
0
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())
Beispiel #5
0
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())
Beispiel #6
0
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())
Beispiel #7
0
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())
Beispiel #8
0
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())