fix(channel): 修复渠道商品规则更新逻辑
- 添加对空规则的处理,避免保存空值- 优化 gid_rule、rule 和 order_limit_rule 的处理逻辑 - 提高代码可读性和稳定性
This commit is contained in:
parent
813d07adb9
commit
81feb225eb
@ -343,10 +343,13 @@ class ChannelProduct extends Controller
|
||||
$gid_rule[$v] = $input;
|
||||
}
|
||||
}
|
||||
|
||||
if ($gid_rule) {
|
||||
$gid_rule = json_encode($gid_rule);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$order_limit_rule = array();
|
||||
foreach ($this->cash as $k => $v) {
|
||||
$input = input('cash_order_limit_' . $k);
|
||||
@ -371,9 +374,13 @@ class ChannelProduct extends Controller
|
||||
$update['percent_type'] = $percent_type;
|
||||
if ($rule) {
|
||||
$update['rule'] = $rule;
|
||||
}else{
|
||||
$update['rule'] = null;
|
||||
}
|
||||
if ($gid_rule) {
|
||||
$update['gid_rule'] = $gid_rule;
|
||||
}else{
|
||||
$update['gid_rule'] = null;
|
||||
}
|
||||
$gid = input('gid');
|
||||
if ($gid) {
|
||||
@ -382,6 +389,8 @@ class ChannelProduct extends Controller
|
||||
|
||||
if ($order_limit_rule) {
|
||||
$update['order_limit_rule'] = $order_limit_rule;
|
||||
}else{
|
||||
$update['order_limit_rule'] = null;
|
||||
}
|
||||
$order_limit = input('order_limit');
|
||||
$update['order_limit'] = $order_limit;
|
||||
|
Loading…
x
Reference in New Issue
Block a user