ExpendController.php 863 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace ghs\controllers;
  3. use bizGhs\expend\classes\ExpendClass;
  4. use common\components\dict;
  5. use common\components\util;
  6. use Yii;
  7. class ExpendController extends BaseController
  8. {
  9. //新增支出 ssh 20220710
  10. public function actionAddExpend()
  11. {
  12. $post = Yii::$app->request->post();
  13. $type = $post['type'] ?? dict::getDict('expendType', 'hs');
  14. $amount = $post['amount'] ?? 0;
  15. if (is_numeric($amount) == false || $amount <= 0) {
  16. util::fail('请输入正确的金额');
  17. }
  18. $remark = $post['remark'] ?? '';
  19. $staffName = $this->shopAdmin->name ?? '';
  20. $data = ['type' => $type, 'amount' => $amount, 'remark' => $remark, 'mainId' => $this->mainId, 'staffId' => $this->shopAdminId, 'staffName' => $staffName];
  21. ExpendClass::add($data);
  22. util::complete();
  23. }
  24. }