| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Module\Fund\Admin\Actions;
- use App\Module\Fund\Models\FundModel;
- use App\Module\Fund\Services\FundService;
- use Dcat\Admin\Admin;
- use Dcat\Admin\Traits\LazyWidget;
- use Dcat\Admin\Contracts\LazyRenderable;
- use UCore\DcatAdmin\Widgets\Form;
- use UCore\Helper\Logger;
- /**
- * 资金处理
- *
- */
- class FundAdminForm extends Form implements LazyRenderable
- {
- use LazyWidget;
- protected string $trans_path = 'fund.form';
- public function run($input)
- {
- $id = $this->payload['id'] ?? null;
- $add = $input['add'];
- $remark = $input['remark'];
- if (!$id) {
- return $this->error('input-error');
- }
- $admin_id = $this->getAdminId();
- $funddata = FundModel::query()->find($id);
- $admin = new FundService($funddata->user_id, $funddata->fund_id);
- $re18 = $admin->admin_operate($admin_id, $funddata->fund_id, $add, $remark, '');
- if (is_string($re18)) {
- Logger::error($re18);
- return $this->_error('fundadmin-error')->refresh();
- }
- return $this->_success('fundadmin-ok')->refresh();
- }
- public function form()
- {
- $this->text('remark')->default('Admin Approved')->required();
- $this->text('add')->default(0)->required();
- }
- }
|