Esempio n. 1
0
        /// <summary>
        /// 9.9包邮精选
        /// </summary>
        /// <param name="pageId">默认为20,最大值100</param>
        /// <param name="pageSize">常规分页方式,请直接传入对应页码</param>
        /// <param name="nineCid">9.9精选的类目id,分类id请求详情:-1-精选,1 -居家百货,2 -美食,3 -服饰,4 -配饰,5 -美妆,6 -内衣,7 -母婴,8 -箱包,9 -数码配件,10 -文娱车品</param>
        /// <returns></returns>
        public ActionResult GetOPGood(int user_id, string pageId = "1", int pageSize = 20, string nineCid = "1")
        {
            try
            {
                string               appid                = CheckAPPID();
                string               cacheKey             = Md5Helper.Hash("OPGood" + pageId + pageSize + nineCid);
                List <OPGoodItem>    oPGoodItems          = redisCache.Read <List <OPGoodItem> >(cacheKey, 7L);
                dm_basesettingEntity dm_BasesettingEntity = dM_BaseSettingIBLL.GetEntityByCache(appid);

                if (oPGoodItems == null)
                {
                    DTK_ApiManage      dTK_ApiManage      = new DTK_ApiManage(dm_BasesettingEntity.dtk_appkey, dm_BasesettingEntity.dtk_appsecret);
                    DTK_OP_ListRequest dTK_OP_ListRequest = new DTK_OP_ListRequest();
                    dTK_OP_ListRequest.version  = "v1.1.0";
                    dTK_OP_ListRequest.nineCid  = nineCid;
                    dTK_OP_ListRequest.pageId   = pageId;
                    dTK_OP_ListRequest.pageSize = pageSize;
                    DTK_OP_ListResponse dTK_OP_ListResponse = dTK_ApiManage.GetOPGood(dTK_OP_ListRequest);
                    if (dTK_OP_ListResponse.code != 0)
                    {
                        return(Fail(dTK_OP_ListResponse.msg));
                    }
                    oPGoodItems = dTK_OP_ListResponse.data.list;
                    redisCache.Write(cacheKey, oPGoodItems, DateTime.Now.AddHours(2.0), 7L);
                }

                dm_userEntity dm_UserEntity = dm_userIBLL.GetEntityByCache(user_id);

                return(SuccessList("获取成功!", oPGoodItems.Select(t => { t.LevelCommission = GetCommissionRate(t.actualPrice, t.commissionRate, dm_UserEntity.userlevel, dm_BasesettingEntity); t.SuperCommission = GetCommissionRate(t.actualPrice, t.commissionRate, 2, dm_BasesettingEntity); return t; })));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 9.9包邮精选
        /// </summary>
        /// <param name="dTK_OP_ListRequest"></param>
        /// <returns></returns>
        public DTK_OP_ListResponse GetOPGood(DTK_OP_ListRequest dTK_OP_ListRequest)
        {
            DTK_OP_ListResponse dTK_OP_ListResponse = null;

            try
            {
                string resultContent = GeneralApiParam(api_op_goods_list, dTK_OP_ListRequest.ModelToUriParam());
                dTK_OP_ListResponse = resultContent.ToJsonObject <DTK_OP_ListResponse>();

                //转换公用商品信息
                if (dTK_OP_ListRequest.IsReturnCommonInfo)
                {
                    dTK_OP_ListResponse.CommonGoodInfoList = ConvertCommonGoodInfo(dTK_OP_ListResponse.data.list);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteException("GetOPGood", ex);
            }
            return(dTK_OP_ListResponse);
        }