当前位置: 首页>>代码示例>>Python>>正文


Python Group.add_group_member方法代码示例

本文整理汇总了Python中models.Group.add_group_member方法的典型用法代码示例。如果您正苦于以下问题:Python Group.add_group_member方法的具体用法?Python Group.add_group_member怎么用?Python Group.add_group_member使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Group的用法示例。


在下文中一共展示了Group.add_group_member方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: store_seller_post

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import add_group_member [as 别名]
def store_seller_post(store_id):
    """
    store 添加商店人员

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

    form = request.form
    name = form.get('name', '')
    password = form.get('password', '')
    number = form.get('number', '')
    if not name or not password or not store_id:
        return INVALID_PARAM()
        
    if not number:
        number = None
    password = md5.new(password).hexdigest()

    group_id = Store.get_store_gid(db, store_id)

    db.begin()
    seller_id = Seller.add_seller(db, name, password, store_id, group_id, number)
    Group.add_group_member(db, group_id, seller_id)
    db.commit()

    content = "%d,%d"%(group_id, seller_id)
    publish_message(g.im_rds, "group_member_add", content)
    
    return redirect(url_for('.store_seller', store_id=store_id))
开发者ID:richmonkey,项目名称:xiaowei_web,代码行数:32,代码来源:store.py

示例2: add_seller

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import add_group_member [as 别名]
def add_seller(store_id):
    rds = g.im_rds
    db = g._imdb
    form = request.form
    name = form.get('name', '')
    password = form.get('password', '')
    md5_password = form.get('md5_password', '')
    salt = form.get('salt', '')
    number = form.get('number', '')
    is_password_empty = not password and (not md5_password or not salt)

    if not name or is_password_empty or not store_id:
        return INVALID_PARAM()
        
    if not number:
        number = None

    if password:
        password = generate_password_hash(password)
    elif md5_password:
        password = "%s:%s"%(salt,md5_password)

    logging.debug("seller name:%s number:%s password md5:%s", name, number, md5_password)
    group_id = Store.get_store_gid(db, store_id)

    db.begin()
    seller_id = Seller.add_seller(db, name, password, store_id, number)
    if group_id:
        Group.add_group_member(db, group_id, seller_id)
    db.commit()

    Store.add_seller_id(rds, store_id, seller_id)

    if group_id:
        content = "%d,%d"%(group_id, seller_id)
        publish_message(g.im_rds, "group_member_add", content)

    obj = {"seller_id":seller_id}
    return make_response(200, obj)
开发者ID:jzxyouok,项目名称:kefu_web,代码行数:41,代码来源:api.py


注:本文中的models.Group.add_group_member方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。