ShopMoneyController.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace hd\controllers;
  3. use bizHd\shop\classes\MainClass;
  4. use bizHd\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', 'hd');
  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. $get = Yii::$app->request->get();
  40. $amount = $get['amount'] ?? 0;
  41. if (is_numeric($amount) == false || $amount <= 0) {
  42. util::fail('请填写金额');
  43. }
  44. $mainId = $this->mainId;
  45. $staffId = $this->shopAdminId ?? 0;
  46. $staff = $this->shopAdmin;
  47. $data = [];
  48. $data['mainId'] = $mainId;
  49. $data['sjId'] = $this->sjId;
  50. $data['amount'] = $amount;
  51. $data['staffId'] = $staffId;
  52. $data['staffName'] = $staff->name ?? '';
  53. $data['ptStyle'] = dict::getDict('ptStyle', 'hd');
  54. $main = MainClass::getLockById($mainId);
  55. if (empty($main)) {
  56. util::fail('没有门店信息');
  57. }
  58. ShopMoneyClass::outAmount($data, $main);
  59. util::complete();
  60. }
  61. }