Пример #1
0
def queue():

    data = request.get_json()
    print data
    result = {}
    if 'reg_id' in data:
        result["reg_id"] = data['reg_id']

    if 'uuid' not in data:
        result["error"] = "give me uuid!"
        return flask.jsonify(**result)
    if 'clinic_name' not in data:
        result["error"] = "give me clinic name!"
        return flask.jsonify(**result)
    if 'fin_no' not in data:
        result["error"] = "give me fin number!"
        return flask.jsonify(**result)

    #print data

    # q = session.query(Queue).filter_by(uuid=data['uuid']).first()
    # if q is not None:

    #     result["key"] = q.key
    #     result["queue_num"] = q.queue_number
    #     d = session.query(Doctor).filter_by(id=q.doctor_id).first()
    #     result["doctor"] = d.name

    #     #json = flask.jsonify(**result)
    #     # if "reg_id" not in data:
    #     #     result['error'] = "at least tell me the reg_id"

    #     print "**********"
    #     if 'reg_id' in data:
    #        gcm_li.gcm_li(data['reg_id'],result)
    #     print "990090902930912093012"
    #     return flask.jsonify(**result)
    #return flask.jsonify(**result)

    #return "uuid already exist!"
    c = session.query(Clinic).filter_by(name=data['clinic_name']).first()
    if not c:
        result["error"] = "clinic name does not exsit!"
        return flask.jsonify(**result)

    result = qapi.generate_queue_li(data['clinic_name'], data['uuid'],
                                    data['fin_no'])
    #result = qapi.generate_queue(data['clinic_name'],data['uuid'])
    # json = flask.jsonify(**result)
    # if "reg_id" not in data:
    #     result['error'] = "at least tell me the reg_id"

    print "------------"
    if 'reg_id' in data:
        print "######reg_id###$$$--->" + data['reg_id']
        gcm_li.gcm_li(data['reg_id'], result)
    return flask.jsonify(**result)
Пример #2
0
def queue():

    data = request.get_json()
    print data
    result = {}
    if 'reg_id' in data:
        result["reg_id"] = data['reg_id']

    if 'uuid' not in data:
        result["error"] = "give me uuid!"
        return flask.jsonify(**result)
    if 'clinic_name' not in data:
        result["error"] = "give me clinic name!"
        return flask.jsonify(**result)
    if 'fin_no' not in data:
        result["error"] = "give me fin number!"
        return flask.jsonify(**result)

    #print data

    # q = session.query(Queue).filter_by(uuid=data['uuid']).first()
    # if q is not None:

    #     result["key"] = q.key
    #     result["queue_num"] = q.queue_number
    #     d = session.query(Doctor).filter_by(id=q.doctor_id).first()
    #     result["doctor"] = d.name

    #     #json = flask.jsonify(**result)
    #     # if "reg_id" not in data:
    #     #     result['error'] = "at least tell me the reg_id"
        
    #     print "**********"
    #     if 'reg_id' in data:
    #        gcm_li.gcm_li(data['reg_id'],result)
    #     print "990090902930912093012"
    #     return flask.jsonify(**result)
        #return flask.jsonify(**result)

        #return "uuid already exist!"
    c = session.query(Clinic).filter_by(name=data['clinic_name']).first()
    if not c:
        result["error"] =  "clinic name does not exsit!"
        return flask.jsonify(**result)

    result = qapi.generate_queue_li(data['clinic_name'],data['uuid'],data['fin_no'])
    #result = qapi.generate_queue(data['clinic_name'],data['uuid'])  
    # json = flask.jsonify(**result)
    # if "reg_id" not in data:
    #     result['error'] = "at least tell me the reg_id"
        
    print "------------"
    if 'reg_id' in data:
        print "######reg_id###$$$--->"+data['reg_id']
        gcm_li.gcm_li(data['reg_id'],result)
    return flask.jsonify(**result)
Пример #3
0
def queue_reg():
    
    data = request.args['messages']
    result = data

    if "reg_id" not in data:
        result['error'] = "at least tell me the reg_id"

    print "**********"
    gcm_li.gcm_li(data['reg_id'],result)
    return flask.jsonify(**result)
Пример #4
0
def queue_reg():

    data = request.args['messages']
    result = data

    if "reg_id" not in data:
        result['error'] = "at least tell me the reg_id"

    print "**********"
    gcm_li.gcm_li(data['reg_id'], result)
    return flask.jsonify(**result)