Exemplo n.º 1
0
        public ActionResult ConvertLinkByPDD(int user_id, string skuid)
        {
            try
            {
                string               appid                = CheckAPPID();
                string               cacheKey             = Md5Helper.Hash(user_id.ToString() + skuid + "3");
                GeneralUrl           pDDLinkInfo          = redisCache.Read <GeneralUrl>(cacheKey, 7L);
                dm_basesettingEntity dm_BasesettingEntity = dM_BaseSettingIBLL.GetEntityByCache(appid);
                if (pDDLinkInfo == null)
                {
                    PDDApi        pDDApi        = new PDDApi(dm_BasesettingEntity.pdd_clientid, dm_BasesettingEntity.pdd_clientsecret, "");
                    dm_userEntity dm_UserEntity = dm_userIBLL.GetEntityByCache(user_id);

                    if (dm_UserEntity.pdd_pid.IsEmpty())
                    {
                        #region 自动分配拼多多pid
                        dm_UserEntity = dM_PidIBLL.AutoAssignPDDPID(dm_UserEntity);
                        #endregion
                    }

                    pDDLinkInfo = pDDApi.GeneralUrl(skuid, dm_UserEntity.pdd_pid);

                    if (pDDLinkInfo != null)
                    {
                        redisCache.Write(cacheKey, pDDLinkInfo, DateTime.Now.AddHours(2.0), 7L);
                    }
                }

                return(Success("转链成功!", pDDLinkInfo));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
 public ActionResult ConvertLinkByPDD(string AppID, string ItemID, string PID)
 {
     try
     {
         s_application_settingEntity s_Application_SettingEntity = application_SettingIBLL.GetEntityByApplicationId(AppID);
         PDDApi pDDApi = new PDDApi(s_Application_SettingEntity.F_PDD_ClientID, s_Application_SettingEntity.F_PDD_ClientSecret, "");
         return(Success("转链成功!", pDDApi.GeneralUrl(ItemID, PID)));
     }
     catch (Exception ex)
     {
         return(Fail(ex.Message));
     }
 }