CashController.php 1.3 KB

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