| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace ghs\controllers;
- use bizGhs\order\classes\OrderClearClass;
- use Yii;
- use common\components\util;
- class OrderClearController extends BaseController
- {
- //收款 ssh 2021.2.4
- public function actionClear()
- {
- $id = Yii::$app->request->post('id');
- $customId = Yii::$app->request->post('customId');
- if (empty($id)) {
- util::fail('请选择交易记录');
- }
- //抹零之后的价格
- $modifyPrice = Yii::$app->request->post('modifyPrice', 0.00);
- if (is_numeric($modifyPrice) == false || $modifyPrice <= 0) {
- util::fail('金额填错了哦');
- }
- $connection = Yii::$app->db;
- $transaction = $connection->beginTransaction();
- $name = $this->shopAdmin['name'] ?? '';
- $data = [
- 'customId' => $customId,
- 'ghsShopAdminId' => $this->shopAdminId,
- 'ghsShopAdminName' => $name,
- 'modifyPrice' => $modifyPrice,
- ];
- try {
- OrderClearClass::clear($data, $id, $this->sjId, $this->shopId);
- $transaction->commit();
- } catch (\Exception $exception) {
- $transaction->rollBack();
- Yii::info("批量收款失败:" . $exception->getMessage());
- util::fail('操作失败');
- }
- util::complete();
- }
- }
|