Пример #1
0
 def getExchangeHistory(self, msg):
     mo = MsgPack()
     mo.setCmd('exchange5')
     mo.setResult('action', 'history')
     mi = hallchecker.CHECK_BASE.check(msg)
     if mi.error:
         mo.setError(1, mi.error)
     else:
         orders = []
         exchangeIds = _dao.getReordKeys(mi.userId)
         exchangeIds.sort(reverse=True)
         for exchangeId in exchangeIds:
             order = _dao.loadRecord(mi.userId, exchangeId)
             orders.append([
                 exchangeId,  # 兑换ID
                 fttime.formatTimeSecond(
                     datetime.fromtimestamp(order.createTime)),  # 兑换时间
                 order.state,  # 兑换状态
                 order.params[
                     'type'],  # 兑换类型 0-手机充值卡 1-手工兑换 2-比赛等线下邀请函、门票等 3-京东卡 4-未使用 5-微信红包 6-京东实物 99-金币
                 order.params['displayName'],  # 兑换物品名称
                 order.params['uName'],  # 昵称
                 order.params['phone'],  # 电话
                 order.params.get('jdAddres',
                                  []),  # 京东收货地址数组 [1级,2级,3级,4级,输入地址]
                 order.extOrderId,  # 京东实物交易单号
                 order.extCardId,  # 京东卡卡号
                 order.extCardPwd,  # 京东卡卡密
             ])
         mo.setResult('userId', mi.userId)
         mo.setResult('orders', orders)
     tyrpcconn.sendToUser(mi.userId, mo)
     return 1
Пример #2
0
def checkStartStopTime(conf):
    ct = fttime.formatTimeSecond()
    startTime = conf['startTime']
    endTime = conf['endTime']
    if ct < startTime or ct > endTime:
        return 0
    return 1
Пример #3
0
def getItemInfo(tabName, itemId):
    if _DEBUG:
        debug('getItemInfo', tabName, itemId)
    info = None
    tabConf = SUBCONFS.get(tabName, None)
    if tabConf:
        conf = tabConf.getScConfig().get('exitems', {}).get(itemId)
        if conf:
            ct = fttime.formatTimeSecond()
            startTime = conf['startTime']
            endTime = conf['endTime']
            if ct < startTime or ct > endTime:
                info = None
            else:
                info  = conf
                if _DEBUG:
                    debug('getItemInfo item timeout', tabName, itemId, ct, conf)
        else:
            if _DEBUG:
                debug('getItemInfo item notfound', tabName, itemId, tabConf.getScConfig())
    else:
        if _DEBUG:
            debug('getItemInfo tabName notfound', tabName, itemId, SUBCONFS.keys())

    if _DEBUG:
        debug('getItemInfo', tabName, itemId, info)
    return info
Пример #4
0
 def _doExchangeQueryUi(self, userId, clientId):
     items = []
     _bannerIds, tabIds = _conf.getExchangeQueryUiTabs(clientId)
     msc = _conf.MAINCONF.getScConfig()
     for tabId in tabIds:
         tname = msc['extabs'][tabId]['name']
         itemIds = []
         page = 0
         ids = 1
         while ids:
             ids = _conf.getExchangeQueryUiItems(tname, page, clientId)
             page += 1
             if ids:
                 itemIds.extend(ids)
         subconf = _conf.SUBCONFS[tname]
         for itemId in itemIds:
             itemConf = subconf.getScConfig().get('exitems', {}).get(itemId)
             items.append({
                 'tab': tname,
                 'id': itemId,
                 'title': itemConf['title'],
                 'price': itemConf['price'],
                 'count': itemConf['count'],
                 'showtext': itemConf['showtext'],
             })
     orders = []
     exchangeIds = _dao.getReordKeys(userId)
     exchangeIds.sort(reverse=True)
     for exchangeId in exchangeIds:
         order = _dao.loadRecord(userId, exchangeId)
         orders.append({
             'time':
             fttime.formatTimeSecond(
                 datetime.fromtimestamp(order.createTime)),  # 兑换时间
             'exchangeId':
             exchangeId,  # 兑换ID
             'state':
             order.state,  # 兑换状态
             'type':
             order.params['type'],  # 兑换类型 0-手机充值卡 3-京东卡 6-京东实物 99-金币
             'displayName':
             order.params['displayName'],  # 兑换物品名称
             'uName':
             order.params['uName'],  # 昵称
             'phone':
             order.params['phone'],  # 电话
             'itemId':
             order.params['itemId'],
             'coupon':
             order.params['coupon'],
             'count':
             order.params['count'],
             'addr':
             order.params.get('jdAddres',
                              []),  # 京东收货地址数组 [1级,2级,3级,4级,输入地址]
             'extOrderId':
             order.extOrderId,  # 京东实物交易单号
         })
     return {'items': items, 'orders': orders}
Пример #5
0
def checkStartStopTimeList(confs):
    ct = fttime.formatTimeSecond()
    newConfs = []
    for conf in confs:
        startTime = conf['startTime']
        endTime = conf['endTime']
        if ct < startTime or ct > endTime:
            continue
        else:
            newConfs.append(conf)
    return newConfs
Пример #6
0
def sendHallUiGameList(userId, intClientId, apiVersion):
    nowdate = fttime.formatTimeSecond()
    mo = MsgPack()
    mo.setCmd('hall_ui5')
    mo.setKey('apiVersion', apiVersion)
    mo.setResult('gameId', HALL_GAMEID)
    mo.setResult('intClientId', intClientId)
    mo.setResult('userId', userId)
    mo.setResult('gamelist',
                 _hallgamelist.getUiInfo(userId, intClientId, nowdate))
    tyrpcconn.sendToUser(userId, mo)
Пример #7
0
 def getUserOrderList(self, userId):
     orders = self._orderDao.getUserOrderList(userId)
     # 转换为列表
     historys = []
     for oid, datas in orders.iteritems():
         datas.append(oid)
         historys.append(datas)
     historys.sort(key=lambda x: x[0], reverse=True)
     for h in historys:
         # 更新时间、商品ID、商品名称、价格单位、价格、状态、订单号
         # 转换时间戳值字符串
         h[0] = fttime.formatTimeSecond(datetime.fromtimestamp(h[0]))
     return historys
Пример #8
0
def filterStartStopTime(defIds, cachedConfig, scKey):
    showIds = []
    ct = fttime.formatTimeSecond()
    confAll = cachedConfig.getScConfig().get(scKey, {})
    for nid in defIds:
        # 开始截止日期判定
        conf = confAll.get(nid)
        if not conf:
            continue
        startTime = conf['startTime']
        endTime = conf['endTime']
        if ct < startTime or ct > endTime:
            continue
        else:
            showIds.append(nid)
    return showIds