|
|
@@ -57,32 +57,32 @@ class LsCustomController extends Controller
|
|
|
|
|
|
echo "shopId:".$shopId." | ".$customName . " customId:" . $customId . " hdId:" . $hdId . " 有欠款 ==== \n\n";
|
|
|
|
|
|
- $c = CustomClass::getById($customId, true);
|
|
|
- $h = HdClass::getById($hdId, true);
|
|
|
- if (empty($c) || empty($h)) {
|
|
|
+ $custom = CustomClass::getById($customId, true);
|
|
|
+ $hd = HdClass::getById($hdId, true);
|
|
|
+ if (empty($custom) || empty($hd)) {
|
|
|
echo $customName . " customId:" . $customId . " hdId:" . $hdId . " 的对象是空的哦!! \n";
|
|
|
util::stop();
|
|
|
}
|
|
|
- $balance = $c->balance ?? 0;
|
|
|
- $hdBalance = $h->balance ?? 0;
|
|
|
+ $balance = $custom->balance ?? 0;
|
|
|
+ $hdBalance = $hd->balance ?? 0;
|
|
|
if (floatval($balance) != $hdBalance) {
|
|
|
echo $customName . " customId:" . $customId . " hdId:" . $hdId . " 二边余额不一致 \n";
|
|
|
util::stop();
|
|
|
}
|
|
|
$newBalance = bcsub($balance, $debtAmount, 2);
|
|
|
- $c->balance = $newBalance;
|
|
|
- $c->debtAmount = 0;
|
|
|
- $c->isDebt =0;
|
|
|
- $c->debtNum = 0;
|
|
|
- $c->save();
|
|
|
-
|
|
|
- $h->balance = $newBalance;
|
|
|
- $h->debtAmount = 0;
|
|
|
- $h->debt =1;
|
|
|
- $h->debtNum = 0;
|
|
|
- $h->save();
|
|
|
-
|
|
|
- $hdName = $h->name ?? '';
|
|
|
+ $custom->balance = $newBalance;
|
|
|
+ $custom->debtAmount = 0;
|
|
|
+ $custom->isDebt =0;
|
|
|
+ $custom->debtNum = 0;
|
|
|
+ $custom->save();
|
|
|
+
|
|
|
+ $hd->balance = $newBalance;
|
|
|
+ $hd->debtAmount = 0;
|
|
|
+ $hd->debt =1;
|
|
|
+ $hd->debtNum = 0;
|
|
|
+ $hd->save();
|
|
|
+
|
|
|
+ $hdName = $hd->name ?? '';
|
|
|
$mainId = $shop['mainId'] ?? 0;
|
|
|
$event = '系统操作:合并欠款';
|
|
|
$capitalType = dict::getDict('capitalType', 'system', 'id');
|
|
|
@@ -108,7 +108,6 @@ class LsCustomController extends Controller
|
|
|
];
|
|
|
BalanceChangeClass::add($change, true);
|
|
|
|
|
|
-
|
|
|
}else{
|
|
|
//echo "shopId:".$shopId." | ".$customName . " customId:" . $customId . " hdId:" . $hdId . " 没有欠款 ok ok \n";
|
|
|
}
|