更新委托天数判断

This commit is contained in:
yaooo 2023-09-09 17:41:58 +08:00
parent da2b6a8cc0
commit 331623ebc9

View File

@ -296,12 +296,12 @@ class Community extends BaseController
if (empty($data['entrust_mer_id']) || empty($data['entrust_day'])) {
throw new ValidateException('供应链商家及委托天数不能为空');
}
if ($data['entrust_day'] < 15 || $data['entrust_day'] > 90) {
throw new ValidateException('委托天数区间为[15-90]天');
$merchantInfo = Db::name('merchant')->where('uid', $this->request->uid())->find();
if ($data['entrust_mer_id'] == $merchantInfo['mer_id']) {
throw new ValidateException('委托商家不能选择自己');
}
$merchantId = Db::name('merchant')->where('uid', $this->request->uid())->value('mer_id');
if ($data['entrust_mer_id'] == $merchantId) {
throw new ValidateException('不能委托自己');
if ($merchantInfo['credit_buy'] && ($data['entrust_day'] < $merchantInfo['settle_cycle'])) {
throw new ValidateException('委托天数不能小于结算周期');
}
}