CashController.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. $get['shopAdminName'] = $shopAdmin->name ?? '';
  22. $get['shopId'] = $this->shopId;
  23. $get['sjId'] = $this->sjId;
  24. $connection = Yii::$app->db;
  25. $transaction = $connection->beginTransaction();
  26. try {
  27. CashClass::addApply($get);
  28. $transaction->commit();
  29. util::success('提交成功,等待审核');
  30. } catch (\Exception $exception) {
  31. $transaction->rollBack();
  32. Yii::info("提现申请报错:" . $exception->getMessage());
  33. util::fail('申请失败');
  34. }
  35. }
  36. }