Ejemplo n.º 1
0
        public JsonResult Get(string id)
        {
            try
            {
                var    result = new QrCodeDTO();
                var    key    = System.Configuration.ConfigurationManager.AppSettings["QrCodeKey"];
                var    values = Des.DesDecrypt(id, Des.GetLegalKey(key)).Split('|');
                string type   = values[0];
                if (values.Length > 1)
                {
                    string ID = values[1], version = "";
                    if (values.Length > 2)
                    {
                        version = values[2];
                    }

                    var qrcode = ProductService.GetProductDetail(ID, decimal.Parse(version));
                    qrcode.Type = type;
                    result      = qrcode;

                    result.State = true;
                }
                else
                {
                    throw new Exception("系统错误,请联系管理员");
                }
                return(Json(result));
            }
            catch (Exception e)
            {
                return(Json(new QrCodeDTO {
                    State = false, Message = e.Message
                }));
            }
        }
Ejemplo n.º 2
0
        //初始化
        public static async void InitAsync(Result <XAppInfo> call)
        {
            Dictionary <string, string> keys = new Dictionary <string, string>();

            keys.Add("Api", "PanGolin_GetSoftInfo");
            HttpWebRequest  request  = GetOkHttpClient(keys);
            HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();

            if (response.StatusCode == HttpStatusCode.OK)
            {
                string body = response.Headers.Get("Result");
                call.next(JsonConvert.DeserializeObject <XAppInfo>(Des.DesDecrypt(body, md5.GetKey(request.Headers.Get("Key")))));
            }
        }
Ejemplo n.º 3
0
        //获取商品信息
        public static async void GetPage_data(Result <KfkPageData> call, string kfk)
        {
            Dictionary <string, string> keys = new Dictionary <string, string>();

            keys.Add("Api", "PanGolin_GetPage_data");
            keys.Add("Url", kfk);
            HttpWebRequest  request  = GetOkHttpClient(keys);
            HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();

            if (response.StatusCode == HttpStatusCode.OK)
            {
                string body = response.Headers.Get("Result");
                call.next(JsonConvert.DeserializeObject <KfkPageData>(Des.DesDecrypt(body, md5.GetKey(request.Headers.Get("Key")))));
            }
        }
Ejemplo n.º 4
0
        //登录
        public static async void loginAsync(Result <XLoginInfo> call, string card, string mac)
        {
            Dictionary <string, string> keys = new Dictionary <string, string>();

            keys.Add("Api", "PanGolin_Verify");
            keys.Add("Mac", mac);
            keys.Add("Code", card);
            HttpWebRequest  request  = GetOkHttpClient(keys);
            HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();

            if (response.StatusCode == HttpStatusCode.OK)
            {
                string body = response.Headers.Get("Result");
                call.next(JsonConvert.DeserializeObject <XLoginInfo>(Des.DesDecrypt(body, md5.GetKey(request.Headers.Get("Key")))));
            }
        }
Ejemplo n.º 5
0
        //创建订单
        public static async void Build_order(Result <Build_order_Info> call, int Productid, int Paytype, string Buyertoken, string kfk)
        {
            Dictionary <string, string> keys = new Dictionary <string, string>();

            keys.Add("Api", "PanGolin_Build_order");
            keys.Add("Productid", "" + Productid);
            keys.Add("Paytype", "" + Paytype);
            keys.Add("Buyertoken", Buyertoken);
            keys.Add("Url", kfk);
            HttpWebRequest  request  = GetOkHttpClient(keys);
            HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();

            if (response.StatusCode == HttpStatusCode.OK)
            {
                string body = response.Headers.Get("Result");
                call.next(JsonConvert.DeserializeObject <Build_order_Info>(Des.DesDecrypt(body, md5.GetKey(request.Headers.Get("Key")))));
            }
        }
Ejemplo n.º 6
0
        //校验
        public static async void CheckAsync(Result <XCheckInfo> call, string Token, bool CheckType, string mac, string card)
        {
            Dictionary <string, string> keys = new Dictionary <string, string>();

            keys.Add("Api", "PanGolin_Check");
            keys.Add("Mac", mac);
            keys.Add("Token", Token);
            keys.Add("Code", card);
            keys.Add("Type", CheckType ? "formal" : "trial");
            HttpWebRequest  request  = GetOkHttpClient(keys);
            HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();

            if (response.StatusCode == HttpStatusCode.OK)
            {
                string body = response.Headers.Get("Result");
                call.next(JsonConvert.DeserializeObject <XCheckInfo>(Des.DesDecrypt(body, md5.GetKey(request.Headers.Get("Key")))));
            }
        }