// +---------------------------------------------------------------------- declare (strict_types=1); namespace app\api\model; use app\common\model\store\Setting as SettingModel; use app\common\enum\Setting as SettingEnum; /** * 系统设置模型 * Class Setting * @package app\api\model */ class Setting extends SettingModel { /** * 获取积分名称 * @return string * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public static function getPointsName(): string { return static::getItem(SettingEnum::POINTS)['points_name']; } /** * 获取未支付订单自动关闭期限(单位:小时) * @return mixed * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public static function getOrderCloseTime() { return static::getItem(SettingEnum::TRADE)['order']['closeHours']; } /** * 获取提现手续费(%) * @return mixed * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public static function getFinanceCommission() { $return = empty(static::getItem(SettingEnum::TRADE)['finance_process'])?'':static::getItem(SettingEnum::TRADE)['finance_process']; return $return; } /** * 获取充值设置 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public static function getRecharge(): array { return static::getItem(SettingEnum::RECHARGE); } /** * 获取微信订阅消息设置 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public static function getSubmsg(): array { $data = []; foreach (static::getItem(SettingEnum::SUBMSG) as $groupName => $group) { foreach ($group as $itemName => $item) { $data[$groupName][$itemName]['template_id'] = $item['template_id']; } } return $data; } }