| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace pt\controllers;
- use bizTy\sj\classes\MerchantClass;
- use bizHd\saas\services\ApplyService;
- use common\components\util;
- use Yii;
- use yii\web\Controller;
- class ApplyController extends BaseController
- {
- //申请列表
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $status = $get['status'] ?? 0;
- $where = [];
- if (!empty($status)) {
- $where['status'] = $status;
- }
- $list = ApplyService::getApplyList($where);
- util::success($list);
- }
- //审核
- public function actionCheck()
- {
- $id = Yii::$app->request->post('id');
- $status = Yii::$app->request->post('status', 0);
- $remark = Yii::$app->request->post('remark', '');
- $apply = ApplyService::getById($id);
- if (empty($apply)) {
- util::fail('找不到申请记录');
- }
- if ($apply['status'] != 1) {
- util::fail('已经审过了');
- }
- $connection = Yii::$app->db;
- $transaction = $connection->beginTransaction();
- try {
- ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
- if ($status == 1) {
- ApplyService::pass($id);
- }
- $transaction->commit();
- } catch (\Exception $exception) {
- $transaction->rollBack();
- Yii::info("审核操作报错:" . $exception->getMessage());
- util::fail('操作失败');
- }
- util::complete();
- }
- }
|