• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tools.sendException函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中view.tools.tools.sendException函数的典型用法代码示例。如果您正苦于以下问题:Python sendException函数的具体用法?Python sendException怎么用?Python sendException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: postTransport

def postTransport(**kw):
    try:
        order = kw.get('order')
        address = kw.get('address')
        t = Transport.query.filter_by(status=1, oid=order.id).first()
        if t:
            t.update_dt = pinpin.getCurTimestamp()
            t.address_line1 = address.address_line1
            t.address_line2 = address.address_line2
            t.tel = address.tel
            t.reciver = address.reciver
            t.save
            return True
        else:
            t = Transport()
            t.oid = order.id
            t.status = 1
            t.create_dt = pinpin.getCurTimestamp()
            t.update_dt = pinpin.getCurTimestamp()
            t.address_line1 = address.address_line1
            t.address_line2 = address.address_line2
            t.tel = address.tel
            t.reciver = address.reciver
            t.save
            return True
    except Exception as e:
        current_app.logger.info('postTransport Exception %s' % e)
        db.session.rollback()
        sendException(e, 'postTransport')
        return False
开发者ID:xingkaixin,项目名称:pinpin,代码行数:30,代码来源:transport.py


示例2: pay

def pay():
    try:
        if request.method == 'POST':
            token = request.json['token']
            text = request.json['text'].strip()
            if token == 'c53b7e88b6155d08027a69601b5d098e':
                current_app.logger.info('bearychat pay text %s' % text)
                commond = [c for c in text.split(' ') if len(c) > 0]
                if len(commond) == 1 and commond[0] == '/pp':
                    sendText('不能这么用,请/pp help 查看使用方法')
                    return 'success'
                elif len(commond) == 2 and commond[0] == '/pp' and commond[1] == 'help':
                    ppHelp()
                    return 'success'
                elif len(commond) == 2 and commond[0] == '/pp' and commond[1] == 'status':
                    payQuery()
                    return 'success'
                elif len(commond) == 3 and commond[0] == '/pp' and commond[2] == 'status':
                    c = commond[1]
                    payQueryById(c)
                    return 'success'
                elif len(commond) == 3 and commond[0] == '/pp' and commond[2] == 'pay':
                    c = commond[1]
                    payById(c)
                    return 'success'
            return 'success'
        return 'fail'
    except Exception as e:
        current_app.logger.exception('pay')
        sendText('有错误发生了')
        sendException(e, 'pay')
        return 'fail'
开发者ID:xingkaixin,项目名称:pinpin,代码行数:32,代码来源:bot.py


示例3: _order_confirm_succ

def _order_confirm_succ(**kw):
    """
    支付收货确认成功
    """
    try:
        order = kw.get('order')
        trade_no = kw.get('trade_no')
        # out_trade_no = kw.get('out_trade_no')
        if order.trade_no2 == trade_no and order.status == OrderStatus.WAITING:
            order.status = OrderStatus.CONFIRMGOODS
            order.save
            group_operator.tellGroupUpdateOnSended(order.gid)
            g = GroupHead.query.get(order.gid)
            u = User.query.get(g.create_userid)
            param = {
                'reciver': u.email,
                'nickname': u.nickname,
                'title': MailSubject.OrderConfirm_To_Group,
                'orderid': order.order_no
            }
            sendMail(**param)
            return True
        return False
    except Exception as e:
        current_app.logger.exception('_order_confirm_succ')
        db.session.rollback()
        sendException(e, '_order_confirm_succ')
        return False
开发者ID:xingkaixin,项目名称:pinpin,代码行数:28,代码来源:order_operator.py


示例4: check_overtime_group

def check_overtime_group():
    from module.group.grouphead import GroupHead
    from control.pinpin import GroupStatus
    from module.user.user import User
    from control.sendmail import sendOtGroupMail
    from view.tools.tools import sendException

    today = arrow.utcnow().to('local').format('YYYYMMDD')
    try:
        current_app.logger.info('check_overtime_group')
        groups = GroupHead.query.filter_by(
            status=GroupStatus.GROUPING, value1=0, value2=0, value3=0, value4=0).all()
        i = 1
        basic = 20
        for g in groups:
            if arrow.get(g.plancompletedt).format('YYYYMMDD') < today:
                u = User.query.get(g.create_userid)
                kwargs = {
                    'nickname': u.nickname,
                    'reciver': u.email,
                    'groupno': g.group_no,
                    'dely': i * basic
                }
                sendOtGroupMail(**kwargs)
                i += 1
    except Exception as e:
        current_app.logger.exception(
            'check_overtime_group')
        sendException(e, 'check_overtime_group')
        raise
    else:
        current_app.logger.info('check_overtime_group end')
开发者ID:xingkaixin,项目名称:pinpin,代码行数:32,代码来源:taskfun.py


示例5: _sendAboutUserPassword

def _sendAboutUserPassword(**kw):
    try:
        title = MailSubject.ResetUserPassword + \
            MailSubject.Subject_Suffix
        nickname = kw.get('nickname')
        email = kw.get('email')
        token = kw.get('token')
        mode = kw.get('mode')

        param = {
            'nickname': nickname,
            'token': token,
            'mode': mode
        }


        msg = Message(title)
        msg.add_recipient(email)
        msg.body = render_template("./mail/resetpassword.txt", param=param)
        mail.send(msg)

        body = render_template("./mail/resetpassword.txt", param=param)
        _mailsend(email, title, body)

        sendNotifyMail(email, title, param)
        return True
    except Exception as e:
        current_app.logger.exception('_sendAboutUserPassword')
        sendException(e, '_sendAboutUserPassword')
        return False
开发者ID:xingkaixin,项目名称:pinpin,代码行数:30,代码来源:sendmail.py


示例6: put

 def put(self, id):
     try:
         if current_user.is_authenticated():
             uid = current_user.id
             isDefault = request.json['isDefault']
             a = UserAddressModel.query.get(id)
             if a and a.uid == uid:
                 if isDefault and a.isDefault == False:
                     setAddressDefault(uid)
                 address_line1 = request.json['address_line1']
                 address_line2 = request.json['address_line2']
                 tel = request.json['tel']
                 reciver = request.json['reciver']
                 update_dt = pinpin.getCurTimestamp()
                 a.address_line1 = address_line1
                 a.address_line2 = address_line2
                 a.tel = tel
                 a.reciver = reciver
                 a.update_dt = update_dt
                 a.isDefault = isDefault
                 a.save
                 return make_response(jsonify({'messages': 'ok'}), 201)
             return make_response(jsonify({'messages': errMsgs.NOT_PERMISSION}), 403)
         return make_response(jsonify({'messages': errMsgs.NOT_LOGIN}), 401)
     except Exception as e:
         current_app.logger.exception('MyAddress put()')
         sendException(e, 'MyAddress put()')
         return make_response(jsonify({'messages': errMsgs.SERVER_ERROR}), 500)
开发者ID:xingkaixin,项目名称:pinpin,代码行数:28,代码来源:useraddress.py


示例7: post

 def post(self):
     try:
         if current_user.is_authenticated():
             uid = current_user.id
             isDefault = hasDefaultAddress(uid)
             address_line1 = request.json['address_line1']
             address_line2 = request.json['address_line2']
             tel = request.json['tel']
             reciver = request.json['reciver']
             create_dt = pinpin.getCurTimestamp()
             update_dt = pinpin.getCurTimestamp()
             a = UserAddressModel()
             a.uid = uid
             a.address_line1 = address_line1
             a.address_line2 = address_line2
             a.tel = tel
             a.reciver = reciver
             a.create_dt = create_dt
             a.update_dt = update_dt
             a.isDefault = isDefault
             a.save
             return make_response(jsonify({'address': a.to_json, 'messages': 'ok'}), 201)
         return make_response(jsonify({'messages': errMsgs.NOT_LOGIN}), 500)
     except Exception as e:
         current_app.logger.exception('MyAddresses post()')
         sendException(e, 'MyAddresses post()')
         return make_response(jsonify({'messages': errMsgs.SERVER_ERROR}), 500)
开发者ID:xingkaixin,项目名称:pinpin,代码行数:27,代码来源:useraddress.py


示例8: _order_confirm_deposit_succ

def _order_confirm_deposit_succ(**kw):
    """
    押金收货确认成功
    """
    try:
        order = kw.get('order')
        trade_no = kw.get('trade_no')
        out_trade_no = kw.get('out_trade_no')
        if order.trade_no == trade_no and order.status == OrderStatus.CONFIRMED:
            order.status = OrderStatus.PAID
            order.out_trade_no = out_trade_no
            order.deposit_pay_dt = pinpin.getCurTimestamp()
            order.save
            group_operator.tellGroupUpdateOnGrouping(order.gid)
            g = GroupHead.query.get(order.gid)
            u = User.query.get(g.create_userid)
            param = {
                'reciver': u.email,
                'nickname': u.nickname,
                'title': MailSubject.OrderDesposit_To_Group,
                'orderid': order.order_no
            }
            sendMail(**param)
            return True
        return False
    except Exception as e:
        current_app.logger.exception('_order_confirm_deposit_succ')
        db.session.rollback()
        sendException(e, '_order_confirm_deposit_succ')
        return False
开发者ID:xingkaixin,项目名称:pinpin,代码行数:30,代码来源:order_operator.py


示例9: OrderConfirm

def OrderConfirm(order):
    '''
    buyer try to confirm order
    will gen a create alipay url if info matched
    alipay will dispay the order on alipay
    buyer can confirm this order
    then alipay will async notify pinpin interface
    and the inferface will confirm the order on pinpin
    '''
    try:
        if order and order.status == OrderStatus.WAITING:
            order.status = OrderStatus.CONFIRMGOODS
            order.save
            group_operator.tellGroupUpdateOnSended(order.gid)
            g = GroupHead.query.get(order.gid)
            u = User.query.get(g.create_userid)
            param = {
                'reciver': u.email,
                'nickname': u.nickname,
                'title': MailSubject.OrderConfirm_To_Group,
                'orderid': order.order_no
            }
            sendMail(**param)
            return True
        return False
    except Exception as e:
        current_app.logger.exception('OrderConfirm')
        sendException(e, 'OrderConfirm')
        return False
开发者ID:xingkaixin,项目名称:pinpin,代码行数:29,代码来源:order_operator.py


示例10: _order_pay_succ

def _order_pay_succ(**kw):
    """
    全部支付成功后更新订单
    """
    try:
        order = kw.get('order')
        trade_no = kw.get('trade_no')
        out_trade_no = kw.get('out_trade_no')
        if order.trade_no2 == trade_no and order.status == OrderStatus.CONFIRMEDSEND:
            order.status = OrderStatus.PAIDALL
            order.out_trade_no2 = out_trade_no
            order.complete_pay_dt = pinpin.getCurTimestamp()
            order.save
            group_operator.tellGroupUpdateOnPrepare(order.gid)
            g = GroupHead.query.get(order.gid)
            u = User.query.get(g.create_userid)
            param = {
                'reciver': u.email,
                'nickname': u.nickname,
                'title': MailSubject.OrderPay_To_Group,
                'orderid': order.order_no
            }
            sendMail(**param)
            return True
        return False
    except Exception as e:
        db.session.rollback()
        sendException(e, '_order_pay_succ')
        return False
开发者ID:xingkaixin,项目名称:pinpin,代码行数:29,代码来源:order_operator.py


示例11: OrderNegotiationConfirmbyTeamer

def OrderNegotiationConfirmbyTeamer(order):
    """
    order is order module
    """
    try:
        if order.status == OrderStatus.NEGOTIATIONSEND:
            order.status = OrderStatus.CONFIRMEDSEND
            actual_price = order.transport_fee + order.express_fee + \
                order.total_sku_amount - order.deposit
            if actual_price <= 0:
                order.actual_price = 0.01
            else:
                order.actual_price = actual_price
            order.save
            group_operator.tellGroupUpdateOnPrepare(order.gid)
            g = GroupHead.query.get(order.gid)
            u = User.query.get(g.create_userid)
            param = {
                'reciver': u.email,
                'nickname': u.nickname,
                'title': MailSubject.OrderTransFeeConfirm_To_Group,
                'orderid': order.order_no
            }
            sendMail(**param)
            return True
        return False
    except Exception as e:
        db.session.rollback()
        current_app.logger.exception('OrderNegotiationConfirmbyTeamer')
        sendException(e, 'OrderNegotiationConfirmbyTeamer')
        return False
开发者ID:xingkaixin,项目名称:pinpin,代码行数:31,代码来源:order_operator.py


示例12: OrderSent

def OrderSent(**kw):
    try:
        order = kw.get('order')
        logistics_name = kw.get('logistics_name')
        invoice_no = kw.get('invoice_no')
        param = {
            'order': order,
            'transorg': logistics_name,
            'transcode': invoice_no
        }
        if putTransport(**param):
            order.status = OrderStatus.WAITING
            order.save
            group_operator.tellGroupOrderDelivery(order.gid)
            u = User.query.get(order.create_userid)
            param = {
                'reciver': u.email,
                'nickname': u.nickname,
                'title': MailSubject.OrderSend_To_Team,
                'orderid': order.order_no
            }
            sendMail(**param)
            return True
        return False
    except Exception as e:
        current_app.logger.exception('OrderSend')
        sendException(e, 'OrderSent')
        return False
开发者ID:xingkaixin,项目名称:pinpin,代码行数:28,代码来源:order_operator.py


示例13: OrderDepositConfirm

def OrderDepositConfirm(order):
    '''

    '''
    try:
        if order.status == OrderStatus.PAIDSENT:
            t = Transport.query.filter_by(oid=order.id).first()
            param = {
                'type': 'DEPOSIT',
                'out_trade_no': order.trade_no,
                'subject': order.order_no,
                'body': _getConfirmLines(order),
                'price': order.deposit,
                'quantity': 1,
                'receive_name': t.reciver,
                'receive_address': t.address_line1,
                'receive_mobile': t.tel
            }
            PAYMENT_TEST = current_app.config['PAYMENT_TEST']
            if PAYMENT_TEST:
                order.status = OrderStatus.PAID
                order.save
                _OrderUpdateInfo(order)
                group_operator.tellGroupUpdateOnGrouping(order.gid)
            alipayurl = alipay_operator.alipay_pay_on_web(**param)
            return alipayurl
        return None
    except Exception as e:
        current_app.logger.exception('OrderDepositConfirm')
        sendException(e, 'OrderDepositConfirm')
        return None
开发者ID:xingkaixin,项目名称:pinpin,代码行数:31,代码来源:order_operator.py


示例14: OrderNegotiationNegotiationbyTeam

def OrderNegotiationNegotiationbyTeam(**kw):
    """
    order
    transportfee
    expressfee
    """
    try:
        order = kw.get('order')
        transportfee = round(float(kw.get('transportfee')), 2)
        expressfee = round(float(kw.get('expressfee')), 2)
        if (transportfee < 0.01 and transportfee != 0) or (expressfee < 0.01 and expressfee != 0):
            raise Exception('price cant less than 0.01')
        if order and order.status == OrderStatus.NEGOTIATIONSEND:
            order.transport_fee = transportfee
            order.express_fee = expressfee
            order.status = OrderStatus.APPLYSEND
            db.session.commit()
            group_operator.tellGroupUpdateOnPrepare(order.gid)
            g = GroupHead.query.get(order.gid)
            u = User.query.get(g.create_userid)
            param = {
                'reciver': u.email,
                'nickname': u.nickname,
                'title': MailSubject.OrderTransFeeUpdate_To_Group,
                'orderid': order.order_no
            }
            sendMail(**param)
            return True
        return False
    except Exception as e:
        db.session.rollback()
        current_app.logger.exception('OrderNegotiationNegotiationbyTeam')
        sendException(e, 'OrderNegotiationNegotiationbyTeam')
        return False
开发者ID:xingkaixin,项目名称:pinpin,代码行数:34,代码来源:order_operator.py


示例15: cancelOrder

def cancelOrder(order):
    """
    取消订单
    """
    try:
        current_app.logger.info('cancel order %s' % order.id)
        ols = OrderLine.query.filter(
            OrderLine.oid == order.id, OrderLine.status > OrderLineStatus.REJECT).all()
        if ols:
            for ol in ols:
                ol.status = OrderLineStatus.CANCEL
                db.session.flush()
            db.session.commit()
            _CheckOrderNegotiation(order)
            _OrderUpdateInfo(order)
            group_operator.tellGroupUpdateOnGrouping(order.gid)
            current_app.logger.info(
                'cancel order succ,Order id is %s' % order.id)
            return True
        current_app.logger.info('cancel order fail,Order id is %s' % order.id)
        return False
    except Exception as e:
        current_app.logger.info(
            'cancel order id is %s exception %s' % (order.id, e))
        db.session.rollback()
        sendException(e, 'cancelOrder')
        return False
开发者ID:xingkaixin,项目名称:pinpin,代码行数:27,代码来源:order_operator.py


示例16: OrderDepositPay

def OrderDepositPay(**kw):
    '''
    buyer try to payment this order
    will gen a create alipay url
    alipay will display payment info on alipay
    buyer can payment
    then alipay will async notify  pinpin interface,sync callback return page
    and the inferface  and the return page will paid the order on pinpin
    '''
    try:
        order = kw.get('order')
        scene = kw.get('scene', 'PC')
        if order and order.status == OrderStatus.CONFIRMED:
            param = {
                'type': 'DEPOSIT',
                'out_trade_no': order.trade_no,
                'subject': order.order_no,
                'body': _getConfirmLines(order),
                'price': order.deposit,
                'quantity': 1,
                'scene': scene
            }
            PAYMENT_TEST = current_app.config['PAYMENT_TEST']
            if PAYMENT_TEST:
                order.status = OrderStatus.PAID
                order.save
                _OrderUpdateInfo(order)
                group_operator.tellGroupUpdateOnGrouping(order.gid)
            alipayurl = alipay_operator.alipay_pay_on_web(**param)
            return alipayurl
        return None
    except Exception as e:
        current_app.logger.exception('OrderDepositPay %s' % e)
        sendException(e, 'OrderDepositPay')
        return None
开发者ID:xingkaixin,项目名称:pinpin,代码行数:35,代码来源:order_operator.py


示例17: order_confirm_succ

def order_confirm_succ(trade_no, out_trade_no):
    try:
        current_app.logger.info('Order_no  %s alipay_no %s try to confirm_succ' %
                                (trade_no, out_trade_no))
        order = OrderHead.query.filter_by(trade_no=trade_no).first()
        if order and order.trade_no == trade_no and order.out_trade_no == out_trade_no and order.status == OrderStatus.PAIDSENT:
            param = {
                'order': order,
                'trade_no': trade_no,
                'out_trade_no': out_trade_no
            }
            _order_confirm_deposit_succ(**param)
            # tellGroupThatOrderisConfirmed(order.id)
            current_app.logger.info('Order_no %s alipay_no %s  confirm_deposit_succ' %
                                    (trade_no, out_trade_no))
            return True
        else:
            order = OrderHead.query.filter_by(trade_no2=trade_no).first()
            if order and order.trade_no2 == trade_no and order.out_trade_no2 == out_trade_no and order.status == OrderStatus.WAITING:
                param = {
                    'order': order,
                    'trade_no': trade_no,
                    'out_trade_no': out_trade_no
                }
                _order_confirm_succ(**param)
                # tellGroupThatOrderisConfirmed(order.id)
                current_app.logger.info('Order_no %s alipay_no %s  confirm_succ' %
                                        (trade_no, out_trade_no))
                return True
        return False
    except Exception as e:
        current_app.logger.exception('order_confirm_succ')
        sendException(e, 'order_confirm_succ')
        return False
开发者ID:xingkaixin,项目名称:pinpin,代码行数:34,代码来源:order_operator.py


示例18: tellGroupUpdateOnSended

def tellGroupUpdateOnSended(gid):
    """
    已发货阶段,提供订单通知团更新信息
    """
    try:
        g = GroupHead.query.get(gid)
        if g and g.status == GroupStatus.SENDED:
            orders = OrderHead.query.filter_by(gid=gid).all()
            value1 = 0
            value2 = 0
            value13 = 0
            for order in orders:
                if order.status == OrderStatus.WAITING:
                    value1 += 1
                elif order.status == OrderStatus.CONFIRMGOODS:
                    value2 += 1
                    value13 += order.deposit + order.actual_price
            g.value1 = value1
            g.value2 = value2
            g.value13 = value13
            g.save
            if g.value1 == 0 and g.value2 == (g.value5 + g.value6):
                _GroupFromSendedToPAYING(g)
            return True
        return False
    except Exception as e:
        current_app.logger.exception('tellGroupUpdateOnSended')
        db.session.rollback()
        sendException(e, 'tellGroupUpdateOnSended')
        return False
开发者ID:xingkaixin,项目名称:pinpin,代码行数:30,代码来源:group_operator.py


示例19: get

    def get(self):
        try:
            if current_user.is_authenticated():
                uid = current_user.id
                user = UserModel.query.get(uid)
                info = UserInfoModel.query.filter_by(uid=uid).first()
                alipay = UserAlipay.query.filter_by(
                    uid=uid, isValid=True).first()
                alipay_acct = alipay.alipay_account if alipay else ''
                wechat = UserWechat.query.filter_by(uid=uid).first()
                wechat_acct = wechat.wechat_openid if wechat else ''

                if user and info:
                    userlist = {
                        'id': user.id,
                        'nickname': user.nickname,
                        'email': user.email,
                        'avatar': info.avatar,
                        'alipay_acct': alipay_acct,
                        'wechat_acct': wechat_acct
                    }
                    return make_response(jsonify({"user": userlist}), 200)
                make_response(jsonify({'messages': errMsgs.NOT_EXIST}), 404)
            return make_response(jsonify({'messages': errMsgs.NOT_LOGIN}), 401)
        except Exception as e:
            current_app.logger.exception('MyUserInfo get()')
            sendException(e, 'MyUserInfo get()')
            return make_response(jsonify({'messages': errMsgs.SERVER_ERROR}), 500)
开发者ID:xingkaixin,项目名称:pinpin,代码行数:28,代码来源:user.py


示例20: auto_confirm_pay_order

def auto_confirm_pay_order():

    from module.order.orderhead import OrderHead
    from control.pinpin import OrderStatus
    from view.order.order_operator import OrderConfirm
    from view.tools.tools import sendException

    AUTO_CLOSE_DAYS = 10

    try:
        current_app.logger.info('auto_confirm_pay_order begin')

        check_close_dt = arrow.utcnow().to('local').replace(
            days=-1 * AUTO_CLOSE_DAYS).timestamp

        orders = OrderHead.query.filter_by(status=OrderStatus.WAITING).all()

        for order in orders:
            if order.complete_pay_dt <= check_close_dt:
                OrderConfirm(order)
    except Exception as e:
        current_app.logger.exception(
            'auto_confirm_pay_order')
        sendException(e, 'auto_confirm_pay_order')
        raise
    else:
        current_app.logger.info('auto_confirm_pay_order end')
开发者ID:xingkaixin,项目名称:pinpin,代码行数:27,代码来源:taskfun.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python view_collection.ViewCollection类代码示例发布时间:2022-05-26
下一篇:
Python render.base函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap