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


Python User.media_leaders方法代码示例

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


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

示例1: apply_pay

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import media_leaders [as 别名]
def apply_pay(invoice_id):
    medium_invoice = searchAdMediumInvoice.get(invoice_id)
    if not medium_invoice:
        abort(404)
    invoice_pay_ids = request.values.getlist('invoices')
    invoice_pays = searchAdMediumInvoicePay.gets(invoice_pay_ids)
    if not invoice_pays:
        abort(403)
    emails = request.values.getlist('email')
    msg = request.values.get('msg', '')
    action = int(request.values.get('action', 0))
    to_users = [g.user] + User.medias() + User.media_leaders() + User.super_leaders()
    to_emails = list(set(emails + [x.email for x in to_users]))
    if action == 2:
        action_msg = u'媒体订单打款申请'
        for invoice in invoice_pays:
            invoice.pay_status = MEDIUM_INVOICE_STATUS_APPLY
            invoice.save()
            flash(u'[%s媒体申请打款,打款金额: %s, 发票号: %s]  %s ' %
                  (invoice.medium_invoice.company, invoice.money,
                   invoice.medium_invoice.invoice_num, invoice.detail), 'success')

            invoice.medium_invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u' %s媒体申请打款,打款金额: %s, 发票号: %s  %s ' %
                (invoice.medium_invoice.company, invoice.money,
                    invoice.medium_invoice.invoice_num, invoice.detail)), msg_channel=3)
        send_type = "saler"
    elif action == 3:
        action_msg = u'同意媒体订单打款申请,请财务打款'
        to_emails += [k.email for k in User.finances()]
        for invoice in invoice_pays:
            invoice.pay_status = MEDIUM_INVOICE_STATUS_AGREE
            invoice.save()
            flash(u' 同意%s媒体订单打款申请,打款金额: %s, 发票号: %s  %s ' %
                  (invoice.medium_invoice.company, invoice.money,
                   invoice.medium_invoice.invoice_num, invoice.detail), 'success')

            invoice.medium_invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u' %s媒体同意打款,打款金额: %s, 发票号: %s  %s ' %
                (invoice.medium_invoice.company, invoice.money,
                    invoice.medium_invoice.invoice_num, invoice.detail)), msg_channel=3)
        send_type = "finance"
    else:
        action_msg = u'消息提醒'

    apply_context = {"to_other": emails,
                     "title": action_msg,
                     "to": to_emails,
                     "action_msg": action_msg,
                     "msg": msg,
                     "invoice": medium_invoice,
                     "send_type": send_type,
                     "invoice_pays": invoice_pays}
    medium_invoice_apply_signal.send(
        current_app._get_current_object(), apply_context=apply_context)
    flash(u'[%s 打款发票开具申请] 已发送邮件给 %s ' %
          (medium_invoice.client_order, ', '.join(to_emails)), 'info')
    return redirect(url_for('searchAd_saler_client_order_medium_invoice.invoice', invoice_id=invoice_id))
开发者ID:giveme168,项目名称:braavos,代码行数:60,代码来源:medium_invoice.py

示例2: invoice_pass

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import media_leaders [as 别名]
def invoice_pass(invoice_id):
    if not g.user.is_finance():
        abort(404)
    invoice = MediumInvoice.get(invoice_id)
    if not invoice:
        abort(404)
    invoices_ids = request.values.getlist('invoices')
    invoices_pay = MediumInvoicePay.gets(invoices_ids)
    if not invoices_pay:
        abort(403)
    emails = request.values.getlist('email')
    msg = request.values.get('msg', '')
    action = int(request.values.get('action', 0))

    to_users = [g.user] + \
        User.medias() + User.media_leaders() + User.super_leaders()
    to_emails = list(set(emails + [x.email for x in to_users]))

    if action != 10:
        invoice_status = MEDIUM_INVOICE_STATUS_PASS
        action_msg = u'媒体款项已打款'
        for invoice_pay in invoices_pay:
            invoice_pay.pay_status = invoice_status
            invoice_pay.save()
            flash(u'媒体订单款已打,名称:%s, 付款金额%s' % (
                invoice_pay.medium_invoice.client_order.name +
                '-' + invoice_pay.medium_invoice.medium.name,
                str(invoice_pay.money)), 'success')
            invoice_pay.medium_invoice.client_order.add_comment(
                g.user, u'媒体订单款已付款,名称%s, 付款金额%s ' % (
                    invoice_pay.medium_invoice.client_order.name +
                        '-' + invoice_pay.medium_invoice.medium.name,
                    str(invoice_pay.money)),
                msg_channel=3)
    else:
        action_msg = u'消息提醒'
    context = {"to_users": to_users,
               "action": 0,
               "action_msg": action_msg,
               "info": msg,
               "invoice": invoice,
               "order": invoice.client_order,
               "send_type": 'end',
               "invoice_pays": invoices_pay}
    medium_invoice_apply_signal.send(
        current_app._get_current_object(), context=context)
    flash(u'已发送邮件给 %s ' % (', '.join(to_emails)), 'info')
    return redirect(url_for("finance_client_order_medium_pay.pay_info", invoice_id=invoice_id))
开发者ID:giveme168,项目名称:braavos,代码行数:50,代码来源:medium_pay.py

示例3: apply_invoice

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import media_leaders [as 别名]
def apply_invoice(invoice_id):
    invoice = MediumInvoice.get(invoice_id)
    if not invoice:
        abort(404)
    invoices_ids = request.values.getlist('invoices')
    invoices = MediumInvoice.gets(invoices_ids)
    if not invoices:
        abort(403)
    emails = request.values.getlist('email')
    msg = request.values.get('msg', '')
    action = int(request.values.get('action', 0))
    to_users = [g.user] + User.medias() + User.media_leaders() + \
        User.super_leaders()
    to_emails = list(set(emails + [x.email for x in to_users]))

    send_type = "saler"
    if action == 2:
        invoice_status = MEDIUM_INVOICE_STATUS_APPLY
        action_msg = u'打款发票开具申请'
    if action != 10:
        for invoice in invoices:
            invoice.invoice_status = invoice_status
            invoice.save()
            flash(u' %s 打款发票申请,发票金额: %s, 发票号: %s  %s ' %
                  (invoice.company, invoice.money, invoice.invoice_num, action_msg), 'success')
            invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u'打款发票内容: %s; 发票金额: %s元; 发票号: %s' %
                (invoice.detail, str(invoice.money), invoice.invoice_num)), msg_channel=3)
    else:
        action_msg = u'消息提醒'

    apply_context = {"sender": g.user,
                     "to_other": emails,
                     "title": action_msg,
                     "to": to_emails,
                     "action_msg": action_msg,
                     "msg": msg,
                     "order": invoice.client_order,
                     "send_type": send_type,
                     "invoices": invoices}
    medium_invoice_apply_signal.send(
        current_app._get_current_object(), apply_context=apply_context)
    flash(u'[%s 打款发票开具申请] 已发送邮件给 %s ' %
          (invoice.client_order, ', '.join(to_emails)), 'info')
    return redirect(url_for("saler_client_order_medium_invoice.index", order_id=invoice.client_order.id))
开发者ID:giveme168,项目名称:braavos,代码行数:47,代码来源:medium_invoice.py

示例4: medium_invoice_apply

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import media_leaders [as 别名]
def medium_invoice_apply(sender, apply_context):
    invoice = apply_context['invoice']
    order = invoice.client_order
    invoice_pays = apply_context['invoice_pays']
    invoice_info = u"发票信息: " + invoice.detail + u'; 发票金额: ' + \
        str(invoice.money) + u'; 发票号: ' + invoice.invoice_num + \
        u'; 未打款金额: ' + str(invoice.get_unpay_money)
    invoice_pay_info = "\n".join(
        [u'打款金额: ' + str(o.money) + u'; 打款时间: ' + o.pay_time_cn + u'; 留言信息: ' + o.detail for o in invoice_pays])
    if apply_context['send_type'] == "saler":
        url = mail.app.config[
            'DOMAIN'] + '/saler/client_order/medium_invoice/%s/invoice' % (invoice.id)
        name = u'黄亮'
    elif apply_context['send_type'] == "media":
        url = mail.app.config[
            'DOMAIN'] + '/saler/client_order/medium_invoice/%s/invoice' % (invoice.id)
        name = name = ', '.join(
            [k.name for k in User.medias() + User.media_leaders()])
    else:
        url = mail.app.config[
            'DOMAIN'] + '/finance/client_order/medium_pay/%s/info' % (invoice.client_order_id)
        name = ', '.join([k.name for k in User.finances()])
    text = u"""%s

Dear %s:

订单: %s
链接地址: %s
发票信息:
%s

打款信息:
%s

留言如下:
    %s
\n
by %s
""" % (apply_context['action_msg'], name, order.name, url, invoice_info, invoice_pay_info, apply_context['msg'], g.user.name)
    send_simple_mail(
        apply_context['title'], recipients=apply_context['to'], body=text)
开发者ID:giveme168,项目名称:braavos,代码行数:43,代码来源:signals.py

示例5: pass_invoice

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import media_leaders [as 别名]
def pass_invoice(invoice_id):
    if not g.user.is_finance():
        abort(404)
    invoice = MediumRebateInvoice.get(invoice_id)
    if not invoice:
        abort(404)
    invoices_ids = request.values.getlist('invoices')
    invoices = MediumRebateInvoice.gets(invoices_ids)
    if not invoices:
        abort(403)
    emails = request.values.getlist('email')
    msg = request.values.get('msg', '')
    action = int(request.values.get('action', 0))
    to_users = User.medias() + User.media_leaders() + User.super_leaders()
    if action != 10:
        invoice_status = INVOICE_STATUS_PASS
        action_msg = u'媒体返点发票已开'
        for invoice in invoices:
            invoice.invoice_status = invoice_status
            invoice.create_time = datetime.date.today()
            invoice.save()
            flash(u'[%s 发票已开,发票金额%s]  %s ' %
                  (invoice.company, invoice.money, action_msg), 'success')
            invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u'发票内容: %s; 发票金额: %s元' % (invoice.detail, str(invoice.money))), msg_channel=6)
    else:
        action_msg = u'消息提醒'

    context = {"to_users": to_users,
               "to_other": emails,
               "action_msg": action_msg,
               "action": 0,
               "info": msg,
               "order": invoice.client_order,
               "send_type": 'end',
               "invoices": invoices
               }
    medium_rebate_invoice_apply_signal.send(
        current_app._get_current_object(), context=context)
    return redirect(url_for("finance_client_order_medium_rebate_invoice.info", order_id=invoice.client_order.id))
开发者ID:giveme168,项目名称:braavos,代码行数:42,代码来源:medium_rebate_invoice.py

示例6: apply_pay

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import media_leaders [as 别名]
def apply_pay(invoice_id):
    medium_invoice = MediumInvoice.get(invoice_id)
    if not medium_invoice:
        abort(404)
    invoice_pay_ids = request.values.getlist('invoices')
    invoice_pays = MediumInvoicePay.gets(invoice_pay_ids)
    if not invoice_pays:
        abort(403)
    emails = request.values.getlist('email')
    msg = request.values.get('msg', '')
    action = int(request.values.get('action', 0))
    to_users = [g.user] + User.medias() + User.media_leaders() + \
        User.super_leaders()
    if action == 2:
        action_msg = u'媒体打款申请'
        for invoice in invoice_pays:
            invoice.pay_status = MEDIUM_INVOICE_STATUS_APPLY
            invoice.save()
            flash(u'[%s媒体申请打款,打款金额: %s, 发票号: %s]  %s ' %
                  (invoice.medium_invoice.company, invoice.money,
                   invoice.medium_invoice.invoice_num, invoice.detail), 'success')

            invoice.medium_invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u' %s媒体申请打款,打款金额: %s, 发票号: %s  %s ' %
                (invoice.medium_invoice.company, invoice.money,
                    invoice.medium_invoice.invoice_num, invoice.detail)), msg_channel=3)
        send_type = "saler"
    elif action == 3:
        action_msg = u'媒体打款申请'
        for invoice in invoice_pays:
            invoice.pay_status = MEDIUM_INVOICE_STATUS_F_AGREE
            invoice.save()
            flash(u'[副总裁同意%s媒体打款,打款金额: %s, 发票号: %s]  %s ' %
                  (invoice.medium_invoice.company, invoice.money,
                   invoice.medium_invoice.invoice_num, invoice.detail), 'success')

            invoice.medium_invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u' 副总裁同意%s媒体打款,打款金额: %s, 发票号: %s  %s ' %
                (invoice.medium_invoice.company, invoice.money,
                    invoice.medium_invoice.invoice_num, invoice.detail)), msg_channel=3)
        send_type = "saler"
    elif action == 4:
        action_msg = u'黄亮已批准媒体打款'
        to_users += User.finances()
        for invoice in invoice_pays:
            invoice.pay_status = MEDIUM_INVOICE_STATUS_AGREE
            invoice.save()
            flash(u' 同意%s媒体订单打款申请,打款金额: %s, 发票号: %s  %s ' %
                  (invoice.medium_invoice.company, invoice.money,
                   invoice.medium_invoice.invoice_num, invoice.detail), 'success')

            invoice.medium_invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u' %s媒体同意打款,打款金额: %s, 发票号: %s  %s ' %
                (invoice.medium_invoice.company, invoice.money,
                    invoice.medium_invoice.invoice_num, invoice.detail)), msg_channel=3)
        send_type = "finance"
    else:
        action_msg = u'消息提醒'

    context = {"to_users": to_users,
               "action": action,
               "to_other": emails,
               "action_msg": action_msg,
               "info": msg,
               "invoice": medium_invoice,
               "order": medium_invoice.client_order,
               "send_type": send_type,
               "invoice_pays": invoice_pays}
    medium_invoice_apply_signal.send(
        current_app._get_current_object(), context=context)
    return redirect(url_for('saler_client_order_medium_invoice.invoice', invoice_id=invoice_id))
开发者ID:giveme168,项目名称:braavos,代码行数:73,代码来源:medium_invoice.py


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