示例#1
0
    def get_activities(cls):
        args_spec = {
            'city_ids': Arg(int, multiple=True, allow_missing=True),
        }
        city_ids = args_parser.parse(args_spec).get('city_ids', [])
        if not city_ids:
            city_ids = cls.get_user_city_ids()

        today = get_today_date_str()
        rest_activities = rst_act_base.query(
            begin_date=today, end_date=today, city_ids=city_ids, is_valid=True)

        food_activities = food_act_base.query(
            begin_date=today, end_date=today, city_ids=city_ids, is_valid=True)

        rest_act_result = []
        for act in rest_activities:
            rest_act_result.append({
                'activity_id': act.id,
                'activity_name': RestaurantActivityMixin.get_name(act)
            })
        food_act_result = []
        for act in food_activities:
            food_act_result.append({
                'activity_id': act.id,
                'activity_name': act.name
            })

        return {
            'food_activities': food_act_result,
            'rest_activities': rest_act_result
        }
示例#2
0
def get_rst_bankcard_list(rst_id):
    arg_spec = {
        'status': Arg(int, allow_missing=True),
        'type_code': Arg(int, allow_missing=True),
        'page_size': Arg(int, allow_missing=True),
        'page_no': Arg(int, allow_missing=True)
    }
    args = args_parser.parse(arg_spec)
    status = args.get('status')
    type_code = args.get('type_code')
    page_no, page_size = get_paging_params()
    offset = (page_no - 1) * page_size
    limit = page_size
    rst_bankcard_list = bankcard_base \
        .query_bankcard(rst_id, status=status, limit=limit, offset=offset)
    rst_bankcard_list_new = [model2dict(m) for m in rst_bankcard_list]
    return {
        'bankcard_list':
        rst_bankcard_list_new,
        'total_num':
        bankcard_base.get_bankcard_count([
            rst_id,
        ],
                                         status=status,
                                         type_code=type_code)
    }
示例#3
0
文件: audit.py 项目: liuzelei/walis
def finish_suspicious_group_auditing():
    args_spec = {
        'restaurant_id': Arg(int),
        'date': Arg(unicode, ),
    }
    args = args_parser.parse(args_spec)
    return order_audit_base.finish_suspicious_group_auditing(**args)
示例#4
0
文件: audit.py 项目: liuzelei/walis
def set_order_phone_confirmed():
    args_spec = {
        'order_id': Arg(int),
        'confirmed': Arg(bool),
    }
    args = args_parser.parse(args_spec)
    return order_base.set_phone_confirmed(**args)
示例#5
0
def set_order_phone_confirmed():
    args_spec = {
        'order_id': Arg(int),
        'confirmed': Arg(bool),
    }
    args = args_parser.parse(args_spec)
    return order_base.set_phone_confirmed(**args)
示例#6
0
def query_receive_by_mobile():
    args_spec = {
        'mobile':Arg(int)
    }
    args = args_parser.parse(args_spec)
    result = sms_base.query_receive_by_mobile(args['mobile'])
    return result
示例#7
0
文件: audit.py 项目: liuzelei/walis
def set_order_valid():
    args_spec = {
        'order_id': Arg(int),
    }
    args = args_parser.parse(args_spec)
    order_id = args['order_id']
    return order_base.set_valid(order_id)
示例#8
0
def get_user_by_mobile():
    args = {
        'mobile':Arg(),
    }
    arg_spec = args_parser.parse(args)
    user = user_base.get_by_mobile(arg_spec['mobile'])
    return user or {}
示例#9
0
def set_order_valid():
    args_spec = {
        'order_id': Arg(int),
    }
    args = args_parser.parse(args_spec)
    order_id = args['order_id']
    return order_base.set_valid(order_id)
示例#10
0
def finish_suspicious_group_auditing():
    args_spec = {
        'restaurant_id': Arg(int),
        'date': Arg(unicode, ),
    }
    args = args_parser.parse(args_spec)
    return order_audit_base.finish_suspicious_group_auditing(**args)
示例#11
0
def retry(pk):
    user_args = {
        'pay_type': Arg(int, required=True),
        'bank_account': Arg(str, required=True),
        'bank_name': Arg(unicode, allow_missing=True),
        'account_type': Arg(int, allow_missing=True),
        'account_holder': Arg(unicode, allow_missing=True),
        'bank_branch': Arg(unicode, allow_missing=True),
        'city': Arg(unicode, allow_missing=True),
    }
    args = args_parser.parse(user_args)
    if args.get('pay_type') == 1:
        result = refund_service.save_bank_account(
            pk=pk,
            admin_id=current_user.id,
            bank_account=args.get('bank_account'),
            bank_name=args.get('bank_name'),
            account_type=args.get('account_type'),
            account_holder=args.get('account_holder'),
            bank_branch=args.get('bank_branch'),
            city=args.get('city')
        )
    else:
        result = refund_service.save_alipay_account(
            pk=pk,
            admin_id=current_user.id,
            bank_account=args.get('bank_account')
        )
    return result
示例#12
0
def is_username_available():
    args = {
        'username':Arg(),
    }
    args_spec = args_parser.parse(args)
    available = user_base.is_username_available(args_spec['username'])
    return {'available':available}
示例#13
0
def olpay_income_details(restaurant_id, date):
    args = args_parser.parse({
        'status': Arg(int, required=False),
    })
    records, total_num = restaurant_manager.get_olpay_detail(
        restaurant_id, date=date, **args)
    return {'records': records, 'total_num': total_num}
示例#14
0
def get_alipay_url():
    args_spec = {
        'batch_id': Arg(int),
    }
    batch_id = args_parser.parse(args_spec)['batch_id']
    url_info = get_alipay_html(batch_id)
    return {'url': url_info.url, 'form_data': url_info.form_data}
示例#15
0
文件: audit.py 项目: liuzelei/walis
def filter_suspicious_orders_amount():
    args_spec = {
        'auditor_id': Arg(int),
        'status': Arg(int),
        'date': Arg(unicode),
    }
    args = args_parser.parse(args_spec)
    return order_audit_base.filter_suspicious_orders_amount(**args)
示例#16
0
def filter_suspicious_orders_amount():
    args_spec = {
        'auditor_id': Arg(int),
        'status': Arg(int),
        'date': Arg(unicode),
    }
    args = args_parser.parse(args_spec)
    return order_audit_base.filter_suspicious_orders_amount(**args)
示例#17
0
def olpay_income_details(restaurant_id, date):
    args = args_parser.parse({
        'status': Arg(int, required=False),
    })
    records, total_num = restaurant_manager.get_olpay_detail(restaurant_id,
                                                             date=date,
                                                             **args)
    return {'records': records, 'total_num': total_num}
示例#18
0
def olpay_income_records(restaurant_id):
    args = args_parser.parse({
        'type': Arg(int, required=False),
        'begin_date': Arg(str, required=False),
        'end_date': Arg(str, required=False),
    })
    records = restaurant_manager.get_olpay_records(restaurant_id, **args)
    return {'records': records}
示例#19
0
def query():
    args_spec = {
        'query':Arg(unicode,default='{}'),
        'struct':Arg(unicode,default='{}'),
    }
    args = args_parser.parse(args_spec)
    result = order_query_helper.ess_search2(**args)
    return result
示例#20
0
文件: payment.py 项目: liuzelei/walis
def get_alipay_url():
    args_spec = {'batch_id': Arg(int), }
    batch_id = args_parser.parse(args_spec)['batch_id']
    url_info = get_alipay_html(batch_id)
    return {
        'url': url_info.url,
        'form_data': url_info.form_data
    }
示例#21
0
def query_by_area():
    arg_spec = {"city_id": Arg(int), "_area": Arg(list)}
    args = args_parser.parse(arg_spec)

    points = []
    for point_dic in args.get("_area", []):
        points.append("{lng},{lat}".format(**point_dic))
    return transaction_svc.get_order_trs_by_area(args["city_id"], points)
示例#22
0
文件: file.py 项目: liuzelei/walis
def delete():
    args = args_parser.parse_all()
    isprivate=args.get('isprivate',False)
    file_hash = args_parser.parse(
        {'file_hash': Arg(str), }).get('file_hash')

    delete_file(file_hash,isprivate=isprivate)
    return ''
示例#23
0
def get_event(event_id):
    args = args_parser.parse({
        'with_name': Arg(bool, allow_missing=True),
        'with_records': Arg(bool, allow_missing=True),
    })
    event = event_service.get_event(event_id, **args)
    _format_event(event)
    return event
示例#24
0
def gets():
    arg_spec = {
        'city_id': Arg(int, allow_missing=True)
    }
    args = args_parser.parse(arg_spec)

    offset, limit = get_paging_params(db_style=True)
    return trs_query_cfg_service.gets(city_id=args.get('city_id'), offset=offset, limit=limit)
示例#25
0
文件: event.py 项目: liuzelei/walis
def get_event(event_id):
    args = args_parser.parse({
        'with_name': Arg(bool, allow_missing=True),
        'with_records': Arg(bool, allow_missing=True),
    })
    event = event_service.get_event(event_id, **args)
    _format_event(event)
    return event
示例#26
0
def query():
    args_spec = {
        'query': Arg(unicode, default='{}'),
        'struct': Arg(unicode, default='{}'),
    }
    args = args_parser.parse(args_spec)
    result = order_query_helper.ess_search2(**args)
    return result
示例#27
0
def query_by_area():
    arg_spec = {'city_id': Arg(int), '_area': Arg(list)}
    args = args_parser.parse(arg_spec)

    points = []
    for point_dic in args.get('_area', []):
        points.append('{lng},{lat}'.format(**point_dic))
    return transaction_svc.get_order_trs_by_area(args['city_id'], points)
示例#28
0
def put(city_id):
    arg_spec = {
        'date_from': Arg(str, required=True),
        'date_end': Arg(str, required=True),
    }
    args = args_parser.parse(arg_spec)
    return trs_query_cfg_service.add_or_update(city_id,
                                               strptime_to_date(args['date_from']),
                                               strptime_to_date(args['date_end']))
示例#29
0
def put():
    args = args_parser.parse({
        'restaurant_ids': Arg([], allow_missing=False),
        'notice_enabled': Arg(int, allow_missing=True),
        'in_charge': Arg(int, allow_missing=True),
    })
    args['restaurant_ids'] = [int(r) for r in args['restaurant_ids']]
    set_notification(**args)
    return ''
示例#30
0
def get():
    args = args_parser.parse({
        'restaurant_id': Arg(int, allow_missing=True),
        'is_premium': Arg(int, allow_missing=True),
        'order_mode': Arg(int, allow_missing=True),
        'is_valid': Arg(int, allow_missing=True),
    })
    result, total_num = get_notifications(args)
    return {'notifications': result, 'total_num': total_num}
示例#31
0
def withdraw_records(restaurant_id):
    args = args_parser.parse({
        'status': Arg(int, required=False),
        'begin_date': Arg(str, required=False),
        'end_date': Arg(str, required=False),
    })
    records, total_num = restaurant_manager.get_withdraw_records(
        restaurant_id, **args)
    return {'records': records, 'total_num': total_num}
示例#32
0
def balance_change(restaurant_id):
    args = args_parser.parse({
        'trade_type': Arg(int, required=False),
        'begin_date': Arg(str, required=False),
        'end_date': Arg(str, required=False),
    })
    records, total_num = restaurant_manager.get_balance_change(
        restaurant_id, **args)
    return {'records': records, 'total_num': total_num}
示例#33
0
def withdraw_records(restaurant_id):
    args = args_parser.parse({
        'status': Arg(int, required=False),
        'begin_date': Arg(str, required=False),
        'end_date': Arg(str, required=False),
    })
    records, total_num = restaurant_manager.get_withdraw_records(
        restaurant_id, **args)
    return {'records': records, 'total_num': total_num}
示例#34
0
def balance_change(restaurant_id):
    args = args_parser.parse({
        'trade_type': Arg(int, required=False),
        'begin_date': Arg(str, required=False),
        'end_date': Arg(str, required=False),
    })
    records, total_num = restaurant_manager.get_balance_change(
        restaurant_id, **args)
    return {'records': records, 'total_num': total_num}
示例#35
0
def olpay_income_records(restaurant_id):
    args = args_parser.parse({
        'type': Arg(int, required=False),
        'begin_date': Arg(str, required=False),
        'end_date': Arg(str, required=False),
    })
    records = restaurant_manager.get_olpay_records(
        restaurant_id, **args)
    return {'records': records}
示例#36
0
文件: zone.py 项目: liuzelei/walis
def set_is_valid():
    args_spec = {"zone_id": Arg(int), "zone_ids": Arg(default=[]), "is_valid": Arg(bool)}
    args = args_parser.parse(args_spec)
    zone_id = args["zone_id"]
    zone_ids = args["zone_ids"]
    if zone_id:
        zone_ids.append(zone_id)
    zone_base.set_is_valid(zone_ids, args["is_valid"])
    return ""
示例#37
0
def put():
    args = args_parser.parse({
        'restaurant_ids': Arg([], allow_missing=False),
        'notice_enabled': Arg(int, allow_missing=True),
        'in_charge': Arg(int, allow_missing=True),
    })
    args['restaurant_ids'] = [int(r) for r in args['restaurant_ids']]
    set_notification(**args)
    return ''
示例#38
0
def set_restaurant_suspicious():
    args_spec = {
        'restaurant_id': Arg(int),
        'is_suspicious': Arg(bool),
        'suspicious_description': Arg(unicode),
    }
    args = args_parser.parse(args_spec)
    order_audit_base.set_restaurant_suspicious(**args)
    return ''
示例#39
0
def edit_username_mobile():
    args_spec = {
        'user_id':Arg(int),
        'username':Arg(unicode),
        'mobile':Arg(unicode),
    }
    args = args_parser.parse(args_spec)
    chaos_base.edit_username_mobile(**args)
    return '{"success": true}'
示例#40
0
文件: audit.py 项目: liuzelei/walis
def set_restaurant_suspicious():
    args_spec = {
        'restaurant_id': Arg(int),
        'is_suspicious': Arg(bool),
        'suspicious_description': Arg(unicode),
    }
    args = args_parser.parse(args_spec)
    order_audit_base.set_restaurant_suspicious(**args)
    return ''
示例#41
0
def delete():
    args = args_parser.parse_all()
    isprivate = args.get('isprivate', False)
    file_hash = args_parser.parse({
        'file_hash': Arg(str),
    }).get('file_hash')

    delete_file(file_hash, isprivate=isprivate)
    return ''
示例#42
0
def mget():
    args_spec = {
        'ids':Arg(),
    }
    args = args_parser.parse(args_spec)
    ids = args.get('ids', None)
    ids = ids if ids else request.json.get('restaurant_ids')
    with thrift_client('ers') as ers:
        result = ers.mget(ids)
        return result
示例#43
0
def mget():
    args_spec = {
        'ids': Arg(),
    }
    args = args_parser.parse(args_spec)
    ids = args.get('ids', None)
    ids = ids if ids else request.json.get('restaurant_ids')
    with thrift_client('ers') as ers:
        result = ers.mget(ids)
        return result
示例#44
0
文件: audit.py 项目: liuzelei/walis
def set_user_active():
    args_spec = {
        'user_id': Arg(int),
        'is_active': Arg(bool),
        'description': Arg(unicode),
    }
    args = args_parser.parse(args_spec)
    args['admin_user_id'] = current_user.id
    user_ban_base.set_active(**args)
    return ''
示例#45
0
文件: audit.py 项目: liuzelei/walis
def set_phone_banned():
    args_spec = {
        'phone': Arg(unicode),
        'is_banned': Arg(bool),
        'description': Arg(unicode),
    }
    args = args_parser.parse(args_spec)
    args['admin_user_id'] = current_user.id
    phone_ban_base.set_banned(**args)
    return ''
示例#46
0
def set_user_active():
    args_spec = {
        'user_id': Arg(int),
        'is_active': Arg(bool),
        'description': Arg(unicode),
    }
    args = args_parser.parse(args_spec)
    args['admin_user_id'] = current_user.id
    user_ban_base.set_active(**args)
    return ''
示例#47
0
def set_phone_banned():
    args_spec = {
        'phone': Arg(unicode),
        'is_banned': Arg(bool),
        'description': Arg(unicode),
    }
    args = args_parser.parse(args_spec)
    args['admin_user_id'] = current_user.id
    phone_ban_base.set_banned(**args)
    return ''
示例#48
0
def query():
    args_spec = {'admin_id': Arg(int, allow_missing=True)}
    args = args_parser.parse(args_spec)
    page_no, page_size = get_paging_params()
    offset = (page_no - 1) * page_size
    limit = page_size

    return coupon_batch_base.query(admin_id=args.get('admin_id',
                                                     current_user.get_id()),
                                   offset=offset,
                                   limit=limit)
示例#49
0
def get_by_city_and_period():
    """ [GET] get restaurant-activities by city_ids and
        start-date and end-date """
    rest_activity_query = thirdparty_svc.ers.TRestaurantActivityQuery()
    args_spec = {
        'city_ids': Arg([], allow_missing=True),
        'begin_date': Arg(str, allow_missing=True),
        'end_date': Arg(str, allow_missing=True),
        'overdue': Arg(bool, allow_missing=True),
    }
    args = args_parser.parse(args_spec, request)

    city_ids = args.get('city_ids', [])

    if not coffee.hr_permission.isPermittedToThis(
            context=current_user.auth_context,
            permission=auth_map_admin['ACT_RST_ADMIN']):
        user_city_ids = current_user.utp_city_ids
        if city_ids:
            city_ids = list(set(city_ids + user_city_ids))
        else:
            city_ids = user_city_ids

    rest_activity_query.city_ids = city_ids
    rest_activity_query.begin_date = args.get('begin_date', None)
    rest_activity_query.end_date = args.get('end_date', None)
    rest_activity_query.limit = 1000
    overdue = args.get('overdue', None)

    with thrift_client('ers') as ers_client:
        restaurant_activities = ers_client.query_restaurant_activity_for_admin(
            rest_activity_query)

    if overdue is not None:
        today = date.today()
        if overdue:
            restaurant_activities = [
                act for act in restaurant_activities if _overdue(act, today)
            ]
        else:
            restaurant_activities = [
                act for act in restaurant_activities
                if not _overdue(act, today)
            ]

    total_num = len(restaurant_activities)
    rest_activities_page = paging(restaurant_activities)
    for act in rest_activities_page:
        act.activity_name = get_restaurant_activity_name(act)

    return {
        'restaurant_activities': rest_activities_page,
        'total_num': total_num
    }
示例#50
0
def get_sms_reply():
    args_spec = {"phone": Arg(str, allow_missing=True)}
    args = args_parser.parse(args_spec)
    page_no, page_size = get_paging_params()
    if page_no and page_size:
        args["offset"] = (page_no - 1) * page_size
        args["limit"] = page_size
    result = PaymentNoticeReply.query(**args)
    reply_list = [{"phone": r.phone_number, "message": r.message, "reply_at": r.reply_at} for r in result]
    total_num = PaymentNoticeReply.query_count(**args)
    return {"reply_list": reply_list, "total_num": total_num}
示例#51
0
文件: poi.py 项目: liuzelei/walis
def _get_args(allow_missing=False):
    args_spec = {
        'id': Arg(int, allow_missing=not allow_missing),
        'name': Arg(allow_missing=allow_missing),
        'city_id': Arg(int, allow_missing=allow_missing),
        'longitude': Arg(float, allow_missing=allow_missing),
        'latitude': Arg(float, allow_missing=allow_missing),
        'extra_tag': Arg(allow_missing=allow_missing),
        'address': Arg(allow_missing=allow_missing),
    }
    return args_parser.parse(args_spec)
示例#52
0
def get():
    args = args_parser.parse({
        'restaurant_id': Arg(int, allow_missing=True),
        'is_premium': Arg(int, allow_missing=True),
        'order_mode': Arg(int, allow_missing=True),
        'is_valid': Arg(int, allow_missing=True),
    })
    result, total_num = get_notifications(args)
    return {
        'notifications': result,
        'total_num': total_num
    }
示例#53
0
文件: coupon.py 项目: longzhang/walis
def update(coupon_id):
    args_spec = {
        'deadline': Arg(str, allow_missing=True),
        'remain': Arg(int, allow_missing=True),
    }
    args = args_parser.parse(args_spec)

    return coupon_base.update(
        coupon_id=coupon_id,
        deadline=args.get('deadline'),
        remain=args.get('remain', 0),
    )