diff --git a/app/admin/controller/SysAccountController.php b/app/admin/controller/SysAccountController.php new file mode 100644 index 0000000..dc90fd9 --- /dev/null +++ b/app/admin/controller/SysAccountController.php @@ -0,0 +1,48 @@ +service = new SysAccountService(); + } + + /** + * 列表页数据格式化 + * + * @param array $data + * @return array + */ + protected function indexFormat($data) + { + if (isset($data['created_at'])) + $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); + if (isset($data['updated_at'])) + $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']); + return $data; + } + + /** + * 数据格式化 + * + * @param array $data + * @return array + */ + protected function showFormat($data) + { + if (isset($data['created_at'])) + $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); + if (isset($data['updated_at'])) + $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']); + return $data; + } +} \ No newline at end of file diff --git a/app/admin/logic/SysAccountLogic.php b/app/admin/logic/SysAccountLogic.php new file mode 100644 index 0000000..104b060 --- /dev/null +++ b/app/admin/logic/SysAccountLogic.php @@ -0,0 +1,17 @@ +validator; + } + + /** + * 构建查询条件 + */ + protected function buildQueryConfig(Request $request, string $scene = 'default'): array + { + $p = $request->all(); + + $config = []; + $config['model'] = $this->modelClass; + switch ($scene) { + case 'index': + // ====== ====== 排序 ====== ====== + $config['order']['sort'] = 'desc'; + $config['order']['id'] = 'desc'; + + // ====== ====== 筛选 ====== ====== + // 状态 + if (isset($p['status']) && in_array($p['status'], [0,1])) { + $config['where']['status'] = $p['status']; + } + // 状态 + if (isset($p['type']) && $p['type']) { + $config['where']['type'] = $p['type']; + } + // 关键字 + if (isset($p['keyword']) && $p['keyword']) { + $k = '%' . $p['keyword'] . '%'; + foreach (['account_name','account_number','bank_name','bank_branch','description'] as $col) { + $config['orWhere'][] = [$col, 'like', $k]; + } + } + //$config['where']['status'] = 1; + break; + case 'show': + $config['where']['id'] = $p['id']; + //$config['where']['status'] = 1; + break; + case 'store': + break; + case 'update': + $config['where']['id'] = $p['id']; + break; + case 'destroy': + $config['where']['id'] = $p['id']; + break; + } + + return $config; + } +} \ No newline at end of file diff --git a/app/admin/validate/SysAccountValidate.php b/app/admin/validate/SysAccountValidate.php new file mode 100644 index 0000000..65cc1d7 --- /dev/null +++ b/app/admin/validate/SysAccountValidate.php @@ -0,0 +1,29 @@ + [ + + ], + + 'update' => [ + + ] + ]; +} \ No newline at end of file diff --git a/app/common/controller/PresetController.php b/app/common/controller/PresetController.php index 37073c4..afc24cb 100644 --- a/app/common/controller/PresetController.php +++ b/app/common/controller/PresetController.php @@ -3,6 +3,7 @@ namespace app\common\controller; use app\admin\service\RoleService; +use app\common\service\SysCurrencyService; use support\Request; use app\common\service\CorpService; use app\common\service\CorpFeishuAppService; @@ -76,6 +77,16 @@ class PresetController extends BaseController } } + public function currency() + { + try { + $result = (new SysCurrencyService)->getList(); + return $this->success($result, '获取货币列表'); + } catch (\Throwable $e) { + return $this->error($e->getMessage()); + } + } + public function cacheClear() { diff --git a/app/common/logic/SysCurrencyLogic.php b/app/common/logic/SysCurrencyLogic.php new file mode 100644 index 0000000..206efa2 --- /dev/null +++ b/app/common/logic/SysCurrencyLogic.php @@ -0,0 +1,21 @@ +get(['id', 'currency_code', 'currency_name', 'currency_symbol', 'exchange_rate', 'float_percent']); + } +} \ No newline at end of file diff --git a/app/common/model/SysAccount.php b/app/common/model/SysAccount.php new file mode 100644 index 0000000..def900f --- /dev/null +++ b/app/common/model/SysAccount.php @@ -0,0 +1,49 @@ +logic = (new SysCurrencyLogic()); + } + + /** + * 获取系统list + */ + public function getList() + { + return $this->logic->getList(); + } +} \ No newline at end of file diff --git a/config/route.php b/config/route.php index e5e6f27..3bd7266 100644 --- a/config/route.php +++ b/config/route.php @@ -61,6 +61,7 @@ Route::group('/common', function () { Route::any('/feishu/app', [app\common\controller\PresetController::class, 'feishuApp']); Route::any('/systems', [app\common\controller\PresetController::class, 'systems']); Route::any('/roles', [app\common\controller\PresetController::class, 'roles']); + Route::any('/currency', [app\common\controller\PresetController::class, 'currency']); Route::any('/cache/clear', [app\common\controller\PresetController::class, 'cacheClear']); Route::any('/menus', [app\common\controller\PresetController::class, 'menus']); }); @@ -235,7 +236,7 @@ Route::group('/admin', function () { Route::any('/destroy', [app\admin\controller\VehColorController::class, 'destroy']); }); - // 汽车颜色 + // 汽车改装项目 Route::group('/modification', function () { Route::any('/list', [app\admin\controller\VehModificationController::class, 'index']); Route::any('/show', [app\admin\controller\VehModificationController::class, 'show']); @@ -244,6 +245,15 @@ Route::group('/admin', function () { Route::any('/destroy', [app\admin\controller\VehModificationController::class, 'destroy']); }); + // 账户 + Route::group('/account', function () { + Route::any('/list', [app\admin\controller\SysAccountController::class, 'index']); + Route::any('/show', [app\admin\controller\SysAccountController::class, 'show']); + Route::any('/store', [app\admin\controller\SysAccountController::class, 'store']); + Route::any('/update', [app\admin\controller\SysAccountController::class, 'update']); + Route::any('/destroy', [app\admin\controller\SysAccountController::class, 'destroy']); + }); + });