|
|
@@ -33,18 +33,24 @@ class GhsController extends BaseController
|
|
|
$get = Yii::$app->request->get();
|
|
|
$id = $get['id'] ?? 0;
|
|
|
$salt = $get['salt'] ?? '';
|
|
|
- $ghs = GhsClass::getById($id, true);
|
|
|
+ $ghs = GhsClass::getById($id);
|
|
|
if (empty($ghs)) {
|
|
|
util::fail('没有找到供货商的信息哦');
|
|
|
}
|
|
|
- if ($ghs->salt != $salt) {
|
|
|
+ if (isset($ghs['salt']) == false || $ghs['salt'] != $salt) {
|
|
|
util::fail('不是您的供货商');
|
|
|
}
|
|
|
- $customId = $ghs->customId ?? 0;
|
|
|
- $custom = CustomClass::getById($customId, true);
|
|
|
+ $debtAmount = $ghs['debtAmount'] ?? 0;
|
|
|
+ $balance = $ghs['balance'] ?? 0;
|
|
|
+ $remainDebtAmount = bcsub($debtAmount, $balance, 2);
|
|
|
+ $remainDebtAmount = floatval($remainDebtAmount);
|
|
|
+ $customId = $ghs['customId'] ?? 0;
|
|
|
+ $custom = CustomClass::getById($customId);
|
|
|
if (empty($custom)) {
|
|
|
util::fail('供货商信息不完整');
|
|
|
}
|
|
|
+ $ghs['remainDebtAmount'] = $remainDebtAmount;
|
|
|
+ $custom['remainDebtAmount'] = $remainDebtAmount;
|
|
|
util::success(['ghs' => $ghs, 'custom' => $custom]);
|
|
|
}
|
|
|
|