Skip to content

Commit e147acc

Browse files
committed
feat: ueditor upgraded to 2.9.0
1 parent a488377 commit e147acc

File tree

90 files changed

+801
-523
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+801
-523
lines changed

module/Member/Util/MemberUtil.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ private static function processBasicFields($keepFields)
9191
return $keepFields;
9292
}
9393

94+
public static function fixAvatar($avatar)
95+
{
96+
return AssetsUtil::fixFullOrDefault($avatar, 'asset/image/avatar.png');
97+
}
98+
9499
public static function getBasic($id, $keepFields = null)
95100
{
96101
$keepFields = self::processBasicFields($keepFields);
@@ -101,7 +106,7 @@ public static function getBasic($id, $keepFields = null)
101106
if (empty($item['nickname'])) {
102107
$item['nickname'] = $item['username'];
103108
}
104-
$item['avatar'] = AssetsUtil::fixFullOrDefault($item['avatar'], 'asset/image/avatar.png');
109+
$item['avatar'] = self::fixAvatar($item['avatar']);
105110
$result = [];
106111
foreach ($keepFields as $keepField) {
107112
if (isset($item[$keepField])) {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
4+
namespace Module\Vendor\Admin\Controller;
5+
6+
7+
use Edwin404\Base\Support\InputPackage;
8+
use Illuminate\Routing\Controller;
9+
use Illuminate\Support\Facades\Session;
10+
use ModStart\Admin\Layout\AdminPage;
11+
use ModStart\Core\Exception\BizException;
12+
use ModStart\Core\Input\Response;
13+
use ModStart\Form\Form;
14+
use ModStart\Widget\Box;
15+
16+
class SecurityController extends Controller
17+
{
18+
public static $PermitMethodMap = [
19+
'*' => '*',
20+
];
21+
22+
public function secondVerify(AdminPage $page)
23+
{
24+
$input = InputPackage::buildFromInput();
25+
$redirect = $input->getTrimString('redirect', modstart_admin_url(''));
26+
$form = Form::make('');
27+
$form->password('password', '安全验证密码');
28+
$form->showReset(false);
29+
$form->formClass('wide');
30+
return $page->pageTitle('二次安全验证')
31+
->body(Box::make($form, '二次安全验证'))
32+
->handleForm($form, function (Form $form) use ($redirect) {
33+
$data = $form->dataForming();
34+
$password = $data['password'];
35+
$passwordCorrectMd5 = modstart_config('Vendor_SecuritySecondVerifyPassword');
36+
BizException::throwsIf('密码不正确', md5($password) != $passwordCorrectMd5);
37+
Session::set('Vendor_SecuritySecondVerifyTime', time() + 3600);
38+
return Response::send(0, null, null, $redirect);
39+
});
40+
}
41+
}

module/Vendor/Admin/routes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
$router->match(['get', 'post'], 'widget/icon', 'WidgetIconController@index');
55
$router->match(['get', 'post'], 'widget/link_select', 'WidgetLinkController@select');
66

7+
$router->match(['get', 'post'], 'security/second_verify', 'SecurityController@secondVerify');
8+

module/Vendor/Docs/release.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
## 3.8.0
1+
## 3.8.0 内容审核优化,二次验证基础工具,导入页面兼容多标签
22

3+
- 新增:后台二次安全验证方式工具类
4+
- 新增:内容审核Job新增快速创建方法
35
- 优化:导入页面兼容后台多标签方式展示
6+
- 优化:内容审核抽象提供者使用方式简化
47

58
---
69

module/Vendor/Provider/ContentVerify/AbstractContentVerifyProvider.php

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,28 @@
1616
abstract class AbstractContentVerifyProvider
1717
{
1818
/**
19-
* 审核业务唯一标识
19+
* 业务唯一标识
2020
* @return string
2121
* @example post
2222
*/
2323
abstract public function name();
2424

2525
/**
26-
* 审核业务名称
26+
* 业务标题
2727
* @return string
2828
* @example 文章
2929
*/
3030
abstract public function title();
3131

3232
/**
33-
* 是否启用自动审核
33+
* 是否自动审核完成
3434
* @param $param
3535
* @return boolean
3636
*/
37-
abstract public function verifyAutoProcess($param);
37+
public function verifyAutoProcess($param)
38+
{
39+
return false;
40+
}
3841

3942
/**
4043
* 待审核数量
@@ -50,12 +53,25 @@ abstract public function verifyCount();
5053
*/
5154
abstract public function verifyRule();
5255

56+
57+
/**
58+
* 启用自动表单审核,返回 false 表示不适用表单审核
59+
* @return false
60+
*/
61+
public function useFormVerify()
62+
{
63+
return false;
64+
}
65+
5366
/**
54-
* 构建审核表单
67+
* 构建审核表单,返回 null 表示不适用表单审核
5568
* @param Form $form
5669
* @param $param
5770
*/
58-
abstract public function buildForm(Form $form, $param);
71+
public function buildForm(Form $form, $param)
72+
{
73+
return null;
74+
}
5975

6076
/**
6177
* 后台审核路径
@@ -94,8 +110,11 @@ public function run($param, $title = null, $body = null)
94110
return;
95111
}
96112
NotifierProvider::notifyNoneLoginOperateProcessUrl(
97-
$this->name(), '[审核]' . $shortTitle, $body,
98-
'content_verify/' . $this->name(), $param
113+
$this->name(),
114+
'[审核]' . $shortTitle,
115+
$body,
116+
$this->useFormVerify() ? 'content_verify/' . $this->name() : null,
117+
$param
99118
);
100119
}
101120

module/Vendor/Provider/ContentVerify/ContentVerifyJob.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace Module\Vendor\Provider\ContentVerify;
55

66

7+
use ModStart\Core\Input\Request;
78
use ModStart\Core\Job\BaseJob;
89

910
class ContentVerifyJob extends BaseJob
@@ -13,15 +14,32 @@ class ContentVerifyJob extends BaseJob
1314
public $body;
1415
public $param;
1516

17+
public static function createQuick($name, $id, $title, $viewUrl)
18+
{
19+
self::create($name, [
20+
'id' => $id,
21+
'viewUrl' => $viewUrl,
22+
], $title);
23+
}
24+
1625
/**
1726
* 创建一个内容审核任务
1827
* @param $name string 审核模块名称
19-
* @param $param array 审核参数,内置参数 viewUrl成功后查看链接 processUrl审核处理链接
20-
* @param $title string 审核标题
28+
* @param $param array 审核参数,内置参数 (viewUrl成功后查看链接,processUrl审核处理链接,domainUrl访问域名URL)
29+
* @param $title string 审核标题,通知标题自动变为 -> [审核]业务标题(审核标题)
2130
* @param $body string 审核内容
2231
*/
2332
public static function create($name, $param, $title, $body = null)
2433
{
34+
if (!isset($param['domainUrl'])) {
35+
$param['domainUrl'] = Request::domainUrl();
36+
}
37+
if (isset($param['viewUrl'])) {
38+
// prepend http:// https://
39+
if (!preg_match('/^https?:\/\//', $param['viewUrl'])) {
40+
$param['viewUrl'] = $param['domainUrl'] . $param['viewUrl'];
41+
}
42+
}
2543
$job = new static();
2644
$job->name = $name;
2745
$job->param = $param;

module/Vendor/Provider/ContentVerify/ContentVerifyProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ public static function get($name)
4848
return null;
4949
}
5050

51-
}
51+
}

module/Vendor/Provider/Notifier/NotifierProvider.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,22 @@ public static function notify($biz, $title, $content, $param = [])
4242
}
4343
}
4444

45-
public static function notifyProcess($biz, $title, $content, $processUrl, $processUrlParam = [])
45+
public static function notifyNoneLoginOperateProcessUrl($biz, $title, $content, $processUrlPath, $param = [])
4646
{
47-
self::notify($biz, $title, $content, array_merge($processUrlParam, [
48-
'processUrl' => $processUrl,
49-
]));
50-
}
51-
52-
public static function notifyNoneLoginOperateProcessUrl($biz, $title, $content, $processUrlPath, $processUrlParam = [])
53-
{
54-
$viewUrl = null;
55-
if (isset($processUrlParam['viewUrl'])) {
56-
$viewUrl = $processUrlParam['viewUrl'];
57-
unset($processUrlParam['viewUrl']);
47+
$systemParam = [
48+
'domainUrl' => null,
49+
'viewUrl' => null,
50+
];
51+
foreach ($systemParam as $k => $v) {
52+
if (isset($param[$k])) {
53+
$systemParam[$k] = $param[$k];
54+
unset($param[$k]);
55+
}
56+
}
57+
if ($processUrlPath) {
58+
$processUrl = NoneLoginOperateUtil::generateUrl($processUrlPath, $param, $systemParam['domainUrl']);
59+
$systemParam['processUrl'] = $processUrl;
5860
}
59-
$processUrl = NoneLoginOperateUtil::generateUrl($processUrlPath, $processUrlParam);
60-
self::notifyProcess($biz, $title, $content, $processUrl, array_merge($processUrlParam, [
61-
'viewUrl' => $viewUrl,
62-
]));
61+
self::notify($biz, $title, $content, array_merge($param, $systemParam));
6362
}
6463
}

module/Vendor/QuickRun/Export/ExportHandle.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,32 @@ public function performExcel()
4848
return $this->perform('xlsx', 'excel');
4949
}
5050

51-
private function perform($ext, $view)
51+
public function performCsv()
5252
{
53+
return $this->perform('xlsx', 'csv');
54+
}
55+
56+
public function performCommon($param = [])
57+
{
58+
return $this->perform(null, 'common', $param);
59+
}
60+
61+
private function perform($ext, $view, $param = [])
62+
{
63+
if (null === $ext) {
64+
$ext = 'xlsx';
65+
}
66+
if (!isset($param['formats'])) {
67+
$param['formats'] = ['xlsx', 'csv'];
68+
}
5369
$pageTitle = $this->data['pageTitle'];
5470
$defaultExportName = $this->data['defaultExportName'];
5571
$input = InputPackage::buildFromInput();
5672
$page = $input->getPage();
5773
$pageSize = $input->getPageSize(null, null, null, 100);
5874
$search = $input->getJsonAsInput('_param')->getArray('search');
5975
$exportName = $input->getTrimString('exportName', $defaultExportName);
76+
$format = $input->getTrimString('format', $ext);
6077

6178
if (Request::isPost()) {
6279
BizException::throwsIfEmpty('导出文件名为空', $exportName);
@@ -66,7 +83,7 @@ private function perform($ext, $view)
6683
$data['list'] = $paginateData['list'];
6784
$data['total'] = $paginateData['total'];
6885
$data['finished'] = count($paginateData['list']) != $pageSize;
69-
$data['exportName'] = $exportName . '.' . $ext;
86+
$data['exportName'] = $exportName . '.' . $format;
7087
$data['exportHeadTitles'] = $this->data['headTitles'];
7188
return Response::generateSuccessData($data);
7289
}
@@ -76,6 +93,7 @@ private function perform($ext, $view)
7693
'pageTitle' => $pageTitle,
7794
'exportName' => $exportName,
7895
'total' => $paginateData['total'],
96+
'formats' => $param['formats'],
7997
]);
8098
}
8199
}

module/Vendor/QuickRun/Export/ImportHandle.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,40 @@ public function handleImport($callback)
100100

101101
public function performExcel()
102102
{
103-
return $this->perform('xlsx', 'excel');
103+
return $this->perform('xlsx', 'common', [
104+
'formats' => ['xlsx'],
105+
]);
104106
}
105107

106-
private function perform($ext, $view)
108+
public function performCsv()
107109
{
110+
return $this->perform('csv', 'common', [
111+
'formats' => ['csv'],
112+
]);
113+
}
114+
115+
public function performCommon($param = [])
116+
{
117+
return $this->perform(null, 'common', $param);
118+
}
119+
120+
private function perform($ext, $view, $param = [])
121+
{
122+
if (null === $ext) {
123+
$ext = 'xlsx';
124+
}
125+
if (!isset($param['formats'])) {
126+
$param['formats'] = ['xlsx', 'csv'];
127+
}
108128
$input = InputPackage::buildFromInput();
109129
if (Request::isPost()) {
110130
$data = $input->getJson('data');
111131
AdminPermission::demoCheck();
112132
return call_user_func_array($this->importCallback, [$data, []]);
113133
}
114134
return view('module::Vendor.View.quickRun.import.' . $view, array_merge($this->data, [
115-
135+
'ext' => $ext,
136+
'formats' => $param['formats'],
116137
]));
117138
}
118139
}

0 commit comments

Comments
 (0)