Ejemplo n.º 1
0
# coding:utf-8
'''
Created on Aug 11, 2012

@author: fenceer
'''
import os
import web

from modules import common, base, tools

render = common.render('test')
UPLOAD_DIR = 'static/upload/'
        
class LocalFile:
    '''
    上传文件
    GET()
        return test.upload()
    POST(Filename,Filedata,#dir)
        return json(filePath)
    '''
    def GET(self):
        return render.upload()
    def POST(self):
        data = web.input()
        upload_dir = UPLOAD_DIR + data.get('dir', 'temp') + '/'
        filePath = upload_dir + data.get('fname', tools.uniqueName()) + data.Filename[data.Filename.find('.'):]
        
        fileDir = filePath[:filePath.rfind('/')]
        if not os.path.exists(fileDir):os.makedirs(fileDir)
Ejemplo n.º 2
0
Archivo: user.py Proyecto: fenceer/yiqi
# coding:utf-8
'''
Created on Oct 25, 2012

@author: xen
'''

import web
from modules import common, tools

db = web.config.db
rdb = web.config.redis
rpipe = rdb.pipeline()
render = common.render('user')
session = web.config._session
cookie_expires = 3 * 24 * 60 * 60


def login(user):
    if user:
        session.uid = user['_id']
        session.email = user['email']
        session.nick = user['nick']
        session.isVip = user['isVip']
        web.setcookie('al', tools.int2hex(user['_id']), cookie_expires)


def checkAuth(uid):
    if uid is not session.uid:
        return render.noAuth()
Ejemplo n.º 3
0
def internalerror():
    return web.internalerror(common.render('framework').internalerror())
Ejemplo n.º 4
0
def notfound():
    return web.notfound(common.render('framework').notfound())
Ejemplo n.º 5
0
# coding:utf-8
'''
Created on 2013-6-13

@author: Eva
'''

import web

from modules import common

db = web.config.db
render = common.render('spage')


class Home:
    '''
    主页
    GET()
    return spage.home()
    '''
    def GET(self):
        pass
        return render.home()


class Product:
    '''
    公司产品
    GET()
    return spage.product()
Ejemplo n.º 6
0
# coding:utf-8
'''
Created on 2013-8-8

@author: Xen
'''
import web

from modules import common, base, rdbKey
import hashlib

db = web.config.db
rdb = web.config.redis
pipe = rdb.pipeline()
render = common.render('admin')
session = web.config._session


class Index:
    '''
    管理后台首页
    GET()
        return manage.index()
    '''
    def GET(self):
        pass
        return render.index()


class Login:
    '''
Ejemplo n.º 7
0
# coding:utf-8
'''
Created on Dec 27, 2012

@author: xen
微信接口
'''

import web
import time

import model
import config
from modules import common

render = common.render('wechat')
db = web.config.db
msgDict = config.msgDict
session = web.config._session


class Query():
    '''
    POST(query)
    RETURN String
    '''
    def GET(self):
        data = web.input()
        if model.wechat.checkSignature(data):
            return data.echostr
        else: