本文整理汇总了Python中models.user.User.medias方法的典型用法代码示例。如果您正苦于以下问题:Python User.medias方法的具体用法?Python User.medias怎么用?Python User.medias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.user.User
的用法示例。
在下文中一共展示了User.medias方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: back_money_apply
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import medias [as 别名]
def back_money_apply(sender, apply_context):
order = apply_context['order']
num = apply_context['num']
type = apply_context['type']
if type == 'invoice':
s_title = u'项目回款信息-返点发票信息'
elif type == 'end':
s_title = u'项目回款完成'
elif type == 'no_end':
s_title = u'回款状态变为未完成'
else:
s_title = u'项目回款信息'
if num == -1:
s_title = u'坏账项目'
if order.__tablename__ in ['searchAd_bra_client_order', 'searchAd_bra_rebate_order']:
to_users = order.direct_sales + order.agent_sales + \
[order.creator, g.user] + order.leaders
else:
to_users = order.direct_sales + order.agent_sales + User.contracts() + \
[order.creator, g.user] + order.leaders + User.medias()
if 3 in order.locations:
to_users += [k for k in User.all()
if k.email.find('chenjingjing') >= 0]
if 1 in order.locations:
to_users += [k for k in User.all()
if k.email.find('weizhaoting') >= 0]
if order.__tablename__ == 'bra_client_order':
title = u"【新媒体订单-合同流程】- %s" % (order.name)
elif order.__tablename__ == 'bra_client_medium_order':
title = u"【直签媒体订单-合同流程】- %s" % (order.name)
elif order.__tablename__ == 'bra_framework_order':
title = u"【框架订单-合同流程】- %s" % (order.name)
elif order.__tablename__ == 'bra_douban_order':
title = u"【直签豆瓣订单-合同流程】- %s" % (order.name)
elif order.__tablename__ == 'searchAd_bra_client_order':
title = u"【效果业务普通订单-合同流程】- %s" % (order.name)
elif order.__tablename__ == 'bra_searchAd_framework_order':
title = u"【效果业务框架订单-合同流程】- %s" % (order.name)
elif order.__tablename__ == 'searchad_bra_rebate_order':
title = u"【效果业务返点订单-合同流程】- %s" % (order.name)
else:
title = u"【合同流程】- %s" % (order.name)
url = mail.app.config['DOMAIN'] + order.info_path()
body = u"""
<h3 style="color:red;">流程状态: %s
回款详情:
本次回款金额: %s
已回款完成比例: %s %%
订单链接地址: %s</h3>
<p><h4>订单信息:</h4>
%s</p>
<p>by %s</p>
""" % (s_title, str(num), order.back_money_percent, url, order.email_info, g.user.name)
flash(u'已发送邮件给%s' % (','.join(_get_active_user_name(to_users))), 'info')
_insert_person_notcie(to_users, title, body)
send_html_mail(title, recipients=_get_active_user_email(
to_users), body=body.replace('\n', '<br/>'))
示例2: contract_email
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import medias [as 别名]
def contract_email(order, attachment):
if order.__tablename__ == 'bra_searchAd_framework_order':
to_users = set(User.contracts() +
User.medias() +
order.sales +
[order.creator, g.user])
elif order.__tablename__ == 'searchAd_bra_client_order':
to_users = set(User.contracts() +
User.medias() +
order.agent_sales +
order.direct_sales +
[order.creator, g.user])
elif order.__tablename__ == 'bra_framework_order':
to_users = set(User.contracts() +
order.agent_sales +
order.direct_sales +
[order.creator, g.user])
elif order.__tablename__ == 'bra_medium_framework_order':
to_users = set(User.contracts() +
order.medium_users +
[order.creator, g.user])
elif order.__tablename__ == 'bra_client_medium_order':
to_users = set(User.contracts() +
User.medias() +
order.agent_sales +
order.direct_sales +
[order.creator, g.user])
else:
to_users = set(User.contracts() +
User.medias() +
order.direct_sales +
order.agent_sales +
order.operaters +
[order.creator, g.user])
action_msg = u"%s文件更新" % (attachment.type_cn)
msg = u"""
文件名:%s
状态:%s
上传者:%s""" % (attachment.filename, attachment.status_cn, g.user.name)
context = {'order': order,
'sender': g.user,
'action_msg': action_msg,
'info': msg,
'to_users': to_users}
zhiqu_contract_apply_signal.send(app._get_current_object(), context=context)
示例3: apply_pay
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import medias [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))
示例4: invoice_pass
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import medias [as 别名]
def invoice_pass(invoice_id):
if not g.user.is_finance():
abort(404)
invoice = searchAdMediumInvoice.get(invoice_id)
if not invoice:
abort(404)
invoices_ids = request.values.getlist('invoices')
invoices_pay = searchAdMediumInvoicePay.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 = invoice.client_order.direct_sales + invoice.client_order.agent_sales + \
[invoice.client_order.creator, g.user] + \
User.operater_leaders() + User.medias()
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'消息提醒'
apply_context = {"title": "媒体订单款已打款",
"sender": g.user,
"to": to_emails,
"action_msg": action_msg,
"msg": msg,
"send_type": "saler",
"invoice": invoice,
"invoice_pays": invoices_pay}
medium_invoice_apply_signal.send(
current_app._get_current_object(), apply_context=apply_context)
flash(u'已发送邮件给 %s ' % (', '.join(to_emails)), 'info')
return redirect(url_for("searchAd_finance_client_order_medium_pay.pay_info", invoice_id=invoice_id))
示例5: apply_invoice
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import medias [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))
示例6: back_money_apply
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import medias [as 别名]
def back_money_apply(sender, apply_context):
order = apply_context['order']
num = apply_context['num']
type = apply_context['type']
if type == 'invoice':
s_title = u'返点发票信息'
elif type == 'end':
s_title = u'回款完成'
elif type == 'no_end':
s_title = u'回款状态变为未完成'
else:
s_title = u'回款信息'
if order.__tablename__ in ['searchAd_bra_client_order', 'searchAd_bra_rebate_order']:
to_users = order.direct_sales + order.agent_sales +\
[order.creator, g.user] + order.leaders
title = u'【搜索部门-项目回款】%s-%s' % (order.name, s_title)
else:
to_users = order.direct_sales + order.agent_sales + User.contracts() +\
[order.creator, g.user] + order.leaders + User.medias()
if 3 in order.locations:
to_users += [k for k in User.all() if k.email.find('chenjingjing') >= 0]
title = u'【项目回款】%s-%s' % (order.name, s_title)
to_emails = list(set([x.email for x in to_users]))
flash(u'已发送邮件给 %s ' %
(', '.join([k.name for k in list(set(to_users))])), 'info')
url = mail.app.config['DOMAIN'] + order.info_path()
body = u"""
订单: %s
链接地址: %s
订单合同号: %s
回款详情:
本次回款金额: %s
已回款完成比例: %s %%
订单信息:
%s
\n
by %s
""" % (order.name, url, order.contract, str(num), order.back_money_percent, order.email_info, g.user.name)
send_simple_mail(title, to_emails, body=body)
示例7: medium_back_money_apply
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import medias [as 别名]
def medium_back_money_apply(sender, apply_context):
order = apply_context['order']
num = apply_context['num']
title = u"【新媒体订单-合同流程】- %s" % (order.name)
s_title = u'项目回款信息-媒体返点回款信息'
url = mail.app.config['DOMAIN'] + order.info_path()
to_users = User.contracts() + [g.user] + User.medias()
body = u"""
<h3 style="color:red;">流程状态: %s
回款详情:
本次回款金额: %s
订单链接地址: %s</h3>
<p><h4>订单信息:</h4>
%s</p>
<p>by %s</p>
""" % (s_title, str(num), url, order.email_info, g.user.name)
flash(u'已发送邮件给%s' % (','.join(_get_active_user_name(to_users))), 'info')
_insert_person_notcie(to_users, title, body)
send_html_mail(title, recipients=_get_active_user_email(
to_users), body=body.replace('\n', '<br/>'))
示例8: medium_invoice_apply
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import medias [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)
示例9: pass_invoice
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import medias [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))
示例10: apply_pay
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import medias [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))