Esempio n. 1
0
        /// <summary>
        /// 删除微店商品
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="itemid"></param>
        /// <returns></returns>
        public static string vdian_item_delete(string access_token, string itemid)
        {
            string _public = JsonHelper.SerializeObject(new @public("vdian.item.delete", access_token));
            string strJson = HttpUtitls.RequestUrl(string.Format("http://api.vdian.com/api?param={0}&public={1}", ("{\"itemid\":" + itemid + "}"), _public), "GET");

            return(strJson);
        }
Esempio n. 2
0
        /// <summary>
        /// 创建微店商品
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="getData"></param>
        /// <returns></returns>
        public static string vdian_item_add(string access_token, string getData)
        {
            string _public = JsonHelper.SerializeObject(new @public("vdian.item.add", access_token));
            string strJson = HttpUtitls.RequestUrl(string.Format("http://api.vdian.com/api?public={0}&param={1}", _public, getData), "GET");

            return(strJson);
        }
Esempio n. 3
0
        /// <summary>
        /// 删除商品分类
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="cate_id"></param>
        /// <returns></returns>
        public static string vdian_shop_cate_del(string access_token, string cate_id)
        {
            string getData = JsonHelper.SerializeObject(new @public("vdian.shop.cate.delete", access_token));
            string strJson = HttpUtitls.RequestUrl(string.Format("http://api.vdian.com/api?param={0}&public={1}", ("{\"cate_id\":" + cate_id + "}"), getData), "GET");

            return(strJson);
        }
Esempio n. 4
0
        /// <summary>
        /// 获取商品分类
        /// </summary>
        /// <param name="getData"></param>
        /// <returns></returns>
        public static string vdian_shop_cate_get(string access_token)
        {
            string getData = JsonHelper.SerializeObject(new @public("vdian.shop.cate.get", access_token));
            string strJson = HttpUtitls.RequestUrl(string.Format("http://api.vdian.com/api?param={0}&public={1}", "{}", getData), "GET");

            return(strJson);
        }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="itemid">商品itemid</param>
        /// <param name="opt">1表示商品上架,2表示商品下架</param>
        /// <returns></returns>
        public static string vdian_item_onSale(string access_token, string itemid, string opt)
        {
            string _public = JsonHelper.SerializeObject(new @public("weidian.item.onSale", access_token));
            string strJson = HttpUtitls.RequestUrl(string.Format("http://api.vdian.com/api?public={0}&param={1}", _public, ("{\"itemid\":" + itemid + ",\"opt\":" + opt + "}")), "GET");

            return(strJson);
        }
Esempio n. 6
0
        /// <summary>
        /// 验证Token是否过期
        /// </summary>
        public static bool TokenExpired(string access_token)
        {
            string jsonStr = HttpUtitls.RequestUrl(string.Format("https://api.weixin.qq.com/cgi-bin/menu/get?access_token={0}", access_token));

            if (string.IsNullOrEmpty(Utils.GetJsonValue(jsonStr, "errcode")))
            {
                return(false);
            }
            return(true);
        }
Esempio n. 7
0
        /// <summary>
        /// 获取关注者OpenID集合
        /// </summary>
        public static List <string> GetOpenIDs(string access_token, string next_openid)
        {
            // 设置参数
            string url       = string.Format("https://api.weixin.qq.com/cgi-bin/user/get?access_token={0}&next_openid={1}", access_token, string.IsNullOrWhiteSpace(next_openid) ? "" : next_openid);
            string returnStr = HttpUtitls.RequestUrl(url);
            int    count     = int.Parse(Utils.GetJsonValue(returnStr, "count"));

            if (count > 0)
            {
                string startFlg = "\"openid\":[";
                int    start    = returnStr.IndexOf(startFlg) + startFlg.Length;
                int    end      = returnStr.IndexOf("]", start);
                string openids  = returnStr.Substring(start, end - start).Replace("\"", "");
                return(openids.Split(',').ToList <string>());
            }
            else
            {
                return(new List <string>());
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 获取Token
        /// </summary>
        public static string GetToken(string appid, string secret)
        {
            string strJson = HttpUtitls.RequestUrl(string.Format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}", appid, secret));

            return(Utils.GetJsonValue(strJson, "access_token"));
        }
Esempio n. 9
0
        /// <summary>
        /// 新增商品分类
        /// </summary>
        /// <param name="getData"></param>
        /// <returns></returns>
        public static string vdian_shop_cate_add(string getData)
        {
            string strJson = HttpUtitls.RequestUrl(string.Format("http://api.vdian.com/api?param={0}", getData), "GET");

            return(strJson);
        }