Пример #1
0
    def deal(self):
        try:
            req = self.request
            schemeid = 103  # match_schemeid

            # match_groupid
            if schemeid:
                cache_name = APISrcCacheName.MATCH_GROUPID % (
                    schemeid, req.groupClass, req.groupType, req.orderType)
                gen_func = m_distribute.match_group_id
                groupid = common.get_cache_comm(cache_name, "", gen_func,
                                                schemeid, req.groupClass,
                                                req.groupType, req.orderType)

            # get_data
            if groupid:
                seri_name = ApiSeriCacheName.SERI_GROUP_ELEMS % (
                    groupid, req.pageSize, req.pageIndex)
                gen_func = m_applist.gen_group_elems
                rsp_data = common.get_cache_comm(seri_name,
                                                 self.request.clientCacheVer,
                                                 gen_func, groupid,
                                                 req.pageSize, req.pageIndex)

            self.response.rescode = 0
            self.response.resmsg = u'成功'
            if rsp_data:
                self.response.serverDataVer = rsp_data[1]
                self.response.groupElems = rsp_data[
                    2] if not rsp_data[0] else ""

        except Exception, ex:
            self.get_error_result()
            self.logger.write('ReqDistributeApps', ex)
Пример #2
0
def req_globalconfig_common(schemeid, cache_version=''):
    """ 协议通用调用方法
        返回:(是否最新版本,服务器当前版本,序列化后的数据)
        获取分组信息
    """
    seri_name = ApiSeriCacheName.SERI_APPS_CONFIG % schemeid
    gen_func = m_appsconfig.gen_appsconfig
    rsp_data = common.get_cache_comm(seri_name, cache_version, gen_func, schemeid)
    return rsp_data
Пример #3
0
def req_appinfo_common(appid, packid=0, client_cache_ver=''):
    """ 协议通用调用方法
        返回:(是否最新版本,服务器当前版本,序列化后的数据)
        获取AppInfo信息
    """
    seri_name = ApiSeriCacheName.SERI_APP_INFO % appid
    gen_func = m_appinfo.gen_appinfo
    rsp_data = common.get_cache_comm(seri_name, client_cache_ver, gen_func,
                                     appid)
    return rsp_data
Пример #4
0
def req_groupelems_common(channelno,
                          groupid,
                          page_size,
                          page_index,
                          client_cache_ver='',
                          architecture=0):
    """ 协议通用调用方法
        返回:(是否最新版本,服务器当前版本,序列化后的数据)
        获取分组信息
    """
    seri_name = ApiSeriCacheName.SERI_CHNNO_GROUP_ELEMS % (
        architecture, channelno, groupid, page_size, page_index)
    gen_func = m_applist.gen_group_elems
    rsp_data = common.get_cache_comm(seri_name, client_cache_ver, gen_func,
                                     groupid, page_size, page_index, seri_name,
                                     channelno, architecture)
    return rsp_data
Пример #5
0
def req_recommapp_common(appid,
                         channel_no,
                         client_cache_ver='',
                         app_type='',
                         order_type='',
                         architecture=0):
    """ 协议通用调用方法
        返回:(是否最新版本,服务器当前版本,序列化后的数据)
        获取推荐应用
    """
    seri_name = ApiSeriRecommCacheName.SERI_RECOMMEND_INFO % (
        architecture, channel_no, appid)
    gen_func = m_apprecomm.get_recommend_info
    rsp_data = common.get_cache_comm(seri_name, client_cache_ver, gen_func,
                                     appid, app_type, order_type, channel_no,
                                     architecture, seri_name)
    return rsp_data