Example #1
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from sqlalchemy.ext.declarative import DeclarativeMeta
from sqlalchemy.orm import object_mapper
import simplejson
import six
from datetime import datetime
import threading
from util.ini_client import ini_load
from enginefacade import EngineFacade

_conf = ini_load('config/mysql.ini')
_dic_con = _conf.get_fields('product_db')

connect = 'mysql://{0}:{1}@{2}:{3}/{4}?charset=utf8'.format(
    _dic_con.get('user'), _dic_con.get('password'), _dic_con.get('host'),
    _dic_con.get('port', 3306), _dic_con.get('database'))

_LOCK = threading.Lock()
_FACADE = None


def _create_facade_lazily():
    global _LOCK
    with _LOCK:
        global _FACADE
        if _FACADE is None:
            args = {"encoding": "utf8", "convert_unicode": True}
            _FACADE = EngineFacade(connect, **args)
Example #2
0
# -*- coding: utf-8 -*-

from random import randint
import datetime
import time
from util import convert
from util.exception import ParamExist
from util.ini_client import ini_load
from util.face_recognition_api import face_recognition_yyl
from db import api as db_api
from logic import Logic
import logging

LOG = logging.getLogger(__name__)

_conf = ini_load('config/time.ini')
_dic_con = _conf.get_fields('sign')
morning = _dic_con.get("morning")
afternoon = _dic_con.get("afternoon")


class SignLogic(Logic):
    def sign_type(self, verify_time="12:00:00"):
        now_time = time.strftime('%H:%M:%S', time.localtime(time.time()))
        if now_time > verify_time:
            return 2
        return 1

    def input(self,
              relevance_type=1,
              phone="",
Example #3
0
#coding:utf-8

from tornado.web import RequestHandler
import tornado.httpclient
from six.moves.urllib import parse
from util.exception import ParamExist
import logging
import json
from logic.userlogic import WXUserLogic
from logic.relative import RelativeLogic
from logic.teacher import TeacherLogic
from logic.verify_manage import VerifyManageLogic
from util.ini_client import ini_load
from util import convert

_conf = ini_load('config/service.ini')
relative_dic_con = _conf.get_fields('relative_wx')
teacher_dic_con = _conf.get_fields('teacher_wx')

LOG = logging.getLogger(__name__)


class WXActionHandler(RequestHandler):
    def post(self, action):
        try:
            if action == "login":
                self.login()
                return
            if action == "bind":
                self.bind_user()
                return
Example #4
0
#coding:utf-8

from tornado.web import RequestHandler
import tornado.httpclient
from six.moves.urllib import parse
from util import common_util
import logging
import json
from logic.drumstick.drumstick_wx_user import DrumstickWXUserLogic

from util.ini_client import ini_load

_conf = ini_load("config/service.ini")
game_dic_con = _conf.get_fields("drumstick_wx")

LOG = logging.getLogger(__name__)


class DrumstickWxLoginHandler(RequestHandler):
    def initialize(self, book_ids, stance_items, buy_nums, skill_items,
                   **kwds):
        self.book_ids = book_ids
        self.stance_items = stance_items
        self.buy_nums = buy_nums
        self.skill_items = skill_items

    def post(self):
        code = self.get_argument("code", "")
        user_name = self.get_argument("user_name", "")
        recommend_id = self.get_argument("recommend_id", "")
        avatar_url = self.get_argument("avatar_url", "")