Ejemplo n.º 1
0
def _build_weixin_games(context, data):
    articles = []
    is_first = True
    for game in data:
        url_pos = game.recommended_reason.find('http://')
        if url_pos != -1:
            description = game.recommended_reason[:url_pos]
        else:
            description = game.recommended_reason
        if is_first:
            pic_url = 'http://weixin.bestgames7.com/media/%s' % game.screenshot_path_1
            title = game.name
            is_first = False
        else:
            pic_url = 'http://weixin.bestgames7.com/media/%s' % game.icon
            title = '%s - %s' % (game.brief_comment.strip(), game.name)
        url = 'http://weixin.bestgames7.com/games/%d/preview' % game.id

        articles.append({
            'title': title,
            'description': description,
            'pic_url': pic_url,
            'url': url
        })
    resp = WeiXin.to_news_xml(context.get('FromUserName', None),
                              context.get('ToUserName', None), articles)
    logger.debug("len %d %s" % (len(resp), resp))
    return resp
Ejemplo n.º 2
0
def _build_weixin_game_collection(context, data):
    articles = []

    articles.append({
        'title':
        u'游戏合集之' + data.title,
        'description':
        u'游戏合集' + data.recommended_reason,
        'pic_url':
        'http://weixin.bestgames7.com/media/%s' % data.cover,
        'url':
        'http://weixin.bestgames7.com/collections/%d/preview' % data.id
    })
    for game in data.games.all()[:3]:
        title = '%s - %s' % (game.brief_comment, game.name)
        url_pos = game.recommended_reason.find('http://')
        if url_pos != -1:
            description = game.recommended_reason[:url_pos]
        else:
            description = game.recommended_reason
        pic_url = 'http://weixin.bestgames7.com/media/%s' % game.icon
        url = 'http://weixin.bestgames7.com/games/%d/preview' % game.id

        articles.append({
            'title': title,
            'description': description,
            'pic_url': pic_url,
            'url': url
        })

    return WeiXin.to_news_xml(context.get('FromUserName', None),
                              context.get('ToUserName', None), articles)
Ejemplo n.º 3
0
def _build_weixin_gift_shop(context, data):
    articles = []
    articles.append({
        'title': u'积分商城',
        'description': u'使用积分在积分商城兑换您心仪的礼品。',
        'pic_url': 'http://cow.bestgames7.com/static/img/giftshop.png',
        'url': 'http://cow.bestgames7.com/weixin/gifts/%d' % data
    })
    return WeiXin.to_news_xml(context.get('FromUserName', None),
                              context.get('ToUserName', None), articles)
Ejemplo n.º 4
0
def _build_weixin_intro(context, data):
    articles = []
    articles.append({
        'title': u'小每 - 您身边的手机游戏砖家',
        'description': u'发现好玩的手机游戏,了解最新的手机游戏资讯,参与趣味答题赢积分换礼品。',
        'pic_url': 'http://cow.bestgames7.com/static/img/weixin-intro.jpg',
        'url': 'http://cow.bestgames7.com/weixin/intro'
    })
    return WeiXin.to_news_xml(context.get('FromUserName', None),
                              context.get('ToUserName', None), articles)
Ejemplo n.º 5
0
def _build_weixin_answer(context, data):
    articles = []
    articles.append({
        'title':
        u'趣味答题',
        'description':
        u'每天一道题,答对一题得5分,积分可以换奖品。',
        'pic_url':
        'http://cow.bestgames7.com/static/img/puzzle.png',
        'url':
        'http://cow.bestgames7.com/weixin/puzzles?user_id=%d' % data
    })
    return WeiXin.to_news_xml(context.get('FromUserName', None),
                              context.get('ToUserName', None), articles)
Ejemplo n.º 6
0
def _build_weixin_game_collection(context, data):
    articles = []
    
    articles.append({'title' : u'游戏合集之' + data.title, 'description' : u'游戏合集' + data.recommended_reason, 'pic_url' : 'http://weixin.bestgames7.com/media/%s' % data.cover, 'url' : 'http://weixin.bestgames7.com/collections/%d/preview' % data.id})
    for game in data.games.all()[:3]:
        title = '%s - %s' % (game.brief_comment, game.name)
        url_pos = game.recommended_reason.find('http://')
        if url_pos != -1:
            description = game.recommended_reason[:url_pos]
        else:
            description = game.recommended_reason
        pic_url = 'http://weixin.bestgames7.com/media/%s' % game.icon
        url = 'http://weixin.bestgames7.com/games/%d/preview' % game.id
        
        articles.append({'title' : title, 'description' : description, 'pic_url' : pic_url, 'url' : url})

    return WeiXin.to_news_xml(context.get('FromUserName', None), context.get('ToUserName', None), articles) 
Ejemplo n.º 7
0
def _build_weixin_games(context, data):
    articles = []
    is_first = True
    for game in data:
        url_pos = game.recommended_reason.find('http://')
        if url_pos != -1:
            description = game.recommended_reason[:url_pos]
        else:
            description = game.recommended_reason
        if is_first:
            pic_url = 'http://weixin.bestgames7.com/media/%s' % game.screenshot_path_1
            title = game.name
            is_first = False
        else:
            pic_url = 'http://weixin.bestgames7.com/media/%s' % game.icon
            title = '%s - %s' % (game.brief_comment.strip(), game.name)
        url = 'http://weixin.bestgames7.com/games/%d/preview' % game.id

        articles.append({'title' : title, 'description' : description, 'pic_url' : pic_url, 'url' : url})
    resp = WeiXin.to_news_xml(context.get('FromUserName', None), context.get('ToUserName', None), articles)
    logger.debug("len %d %s" % (len(resp), resp))
    return resp
Ejemplo n.º 8
0
def _build_weixin_answer(context, data):
    articles = []
    articles.append({'title' : u'趣味答题', 'description' : u'每天一道题,答对一题得5分,积分可以换奖品。', 'pic_url' : 'http://cow.bestgames7.com/static/img/puzzle.png', 'url' : 'http://cow.bestgames7.com/weixin/puzzles?user_id=%d' % data})
    return WeiXin.to_news_xml(context.get('FromUserName', None), context.get('ToUserName', None), articles)
Ejemplo n.º 9
0
def _build_weixin_gift_shop(context, data):
    articles = []
    articles.append({'title' : u'积分商城', 'description' : u'使用积分在积分商城兑换您心仪的礼品。', 'pic_url' : 'http://cow.bestgames7.com/static/img/giftshop.png', 'url' : 'http://cow.bestgames7.com/weixin/gifts/%d' % data})
    return WeiXin.to_news_xml(context.get('FromUserName', None), context.get('ToUserName', None), articles)
Ejemplo n.º 10
0
def _build_weixin_intro(context, data):
    articles = []
    articles.append({'title' : u'小每 - 您身边的手机游戏砖家', 'description' : u'发现好玩的手机游戏,了解最新的手机游戏资讯,参与趣味答题赢积分换礼品。', 'pic_url' : 'http://cow.bestgames7.com/static/img/weixin-intro.jpg', 'url' : 'http://cow.bestgames7.com/weixin/intro'})
    return WeiXin.to_news_xml(context.get('FromUserName', None), context.get('ToUserName', None), articles)
Ejemplo n.º 11
0
def _build_webapp(context, data):
    articles = []
    articles.append(data)
    return WeiXin.to_news_xml(context.get('FromUserName', None), context.get('ToUserName', None), articles)