Exemplo n.º 1
0
        /// <summary>
        /// 推广计划转链
        /// </summary>
        public CPS_Convert_LinkResponse Get_CPS_Convert_Link(CPS_Convert_LinkRequest cPS_Convert_LinkRequest)
        {
            CPS_Convert_LinkResponse cPS_Convert_LinkResponse = null;

            try
            {
                bool   IsSuccess = false; string Msg = "";
                string paramJson = cPS_Convert_LinkRequest.ToJsonStr();

                cPS_Convert_LinkResponse = Convert_TemplateResponse <CPS_Convert_LinkResponse>("cps-mesh.cpslink.links.post", paramJson, ref IsSuccess, ref Msg);
            }
            catch (Exception ex)
            {
                LogHelper.WriteException("Get_CPS_Convert_Link", ex);
            }

            return(cPS_Convert_LinkResponse);
        }
Exemplo n.º 2
0
        public ActionResult ConvertFunLink(int module_fun_id)
        {
            try
            {
                NameValueCollection nameValueCollection = base.Request.Headers;
                dm_userEntity       dm_UserEntity       = CacheHelper.ReadUserInfo(nameValueCollection);


                if (!dm_UserEntity.IsEmpty())
                {
                    string cacheKey = Md5Helper.Hash(module_fun_id + "module_fun_id" + dm_UserEntity.id);
                    string to_link  = redisCache.Read <string>(cacheKey, 7);
                    if (to_link.IsEmpty())
                    {
                        dm_decoration_fun_manageEntity dm_Decoration_Fun_ManageEntity = dm_Decoration_Fun_ManageIBLL.GetEntity(module_fun_id);
                        if (dm_Decoration_Fun_ManageEntity.fun_type == 2)
                        {
                            #region 多麦模块处理  多麦模块fun_param为int类型
                            CPS_Convert_LinkResponse cPS_Convert_LinkResponse = dm_Dauomai_Plan_ManageIBLL.ConvertLink(int.Parse(dm_Decoration_Fun_ManageEntity.fun_param), (int)dm_UserEntity.id);
                            to_link = cPS_Convert_LinkResponse.short_url;
                            #endregion
                        }
                        else if (dm_Decoration_Fun_ManageEntity.fun_type == 3)
                        {
                            #region 站内H5页面 fun_param为自定义的h5链接地址
                            if (dm_Decoration_Fun_ManageEntity.fun_param.EndsWith("?"))
                            {
                                dm_Decoration_Fun_ManageEntity.fun_param = dm_Decoration_Fun_ManageEntity.fun_param.TrimEnd('?');
                            }
                            string param = string.Format("token={0}&version={1}&platform={2}&timestamp={3}", nameValueCollection["token"], nameValueCollection["version"], nameValueCollection["platform"], nameValueCollection["timestamp"]);
                            if (dm_Decoration_Fun_ManageEntity.fun_param.Contains("?"))
                            {
                                param = "&" + param;
                            }
                            else
                            {
                                param = "?" + param;
                            }

                            to_link = dm_Decoration_Fun_ManageEntity.fun_param + param;
                            #endregion
                        }
                        else if (dm_Decoration_Fun_ManageEntity.fun_type == 4)
                        {
                            string appid = CheckAPPID();
                            dm_basesettingEntity dm_BasesettingEntity = dM_BaseSettingIBLL.GetEntityByCache(appid);
                            DTK_ApiManage        dTK_ApiManage        = new DTK_ApiManage(dm_BasesettingEntity.dtk_appkey, dm_BasesettingEntity.dtk_appsecret);

                            #region 淘宝官方活动
                            DTK_TB_ActivityLinkRequest dTK_TB_ActivityLinkRequest = new DTK_TB_ActivityLinkRequest();
                            dTK_TB_ActivityLinkRequest.promotionSceneId = dm_Decoration_Fun_ManageEntity.fun_param;
                            dTK_TB_ActivityLinkRequest.pid        = dm_UserEntity.tb_pid;
                            dTK_TB_ActivityLinkRequest.relationId = dm_UserEntity.tb_relationid;
                            dTK_TB_ActivityLinkRequest.unionId    = "dlm" + dm_UserEntity.id;
                            DTK_TB_ActivityLinkResponse dTK_TB_ActivityLinkResponse = dTK_ApiManage.GetTB_ActivityConvertLink(dTK_TB_ActivityLinkRequest);
                            if (dTK_TB_ActivityLinkResponse.code == 200 && !dTK_TB_ActivityLinkResponse.data.IsEmpty())
                            {
                                to_link = dTK_TB_ActivityLinkResponse.data.click_url;
                            }
                            else
                            {
                                throw new Exception("淘宝官方活动转链失败!");
                            }
                            #endregion
                        }
                        else
                        {
                            throw new Exception("未找到扩展类型!");
                        }
                    }

                    return(Success(to_link));
                }
                else
                {
                    throw new Exception("模块转链:用户信息异常!");
                }
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }