|
|
@@ -8,6 +8,7 @@ use bizHd\custom\classes\HdClass;
|
|
|
use bizHd\custom\models\Custom;
|
|
|
use bizHd\shop\models\Shop;
|
|
|
use common\components\dict;
|
|
|
+use common\components\util;
|
|
|
use yii\console\Controller;
|
|
|
use Yii;
|
|
|
|
|
|
@@ -50,20 +51,20 @@ class LsCustomController extends Controller
|
|
|
$customName = $custom['name'] ?? '';
|
|
|
if (empty($hdId) || empty($customId)) {
|
|
|
echo $customName . " customId:" . $customId . " hdId:" . $hdId . " 的ID是空的 \n";
|
|
|
- continue;
|
|
|
+ util::stop();
|
|
|
}
|
|
|
if ($debtAmount > 0) {
|
|
|
$c = CustomClass::getById($customId, true);
|
|
|
$h = HdClass::getById($hdId, true);
|
|
|
if (empty($c) || empty($h)) {
|
|
|
echo $customName . " customId:" . $customId . " hdId:" . $hdId . " 的对象是空的哦!! \n";
|
|
|
- continue;
|
|
|
+ util::stop();
|
|
|
}
|
|
|
$balance = $c->balance ?? 0;
|
|
|
$hdBalance = $h->balance ?? 0;
|
|
|
if (floatval($balance) != $hdBalance) {
|
|
|
echo $customName . " customId:" . $customId . " hdId:" . $hdId . " 二边余额不一致 \n";
|
|
|
- continue;
|
|
|
+ util::stop();
|
|
|
}
|
|
|
$newBalance = bcsub($balance, $debtAmount, 2);
|
|
|
$c->balance = $newBalance;
|
|
|
@@ -97,10 +98,11 @@ class LsCustomController extends Controller
|
|
|
];
|
|
|
BalanceChangeClass::add($change, true);
|
|
|
|
|
|
- $transaction->commit();
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ $transaction->commit();
|
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
$transaction->rollBack();
|