public ActionResult Save(ProductInfoModel model)
        {
            Product_Info modPro = null;

            //产品分类验证
            if (model.classid == 0)
            {
                return(LayerAlertErrorAndReturn("请选择一个产品分类!"));
            }
            Product_Class modClass = null;

            if (model.classid > 0)
            {
                modClass = Bll.BllProduct_Class.First(o => o.Id == model.classid);
                if (modClass == null)
                {
                    return(LayerAlertErrorAndReturn("分类不存在!"));
                }
            }

            //spu编号重复验证
            if (model.id == 0 && Bll.BllProduct_Info.IsExistsSpu(model.spu))
            {
                return(LayerAlertErrorAndReturn("该SPU编号已存在,请修改!"));
            }

            //产品属性
            List <Product_AttributeSet> attrsetlist    = new List <Product_AttributeSet>();                          //属性关联
            List <AttrJson>             listAttr       = GetAttrList(model.classid, ref attrsetlist);                //分类配置属性
            List <AttrJson>             listAttrCustom = GetCustomAttrList("myAttrId", "myAttrName", "myAttrValue"); //自定义属性

            model.content = TransferImgToLocal(EscapeSpace(model.content ?? ""));

            if (model.id == 0)
            {
                modPro = new Product_Info();
                //DTO转换,模型数据处理
                modPro            = BindProModel(model.MapTo(modPro), modClass, listAttr, listAttrCustom);
                modPro.CreateDate = DateTime.Now;
                modPro.Url        = GetFormatUrl(model.title);
                int proId = Bll.BllProduct_Info.Insert(modPro);
                if (proId > 0)
                {
                    //绑定可筛选属性
                    InsertAttrlist(attrsetlist, proId);
                    return(LayerAlertSuccessAndRefresh("添加成功"));
                }
                else
                {
                    return(LayerAlertErrorAndReturn("添加失败"));
                }
            }
            else
            {
                //获取产品信息
                modPro = Bll.BllProduct_Info.First(o => o.Id == model.id);
                if (modPro == null)
                {
                    return(LayerAlertErrorAndReturn("产品不存在!"));
                }
                //绑定模型
                modPro            = BindProModel(model.MapTo(modPro), modClass, listAttr, listAttrCustom);
                modPro.Url        = GetFormatUrl(model.title);
                modPro.UpdateDate = DateTime.Now;
                if (Bll.BllProduct_Info.Update(modPro, o => o.Id == modPro.Id) > 0)
                {
                    //绑定可筛选属性
                    InsertAttrlist(attrsetlist, modPro.Id);
                    return(LayerAlertSuccessAndRefresh("修改成功"));
                }
                else
                {
                    return(LayerAlertErrorAndReturn("修改失败"));
                }
            }
        }