Exemple #1
0
class SMSClient(object):

    bearychat = BearyChat('staging')

    def __repr__(self):
        if self.bearychat.configured:
            return '<BearyChatSMSClient>'
        return '<FakeSMSClient>'

    @classmethod
    def send(cls, phones, text, tag, operator):
        if isinstance(phones, basestring):
            phones = [phones]

        for phone in phones:
            line = u'%s\t%s\t%s\t%s' % (phone, text, tag, operator)
            print line.encode('utf-8')
            if cls.bearychat.configured:
                cls.bearychat.say(line)
        return True

    @classmethod
    def asend(cls, phones, text, tag, operator):
        SMSClient.send(phones, text, tag, operator)
Exemple #2
0
# coding: utf-8

import datetime

from babel.dates import format_timedelta
from babel.numbers import format_number

from jupiter.integration.bearychat import BearyChat
from jupiter.integration.mq import WorkerTaskError
from . import pool

bearychat = BearyChat('savings_xm')


@pool.async_worker('guihua_hoarder_payment_track_mq')
def hoarder_payment_tracking(order_id):
    from core.models.hoarder.order import HoarderOrder
    from jupiter.ext import sxb

    expected_status_set = frozenset([
        HoarderOrder.Status.success, HoarderOrder.Status.failure,
        HoarderOrder.Status.backed
    ])

    order = HoarderOrder.get(order_id)
    origin_status = order.status

    # 当订单属于自然失败时不再更新状态
    if origin_status in expected_status_set:
        return
from babel.dates import format_timedelta

from jupiter.app import create_app
from jupiter.integration.bearychat import BearyChat
from core.models.decorators import coerce_type
from core.models.plan.plan import Plan
from core.models.plan.report import Report
from libs.db.store import db
from libs.fs.fs import QiniuFS


logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

bearychat = BearyChat('data')
fs = QiniuFS('guihua-internal', 'http://7xnqtg.dl1.z0.glb.clouddn.com')
fs_expires = datetime.timedelta(minutes=30)

CAREERS = {
    '1': '公务员',
    '2': '国企、事业单位职工',
    '3': '私企、外企职工',
    '4': '私营业主、自由职业者',
    '5': '学生',
    '6': '待业',
    '7': '其他',
}


def export_by_user(user_id):
Exemple #4
0
# coding: utf-8

import json

from flask import url_for

from libs.utils.log import bcolors
from core.models.oauth import OAuthClient, OAuthScope
from jupiter.app import create_app
from jupiter.integration.bearychat import BearyChat

bearychat = BearyChat('staging')
TEMPLATE = u'''\
@group 测试环境已更新
**Client ID** `{}`
**Client Secret** `{}`'''


def get_redirect_uri():
    try:
        from envcfg.json.solar import OAUTHY_REDIRECT_URI
    except ImportError:
        return 'http://oauthy.guihua.dev/login/guihua/authorized'
    else:
        return OAUTHY_REDIRECT_URI


def main():
    bcolors.run('Add OAuth client.')
    client = OAuthClient.add(name=u'OAuthy',
                             redirect_uri=get_redirect_uri(),
Exemple #5
0
from enum import Enum
from werkzeug.utils import cached_property

from jupiter.ext import sentry
from jupiter.integration.bearychat import BearyChat
from libs.db.store import db
from libs.cache import mc, cache
from core.models.mixin.props import PropsMixin, PropsItem
from core.models.utils.types import unicode_type, date_type
from .consts import ZW_SAFE_RESERVATION_AMOUNT
from .errors import InvalidProductError, ImproperAmountAllocation
from .profit_hike import ProfitHikeMixin
from ..common import ProfitPeriod
from ..providers import zhiwang

bearychat = BearyChat('savings')


class SaleMode(Enum):
    share = 'SHARE'
    mutex = 'MUTEX'


class ZhiwangProduct(PropsMixin, ProfitHikeMixin):
    class Type(Enum):
        classic = 'PT_CLASSIC'
        fangdaibao = 'PT_FANGDAIBAO'

    Type.classic.label = u'定期产品'
    Type.fangdaibao.label = u'不定期产品'