public JsonResult AddProducts(string ids) { Result result = new Result { success = false, msg = "未知错误" }; bool isDataOk = true; List <long> productids = new List <long>(); if (!isConfigRight) { isDataOk = false; result = new Result { success = false, msg = "错误的默认佣金比,请设置默认佣金比" }; } if (isDataOk) { if (!Regex.IsMatch(ids, @"^(\d|,)+?")) { isDataOk = false; result = new Result { success = false, msg = "错误的商品编号列表" }; } } //组装id数据 if (isDataOk) { string[] _arrid = ids.Split(','); foreach (string item in _arrid) { long _proid = 0; if (long.TryParse(item, out _proid)) { if (_proid > 0) { productids.Add(_proid); } } } if (productids.Count < 1) { isDataOk = false; result = new Result { success = false, msg = "错误的商品编号列表" }; } else { _iDistributionService.BatAddDistributionProducts(productids, curshopid, distributorConfig.DistributorDefaultRate); result = new Result { success = true, msg = "添加分销商品成功" }; } } return(Json(result)); }