/// <summary>
        /// 客户端登录
        /// </summary>
        /// <param name="Account">用户名</param>
        /// <param name="PassWord">密码</param>
        /// <returns></returns>
        public ActionResult Login(string Account, string PassWord)
        {
            try
            {
                s_data_agentEntity s_Data_AgentEntity = agentManageBLL.Login(Account, PassWord);
                if (s_Data_AgentEntity.IsEmpty())
                {
                    throw new Exception("用户名或密码错误!");
                }
                if (s_Data_AgentEntity.F_AllowEndTime < DateTime.Now)
                {
                    throw new Exception("该账户授权已过期!");
                }
                s_application_settingEntity s_Application_SettingEntity = application_SettingIBLL.GetEntityByApplicationId(s_Data_AgentEntity.F_ApplicationId);
                if (s_Application_SettingEntity.IsEmpty())
                {
                    throw new Exception("该用户已废弃!");
                }
                dynamic dy = new
                {
                    Account_Info  = s_Data_AgentEntity,//机器人账户信息
                    Agent_Setting = s_Application_SettingEntity
                };

                return(Success("登录成功!", dy));
            }
            catch (Exception ex)
            {
                return(Fail(ex.Message));
            }
        }
 public ActionResult ConvertLinkByJD(string AppID, string ItemID, string SiteID, string PositionID)
 {
     try
     {
         s_application_settingEntity s_Application_SettingEntity = application_SettingIBLL.GetEntityByApplicationId(AppID);
         JDApi jDApi = new JDApi(s_Application_SettingEntity.F_JD_AppKey, s_Application_SettingEntity.F_JD_Secret, s_Application_SettingEntity.F_JD_SessionKey);
         return(Success("转链成功!", jDApi.ConvertUrl(ItemID, SiteID, PositionID, "")));
     }
     catch (Exception ex)
     {
         return(Fail(ex.Message));
     }
 }
 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));
     }
 }
 public ActionResult ConvertLinkByTB(string AppID, string ItemID, string PID, string RelationID)
 {
     try
     {
         s_application_settingEntity s_Application_SettingEntity = application_SettingIBLL.GetEntityByApplicationId(AppID);
         TBApi  tBApi         = new TBApi(tb_appkey, tb_appsecret, s_Application_SettingEntity.F_TB_SessionKey);
         string resultContent = tBApi.ConvertLink(ItemID, PID, RelationID);
         return(Success("转链成功!", resultContent));
     }
     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));
            }
        }
        public ActionResult Search_JD_Good(string AppID, int EliteID, int PageNo = 1, int PageSize = 20, string SortName = "price", string Sort = "desc")
        {
            try
            {
                s_application_settingEntity s_Application_SettingEntity = application_SettingIBLL.GetEntityByApplicationId(AppID);
                JDApi jDApi   = new JDApi(s_Application_SettingEntity.F_JD_AppKey, s_Application_SettingEntity.F_JD_Secret, s_Application_SettingEntity.F_JD_SessionKey);
                var   jDGoods = jDApi.GetGoodList(EliteID, PageNo, PageSize, SortName, Sort);

                return(Success("商品查询成功!", jDGoods));
            }
            catch (Exception ex)
            {
                return(Fail(ex.Message));
            }
        }
        public ActionResult Sync_JD_Order(string AppID, int OrderType, string UpdateTime, int PageNo = 1, int PageSize = 20)
        {
            try
            {
                s_application_settingEntity s_Application_SettingEntity = application_SettingIBLL.GetEntityByApplicationId(AppID);
                JDApi   jDApi   = new JDApi(s_Application_SettingEntity.F_JD_AppKey, s_Application_SettingEntity.F_JD_Secret, s_Application_SettingEntity.F_JD_SessionKey);
                JDOrder jDOrder = jDApi.GetOrder(PageNo, PageSize, OrderType, UpdateTime);

                return(Success("订单获取成功!", jDOrder));
            }
            catch (Exception ex)
            {
                return(Fail(ex.Message));
            }
        }
        public ActionResult Search_TB_Good(string AppID)
        {
            try
            {
                s_application_settingEntity s_Application_SettingEntity = application_SettingIBLL.GetEntityByApplicationId(AppID);
                TBApi  tBApi         = new TBApi(tb_appkey, tb_appsecret, s_Application_SettingEntity.F_TB_SessionKey);
                string resultContent = tBApi.SearchGood();

                return(Success("商品查询成功!", resultContent));
            }
            catch (Exception ex)
            {
                return(Fail(ex.Message));
            }
        }
        public ActionResult Sync_TB_Order(string AppID, string QueryType, string Position_Index, string StartTime, string EndTime, string Jump_Type = "1", int PageNo = 1, int PageSize = 20, string TK_Status = "", string Order_Scene = "1")
        {
            try
            {
                s_application_settingEntity s_Application_SettingEntity = application_SettingIBLL.GetEntityByApplicationId(AppID);
                TBApi     tBApi         = new TBApi(tb_appkey, tb_appsecret, s_Application_SettingEntity.F_TB_SessionKey);
                OrderData resultContent = tBApi.GetOrder(QueryType, Position_Index, PageSize.ToString(), TK_Status, StartTime, EndTime, Jump_Type, PageNo.ToString(), Order_Scene);

                return(Success("订单获取成功!", resultContent));
            }
            catch (Exception ex)
            {
                return(Fail(ex.Message));
            }
        }
 public ActionResult SaveForm(string keyValue, s_application_settingEntity entity)
 {
     entity.F_ApplicationId = LoginUserInfo.Get().userId;
     application_SettingIBLL.SaveEntity(keyValue, entity);
     return(Success("保存成功!"));
 }