public JsonResult Product_Async(string id)
        {
            Hashtable hash = new Hashtable();
            Guid ID = new Guid(id);
            List<Product> plist = ProductService.instance().GetProductByCid(ID).ToList();
            foreach (var p in plist)
            {
                if (string.IsNullOrEmpty(p.itemid))
                {
                    product_item entity = new product_item();
                    entity.item_name = Utils.DropHTML(p.Description);
                    entity.price = p.Attr.First().price.Price.ToString();
                    entity.stock = p.Attr.First().price.Stock.ToString();
                    entity.imgs = new List<string>();
                    entity.cate_ids = new List<string>() { ClassService.instance().Single(p.ClassID).cate_id };
                    entity.skus = new List<skus>();
                    entity.merchant_code = "";
                    foreach (var item in FilesService.instance().GetFilesByRelationID(p.ID))
                    {
                        string reulst_msg = WSApi.upload(GetToken(), item.FilePath);
                        if (Utils.GetJsonValue(reulst_msg, "status_code") == "0")
                        {
                            string imgurl = Utils.GetJsonValue(reulst_msg, "result");
                            if (imgurl.Split('?').Length > 0)
                                entity.imgs.Add(imgurl.Split('?')[0]);
                            else
                                entity.imgs.Add(imgurl);
                        }
                    }
                    foreach (var item in Product_AttService.GetAttsByPID(ID))
                    {
                        entity.skus.Add(new skus()
                        {
                            price = item.price.Price.ToString(),
                            sku_merchant_code = "",
                            stock = item.price.Stock.ToString(),
                            title = item.key.Name + ":" + item.val.Value

                        });
                    };
                    string json = WSApiJson.vdian_item_add(entity);
                    string msg = WSApi.vdian_item_add(GetToken(), json);
                    string status_code = Utils.GetJsonValue(msg, "status_code");
                    if (status_code == "0")
                    {
                        p.itemid = Utils.GetJsonValue(msg, "itemid");
                        p.opt = "1";
                        ProductService.instance().Update(p);
                    }
                    else
                    {
                        hash[p.Title] = Utils.GetJsonValue(msg, "status_reason");
                    }
                }
            }
            return Json(hash, JsonRequestBehavior.AllowGet);
        }
        public JsonResult Product(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            Guid ID = new Guid(form["ID"]);
            Product p = ProductService.instance().Single(ID);
            if (!string.IsNullOrEmpty(p.itemid))
            {
                string del_msg = WSApi.vdian_item_delete(GetToken(), p.itemid);
                if (Utils.GetJsonValue(del_msg, "status_code") != "0")
                {
                    result.msg = Utils.GetJsonValue(del_msg, "status_reason");
                    return Json(result, JsonRequestBehavior.AllowGet);
                }
            }
            product_item entity = new product_item();
            entity.item_name = form["Description"];
            entity.price = form["Price"];
            entity.stock = form["Stock"];
            entity.imgs = new List<string>();
            entity.cate_ids = new List<string>() { form["cate_ids"] };
            entity.skus = new List<skus>();
            entity.merchant_code = "";
            foreach (var item in FilesService.instance().GetFilesByRelationID(ID))
            {
                string reulst_msg = WSApi.upload(GetToken(), item.FilePath);
                if (Utils.GetJsonValue(reulst_msg, "status_code") == "0")
                {
                    string imgurl = Utils.GetJsonValue(reulst_msg, "result");
                    if (imgurl.Split('?').Length > 0)
                        entity.imgs.Add(imgurl.Split('?')[0]);
                    else
                        entity.imgs.Add(imgurl);
                }
            }
            foreach (var item in Product_AttService.GetAttsByPID(ID))
            {
                entity.skus.Add(new skus()
                {
                    price = item.price.Price.ToString(),
                    sku_merchant_code = "",
                    stock = item.price.Stock.ToString(),
                    title = item.key.Name + ":" + item.val.Value

                });
            };
            string json = WSApiJson.vdian_item_add(entity);
            string msg = WSApi.vdian_item_add(GetToken(), json);
            result.status = Convert.ToInt32(Utils.GetJsonValue(msg, "status_code"));
            if (result.status == 0)
            {
                p.itemid = Utils.GetJsonValue(msg, "itemid");
                p.opt = "1";
                ProductService.instance().Update(p);
            }
            result.msg = result.status == 0 ? "操作成功" : "操作失败";
            result.ResultURL = "/WeShop/Product/" + p.ID;
            return Json(result, JsonRequestBehavior.AllowGet);
        }
 /// <summary>
 /// 创建微店商品
 /// </summary>
 /// <param name="access_token"></param>
 /// <param name="entity"></param>
 /// <returns></returns>
 public static string vdian_item_add(product_item entity)
 {
     StringBuilder str = new StringBuilder();
     str.Append(JsonHelper.SerializeObject(entity));
     return str.ToString();
 }