request->get(); $status = $get['status'] ?? 0; $where = []; $where['mainId'] = $this->mainId; if (!empty($status)) { $where['status'] = $status; } $list = ScanPayClass::getPayList($where); util::success($list); } public function actionDetail() { $get = Yii::$app->request->get(); $id = $get['id'] ?? 0; $detail = ScanPayClass::getDetail($id, $this->mainId); util::success($detail); } public function actionRefund() { $shopAdmin = $this->shopAdmin; if (!isset($shopAdmin['super']) || $shopAdmin['super'] != 1) { util::fail('超管才能操作退款'); } if (getenv('YII_ENV') == 'production') { if ($this->mainId == 23390) { if (!in_array($this->adminId, [23960, 77951, 4])) { util::fail('你不能售后哈。。'); } } if ($this->mainId == 7704) { if (in_array($this->shopAdminId, [133727, 133545]) == false) { util::fail('无法操作。。'); } } if ($this->mainId == 42680) { if (!in_array($this->adminId, [40144])) { util::fail('你不能售后哦。。'); } } } $post = Yii::$app->request->post(); $id = $post['id'] ?? 0; if (empty($id)) { util::fail('参数错误'); } $cacheKey = 'ghs_scan_pay_refund_' . $id; $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]); if (!empty($has)) { util::fail('请5秒之后再提交'); } Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 5, 'has']); $post['mainId'] = $this->mainId; $post['shopAdminId'] = $this->shopAdminId; $post['shopAdminName'] = $shopAdmin['name'] ?? ''; $connection = Yii::$app->db; $transaction = $connection->beginTransaction(); try { $respond = ScanPayRefundClass::createRefund($id, $post); $transaction->commit(); util::success($respond); } catch (\Exception $exception) { $transaction->rollBack(); Yii::info('收款码退款失败:' . $exception->getMessage()); util::fail($exception->getMessage() ?: '操作失败'); } } }