示例#1
0
 public void GetTrade(SortedDictionary <string, string> parameters, ref string results)
 {
     if (this.CheckTradesParameters(parameters, ref results) && OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref results))
     {
         results = this.tradeApi.GetTrade(parameters["tid"]);
     }
 }
        public HttpResponseMessage GetProduct()
        {
            int    num_iid = 0;
            string content = "";
            NameValueCollection nameValueCollection            = base.Request.RequestUri.ParseQueryString();
            SortedDictionary <string, string> sortedDictionary = new SortedDictionary <string, string>();

            string[] allKeys = nameValueCollection.AllKeys;
            foreach (string text in allKeys)
            {
                sortedDictionary.Add(text, nameValueCollection.Get(text));
            }
            if (this.CheckProductParameters(sortedDictionary, out num_iid, out content))
            {
                SiteSettings siteSettings = HiContext.Current.SiteSettings;
                if (OpenApiSign.CheckSign(sortedDictionary, siteSettings.CheckCode, ref content))
                {
                    content = this.GetProduct(num_iid);
                }
            }
            return(new HttpResponseMessage
            {
                Content = new StringContent(content, Encoding.UTF8, "application/json")
            });
        }
示例#3
0
 public void ChangLogistics(SortedDictionary <string, string> parameters, ref string result)
 {
     if (this.CheckChangLogisticsParameters(parameters, ref result) && OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref result))
     {
         result = this.tradeApi.ChangLogistics(parameters["tid"], parameters["company_name"], parameters["out_sid"]);
     }
 }
示例#4
0
        public void GetProduct(SortedDictionary <string, string> parameters, ref string result)
        {
            int num = 0;

            if (this.CheckProductParameters(parameters, out num, out result) && OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref result))
            {
                result = this.productApi.GetProduct(num);
            }
        }
示例#5
0
        /// <summary>
        /// 检测基础参数和参数签名
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static void CheckBaseParamsAndSign(SortedDictionary <string, string> data)
        {
            if (data == null)
            {
                throw new MallApiException(Hishop.Open.Api.OpenApiErrorCode.System_Error, "no params");
            }
            if (data.Count < 1)
            {
                throw new MallApiException(Hishop.Open.Api.OpenApiErrorCode.System_Error, "no params");
            }
            string app_key   = "";
            string timestamp = "";
            string sign      = "";

            #region 基础检测
            if (!data.TryGetValue("app_key", out app_key))
            {
                throw new MallApiException(Hishop.Open.Api.OpenApiErrorCode.Missing_App_Key, "app_key");
            }
            if (string.IsNullOrWhiteSpace(app_key))
            {
                throw new MallApiException(Hishop.Open.Api.OpenApiErrorCode.Missing_App_Key, "app_key");
            }
            if (!data.TryGetValue("timestamp", out timestamp))
            {
                throw new MallApiException(Hishop.Open.Api.OpenApiErrorCode.Missing_Timestamp, "timestamp");
            }
            if (string.IsNullOrWhiteSpace(timestamp))
            {
                throw new MallApiException(Hishop.Open.Api.OpenApiErrorCode.Missing_Timestamp, "timestamp");
            }
            if (!OpenApiSign.CheckTimeStamp(timestamp))
            {
                throw new MallApiException(Hishop.Open.Api.OpenApiErrorCode.Invalid_Timestamp, "timestamp");
            }
            if (!data.TryGetValue("sign", out sign))
            {
                throw new MallApiException(Hishop.Open.Api.OpenApiErrorCode.Missing_Signature, "sign");
            }
            if (string.IsNullOrWhiteSpace(sign))
            {
                throw new MallApiException(Hishop.Open.Api.OpenApiErrorCode.Missing_Signature, "sign");
            }
            #endregion

            ShopHelper shobj = new ShopHelper(app_key);

            //验签
            string msg = "";
            if (!OpenApiSign.CheckSign(data, shobj.AppSecreate, ref msg))
            {
                throw new MallApiException(Hishop.Open.Api.OpenApiErrorCode.Invalid_Signature, "sign");
            }
        }
示例#6
0
 public void SendLogistic(System.Collections.Generic.SortedDictionary <string, string> parameters, ref string result)
 {
     if (!this.CheckSendLogisticParameters(parameters, ref result))
     {
         return;
     }
     if (!OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref result))
     {
         return;
     }
     result = this.tradeApi.SendLogistic(parameters["tid"], parameters["company_name"], parameters["out_sid"]);
 }
示例#7
0
 public void GetTrade(System.Collections.Generic.SortedDictionary <string, string> parameters, ref string results)
 {
     if (!this.CheckTradesParameters(parameters, ref results))
     {
         return;
     }
     if (!OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref results))
     {
         return;
     }
     results = this.tradeApi.GetTrade(parameters["tid"]);
 }
示例#8
0
        public void GetProduct(System.Collections.Generic.SortedDictionary <string, string> parameters, ref string result)
        {
            int num_iid = 0;

            if (!this.CheckProductParameters(parameters, out num_iid, out result))
            {
                return;
            }
            if (!OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref result))
            {
                return;
            }
            result = this.productApi.GetProduct(num_iid);
        }
示例#9
0
        public void UpdateTradeMemo(System.Collections.Generic.SortedDictionary <string, string> parameters, ref string result)
        {
            int flag = 0;

            if (!this.CheckUpdateTradeMemoParameters(parameters, out flag, ref result))
            {
                return;
            }
            if (!OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref result))
            {
                return;
            }
            result = this.tradeApi.UpdateTradeMemo(parameters["tid"], parameters["memo"], flag);
        }
示例#10
0
        public void UpdateProductApproveStatus(System.Collections.Generic.SortedDictionary <string, string> parameters, ref string result)
        {
            int    num_iid = 0;
            string empty   = string.Empty;

            if (!this.CheckUpdateApproveStatusParameters(parameters, out num_iid, out empty, out result))
            {
                return;
            }
            if (!OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref result))
            {
                return;
            }
            result = this.productApi.UpdateProductApproveStatus(num_iid, empty);
        }
示例#11
0
        public void UpdateProductQuantity(System.Collections.Generic.SortedDictionary <string, string> parameters, ref string result)
        {
            int num_iid  = 0;
            int quantity = 0;
            int type     = 1;

            if (!this.CheckUpdateQuantityParameters(parameters, out num_iid, out quantity, out type, out result))
            {
                return;
            }
            if (!OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref result))
            {
                return;
            }
            result = this.productApi.UpdateProductQuantity(num_iid, parameters["sku_id"], quantity, type);
        }
示例#12
0
        private void GetSoldTrades(System.Collections.Generic.SortedDictionary <string, string> parameters, ref string results)
        {
            System.DateTime?start_created = null;
            System.DateTime?end_created   = null;
            string          empty         = string.Empty;
            int             page_no       = 0;
            int             page_size     = 0;

            if (!this.CheckSoldTradesParameters(parameters, out start_created, out end_created, out empty, out page_no, out page_size, ref results))
            {
                return;
            }
            if (!OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref results))
            {
                return;
            }
            results = this.tradeApi.GetSoldTrades(start_created, end_created, empty, parameters["buyer_uname"], page_no, page_size);
        }
示例#13
0
        public void GetSoldProducts(System.Collections.Generic.SortedDictionary <string, string> parameters, ref string result)
        {
            System.DateTime?start_modified = null;
            System.DateTime?end_modified   = null;
            string          approve_status = "";
            int             page_no        = 0;
            int             page_size      = 0;

            if (!this.CheckSoldProductsParameters(parameters, out start_modified, out end_modified, out approve_status, out page_no, out page_size, out result))
            {
                return;
            }
            if (!OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref result))
            {
                return;
            }
            result = this.productApi.GetSoldProducts(start_modified, end_modified, approve_status, parameters["q"], parameters["order_by"], page_no, page_size);
        }
示例#14
0
        private void GetIncrementSoldTrades(System.Collections.Generic.SortedDictionary <string, string> parameters, ref string results)
        {
            string status    = "";
            int    page_no   = 0;
            int    page_size = 0;

            System.DateTime start_modified;
            System.DateTime end_modified;
            if (!this.CheckIncrementSoldTradesParameters(parameters, out start_modified, out end_modified, out status, out page_no, out page_size, ref results))
            {
                return;
            }
            if (!OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref results))
            {
                return;
            }
            results = this.tradeApi.GetIncrementSoldTrades(start_modified, end_modified, status, parameters["buyer_uname"], page_no, page_size);
        }
        public HttpResponseMessage GetSoldProducts()
        {
            NameValueCollection nameValueCollection            = base.Request.RequestUri.ParseQueryString();
            SortedDictionary <string, string> sortedDictionary = new SortedDictionary <string, string>();

            string[] allKeys = nameValueCollection.AllKeys;
            foreach (string text in allKeys)
            {
                sortedDictionary.Add(text, nameValueCollection.Get(text));
            }
            DateTime?    start_modified = null;
            DateTime?    end_modified   = null;
            string       approve_status = "";
            string       content        = "";
            int          page_no        = 0;
            int          page_size      = 0;
            SiteSettings siteSettings   = HiContext.Current.SiteSettings;

            if (this.CheckSoldProductsParameters(sortedDictionary, out start_modified, out end_modified, out approve_status, out page_no, out page_size, out content) && OpenApiSign.CheckSign(sortedDictionary, siteSettings.CheckCode, ref content))
            {
                content = this.GetSoldProducts(start_modified, end_modified, approve_status, sortedDictionary["q"], sortedDictionary["order_by"], page_no, page_size);
            }
            return(new HttpResponseMessage
            {
                Content = new StringContent(content, Encoding.UTF8, "application/json")
            });
        }
示例#16
0
        public void UpdateProductQuantity(SortedDictionary <string, string> parameters, ref string result)
        {
            int num      = 0;
            int quantity = 0;
            int type     = 1;

            if (this.CheckUpdateQuantityParameters(parameters, out num, out quantity, out type, out result) && OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref result))
            {
                result = this.productApi.UpdateProductQuantity(num, parameters["sku_id"], quantity, type);
            }
        }
示例#17
0
        public void UpdateProductApproveStatus(SortedDictionary <string, string> parameters, ref string result)
        {
            int    num    = 0;
            string status = string.Empty;

            if (this.CheckUpdateApproveStatusParameters(parameters, out num, out status, out result) && OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref result))
            {
                result = this.productApi.UpdateProductApproveStatus(num, status);
            }
        }
示例#18
0
        public void GetSoldProducts(SortedDictionary <string, string> parameters, ref string result)
        {
            DateTime?nullable  = null;
            DateTime?nullable2 = null;
            string   status    = "";
            int      num       = 0;
            int      num2      = 0;

            if (this.CheckSoldProductsParameters(parameters, out nullable, out nullable2, out status, out num, out num2, out result) && OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref result))
            {
                result = this.productApi.GetSoldProducts(nullable, nullable2, status, parameters["q"], parameters["order_by"], num, num2);
            }
        }
示例#19
0
        public HttpResponseMessage GetUsers()
        {
            string content = "";
            NameValueCollection nameValueCollection            = base.Request.RequestUri.ParseQueryString();
            SortedDictionary <string, string> sortedDictionary = new SortedDictionary <string, string>();

            string[] allKeys = nameValueCollection.AllKeys;
            foreach (string text in allKeys)
            {
                sortedDictionary.Add(text, nameValueCollection.Get(text));
            }
            DateTime?    start_time   = null;
            DateTime?    end_time     = null;
            int          page_no      = 0;
            int          page_size    = 0;
            SiteSettings siteSettings = HiContext.Current.SiteSettings;

            if (this.CheckUsersParameters(sortedDictionary, out start_time, out end_time, out page_no, out page_size, out content) && OpenApiSign.CheckSign(sortedDictionary, siteSettings.CheckCode, ref content))
            {
                content = this.lastGetUsers(start_time, end_time, page_no, page_size);
            }
            return(new HttpResponseMessage
            {
                Content = new StringContent(content, Encoding.UTF8, "application/json")
            });
        }
示例#20
0
        private void GetSoldTrades(SortedDictionary <string, string> parameters, ref string results)
        {
            DateTime?nullable  = null;
            DateTime?nullable2 = null;
            string   status    = string.Empty;
            int      num       = 0;
            int      num2      = 0;

            if (this.CheckSoldTradesParameters(parameters, out nullable, out nullable2, out status, out num, out num2, ref results) && OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref results))
            {
                results = this.tradeApi.GetSoldTrades(nullable, nullable2, status, parameters["buyer_uname"], num, num2);
            }
        }
示例#21
0
        private void GetIncrementSoldTrades(SortedDictionary <string, string> parameters, ref string results)
        {
            DateTime time;
            DateTime time2;
            string   status = "";
            int      num    = 0;
            int      num2   = 0;

            if (this.CheckIncrementSoldTradesParameters(parameters, out time, out time2, out status, out num, out num2, ref results) && OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref results))
            {
                results = this.tradeApi.GetIncrementSoldTrades(time, time2, status, parameters["buyer_uname"], num, num2);
            }
        }
示例#22
0
        public void UpdateTradeMemo(SortedDictionary <string, string> parameters, ref string result)
        {
            int flag = 0;

            if (this.CheckUpdateTradeMemoParameters(parameters, out flag, ref result) && OpenApiSign.CheckSign(parameters, this.site.CheckCode, ref result))
            {
                result = this.tradeApi.UpdateTradeMemo(parameters["tid"], parameters["memo"], flag);
            }
        }