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)); } }
/// <summary> /// 获取拼多多商品列表 /// </summary> /// <param name="keyWord">关键词</param> /// <param name="pageIndex">页码</param> /// <param name="pageSize">每页显示数量</param> /// <param name="sort">排序方式:0-综合排序;1-按佣金比率升序;2-按佣金比例降序;3-按价格升序;4-按价格降序;5-按销量升序;6-按销量降序;7-优惠券金额排序升序;8-优惠券金额排序降序;9-券后价升序排序;10-券后价降序排序;11-按照加入多多进宝时间升序;12-按照加入多多进宝时间降序;13-按佣金金额升序排序;14-按佣金金额降序排序;15-店铺描述评分升序;16-店铺描述评分降序;17-店铺物流评分升序;18-店铺物流评分降序;19-店铺服务评分升序;20-店铺服务评分降序;27-描述评分击败同类店铺百分比升序,28-描述评分击败同类店铺百分比降序,29-物流评分击败同类店铺百分比升序,30-物流评分击败同类店铺百分比降序,31-服务评分击败同类店铺百分比升序,32-服务评分击败同类店铺百分比降序</param> /// <returns></returns> public ActionResult Get_PDD_GoodList(int user_id, string keyWord = "女装", int pageIndex = 1, int pageSize = 20, int sort = 0, bool with_coupon = false) { try { string appid = CheckAPPID(); string cacheKey = Md5Helper.Hash("PDDGoodList" + keyWord + pageIndex + pageSize + sort + with_coupon); List <GoodItem> goodItems = redisCache.Read <List <GoodItem> >(cacheKey, 7L); dm_basesettingEntity dm_BasesettingEntity = dM_BaseSettingIBLL.GetEntityByCache(appid); if (goodItems == null) { PDDApi pDDApi = new PDDApi(dm_BasesettingEntity.pdd_clientid, dm_BasesettingEntity.pdd_clientsecret, ""); goodItems = pDDApi.SearchGood(keyWord, pageIndex, pageSize, sort, with_coupon); if (goodItems.Count > 0) { redisCache.Write(cacheKey, goodItems, DateTime.Now.AddHours(2.0), 7L); } else { return(Fail("没有更多数据了")); } } dm_userEntity dm_UserEntity = dm_userIBLL.GetEntityByCache(user_id); return(SuccessList("获取成功!", goodItems.Select(t => { t.LevelCommission = GetPDDCommissionRate(t.min_group_price - t.coupon_discount, t.promotion_rate, dm_UserEntity.userlevel, dm_BasesettingEntity); t.SuperCommission = GetPDDCommissionRate(t.min_group_price - t.coupon_discount, t.promotion_rate, 2, dm_BasesettingEntity); return t; }))); } 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)); } }
/// <summary> /// 查询拼多多商品 /// </summary> /// <param name="AppID">应用商ID</param> /// <param name="KeyWord">关键词</param> /// <param name="PageNo">页码</param> /// <param name="PageSize">每页显示数量</param> /// <param name="SortType">排序方式:0-综合排序;1-按佣金比率升序;2-按佣金比例降序;3-按价格升序;4-按价格降序;5-按销量升序;6-按销量降序;7-优惠券金额排序升序;8-优惠券金额排序降序;9-券后价升序排序;10-券后价降序排序;11-按照加入多多进宝时间升序;12-按照加入多多进宝时间降序;13-按佣金金额升序排序;14-按佣金金额降序排序;15-店铺描述评分升序;16-店铺描述评分降序;17-店铺物流评分升序;18-店铺物流评分降序;19-店铺服务评分升序;20-店铺服务评分降序;27-描述评分击败同类店铺百分比升序,28-描述评分击败同类店铺百分比降序,29-物流评分击败同类店铺百分比升序,30-物流评分击败同类店铺百分比降序,31-服务评分击败同类店铺百分比升序,32-服务评分击败同类店铺百分比降序</param> /// <param name="WithCoupon">是否只返回优惠券的商品,false返回所有商品,true只返回有优惠券的商品</param> /// <returns></returns> public ActionResult Search_PDD_Good(string AppID, string KeyWord, int PageNo = 1, int PageSize = 20, int SortType = 0, bool WithCoupon = false) { 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, ""); List <GoodItem> goodItems = pDDApi.SearchGood(KeyWord, PageNo, PageSize, SortType, WithCoupon); return(Success("商品获取成功!", goodItems)); } catch (Exception ex) { return(Fail(ex.Message)); } }
public ActionResult Sync_PDD_Order(string AppID, string StartTime, string EndTime, int PageNo = 1, int PageSize = 20, bool ReturnCount = true) { 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, ""); List <pdd_order> pdd_Orders = pDDApi.GetOrderList(StartTime, EndTime, PageNo, PageSize, ReturnCount); return(Success("订单获取成功!", pdd_Orders)); } catch (Exception ex) { return(Fail(ex.Message)); } }