本文整理汇总了Python中models.Group.create_group方法的典型用法代码示例。如果您正苦于以下问题:Python Group.create_group方法的具体用法?Python Group.create_group怎么用?Python Group.create_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Group
的用法示例。
在下文中一共展示了Group.create_group方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_store
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import create_group [as 别名]
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: store_add_post
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import create_group [as 别名]
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'))