def get_list(self, u_id, u_mobile, order_id, ctime_st, ctime_ed, order_type, page, count): if order_type == 'all': orders, total = yield self.context_repos.order_repo.select_for_background_all( u_id, u_mobile, order_id, ctime_st, ctime_ed, page, count) else: if order_type == 'need_pay': state = 0 elif order_type == 'need_send': state = 1 elif order_type == 'need_receive': state = 2 elif order_type == 'complete': state = 3 elif order_type == 'cancel': state = 4 elif order_type == 'overtime': state = 5 orders, total = yield self.context_repos.order_repo.select_for_background( u_id, u_mobile, order_id, state, ctime_st, ctime_ed, page, count) res = { 'orders': orders, 'pagination': Common().pagination(total, page, count) } raise gen.Return(res)
def __init__(self): # 创建一个logger self.logger = logging.getLogger(MyConfig().logModule) self.logger.setLevel(logging.DEBUG) # 创建一个handler,用于写入日志文件 Common().createDir(MyConfig().logPath) fh = logging.handlers.RotatingFileHandler( MyConfig().logPath + MyConfig().logModule + '.log', maxBytes=20 * 1024 * 1024, backupCount=10) #FileHandler() fh.setLevel(logging.DEBUG) # 再创建一个handler,用于输出到控制台,可以不需要 ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) # 定义handler的输出格式 #2011-08-31 19:18:29,816 - mylogger - INFO - start ok! formatter = logging.Formatter( '%(asctime)s-%(filename)s:%(lineno)s-%(name)s-%(levelname)s-%(message)s' ) fh.setFormatter(formatter) ch.setFormatter(formatter) # 给logger添加handler self.logger.addHandler(fh) self.logger.addHandler(ch) # 记录一条日志 self.logger.info('Init Logger OK !')
def get_order_list(self, user_id, order_type, page, count): """ 获取我的订单列表 :param count: :param page: :param order_type: :param user_id: :return: """ if order_type == 'all': res, total = yield self.context_repos.order_repo.select_by_user_id_all( user_id, page, count) elif order_type == 'need_pay': res, total = yield self.context_repos.order_repo.select_by_user_id_state( user_id, 0, page, count) elif order_type == 'need_send': res, total = yield self.context_repos.order_repo.select_by_user_id_state( user_id, 1, page, count) elif order_type == 'need_receive': res, total = yield self.context_repos.order_repo.select_by_user_id_state( user_id, 2, page, count) elif order_type == 'complete': res, total = yield self.context_repos.order_repo.select_by_user_id_state( user_id, 3, page, count) elif order_type == 'cancel': res, total = yield self.context_repos.order_repo.select_by_user_id_state( user_id, 4, page, count) elif order_type == 'overtime': res, total = yield self.context_repos.order_repo.select_by_user_id_state( user_id, 5, page, count) else: raise gen.Return({'code': 201, 'msg': 'type参数错误'}) for order in res: order_id = order['order_id'] sku_orders = yield self.context_repos.sku_order_repo.select_by_order_id( order_id) order['skus_info'] = sku_orders pagination = Common().pagination(total, page, count) raise gen.Return({ 'code': 0, 'msg': '获取成功', 'data': { 'pagination': pagination, 'order_list': res } })
def __init__(self): if ENV == "DEV": self.debug = True else: self.debug = False self.sqlUsr = "******" self.sqlPasswd = "55haitao" self.sqlDataBase = "cateOptSys" self.logPath = './mallHomePage_log/' self.logModule = "mallHomePage" if Common().isLinux() is False: '''WIN''' self.homeUrl = '/mallhome/' self.searchUrl = '/mallsearch/' self.infoUrl = '/mallsearch/info/' self.sevIp = "127.0.0.1" self.sevPort = "8001" self.redisRdIp = '120.26.117.54' # online1 self.redisRdPort = 6390 self.redisWrIp = '114.55.11.179' #online 4 主 self.redisWrPort = 6393 #mongodb self.mongodbIp = "114.55.11.179" #"121.43.200.103" self.mongodbPort = 6391 #27017 #sql self.mysqlHost = "120.26.117.54" self.mysqlPort = 3306 self.mysqlDatabase = "cateOptSys" self.mysqlUser = "******" self.mysqlPasswd = "55haitao" '''正规环境需要更新部署的内部接口''' self.getNaviUrl = "http://121.43.200.103:2700/mall/homepage/navi/get" # dev1 ?type=pre self.getBannerUrl = "http://121.43.200.103:2700/mall/homepage/banner/get?level=0" #dev1 self.getFourAd = "http://121.43.200.103:2700/mall/homepage/fourAd/get" self.getSpecial = "http://121.43.200.103:2700/mall/homepage/special/get" self.getOfficalWebSale = "http://121.43.200.103:2700/mall/homepage/officalWebSale/get" self.getNewArrivals = "http://121.43.200.103:2700/mall/homepage/newArrivals/get" self.getSubject = "http://121.43.200.103:2700/mall/homepage/subject/get" self.getFeature = "http://121.43.200.103:2700/mall/homepage/feature/get" # self.getSeller = "http://121.43.200.103:2700/mall/homepage/seller/get" self.getSeller = "http://120.26.117.54:8889/searchGET?query=*" self.getBrand = "http://121.43.200.103:2700/mall/homepage/brand/get" self.getBrandSearch = "http://121.43.200.103:2700/mall/homepage/brand/search?query=" self.getOfficalWebSaleAll = "http://121.43.200.103:2700/mall/homepage/officalWebSale/get?type=1" else: '''LINUX''' self.homeUrl = '/mallhome/' self.searchUrl = '/mallsearch/' self.infoUrl = '/mallsearch/info/' self.sevIp = "127.0.0.1" self.sevPort = "12910" self.redisRdIp = '10.51.35.123' self.redisRdPort = 6390 self.redisWrIp = '10.25.1.67' self.redisWrPort = 6381 #mongodb self.mongodbIp = "10.51.35.123" #online1 self.mongodbPort = 6391 #mysql配置 self.mysqlHost = "10.51.35.123" self.mysqlPort = 3306 self.mysqlDatabase = "cateOptSys" self.mysqlUser = "******" self.mysqlPasswd = "55haitao" '''正规环境需要更新部署的内部接口''' self.getNaviUrl = "http://127.0.0.1:2700/mall/homepage/navi/get" #dev1 self.getBannerUrl = "http://127.0.0.1:2700/mall/homepage/banner/get?level=0" #dev1 self.getFourAd = "http://127.0.0.1:2700/mall/homepage/fourAd/get" self.getSpecial = "http://127.0.0.1:2700/mall/homepage/special/get" self.getSpecialAll = "http://127.0.0.1:2700/mall/homepage/special/get?type=1" self.getOfficalWebSale = "http://127.0.0.1:2700/mall/homepage/officalWebSale/get" self.getNewArrivals = "http://127.0.0.1:2700/mall/homepage/newArrivals/get" self.getSubject = "http://127.0.0.1:2700/mall/homepage/subject/get" self.getFeature = "http://127.0.0.1:2700/mall/homepage/feature/get" self.getBrand = "http://127.0.0.1:2700/mall/homepage/brand/get" self.getBrandSearch = "http://127.0.0.1:2700/mall/homepage/brand/search?query=" # self.getSeller = "http://127.0.0.1:2700/mall/homepage/seller/get" self.getSeller = "http://10.51.35.123:8889/searchGET?query=*" self.getOfficalWebSaleAll = "http://127.0.0.1:2700/mall/homepage/officalWebSale/get?type=1"