CashController.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. if (getenv('YII_ENV') == 'production') {
  28. util::fail('系统自动提现,无需人为操作');
  29. }else{
  30. //这里需要测试,所以打开来
  31. //util::fail('系统自动提现,无需人为操作');
  32. }
  33. $get = Yii::$app->request->get();
  34. $get['shopAdminId'] = $this->shopAdminId;
  35. $shopAdmin = $this->shopAdmin;
  36. if (isset($shopAdmin['super']) == false || $shopAdmin['super'] != 1) {
  37. util::fail('超管才能申请提现');
  38. }
  39. $get['shopAdminName'] = $shopAdmin->name ?? '';
  40. $get['shopId'] = $this->shopId;
  41. $get['sjId'] = $this->sjId;
  42. $get['ptStyle'] = dict::getDict('ptStyle', 'ghs');
  43. $connection = Yii::$app->db;
  44. $transaction = $connection->beginTransaction();
  45. try {
  46. CashClass::addApply($get);
  47. $transaction->commit();
  48. util::complete('申请成功,第二天到帐');
  49. } catch (\Exception $exception) {
  50. $transaction->rollBack();
  51. Yii::info("提现申请报错:" . $exception->getMessage());
  52. util::fail('申请失败');
  53. }
  54. }
  55. }