CashController.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace hd\controllers;
  3. use biz\sj\classes\CashClass;
  4. use common\components\util;
  5. use Yii;
  6. class CashController extends BaseController
  7. {
  8. //客户列表 ssh 2019.11.30
  9. public function actionList()
  10. {
  11. $where = ['shopId' => $this->shopId];
  12. $list = CashClass::getCashList($where);
  13. util::success($list);
  14. }
  15. //申请提现 ssh 2021.3.14
  16. public function actionApply()
  17. {
  18. $get = Yii::$app->request->get();
  19. $get['shopAdminId'] = $this->shopAdminId;
  20. $shopAdmin = $this->shopAdmin;
  21. if (isset($shopAdmin['super']) == false || $shopAdmin['super'] != 1) {
  22. util::fail('超管才能申请提现');
  23. }
  24. $get['shopAdminName'] = $shopAdmin->name ?? '';
  25. $get['shopId'] = $this->shopId;
  26. $get['sjId'] = $this->sjId;
  27. $connection = Yii::$app->db;
  28. $transaction = $connection->beginTransaction();
  29. try {
  30. CashClass::addApply($get);
  31. $transaction->commit();
  32. util::success('提交成功,等待审核');
  33. } catch (\Exception $exception) {
  34. $transaction->rollBack();
  35. Yii::info("提现申请报错:" . $exception->getMessage());
  36. util::fail('申请失败');
  37. }
  38. }
  39. }