CashController.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace ghs\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 20230424
  10. public function actionGetInfo()
  11. {
  12. $get = Yii::$app->request->get();
  13. $id = $get['id'] ?? 0;
  14. $cash = CashClass::getById($id, true);
  15. util::success(['info' => $cash]);
  16. }
  17. //客户列表 ssh 2019.11.30
  18. public function actionList()
  19. {
  20. $where = ['mainId' => $this->mainId];
  21. $list = CashClass::getCashList($where);
  22. util::success($list);
  23. }
  24. //申请提现 ssh 2021.3.14
  25. public function actionApply()
  26. {
  27. util::fail('系统自动提现,无需人为操作');
  28. $get = Yii::$app->request->get();
  29. $get['shopAdminId'] = $this->shopAdminId;
  30. $shopAdmin = $this->shopAdmin;
  31. if (isset($shopAdmin['super']) == false || $shopAdmin['super'] != 1) {
  32. util::fail('超管才能申请提现');
  33. }
  34. $get['shopAdminName'] = $shopAdmin->name ?? '';
  35. $get['shopId'] = $this->shopId;
  36. $get['sjId'] = $this->sjId;
  37. $get['ptStyle'] = dict::getDict('ptStyle', 'ghs');
  38. $connection = Yii::$app->db;
  39. $transaction = $connection->beginTransaction();
  40. try {
  41. CashClass::addApply($get);
  42. $transaction->commit();
  43. util::complete('申请成功,第二天到帐');
  44. } catch (\Exception $exception) {
  45. $transaction->rollBack();
  46. Yii::info("提现申请报错:" . $exception->getMessage());
  47. util::fail('申请失败');
  48. }
  49. }
  50. }