Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ken678 committed Dec 27, 2024
2 parents f0a7d0c + 3854cdb commit 013c087
Show file tree
Hide file tree
Showing 29 changed files with 139 additions and 435 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ Thumbs.db
/.vscode
/.settings
/.buildpath
/.project
/.project
/addons/*
node_modules
5 changes: 2 additions & 3 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
版权所有Copyright © 2006-2023 by ThinkPHP (http://thinkphp.cn)
YznCMS遵循Apache2开源协议发布,并提供免费使用。
版权所有Copyright © 2017-2024 by YznCMS (https://www.yzncms.com)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。

Apache Licence是著名的非盈利开源组织Apache采用的协议。
该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
### 系统基于ThinkPHP8.x后端+(Layui2.9.x+RequireJS)前端框架,承诺后台框架永久免费且商业授权无限制,更可移除前台版权信息,是个人和企业专享、高度自定义的理想后台管理系统选择。

[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://gitee.com/ken678/YZNCMS/blob/master/LICENSE.txt)
[![Version](https://img.shields.io/badge/YznCMS-2.0.0-brightgreen.svg)](https://gitee.com/ken678/YZNCMS/)
[![Version](https://img.shields.io/badge/YznCMS-2.0.1-brightgreen.svg)](https://gitee.com/ken678/YZNCMS/)
[![star](https://gitee.com/ken678/YZNCMS/badge/star.svg?theme=dark)](https://gitee.com/ken678/YZNCMS/stargazers)
[![fork](https://gitee.com/ken678/YZNCMS/badge/fork.svg?theme=dark)](https://gitee.com/ken678/YZNCMS/members)

Expand All @@ -16,6 +16,10 @@
- PHP版本:php >= 8.0 (推荐8.1+)
- 数据库:MySQL >= 5.6 (需支持 innodb 引擎)

## [官方仓库]
- Gitee:https://gitee.com/ken678/YZNCMS
- GitHub:https://github.com/ken678/yzncms

## [插件版权]
- 插件可用于个人或企业自营网站或为客户定制开发
- 插件(包含免费和付费插件)禁止二次转售,复制和传播等形式分发插件源码
Expand Down Expand Up @@ -76,6 +80,7 @@
|地区管理|省市区三级联动|免费|
|图片处理|支持图片裁剪、旋转、水印等功能,图片处理必备插件|免费|
|频率限制|限定用户在一段时间内的访问次数,用于保护接口防爬防爆破|免费|
|TinyMCE富文本编辑器|一款易用、且功能强大的所见即所得的富文本编辑器|免费|
|评论插件|类似多说,一段JS即可调用的强大评论|付费|
|会员推广|生成推广链接,后台生成邀请码注册|付费|
|通用数据导出|支持任意表和关联表导出excel等格式|付费|
Expand Down
2 changes: 0 additions & 2 deletions app/admin/command/Crud.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ class Crud extends Command
'auth_rule',
'config',
'field_type',
'model',
'model_field',
'terms',
'ems',
'sms',
Expand Down
48 changes: 0 additions & 48 deletions app/admin/command/Install/yzncms.sql
Original file line number Diff line number Diff line change
Expand Up @@ -284,54 +284,6 @@ INSERT INTO `yzn_field_type` VALUES ('color', '颜色值', 21, 'varchar(7) NOT N
INSERT INTO `yzn_field_type` VALUES ('city', '城市地区', 22, 'varchar(255) NOT NULL', 0, 0);
INSERT INTO `yzn_field_type` VALUES ('custom', '自定义', 23, 'text NOT NULL', 1, 0);

-- ----------------------------
-- Table structure for `yzn_model`
-- ----------------------------
DROP TABLE IF EXISTS `yzn_model`;
CREATE TABLE `yzn_model` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`module` varchar(15) NOT NULL DEFAULT '' COMMENT '所属模块',
`name` varchar(30) NOT NULL DEFAULT '' COMMENT '模型名称',
`tablename` varchar(20) NOT NULL DEFAULT '' COMMENT '表名',
`description` varchar(100) NOT NULL DEFAULT '' COMMENT '描述',
`setting` text NOT NULL COMMENT '配置信息',
`type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '模型类别:1-独立表,2-主附表',
`create_time` int(10) unsigned DEFAULT NULL COMMENT '添加时间',
`update_time` int(10) unsigned DEFAULT NULL COMMENT '更新时间',
`listorder` tinyint(3) NOT NULL DEFAULT '0' COMMENT '排序',
`status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '状态',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT='模型列表';

-- ----------------------------
-- Table structure for `yzn_model_field`
-- ----------------------------
DROP TABLE IF EXISTS `yzn_model_field`;
CREATE TABLE `yzn_model_field` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`modelid` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '模型ID',
`name` varchar(20) NOT NULL DEFAULT '' COMMENT '字段名',
`title` varchar(30) NOT NULL DEFAULT '' COMMENT '别名',
`remark` tinytext NULL COMMENT '字段提示',
`pattern` varchar(255) NOT NULL DEFAULT '' COMMENT '数据校验正则',
`errortips` varchar(255) NOT NULL DEFAULT '' COMMENT '数据校验未通过的提示信息',
`type` varchar(20) NOT NULL DEFAULT '' COMMENT '字段类型',
`extend` varchar(255) DEFAULT '' COMMENT '扩展信息',
`setting` mediumtext NULL COMMENT '字段配置',
`ifsystem` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否主表字段 1 是',
`iscore` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否内部字段',
`iffixed` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否固定不可修改',
`ifrequire` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否必填',
`ifsearch` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '作为搜索条件',
`isadd` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '在投稿中显示',
`create_time` int(10) unsigned DEFAULT NULL COMMENT '创建时间',
`update_time` int(10) unsigned DEFAULT NULL COMMENT '更新时间',
`listorder` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
`status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '状态',
PRIMARY KEY (`id`),
KEY `name` (`name`,`modelid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT='模型字段列表';

-- ----------------------------
-- Table structure for `yzn_terms`
-- ----------------------------
Expand Down
10 changes: 8 additions & 2 deletions app/admin/controller/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

class Index extends Backend
{
protected $noNeedLogin = ['login'];
protected $noNeedRight = ['index', 'cache', 'logout'];
protected $noNeedLogin = ['login', 'captcha'];
protected $noNeedRight = ['index', 'cache', 'logout', 'captcha'];

//初始化
protected function initialize()
Expand Down Expand Up @@ -163,4 +163,10 @@ public function cache()
Event::trigger("wipecache_after");
$this->success('清理缓存');
}

//验证码
public function captcha()
{
return \think\captcha\facade\Captcha::create();
}
}
2 changes: 1 addition & 1 deletion app/admin/view/index/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<i class="layui-icon layui-icon-vercode"></i>
</div>
<input type="text" name="verify" lay-verify="required" placeholder="验证码" autocomplete="off" class="layui-input">
<img id="verify" src="{:rtrim('__PUBLIC__', '/')}/index.php/captcha" alt="验证码" class="captcha">
<img id="verify" src="{:url('admin/index/captcha')}" alt="验证码" class="captcha">
</div>
</div>
<!--@CaptchaEnd-->
Expand Down
52 changes: 10 additions & 42 deletions app/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ function parse_attr(string $value = '')
if (strpos($value, ':')) {
$value = [];
foreach ($array as $val) {
[$k, $v] = explode(':', $val);
$value[$k] = $v;
[$k, $v] = explode(':', $val);
$value[$k] = $v;
}
} else {
$value = $array;
Expand Down Expand Up @@ -261,7 +261,7 @@ function human_date($time, $local = null)
* @param string $delimiter 数字和单位分隔符
* @return string 格式化后的带单位的大小
*/
function format_bytes(float|int $size, string $delimiter = ''): string
function format_bytes(float | int $size, string $delimiter = ''): string
{
$units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
for ($i = 0; $size >= 1024 && $i < 5; $i++) {
Expand Down Expand Up @@ -334,38 +334,6 @@ function genRandomString(int $len = 6): string
}
}

if (!function_exists('getModel')) {
/**
* 获取模型数据
* @param type $modelid 模型ID
* @param type $name 返回的字段,默认返回全部,数组
* @return boolean
*/
function getModel($modelid, $name = '')
{
if (empty($modelid) || !is_numeric($modelid)) {
return false;
}
$key = 'getModel_' . $modelid;
/* 读取缓存数据 */
$cache = Cache::get($key);
if ($cache === 'false') {
return false;
}
if (empty($cache)) {
//读取数据
$cache = Db::name('Model')->find($modelid);
if (empty($cache)) {
Cache::set($key, 'false', 60);
return false;
} else {
Cache::set($key, $cache, 3600);
}
}
return is_null($name) ? $cache : $cache[$name];
}
}

if (!function_exists('http_down')) {
/**
* 下载远程文件,默认保存在temp下
Expand Down Expand Up @@ -564,8 +532,8 @@ function hsv2rgb($h, $s, $v): array
*/
function letter_avatar(string $text): string
{
$total = unpack('L', hash('adler32', $text, true))[1];
$hue = $total % 360;
$total = unpack('L', hash('adler32', $text, true))[1];
$hue = $total % 360;
[$r, $g, $b] = hsv2rgb($hue / 360, 0.3, 0.9);

$bg = "rgb({$r},{$g},{$b})";
Expand All @@ -583,11 +551,11 @@ function letter_avatar(string $text): string
* @param ?string $background 背景颜色
* @return string
*/
function build_suffix_image(string $suffix, string $background = null): string
function build_suffix_image(string $suffix, ?string $background = null): string
{
$suffix = mb_substr(strtoupper($suffix), 0, 4);
$total = unpack('L', hash('adler32', $suffix, true))[1];
$hue = $total % 360;
$suffix = mb_substr(strtoupper($suffix), 0, 4);
$total = unpack('L', hash('adler32', $suffix, true))[1];
$hue = $total % 360;
[$r, $g, $b] = hsv2rgb($hue / 360, 0.3, 0.9);

$background = $background ?: "rgb({$r},{$g},{$b})";
Expand Down Expand Up @@ -644,7 +612,7 @@ function check_cors_request()
* @param bool $is_image
* @return bool|string|string[]
*/
function xss_clean(array|string $content, bool $is_image = false)
function xss_clean(array | string $content, bool $is_image = false)
{
return \app\common\library\Security::instance()->xss_clean($content, $is_image);
}
Expand Down
Loading

0 comments on commit 013c087

Please sign in to comment.