|
|
@@ -119,7 +119,7 @@ class OrderClearController extends BaseController
|
|
|
util::fail('没有找到结账单');
|
|
|
}
|
|
|
$ghsId = $clear->ghsId ?? 0;
|
|
|
- $ghs = GhsClass::getById($ghsId, true);
|
|
|
+ $ghs = GhsClass::getLockById($ghsId);
|
|
|
if ($ghs->shopId != $this->shopId) {
|
|
|
util::fail('没有权限');
|
|
|
}
|
|
|
@@ -154,7 +154,19 @@ class OrderClearController extends BaseController
|
|
|
$connection = Yii::$app->db;
|
|
|
$transaction = $connection->beginTransaction();
|
|
|
try {
|
|
|
+
|
|
|
+ $amount = $clear->actPrice ?? 0;
|
|
|
+ $customId = $clear->customId ?? 0;
|
|
|
+ $custom = CustomClass::getLockById($customId);
|
|
|
+ $shop = $this->shop;
|
|
|
+ $staff = $this->shopAdmin;
|
|
|
+ //充值
|
|
|
+ CustomClass::rechargeBalance($custom, $amount, $shop, $staff);
|
|
|
+ //结账
|
|
|
OrderClearClass::confirmClear($clear, $payWay);
|
|
|
+ $clearInfo = OrderClearClass::getLockById($id);
|
|
|
+ //结账消余额
|
|
|
+ CustomClass::clearConsumeBalance($amount, $custom, $ghs, $shop, $staff, $clearInfo);
|
|
|
$transaction->commit();
|
|
|
util::complete();
|
|
|
} catch (\Exception $exception) {
|