/// <summary>
        /// 新增/编辑品牌
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult AddBrand(int id = 0)
        {
            var r = new AddSpuModel{Display = true};
            if (id > 0)
            {
                var req = YunClient.Instance.Execute(new GetItemPropValueRequest {PropValueId = id}).ItemPropValue;
                if (req != null)
                {
                    r.Name = req.Value;
                    r.Img = req.Image;
                    r.Sort = req.Sort;
                    r.Display = req.IsHide;
                }
            }

            return View(r);
        }
        public ActionResult AddBrand(AddSpuModel model, int id = 0)
        {
            if (ModelState.IsValid)
            {
                InitBrand();

                bool result;

                if (id <= 0)
                {
                    result = YunClient.Instance.Execute(new AddItemPropValueRequest
                    {
                        Value = model.Name,
                        PropNameId = (int) _brandPropNameId,
                        Sort = model.Sort,
                        Thumb = FileManage.UploadOneFile()
                    }, Token).Result > 0;
                }
                else
                {
                    var img = FileManage.UploadOneFile();

                    result = YunClient.Instance.Execute(new UpdateItemPropValueRequest
                    {
                        Name = model.Name,
                        Sort = model.Sort,
                        Image = string.IsNullOrEmpty(img) ? model.Img : img,
                    }, Token).Result;
                }

                if (result)
                {
                    TempData["success"] = "提交成功,数据已保存";
                    return RedirectToAction("Brand");
                }

                TempData["error"] = "保存失败,数据不完整";
            }

            return View(model);
        }
        public ActionResult UpdateSpu(AddSpuModel model, int id = 0, string addType = "")
        {
            if (id > 0 && (addType == "name" || addType == "value"))
            {
                if (addType == "name")
                {
                    return Json(YunClient.Instance.Execute(new UpdateItemPropNameRequest
                    {
                        Name = model.Name,
                        PropNameId = id,
                        Sort = model.Sort,
                    }, Token).Result);
                }

                return Json(YunClient.Instance.Execute(new UpdateItemPropValueRequest
                {
                    Name = model.Name,
                    PropValueId = id,
                    Sort = model.Sort,
                    IsHide = false
                }, Token).Result);
            }

            return Content("未选择属性");
        }
        public ActionResult AddSpu(AddSpuModel model, int id = 0, string addType = "", string q = "")
        {
            if (addType != "name" && addType != "value") return Json(-1);

            if (addType == "value")
            {
                if (Request.QueryString["q"] != null)
                {
                    return Json(YunClient.Instance.Execute(new AddItemPropValueRequest
                    {
                        Value = model.Name,
                        PropNameId = 0,
                        ParentId = id,
                        Sort = model.Sort,
                        IsHide = false
                    }, Token).Result);
                }

                return Json(YunClient.Instance.Execute(new AddItemPropValueRequest
                {
                    Value = model.Name,
                    PropNameId = id,
                    ParentId = 0,
                    Sort = model.Sort,
                    IsHide = false
                }, Token).Result);
            }

            return Json(YunClient.Instance.Execute(new AddItemPropNameRequest
            {
                CanCustomValue = false,
                HasMultiValues = false,
                IsRequired = false,
                Name = model.Name,
                Sort = model.Sort,
                ItemCatId = id,
                ShopId = GlobeInfo.InitiatedShopId
            }, Token).Result);
        }
        /// <summary>
        /// 新增/编辑品牌
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult AddBrand(AddSpuModel model ,int id = 0)
        {
            if (ModelState.IsValid)
            {
                
            }

            return View(model);
        }