| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace ghs\controllers;
- use bizGhs\expend\classes\ExpendClass;
- use common\components\dict;
- use common\components\util;
- use Yii;
- class ExpendController extends BaseController
- {
- public function actionList()
- {
- $where = [];
- $where['mainId'] = $this->mainId;
- $list = ExpendClass::getExpendList($where);
- util::success($list);
- }
- //新增支出 ssh 20220710
- public function actionAddExpend()
- {
- $post = Yii::$app->request->post();
- $type = $post['type'] ?? dict::getDict('expendType', 'hs');
- $amount = $post['amount'] ?? 0;
- if (is_numeric($amount) == false || $amount <= 0) {
- util::fail('请输入正确的金额');
- }
- $remark = $post['remark'] ?? '';
- $staffName = $this->shopAdmin->name ?? '';
- $data = ['type' => $type, 'amount' => $amount, 'remark' => $remark, 'mainId' => $this->mainId, 'staffId' => $this->shopAdminId, 'staffName' => $staffName];
- ExpendClass::add($data);
- util::complete();
- }
- }
|