示例#1
0
        public string GetExtendedAppList(ExtendedAppType type)
        {
            Dictionary <string, string> parames = new Dictionary <string, string>();

            parames.Add("type", ((int)type).ToString());
            parames.Add("userId", ((int)type).ToString());
            parames.Add("fuselageNumber", "sfsdffsffsf");
            string signStr = Signature.Compute(key, secret, timespan, Signature.GetQueryData(parames));

            Dictionary <string, string> headers = new Dictionary <string, string>();

            headers.Add("key", key);
            headers.Add("timestamp", timespan.ToString());
            headers.Add("sign", signStr);
            HttpUtil http   = new HttpUtil();
            string   result = http.HttpGet("http://localhost:1664/api/ExtendedApp/GetList?type=" + ((int)type).ToString() + "&userId=" + ((int)type).ToString() + "&fuselageNumber=sfsdffsffsf", headers);

            return(result);
        }
示例#2
0
        public APIResponse GetList(int userId, ExtendedAppType type)
        {
            List <ExtendedApp> extendedApps = new List <ExtendedApp>();

            if (type == ExtendedAppType.All)
            {
                extendedApps = CurrentDb.ExtendedApp.Where(m => m.Type != Enumeration.ExtendedAppType.CarService && m.IsDisplay == true).Take(4).ToList();
            }
            else if (type == ExtendedAppType.MainHomeCarService)
            {
                extendedApps = CurrentDb.ExtendedApp.Where(m => m.Type == Enumeration.ExtendedAppType.CarService && m.IsDisplay == true).Take(4).ToList();
            }
            else if (type == ExtendedAppType.MainHomeRecommend)
            {
                extendedApps = CurrentDb.ExtendedApp.Where(m => m.Type != Enumeration.ExtendedAppType.CarService && m.IsDisplay == true).Take(4).ToList();
            }

            List <ExtendedAppModel> model = new List <ExtendedAppModel>();

            foreach (var m in extendedApps)
            {
                ExtendedAppModel imageModel = new ExtendedAppModel();
                imageModel.Id        = m.Id;
                imageModel.Name      = m.Name;
                imageModel.ImgUrl    = m.ImgUrl;
                imageModel.LinkUrl   = m.LinkUrl;
                imageModel.AppKey    = m.AppKey;
                imageModel.AppSecret = m.AppSecret;
                model.Add(imageModel);
            }

            APIResult result = new APIResult()
            {
                Result = ResultType.Success, Code = ResultCode.Success, Message = "", Data = model
            };

            return(new APIResponse(result));
        }