Пример #1
0
def push_order_to_barber_test(*, order: OrderProxy, barbers: [BarberProxy], dis_list):
    _ = order.get_dict()
    # o = {}
    # o['phone'] = _['cusphone']
    # o['name'] = _['cusname']
    _["distance"] = 770
    push_msg(alias="18558701653", msg=_)
Пример #2
0
def accepted_order(request):
    result = {'code': 100, 'log': 'order accepted success'}
    re_data = None
    try:
        data = Checker.request(request, ['orderID', 'phone', 'distance'])
        format_time = time.strftime('%Y.%m.%d;%H:%M', time.localtime(time.time()))
        order = OrderProxy(int(data['orderID']))
        if order.accepted:
            raise OrderHasAccepted
        order = order.update(bar_phone=data['phone'], time_=format_time, accepted=True).get_dict()
        barber = BarberProxy(data['phone'])
        order['distance'], order['shop'], order['address'] = data['distance'], barber.shop, barber.address
        notify_cus_order_accepted(order)
    except JianyueError as e:
        result = e.info
    finally:
        result['data'] = re_data
        return HttpResponse(encode(result))
Пример #3
0
def accepted_order(request):
    result = {'code': 100, 'log': 'Order has been accepted successfully.'}
    re_data = None
    try:
        #result = {'code': 100, 'log': 'Order has been accepted successfully.'}
        data = Checker.request(request, ['orderID', 'phone', 'distance'])
        time_ = current_time()
        order = OrderProxy(int(data['orderID']))
        if order.accepted:
            raise OrderHasAccepted
        order = order.update(bar_phone=data['phone'], time_=time_, accepted=True).get_dict()
        barber = BarberProxy(data['phone'])
        order['distance'], order['shop'], order['address'] = data['distance'], barber.shop, barber.address
        notify_cus_order_accepted(order)
    except JianyueError as e:
        result = e.info
    finally:
        result['data'] = re_data
        return HttpResponse(encode(result))
Пример #4
0
def push_order_to_barber(*, order: OrderProxy, barbers: [BarberProxy], dis_list):  # order需不需要做处理
    size = len(dis_list)
    error = 0
    for i in range(0, size):
        _ = order.get_dict()
        o = {}
        o['phone'] = _['cusphone']
        o['name'] = _['cusname']
        o['distance'] = dis_list[i]
        try:
            push_msg(alias=barbers[i].phone, msg=o)
        except Exception:
            error += 1
    if error:
        raise PushError
Пример #5
0
def push_order_to_barber(*, order: OrderProxy, barbers: [BarberProxy], dis_list):
    """
    向理发师推送订单消息
    :param order:OrderProxy类对象
    :param barbers:BarberProxy类对象列表
    :param dis_list:距离列表
    :return:
    """
    size = len(dis_list)
    error = 0
    for i in range(0, size):
        _ = order.get_dict()
        o = {}
        o["phone"] = _["cusphone"]
        o["name"] = _["cusname"]
        o["distance"] = dis_list[i]
        # push_msg(alias=barbers[i].phone, msg=o)
        try:
            push_msg(alias=barbers[i].phone, msg=o)
        except Exception:
            error += 1
    if error:
        raise PushError