Esempio n. 1
0
def do_business(sender, **kwargs):
    baseutil.well_print('ipn received')
    ipn_obj = sender
    out_trade_no = ipn_obj.invoice  # 本站订单号
    total_fee = ipn_obj.mc_gross
    trade = get_object_or_404(Transaction, out_trade_no=out_trade_no)
    # send mail to admin
    mail_content = u"Bluessh有新用户付款成功,用户名为 %s, 付款金额为 $%s"\
                    % (trade.user.username,total_fee)
    mail_admins(u"Bluessh有新用户付款成功", mail_content, fail_silently=True)
    #创建账单对应的ssh帐号,并保存到UserProduct
    baseutil.well_print("username:%s, total_fee:%s" %
                        (trade.user.username, total_fee))
    create_ssh_user(trade)
Esempio n. 2
0
def do_business(sender, **kwargs):
    baseutil.well_print('ipn received')
    ipn_obj = sender
    out_trade_no = ipn_obj.invoice # 本站订单号
    total_fee = ipn_obj.mc_gross
    trade = get_object_or_404(Transaction,out_trade_no=out_trade_no)
    # send mail to admin
    mail_content = u"Bluessh有新用户付款成功,用户名为 %s, 付款金额为 $%s"\
                    % (trade.user.username,total_fee)
    mail_admins(u"Bluessh有新用户付款成功",
                mail_content,
                fail_silently=True)
    #创建账单对应的ssh帐号,并保存到UserProduct
    baseutil.well_print("username:%s, total_fee:%s" % (trade.user.username,total_fee))
    create_ssh_user(trade)
Esempio n. 3
0
def send_mail_post_save(sender,instance,**kwargs):
    """
        SendMail post_save signal callback
    """
    if instance.confirm:
        subject = instance.subject
        content = instance.content
        rev_list = []
        if instance.receivers == 'ALL': #群发所有用户
            for user in User.objects.all():
                rev_list.append(user.email)
        else : #群发指定用户
            rev_list = instance.receivers.split(',')
        #well_print(rev_list)
        #well_print(subject)
        #well_print(content)
        mail_to_list(subject,content,rev_list)
        well_print('send mail done')