ShopMoneyController.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace ghs\controllers;
  3. use bizGhs\shop\classes\MainClass;
  4. use bizGhs\shop\classes\ShopMoneyClass;
  5. use common\components\dict;
  6. use common\components\util;
  7. use Yii;
  8. class ShopMoneyController extends BaseController
  9. {
  10. public $guestAccess = [];
  11. //存入现金 20220811
  12. public function actionIn()
  13. {
  14. $get = Yii::$app->request->get();
  15. $amount = $get['amount'] ?? 0;
  16. if (is_numeric($amount) == false || $amount <= 0) {
  17. util::fail('请填写金额');
  18. }
  19. $mainId = $this->mainId;
  20. $staffId = $this->shopAdminId ?? 0;
  21. $staff = $this->shopAdmin;
  22. $data = [];
  23. $data['mainId'] = $mainId;
  24. $data['sjId'] = $this->sjId;
  25. $data['amount'] = $amount;
  26. $data['staffId'] = $staffId;
  27. $data['staffName'] = $staff->name ?? '';
  28. $data['ptStyle'] = dict::getDict('ptStyle', 'ghs');
  29. $main = MainClass::getLockById($mainId);
  30. if (empty($main)) {
  31. util::fail('没有门店信息');
  32. }
  33. ShopMoneyClass::inAmount($data, $main);
  34. util::complete();
  35. }
  36. //取出现金 ssh 20220811
  37. public function actionOut()
  38. {
  39. $staff = $this->shopAdmin;
  40. if (isset($staff->super) == false || $staff->super != 1) {
  41. util::fail('没有权限');
  42. }
  43. $get = Yii::$app->request->get();
  44. $amount = $get['amount'] ?? 0;
  45. if (is_numeric($amount) == false || $amount <= 0) {
  46. util::fail('请填写金额');
  47. }
  48. $mainId = $this->mainId;
  49. $staffId = $this->shopAdminId ?? 0;
  50. $data = [];
  51. $data['mainId'] = $mainId;
  52. $data['sjId'] = $this->sjId;
  53. $data['amount'] = $amount;
  54. $data['staffId'] = $staffId;
  55. $data['staffName'] = $staff->name ?? '';
  56. $data['ptStyle'] = dict::getDict('ptStyle', 'ghs');
  57. $main = MainClass::getLockById($mainId);
  58. if (empty($main)) {
  59. util::fail('没有门店信息');
  60. }
  61. ShopMoneyClass::outAmount($data, $main);
  62. util::complete();
  63. }
  64. }