Commit df37fb39 authored by luhongguang's avatar luhongguang

update: rule_limit判断

parent f0c07e80
......@@ -14,6 +14,7 @@ class GoodsException extends BaseException
const PRINTER_ALREADY_EXIST = 36;
const EMPTY_OTA_ID = 37;
const OTA_NOT_EXIST = 38;
const RULE_LIMIT_ERROR = 50;
protected $cus = [
0 => '商品创建失败,请稍后重试',
......@@ -66,5 +67,6 @@ class GoodsException extends BaseException
47 => 'sku rollback error',
48 => '请满足以下条件后提交,售价-分销总金额-手续费>=结算价',
49 => '库存不得小于已售库存',
self::RULE_LIMIT_ERROR => '单人可买上限填写错误',
];
}
\ No newline at end of file
......@@ -192,6 +192,12 @@ class MarketingPindanGoodsService
if ($checkGoodsDesc) {
throw new GoodsException(['cus' => 20]);
}
//判断是否是整数
if (!empty($skuData["rule_limit"]) && (!is_numeric($skuData["rule_limit"]) || strpos($skuData["rule_limit"], ".") !== false)) {
throw new GoodsException(['cus' => GoodsException::RULE_LIMIT_ERROR]);
}
$skuParams = [
"goods_sku_id" => $skuId,
"goods_spu_id" => $spuData["goods_spu_id"],
......@@ -311,6 +317,10 @@ class MarketingPindanGoodsService
throw new GoodsException(['cus' => 34]);
}
//判断是否是整数
if (!empty($params["rule_limit"]) && (!is_numeric($params["rule_limit"]) || strpos($params["rule_limit"], ".") !== false)) {
throw new GoodsException(['cus' => GoodsException::RULE_LIMIT_ERROR]);
}
$skuParams = [
"goods_name" => $params["goods_name"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment