|
|
@@ -6,6 +6,7 @@ use biz\ghs\classes\GhsClass;
|
|
|
use bizGhs\clear\classes\ClearClass;
|
|
|
use bizGhs\clear\services\ClearService;
|
|
|
use bizGhs\custom\classes\CustomClass;
|
|
|
+use bizGhs\order\classes\OrderClearClass;
|
|
|
use bizHd\shop\classes\ShopClass;
|
|
|
use common\components\dict;
|
|
|
use common\components\imgUtil;
|
|
|
@@ -42,7 +43,7 @@ class ClearController extends BaseController
|
|
|
util::fail('账单已取消');
|
|
|
}
|
|
|
$clear->status = ClearClass::STATUS_EXPIRE;
|
|
|
- $clear->remark = "客户手动取消 ".date('Y-m-d H:i:s');
|
|
|
+ $clear->remark = "客户手动取消 " . date('Y-m-d H:i:s');
|
|
|
$clear->save();
|
|
|
$orderSn = $clear->orderSn ?? '';
|
|
|
|
|
|
@@ -148,7 +149,57 @@ class ClearController extends BaseController
|
|
|
$remainSecond = $remainSecond > 0 ? $remainSecond : 0;
|
|
|
$clear['remainSecond'] = $remainSecond;
|
|
|
$clear['hasRenew'] = 1;
|
|
|
+
|
|
|
+ //如果是虚拟关系,暂时允许花店一键结账
|
|
|
+ $ghsId = $clear['ghsId'] ?? 0;
|
|
|
+ $ghs = GhsClass::getById($ghsId, true);
|
|
|
+ $live = $ghs->live ?? 1;
|
|
|
+ $clear['live'] = $live;
|
|
|
+
|
|
|
util::success($clear);
|
|
|
}
|
|
|
|
|
|
+ public function actionHasWxPay()
|
|
|
+ {
|
|
|
+ $id = Yii::$app->request->get('id');
|
|
|
+ $clear = ClearClass::getById($id, true);
|
|
|
+ if (empty($clear)) {
|
|
|
+ util::fail('没有结账信息哦');
|
|
|
+ }
|
|
|
+ if ($clear->customShopId != $this->shopId) {
|
|
|
+ util::fail('不是你的结账单');
|
|
|
+ }
|
|
|
+
|
|
|
+ util::checkRepeatCommit($this->adminId, 4);
|
|
|
+
|
|
|
+ //暂时用批发端的写法来顶替一下
|
|
|
+
|
|
|
+ $connection = Yii::$app->db;
|
|
|
+ $transaction = $connection->beginTransaction();
|
|
|
+ try {
|
|
|
+ $payWay = 0;
|
|
|
+ $amount = $clear->actPrice ?? 0;
|
|
|
+ $customId = $clear->customId ?? 0;
|
|
|
+ $custom = CustomClass::getLockById($customId);
|
|
|
+ $shop = $this->shop;
|
|
|
+ $staff = $this->shopAdmin;
|
|
|
+ //充值
|
|
|
+ $return = CustomClass::rechargeBalance($custom, $amount, $shop, $staff, $payWay);
|
|
|
+ $custom = $return['custom'];
|
|
|
+ $ghs = $return['ghs'];
|
|
|
+ //结账
|
|
|
+ OrderClearClass::confirmClear($clear, $payWay);
|
|
|
+ $clearInfo = OrderClearClass::getLockById($id);
|
|
|
+ //结账消余额
|
|
|
+ CustomClass::clearConsumeBalance($amount, $custom, $ghs, $shop, $staff, $clearInfo);
|
|
|
+ $transaction->commit();
|
|
|
+ util::complete();
|
|
|
+ } catch (\Exception $exception) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ Yii::info("失败:" . $exception->getMessage());
|
|
|
+ util::fail('操作失败');
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|