예제 #1
0
파일: api.py 프로젝트: jzxyouok/kefu_web
def add_store():
    db = g._imdb
    developer_id = g.developer_id
    appid = KEFU_APPID
    name = request.form['name'] if request.form.has_key('name') else None
    if not name:
        return INVALID_PARAM()

    mode = default_mode
    db.begin()
    if mode == MODE_BROADCAST:
        gid = Group.create_group(db, appid, 0, name, False)
    else:
        gid = 0
    store_id = Store.create_store(db, name, gid, mode, developer_id)
    db.commit()

    #将名称存储redis,用于后台推送
    Store.set_store_name(g.im_rds, store_id, name)

    if gid:
        content = "%d,%d,%d"%(gid, appid, 0)
        publish_message(g.im_rds, "group_create", content)

    obj = {"store_id":store_id}
    return make_response(200, obj)
예제 #2
0
def store_add_post():
    """
    store 添加商店

    """
    db = g._imdb
    developer_id = session['user']['id']

    appid = config.KEFU_APPID
    name = request.form['name'] if request.form.has_key('name') else None
    if not name:
        return INVALID_PARAM()

    db.begin()
    gid = Group.create_group(db, appid, 0, name, False)
    store_id = Store.create_store(db, name, gid, developer_id)
    db.commit()

    #将名称存储redis,用于后台推送
    Store.set_store_name(g.im_rds, store_id, name)

    content = "%d,%d,%d" % (gid, appid, 0)
    publish_message(g.im_rds, "group_create", content)

    obj = {"store_id": store_id}

    return redirect(url_for('.store_index'))
예제 #3
0
파일: store.py 프로젝트: jzxyouok/kefu_web
def store_add_post():
    """
    store 添加商店

    """
    db = g._imdb
    developer_id = session['user']['id']
    
    appid = config.KEFU_APPID
    name = request.form['name'] if request.form.has_key('name') else None
    if not name:
        return INVALID_PARAM()

    mode = default_mode
    db.begin()
    if mode == MODE_BROADCAST:
        gid = Group.create_group(db, appid, 0, name, False)
    else:
        gid = 0
    store_id = Store.create_store(db, name, gid, mode, developer_id)
    db.commit()

    #将名称存储redis,用于后台推送
    Store.set_store_name(g.im_rds, store_id, name)

    if gid:
        content = "%d,%d,%d"%(gid, appid, 0)
        publish_message(g.im_rds, "group_create", content)

    obj = {"store_id":store_id}

    return redirect(url_for('.store_index'))