Skip to content

Commit

Permalink
Merge pull request #502 from thinkcmf/dev
Browse files Browse the repository at this point in the history
5.0.180626
  • Loading branch information
thinkcmf committed Jun 25, 2018
2 parents 3795d67 + 78b0785 commit d503cab
Show file tree
Hide file tree
Showing 54 changed files with 1,019 additions and 294 deletions.
20 changes: 19 additions & 1 deletion README.md
@@ -1,4 +1,4 @@
ThinkCMF 5.0.180525 正式版
ThinkCMF 5.0.180626 正式版
===============

### 系列讲座
Expand Down Expand Up @@ -127,6 +127,24 @@ http://www.thinkcmf.com/topic/index/index/cat/11.html
https://github.com/thinkcmf/thinkcmf/issues

### 更新日志
#### 5.0.180626
* 升级TP到`5.0.20`
* 增加插件REST api基类`PluginRestBaseController`
* 增加我的喜欢功能
* 增加手机相关设备类型判断函数
* 优化百度编辑器视频上传
* 优化get_client_ip()方法,默认使用高级模式
* 优化手机号检查支持国际手机号
* 优化图片和文件链接转化函数
* Restful api基类增加apiVersion属性
* 修复邮箱验证码发送失败
* 七牛插件增加东南亚节点
* 前台模板文件解析标准化

[门户应用]
* 增加文章`thumbnail`字段
* 增加文章收藏数功能

#### 5.0.180525
* 修复ajax请求普通页面时返回格式为json
* 优化图片链接生成
Expand Down
31 changes: 31 additions & 0 deletions app/install/data/thinkcmf.sql
Expand Up @@ -1105,3 +1105,34 @@ CREATE TABLE IF NOT EXISTS `cmf_verification_code` (
`account` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '手机号或者邮箱',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='手机邮箱数字验证码表';


-- 增缩略图字段
ALTER TABLE `cmf_portal_post` ADD `thumbnail` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '缩略图' AFTER `post_source`;

ALTER TABLE `cmf_auth_rule` CHANGE `app` `app` VARCHAR(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '规则所属app';

ALTER TABLE `cmf_portal_post` ADD `post_favorites` INT UNSIGNED NOT NULL DEFAULT '0' COMMENT '收藏数' AFTER `post_hits`;

ALTER TABLE `cmf_user_favorite` ADD `thumbnail` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '缩略图' AFTER `title`;

ALTER TABLE `cmf_user_favorite` CHANGE `url` `url` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收藏内容的原文地址,JSON格式';
ALTER TABLE `cmf_user_favorite` CHANGE `description` `description` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收藏内容的描述';
ALTER TABLE `cmf_user_favorite` CHANGE `table_name` `table_name` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '收藏实体以前所在表,不带前缀';


CREATE TABLE `cmf_user_like` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '用户 id',
`object_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '内容原来的主键id',
`create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`table_name` varchar(64) NOT NULL DEFAULT '' COMMENT '内容以前所在表,不带前缀',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT '内容的原文地址,不带域名',
`title` varchar(100) NOT NULL DEFAULT '' COMMENT '内容的标题',
`thumbnail` varchar(100) NOT NULL DEFAULT '' COMMENT '缩略图',
`description` text COMMENT '内容的描述',
PRIMARY KEY (`id`),
KEY `uid` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='用户点赞表';

ALTER TABLE `cmf_user` CHANGE `mobile` `mobile` VARCHAR(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '中国手机不带国家代码,国际手机号格式为:国家代码-手机号';
2 changes: 2 additions & 0 deletions app/portal/model/PortalPostModel.php
Expand Up @@ -91,6 +91,7 @@ public function adminAddArticle($data, $categories)

if (!empty($data['more']['thumbnail'])) {
$data['more']['thumbnail'] = cmf_asset_relative_url($data['more']['thumbnail']);
$data['thumbnail'] = $data['more']['thumbnail'];
}

$this->allowField(true)->data($data, true)->isUpdate(false)->save();
Expand Down Expand Up @@ -124,6 +125,7 @@ public function adminEditArticle($data, $categories)

if (!empty($data['more']['thumbnail'])) {
$data['more']['thumbnail'] = cmf_asset_relative_url($data['more']['thumbnail']);
$data['thumbnail'] = $data['more']['thumbnail'];
}
$this->allowField(true)->isUpdate(true)->data($data, true)->save();

Expand Down
39 changes: 22 additions & 17 deletions app/portal/service/ApiService.php
Expand Up @@ -333,23 +333,28 @@ public static function category($id)
return $portalCategoryModel->where($where)->find();
}

/**
* 返回指定分类下的子分类
* @param int $categoryId 分类id
* @return false|\PDOStatement|string|\think\Collection 返回指定分类下的子分类
*/
public static function subCategories($categoryId)
{
$portalCategoryModel = new PortalCategoryModel();

$where = [
'status' => 1,
'delete_time' => 0,
'parent_id' => $categoryId
];

return $portalCategoryModel->where($where)->select();
}
/**
* 返回指定分类下的子分类
* @param int $categoryId 分类id
* @param $field string 指定查询字段
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @return false|\PDOStatement|string|\think\Collection 返回指定分类下的子分类
*/
public static function subCategories($categoryId,$field='*')
{
$portalCategoryModel = new PortalCategoryModel();

$where = [
'status' => 1,
'delete_time' => 0,
'parent_id' => $categoryId
];

return $portalCategoryModel->field($field)->where($where)->select();
}

/**
* 返回指定分类下的所有子分类
Expand Down
4 changes: 2 additions & 2 deletions app/user/controller/LoginController.php
Expand Up @@ -69,7 +69,7 @@ public function doLogin()
if (Validate::is($data['username'], 'email')) {
$user['user_email'] = $data['username'];
$log = $userModel->doEmail($user);
} else if (preg_match('/(^(13\d|15[^4\D]|17[013678]|18\d)\d{8})$/', $data['username'])) {
} else if (cmf_check_mobile($data['username'])) {
$user['mobile'] = $data['username'];
$log = $userModel->doMobile($user);
} else {
Expand Down Expand Up @@ -148,7 +148,7 @@ public function passwordReset()

$log = $userModel->emailPasswordReset($data['username'], $data['password']);

} else if (preg_match('/(^(13\d|15[^4\D]|17[013678]|18\d)\d{8})$/', $data['username'])) {
} else if (cmf_check_mobile($data['username'])) {
$user['mobile'] = $data['username'];
$log = $userModel->mobilePasswordReset($data['username'], $data['password']);
} else {
Expand Down
6 changes: 3 additions & 3 deletions app/user/controller/RegisterController.php
Expand Up @@ -86,10 +86,10 @@ public function doRegister()
$user['user_pass'] = $data['password'];
if (Validate::is($data['username'], 'email')) {
$user['user_email'] = $data['username'];
$log = $register->register($user,3);
} else if (preg_match('/(^(13\d|15[^4\D]|17[013678]|18\d)\d{8})$/', $data['username'])) {
$log = $register->register($user, 3);
} else if (cmf_check_mobile($data['username'])) {
$user['mobile'] = $data['username'];
$log = $register->register($user,2);
$log = $register->register($user, 2);
} else {
$log = 2;
}
Expand Down
4 changes: 2 additions & 2 deletions app/user/controller/VerificationCodeController.php
Expand Up @@ -50,7 +50,7 @@ public function send()

if (Validate::is($data['username'], 'email')) {
$accountType = 'email';
} else if (preg_match('/(^(13\d|15[^4\D]|17[013678]|18\d)\d{8})$/', $data['username'])) {
} else if (cmf_check_mobile($data['username'])) {
$accountType = 'mobile';
} else {
$this->error("请输入正确的手机或者邮箱格式!");
Expand Down Expand Up @@ -83,7 +83,7 @@ public function send()
$username = empty($user['user_nickname']) ? $user['user_login'] : $user['user_nickname'];

$message = htmlspecialchars_decode($emailTemplate['template']);
$message = $this->display($message, ['code' => $code, 'username' => $username]);
$message = $this->view->display($message, ['code' => $code, 'username' => $username]);
$subject = empty($emailTemplate['subject']) ? 'ThinkCMF验证码' : $emailTemplate['subject'];
$result = cmf_send_email($data['username'], $subject, $message);

Expand Down
30 changes: 15 additions & 15 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/index.php
Expand Up @@ -32,7 +32,7 @@
define('RUNTIME_PATH', CMF_ROOT . 'data/runtime/');

// 定义CMF 版本号
define('THINKCMF_VERSION', '5.0.180525');
define('THINKCMF_VERSION', '5.0.180626');

// 加载框架基础文件
require CMF_ROOT . 'simplewind/thinkphp/base.php';
Expand Down
22 changes: 22 additions & 0 deletions public/plugins/demo/controller/ApiIndexController.php
@@ -0,0 +1,22 @@
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Dean <zxxjjforever@163.com>
// +----------------------------------------------------------------------
namespace plugins\demo\controller; //Demo插件英文名,改成你的插件英文就行了
use cmf\controller\PluginRestBaseController;
use plugins\Demo\Model\PluginDemoModel;
use think\Db;

class ApiIndexController extends PluginRestBaseController
{

public function index()
{
$this->success('success', ['hello' => 'hello ThinkCMF!']);
}

}
2 changes: 1 addition & 1 deletion public/plugins/qiniu/QiniuPlugin.php
Expand Up @@ -18,7 +18,7 @@ class QiniuPlugin extends Plugin
public $info = [
'name' => 'Qiniu',
'title' => '七牛云存储',
'description' => '七牛云存储',
'description' => 'ThinkCMF七牛专享优惠码:507670e8',
'status' => 1,
'author' => 'ThinkCMF',
'version' => '1.0'
Expand Down
1 change: 1 addition & 0 deletions public/plugins/qiniu/config.php
Expand Up @@ -79,6 +79,7 @@
'z1' => '华北',
'z2' => '华南',
'na0' => '北美',
'as0' => '东南亚',
],
'value' => 'http',
"rule" => [
Expand Down
1 change: 1 addition & 0 deletions public/static/js/ueditor/dialogs/video/video.js
Expand Up @@ -395,6 +395,7 @@
server: actionUrl,
fileVal: editor.getOpt('videoFieldName'),
duplicate: true,
timeout: 0,
fileSingleSizeLimit: fileMaxSize,
compress: false,
chunked: true,//开启分片
Expand Down
2 changes: 1 addition & 1 deletion public/static/js/ueditor/ueditor.config.js
Expand Up @@ -410,7 +410,7 @@
hr: ['class', 'style', 'id'],
i: ['class', 'style', 'id'],
iframe: ['src', 'width', 'height', 'class', 'id', 'style', 'frameborder', 'name'],
img: ['src', 'alt', 'title', 'width', 'height', 'id', '_src', 'loadingclass', '_url', 'data-latex','style'],
img: ['src', 'alt', 'title', 'width', 'height', 'id', '_src', 'loadingclass', 'class', 'style','_url', 'data-latex'],
ins: ['datetime', 'class', 'style', 'id'],
li: ['class', 'style', 'id'],
mark: [],
Expand Down
Expand Up @@ -148,6 +148,8 @@
<a href="javascript:parent.imagePreviewDialog('{:cmf_get_image_preview_url($vo.more.thumbnail)}');">
<i class="fa fa-photo fa-fw"></i>
</a>
<else/>
<i class="fa fa-close fa-fw"></i>
</notempty>
</td>
<td>
Expand Down

0 comments on commit d503cab

Please sign in to comment.