CashController.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. $get = Yii::$app->request->get();
  28. $get['shopAdminId'] = $this->shopAdminId;
  29. $shopAdmin = $this->shopAdmin;
  30. if (isset($shopAdmin['super']) == false || $shopAdmin['super'] != 1) {
  31. util::fail('超管才能申请提现');
  32. }
  33. $get['shopAdminName'] = $shopAdmin->name ?? '';
  34. $get['shopId'] = $this->shopId;
  35. $get['sjId'] = $this->sjId;
  36. $get['ptStyle'] = dict::getDict('ptStyle', 'ghs');
  37. $connection = Yii::$app->db;
  38. $transaction = $connection->beginTransaction();
  39. try {
  40. CashClass::addApply($get);
  41. $transaction->commit();
  42. util::complete('申请成功,第二天到帐');
  43. } catch (\Exception $exception) {
  44. $transaction->rollBack();
  45. Yii::info("提现申请报错:" . $exception->getMessage());
  46. util::fail('申请失败');
  47. }
  48. }
  49. }