初始化

缺陷:主题配色需要优化整体的同风格
This commit is contained in:
2026-08-14 23:21:21 +08:00
parent 6e2769c528
commit bcf54c2727
152 changed files with 13521 additions and 141 deletions

View File

@@ -0,0 +1,15 @@
<?php
namespace App\BaseApp;
/**
* 业务表模型基类
*
* 业务表与系统表同库不同前缀(系统表 nl_ / 业务表 cc_
* 故业务表走独立的 business 连接。所有 cc_* 表的 Model 都应继承本类而不是 BaseModel。
* 代码生成器产出的 Model 默认继承 BaseModel用于业务表时需手工改成本类。
*/
class BaseBusinessModel extends BaseModel
{
protected $connection = 'business';
}

View File

@@ -14,6 +14,17 @@ class BaseController
protected array $notRequest = [];
protected array $updateField = [];
protected $service;
/**
* @var array<int, string> 不注册成路由的方法名
*
* autoRouteRegister 是反射整个类,继承来的方法也会被注册,
* 于是每个控制器都白得一套 list/option/detail/create/update/delete。
* 对不该有 CRUD 的控制器(比如登录),在子类里声明要排除的方法即可,
* 不必为了挂 @Method NO 去空覆写六个方法。
*/
protected array $exceptRoute = [];
public function __construct()
{
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\BaseApp;
use App\Service\common\UtilsService;
use App\Service\wx\WxTokenService;
/**
* 小程序业务基类
*
* BaseService 的区别只在身份来源:后台是 nl_admin小程序是 cc_wx_user。
* 分页与查询能力复用 BaseNotAuthService但不走它的构造那里解的是后台 token
*/
class BaseWxService extends BaseNotAuthService
{
/**
* @var bool 是否要求已登录
*/
protected bool $needLogin = true;
public function __construct()
{
$this->utils = UtilsService::getInstance();
$token = WxTokenService::getInstance();
if ($this->needLogin) {
$this->userInfo = $token->requireUser();
} else {
$this->userInfo = $token->resolveUser(request()->bearerToken()) ?? [];
}
$this->userId = (int) ($this->userInfo['id'] ?? 0);
}
/**
* 当前用户是否可见价格
*/
protected function canSeePrice(): bool
{
return (bool) ($this->userInfo['show_price'] ?? 0);
}
/**
* 当前用户的价格倍率
*/
protected function priceMultiplier(): mixed
{
return $this->userInfo['price_number'] ?? 1;
}
}