Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Dfer.Site
df-php-root
提交
98c1bda2
D
df-php-root
项目概览
Dfer.Site
/
df-php-root
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
df-php-root
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
98c1bda2
编写于
4月 17, 2024
作者:
Dfer.Site
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.4.2
上级
1f184a74
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
1020 addition
and
1020 deletion
+1020
-1020
root/areas/admin/controller/BaseController.php
root/areas/admin/controller/BaseController.php
+111
-111
root/areas/admin/controller/ColumnController.php
root/areas/admin/controller/ColumnController.php
+294
-294
root/areas/admin/controller/HomeController.php
root/areas/admin/controller/HomeController.php
+444
-444
root/areas/admin/controller/LoginController.php
root/areas/admin/controller/LoginController.php
+32
-32
root/areas/admin/controller/UploadController.php
root/areas/admin/controller/UploadController.php
+15
-15
root/areas/admin/model/ConfigModel.php
root/areas/admin/model/ConfigModel.php
+2
-2
root/areas/admin/validate/LoginValidate.php
root/areas/admin/validate/LoginValidate.php
+9
-9
root/areas/homepage/controller/BaseController.php
root/areas/homepage/controller/BaseController.php
+52
-52
root/areas/homepage/controller/HomeController.php
root/areas/homepage/controller/HomeController.php
+43
-43
root/data/lang/zh-cn.php
root/data/lang/zh-cn.php
+2
-2
root/extend/Demo.php
root/extend/Demo.php
+10
-10
src/RootDirPlugin.php
src/RootDirPlugin.php
+5
-5
version
version
+1
-1
未找到文件。
root/areas/admin/controller/BaseController.php
浏览文件 @
98c1bda2
...
...
@@ -3,131 +3,131 @@ namespace areas\admin\controller;
use
areas\admin\model\
{
UserModel
};
use
Dfer\Tools\Statics\
{
Common
};
/**
* 基础类
*/
* 基础类
*/
abstract
class
BaseController
{
/**
* 初始方法
*/
function
__construct
()
{
$this
->
initialize
();
}
/**
* 初始方法
*/
function
__construct
()
{
$this
->
initialize
();
}
protected
function
initialize
()
{
$this
->
verifyLogin
(
1
);
}
protected
function
initialize
()
{
$this
->
verifyLogin
(
1
);
}
/**
* 视图
*/
public
function
view
(
$params
,
$template
=
'common'
)
{
extract
(
$params
);
// var_dump(func_get_args(),PHP_EOL,get_defined_vars());
include_once
view
(
$template
);
}
* 视图
*/
public
function
view
(
$params
,
$template
=
'common'
)
{
extract
(
$params
);
// var_dump(func_get_args(),PHP_EOL,get_defined_vars());
include_once
view
(
$template
);
}
/**
* 网页跳转的提示页面
* @param {Object} $var 变量
**/
public
function
jumpPrompt
(
$status
=
true
,
$redirect
=
\
ENUM
::
GO_BACK
,
$msg
=
""
)
{
global
$_param
;
if
(
!
is_int
(
$redirect
)){
$redirect
=
split_url
(
$redirect
);
// var_dump($url,$redirect);die;
}
message
(
view
(
'message'
,
true
),
$status
,
$redirect
,
$status
?
$msg
:
null
,
!
$status
?
$msg
:
null
);
}
/**
* 网页跳转的提示页面
* @param {Object} $var 变量
**/
public
function
jumpPrompt
(
$status
=
true
,
$redirect
=
\
ENUM
::
GO_BACK
,
$msg
=
""
)
{
global
$_param
;
if
(
!
is_int
(
$redirect
)){
$redirect
=
split_url
(
$redirect
);
// var_dump($url,$redirect);die;
}
message
(
view
(
'message'
,
true
),
$status
,
$redirect
,
$status
?
$msg
:
null
,
!
$status
?
$msg
:
null
);
}
/**
*
* 验证登陆
* ses里保存了用户的id、nm、pw
* @param {Object} $type 0 跳转 1 获取id
*/
public
function
verifyLogin
(
$type
=
0
)
{
$login
=
session_get
(
\
ENUM
::
USER_BACK
);
if
(
!
empty
(
$login
))
{
$id
=
$login
[
0
];
$nm
=
Common
::
hexToStr
(
$login
[
1
]);
$pw
=
Common
::
hexToStr
(
$login
[
2
]);
if
(
$type
==
'all'
)
{
return
array
(
$id
,
$nm
,
$pw
);
}
/**
*
* 验证登陆
* ses里保存了用户的id、nm、pw
* @param {Object} $type 0 跳转 1 获取id
*/
public
function
verifyLogin
(
$type
=
0
)
{
$login
=
session_get
(
\
ENUM
::
USER_BACK
);
if
(
!
empty
(
$login
))
{
$id
=
$login
[
0
];
$nm
=
Common
::
hexToStr
(
$login
[
1
]);
$pw
=
Common
::
hexToStr
(
$login
[
2
]);
if
(
$type
==
'all'
)
{
return
array
(
$id
,
$nm
,
$pw
);
}
$user
=
UserModel
::
where
([
'nm'
=>
$nm
])
->
first
();
$user
=
UserModel
::
where
([
'nm'
=>
$nm
])
->
first
();
if
(
$user
[
'pw'
]
==
$pw
)
{
if
(
$type
)
{
// var_dump($user['pw'] == $pw);die();
return
$id
;
}
else
{
to_url
(
'admin/home/index'
);
}
}
}
else
{
if
(
$type
)
{
to_url
(
'admin/login/index'
);
}
//header("location:?A=admin&c=login");
}
}
if
(
$user
[
'pw'
]
==
$pw
)
{
if
(
$type
)
{
// var_dump($user['pw'] == $pw);die();
return
$id
;
}
else
{
to_url
(
'admin/home/index'
);
}
}
}
else
{
if
(
$type
)
{
to_url
(
'admin/login/index'
);
}
//header("location:?A=admin&c=login");
}
}
/**
* wx公众号状态
* id不为空就设置缓存
* id为空,有缓存就读取缓存,没有就读取wx第一条数据
* @param {Object} $id
*/
public
function
wxAc
(
$id
=
''
)
{
if
(
isset
(
$_GET
[
'wx_id'
]))
{
return
$_GET
[
'wx_id'
];
}
if
(
$id
!=
''
)
{
session_set
(
'wx'
,
$id
);
return
$id
;
}
$id
=
session_get
(
'wx'
);
if
(
$id
==
""
)
{
//缓存不存在就读数据库
$dt
=
show
(
"wx"
,
-
1
);
$rt
=
$dt
[
0
][
0
];
}
else
{
//存在就直接返回
$rt
=
$id
;
}
return
$rt
;
}
/**
* wx公众号状态
* id不为空就设置缓存
* id为空,有缓存就读取缓存,没有就读取wx第一条数据
* @param {Object} $id
*/
public
function
wxAc
(
$id
=
''
)
{
if
(
isset
(
$_GET
[
'wx_id'
]))
{
return
$_GET
[
'wx_id'
];
}
if
(
$id
!=
''
)
{
session_set
(
'wx'
,
$id
);
return
$id
;
}
$id
=
session_get
(
'wx'
);
if
(
$id
==
""
)
{
//缓存不存在就读数据库
$dt
=
show
(
"wx"
,
-
1
);
$rt
=
$dt
[
0
][
0
];
}
else
{
//存在就直接返回
$rt
=
$id
;
}
return
$rt
;
}
const
SUCCESS
=
'alert-success'
;
const
ERROR
=
'alert-danger'
;
/**
* 提示
* @param {Object} $msg 变量
**/
public
function
notice
(
$msg
=
'...'
,
$type
=
self
::
ERROR
)
{
$html
=
<<<STR
<div class="alert {$type}" role="alert">{$msg}</div>
STR;
echo
$html
;
}
const
SUCCESS
=
'alert-success'
;
const
ERROR
=
'alert-danger'
;
/**
* 提示
* @param {Object} $msg 变量
**/
public
function
notice
(
$msg
=
'...'
,
$type
=
self
::
ERROR
)
{
$html
=
<<<STR
<div class="alert {$type}" role="alert">{$msg}</div>
STR;
echo
$html
;
}
/**
* 验证
* @param {Object} $var 变量
**/
public
function
validate
(
$var
=
null
)
{
return
new
$var
;
}
/**
* 验证
* @param {Object} $var 变量
**/
public
function
validate
(
$var
=
null
)
{
return
new
$var
;
}
...
...
root/areas/admin/controller/ColumnController.php
浏览文件 @
98c1bda2
...
...
@@ -6,300 +6,300 @@ use Dfer\Tools\Statics\{Common};
class
ColumnController
extends
BaseController
{
// ********************** 文章管理 START **********************
function
article
(
$param
)
{
$output
=
ArticleModel
::
order
(
'asc'
)
->
select
();
// var_dump($output);
$this
->
view
(
get_defined_vars
());
}
function
articleAdd
(
$param
)
{
$output
=
ArticleModel
::
where
(
$param
)
->
find
();
$this
->
view
(
get_defined_vars
());
}
function
articleUpdate
()
{
$dt
=
post
(
'data'
);
$id
=
post
(
'id'
);
$ret
=
ArticleModel
::
where
(
$id
)
->
update
(
$dt
);
$this
->
jumpPrompt
(
$ret
,
ArticleModel
::
getName
());
}
/**
* 删除
* @param {Object} $id
*/
function
articleDel
(
$id
)
{
$ret
=
ArticleModel
::
where
(
$id
)
->
del
();
$this
->
jumpPrompt
(
$ret
,
ArticleModel
::
getName
());
}
/**
* 富文本上传组件
* @param {Object} $name
*/
function
articleEditUp
(
$name
)
{
Common
::
showJsonBase
(
Common
::
uploadFile
(
Common
::
UPLOAD_UMEDITOR_EDITOR
));
}
/**
* 单文件上传组件
* @param {Object} $name
*/
function
articleUp
(
$name
)
{
Common
::
showJsonBase
(
Common
::
uploadFile
(
Common
::
UPLOAD_WEB_UPLOADER
));
}
// ********************** 文章管理 END **********************
// ********************** 留言管理 START **********************
public
function
message
(
$param
)
{
$output
=
MessageModel
::
order
([
"time"
=>
'desc'
])
->
select
();
$this
->
view
(
get_defined_vars
());
}
/**
* 预览
* @param {Object} $param
*/
function
messageView
(
$param
)
{
$output
=
MessageModel
::
where
(
$param
)
->
first
();
MessageModel
::
where
(
$param
)
->
update
([
"status"
=>
true
]);
$this
->
view
(
get_defined_vars
());
}
/**
* 删除留言
* @param {Object} $id
*/
function
messageDel
(
$id
)
{
$ret
=
MessageModel
::
where
(
$id
)
->
del
();
$this
->
jumpPrompt
(
$ret
,
MessageModel
::
getName
());
}
// ********************** 留言管理 END **********************
// ********************** 链接管理 START **********************
public
function
link
(
$param
)
{
$output
=
LinkModel
::
select
();
$this
->
view
(
get_defined_vars
());
}
function
linkAdd
(
$param
)
{
$output
=
LinkModel
::
where
(
$param
)
->
find
();
$this
->
view
(
get_defined_vars
());
}
function
linkUpdate
()
{
$dt
=
post
(
'data'
);
$id
=
post
(
'id'
);
$ret
=
LinkModel
::
where
(
$id
)
->
update
(
$dt
);
$this
->
jumpPrompt
(
$ret
,
LinkModel
::
getName
());
}
/**
* 删除
* @param {Object} $id
*/
function
linkDel
(
$id
)
{
$ret
=
LinkModel
::
where
(
$id
)
->
del
();
$this
->
jumpPrompt
(
$ret
,
LinkModel
::
getName
());
}
// ********************** 链接管理 END **********************
// ********************** 音乐管理 START **********************
public
function
music
(
$param
)
{
$output
=
MusicModel
::
select
();
$this
->
view
(
get_defined_vars
());
}
function
musicAdd
(
$param
)
{
$output
=
MusicModel
::
where
(
$param
)
->
find
();
$this
->
view
(
get_defined_vars
());
}
function
musicUpdate
()
{
$dt
=
post
(
'data'
);
$id
=
post
(
'id'
);
$ret
=
MusicModel
::
where
(
$id
)
->
update
(
$dt
);
// var_dump($ret);
$this
->
jumpPrompt
(
$ret
,
MusicModel
::
getName
());
}
/**
* 删除
* @param {Object} $id
*/
function
musicDel
(
$id
)
{
$ret
=
MusicModel
::
where
(
$id
)
->
del
();
$this
->
jumpPrompt
(
$ret
,
MusicModel
::
getName
());
}
// ********************** 音乐管理 END **********************
// ********************** 布局 START **********************
function
layout
(
$param
)
{
$output
=
ConfigModel
::
where
([
'key'
=>
'layout'
])
->
find
()[
'val'
];
$img
=
LayoutImgModel
::
select
();
$this
->
view
(
get_defined_vars
());
}
function
layoutUpdate
()
{
$dt
=
post
(
'data'
);
$id
=
post
(
'id'
);
$ret
=
ConfigModel
::
where
([
'key'
=>
'layout'
])
->
update
([
'val'
=>
$dt
]);
$this
->
jumpPrompt
(
$ret
,
"layout"
);
}
/**
* 主页背景图
* @param {Object} $name
*/
function
layoutPicUp
(
$name
)
{
$dt
[
'img'
]
=
Common
::
uploadFile
(
Common
::
UPLOAD_WEB_UPLOADER
);
LayoutImgModel
::
insert
(
$dt
);
//不限制尺寸
Common
::
showJsonBase
(
$dt
[
'img'
]);
}
function
layoutUp
(
$name
)
{
Common
::
showJsonBase
(
Common
::
uploadFile
(
Common
::
UPLOAD_WEB_UPLOADER
,[
'path'
=>
VIEW_ASSETS
.
'/fontFamily/font.TTF'
]));
}
/**
* 图片删除
* @param {Object} $name
*/
function
layoutPicDel
(
$name
)
{
$id
=
param
(
'id'
);
$img
=
LayoutImgModel
::
where
(
$id
)
->
first
();
$rt
=
LayoutImgModel
::
where
(
$id
)
->
del
()
.
','
;
$rt
.
=
Common
::
delFile
(
$img
[
'img'
]);
show_json
(
1
,
$rt
);
}
// ********************** 布局 END **********************
// ********************** 记事本 START **********************
public
function
notepad
(
$param
)
{
$output
=
NotepadModel
::
order
([
'time'
,
'desc'
])
->
select
();
$this
->
view
(
get_defined_vars
());
}
/**
* 修改记事本
* @param {Object} $param
*/
public
function
notepadAdd
(
$param
)
{
$output
=
NotepadModel
::
where
([
"id"
=>
$param
])
->
first
();
$this
->
view
(
get_defined_vars
());
}
/**
* 记事本上传组件
* @param {Object} $name
*/
public
function
notepadEditUp
(
$name
)
{
Common
::
showJsonBase
(
Common
::
uploadFile
(
Common
::
UPLOAD_UMEDITOR_EDITOR
));
}
/**
* 预览记事本
* @param {Object} $param
*/
public
function
notepadView
(
$param
)
{
$output
=
NotepadModel
::
where
([
"id"
=>
$param
])
->
first
();
$this
->
view
(
get_defined_vars
());
}
/**
* 更新数据
*/
public
function
notepadUpdate
()
{
$dt
=
post
(
'data'
);
$id
=
post
(
'id'
);
// var_dump($_POST);die;
$ret
=
NotepadModel
::
where
(
$id
)
->
update
(
$dt
);
$this
->
jumpPrompt
(
$ret
,
NotepadModel
::
getName
());
}
/**
* 删除
* @param {Object} $id
*/
public
function
notepadDel
(
$id
)
{
$ret
=
NotepadModel
::
where
(
$id
)
->
del
();
$this
->
jumpPrompt
(
$ret
,
NotepadModel
::
getName
());
}
public
function
notepadSs
(
$param
)
{
NotepadModel
::
showPage
(
str
(
"admin/column/
{
0
}
_ss"
,[
NotepadModel
::
getName
()]));
$this
->
view
(
get_defined_vars
());
}
/**
* 修改记事本
* @param {Object} $param
*/
public
function
notepadSsAdd
(
$param
)
{
$output
=
NotepadModel
::
where
([
"id"
=>
$param
])
->
first
();
$this
->
view
(
get_defined_vars
());
}
/**
* 删除
* @param {Object} $id
*/
public
function
notepadSsDel
(
$id
)
{
$ret
=
NotepadModel
::
where
(
$id
)
->
del
();
$this
->
jumpPrompt
(
$ret
,
str
(
"
{
0
}
_ss"
,[
NotepadModel
::
getName
()]));
}
/**
* 更新数据
*/
public
function
notepadSsUpdate
()
{
$id
=
post
(
'id'
);
$dt
=
post
(
'data'
);
$ret
=
NotepadModel
::
where
(
$id
)
->
update
(
$dt
);
$this
->
jumpPrompt
(
$ret
,
str
(
"
{
0
}
_ss"
,[
NotepadModel
::
getName
()]));
}
/**
* 预览记事本
* @param {Object} $param
*/
public
function
notepadSsView
(
$param
)
{
$output
=
NotepadModel
::
where
([
"id"
=>
$param
])
->
first
();
$this
->
view
(
get_defined_vars
());
}
// ********************** 记事本 END **********************
// ********************** 文章管理 START **********************
function
article
(
$param
)
{
$output
=
ArticleModel
::
order
(
'asc'
)
->
select
();
// var_dump($output);
$this
->
view
(
get_defined_vars
());
}
function
articleAdd
(
$param
)
{
$output
=
ArticleModel
::
where
(
$param
)
->
find
();
$this
->
view
(
get_defined_vars
());
}
function
articleUpdate
()
{
$dt
=
post
(
'data'
);
$id
=
post
(
'id'
);
$ret
=
ArticleModel
::
where
(
$id
)
->
update
(
$dt
);
$this
->
jumpPrompt
(
$ret
,
ArticleModel
::
getName
());
}
/**
* 删除
* @param {Object} $id
*/
function
articleDel
(
$id
)
{
$ret
=
ArticleModel
::
where
(
$id
)
->
del
();
$this
->
jumpPrompt
(
$ret
,
ArticleModel
::
getName
());
}
/**
* 富文本上传组件
* @param {Object} $name
*/
function
articleEditUp
(
$name
)
{
Common
::
showJsonBase
(
Common
::
uploadFile
(
Common
::
UPLOAD_UMEDITOR_EDITOR
));
}
/**
* 单文件上传组件
* @param {Object} $name
*/
function
articleUp
(
$name
)
{
Common
::
showJsonBase
(
Common
::
uploadFile
(
Common
::
UPLOAD_WEB_UPLOADER
));
}
// ********************** 文章管理 END **********************
// ********************** 留言管理 START **********************
public
function
message
(
$param
)
{
$output
=
MessageModel
::
order
([
"time"
=>
'desc'
])
->
select
();
$this
->
view
(
get_defined_vars
());
}
/**
* 预览
* @param {Object} $param
*/
function
messageView
(
$param
)
{
$output
=
MessageModel
::
where
(
$param
)
->
first
();
MessageModel
::
where
(
$param
)
->
update
([
"status"
=>
true
]);
$this
->
view
(
get_defined_vars
());
}
/**
* 删除留言
* @param {Object} $id
*/
function
messageDel
(
$id
)
{
$ret
=
MessageModel
::
where
(
$id
)
->
del
();
$this
->
jumpPrompt
(
$ret
,
MessageModel
::
getName
());
}
// ********************** 留言管理 END **********************
// ********************** 链接管理 START **********************
public
function
link
(
$param
)
{
$output
=
LinkModel
::
select
();
$this
->
view
(
get_defined_vars
());
}
function
linkAdd
(
$param
)
{
$output
=
LinkModel
::
where
(
$param
)
->
find
();
$this
->
view
(
get_defined_vars
());
}
function
linkUpdate
()
{
$dt
=
post
(
'data'
);
$id
=
post
(
'id'
);
$ret
=
LinkModel
::
where
(
$id
)
->
update
(
$dt
);
$this
->
jumpPrompt
(
$ret
,
LinkModel
::
getName
());
}
/**
* 删除
* @param {Object} $id
*/
function
linkDel
(
$id
)
{
$ret
=
LinkModel
::
where
(
$id
)
->
del
();
$this
->
jumpPrompt
(
$ret
,
LinkModel
::
getName
());
}
// ********************** 链接管理 END **********************
// ********************** 音乐管理 START **********************
public
function
music
(
$param
)
{
$output
=
MusicModel
::
select
();
$this
->
view
(
get_defined_vars
());
}
function
musicAdd
(
$param
)
{
$output
=
MusicModel
::
where
(
$param
)
->
find
();
$this
->
view
(
get_defined_vars
());
}
function
musicUpdate
()
{
$dt
=
post
(
'data'
);
$id
=
post
(
'id'
);
$ret
=
MusicModel
::
where
(
$id
)
->
update
(
$dt
);
// var_dump($ret);
$this
->
jumpPrompt
(
$ret
,
MusicModel
::
getName
());
}
/**
* 删除
* @param {Object} $id
*/
function
musicDel
(
$id
)
{
$ret
=
MusicModel
::
where
(
$id
)
->
del
();
$this
->
jumpPrompt
(
$ret
,
MusicModel
::
getName
());
}
// ********************** 音乐管理 END **********************
// ********************** 布局 START **********************
function
layout
(
$param
)
{
$output
=
ConfigModel
::
where
([
'key'
=>
'layout'
])
->
find
()[
'val'
];
$img
=
LayoutImgModel
::
select
();
$this
->
view
(
get_defined_vars
());
}
function
layoutUpdate
()
{
$dt
=
post
(
'data'
);
$id
=
post
(
'id'
);
$ret
=
ConfigModel
::
where
([
'key'
=>
'layout'
])
->
update
([
'val'
=>
$dt
]);
$this
->
jumpPrompt
(
$ret
,
"layout"
);
}
/**
* 主页背景图
* @param {Object} $name
*/
function
layoutPicUp
(
$name
)
{
$dt
[
'img'
]
=
Common
::
uploadFile
(
Common
::
UPLOAD_WEB_UPLOADER
);
LayoutImgModel
::
insert
(
$dt
);
//不限制尺寸
Common
::
showJsonBase
(
$dt
[
'img'
]);
}
function
layoutUp
(
$name
)
{
Common
::
showJsonBase
(
Common
::
uploadFile
(
Common
::
UPLOAD_WEB_UPLOADER
,[
'path'
=>
VIEW_ASSETS
.
'/fontFamily/font.TTF'
]));
}
/**
* 图片删除
* @param {Object} $name
*/
function
layoutPicDel
(
$name
)
{
$id
=
param
(
'id'
);
$img
=
LayoutImgModel
::
where
(
$id
)
->
first
();
$rt
=
LayoutImgModel
::
where
(
$id
)
->
del
()
.
','
;
$rt
.
=
Common
::
delFile
(
$img
[
'img'
]);
show_json
(
1
,
$rt
);
}
// ********************** 布局 END **********************
// ********************** 记事本 START **********************
public
function
notepad
(
$param
)
{
$output
=
NotepadModel
::
order
([
'time'
,
'desc'
])
->
select
();
$this
->
view
(
get_defined_vars
());
}
/**
* 修改记事本
* @param {Object} $param
*/
public
function
notepadAdd
(
$param
)
{
$output
=
NotepadModel
::
where
([
"id"
=>
$param
])
->
first
();
$this
->
view
(
get_defined_vars
());
}
/**
* 记事本上传组件
* @param {Object} $name
*/
public
function
notepadEditUp
(
$name
)
{
Common
::
showJsonBase
(
Common
::
uploadFile
(
Common
::
UPLOAD_UMEDITOR_EDITOR
));
}
/**
* 预览记事本
* @param {Object} $param
*/
public
function
notepadView
(
$param
)
{
$output
=
NotepadModel
::
where
([
"id"
=>
$param
])
->
first
();
$this
->
view
(
get_defined_vars
());
}
/**
* 更新数据
*/
public
function
notepadUpdate
()
{
$dt
=
post
(
'data'
);
$id
=
post
(
'id'
);
// var_dump($_POST);die;
$ret
=
NotepadModel
::
where
(
$id
)
->
update
(
$dt
);
$this
->
jumpPrompt
(
$ret
,
NotepadModel
::
getName
());
}
/**
* 删除
* @param {Object} $id
*/
public
function
notepadDel
(
$id
)
{
$ret
=
NotepadModel
::
where
(
$id
)
->
del
();
$this
->
jumpPrompt
(
$ret
,
NotepadModel
::
getName
());
}
public
function
notepadSs
(
$param
)
{
NotepadModel
::
showPage
(
str
(
"admin/column/
{
0
}
_ss"
,[
NotepadModel
::
getName
()]));
$this
->
view
(
get_defined_vars
());
}
/**
* 修改记事本
* @param {Object} $param
*/
public
function
notepadSsAdd
(
$param
)
{
$output
=
NotepadModel
::
where
([
"id"
=>
$param
])
->
first
();
$this
->
view
(
get_defined_vars
());
}
/**
* 删除
* @param {Object} $id
*/
public
function
notepadSsDel
(
$id
)
{
$ret
=
NotepadModel
::
where
(
$id
)
->
del
();
$this
->
jumpPrompt
(
$ret
,
str
(
"
{
0
}
_ss"
,[
NotepadModel
::
getName
()]));
}
/**
* 更新数据
*/
public
function
notepadSsUpdate
()
{
$id
=
post
(
'id'
);
$dt
=
post
(
'data'
);
$ret
=
NotepadModel
::
where
(
$id
)
->
update
(
$dt
);
$this
->
jumpPrompt
(
$ret
,
str
(
"
{
0
}
_ss"
,[
NotepadModel
::
getName
()]));
}
/**
* 预览记事本
* @param {Object} $param
*/
public
function
notepadSsView
(
$param
)
{
$output
=
NotepadModel
::
where
([
"id"
=>
$param
])
->
first
();
$this
->
view
(
get_defined_vars
());
}
// ********************** 记事本 END **********************
...
...
root/areas/admin/controller/HomeController.php
浏览文件 @
98c1bda2
此差异已折叠。
点击以展开。
root/areas/admin/controller/LoginController.php
浏览文件 @
98c1bda2
...
...
@@ -7,10 +7,10 @@ use Dfer\Tools\Statics\{Common};
class
LoginController
extends
BaseController
{
protected
function
initialize
()
{
protected
function
initialize
()
{
}
}
// ********************** 登陆 START **********************
public
function
index
(
$param
)
...
...
@@ -18,45 +18,45 @@ class LoginController extends BaseController{
get_web
();
$this
->
verifyLogin
();
// var_dump(post());
// var_dump(post());
//接收post
if
(
post
())
{
$user_sm
=
post
(
'data'
);
$result
=
LoginValidate
::
check
(
$user_sm
);
// var_dump($result);die;
if
(
!
$result
->
status
){
$this
->
notice
(
$result
->
error
);
}
else
{
$user
=
UserModel
::
where
([
'nm'
=>
$user_sm
[
'nm'
]])
->
first
();
if
(
$user
!=
null
)
{
if
(
$user
[
"pw"
]
==
$user_sm
[
"pw"
]
&&
$user
[
"nm"
]
==
$user_sm
[
"nm"
])
{
UserModel
::
where
(
$user
[
0
])
->
update
(
array
(
'last_login_time'
=>
Common
::
getTime
(
TIMESTAMP
)));
// 设置session在cookie的保存时间
cookie_set
(
session_name
(),
session_id
(),
SESSION_EXPIRES
);
session_set
(
\
ENUM
::
USER_BACK
,
array
(
$user
[
0
],
Common
::
strToHex
(
$user
[
"nm"
]),
Common
::
strToHex
(
$user
[
"pw"
])));
to_url
(
"admin/home/index"
);
}
}
$this
->
notice
(
'同志,请确定你的账号和密码'
);
}
$result
=
LoginValidate
::
check
(
$user_sm
);
// var_dump($result);die;
if
(
!
$result
->
status
){
$this
->
notice
(
$result
->
error
);
}
else
{
$user
=
UserModel
::
where
([
'nm'
=>
$user_sm
[
'nm'
]])
->
first
();
if
(
$user
!=
null
)
{
if
(
$user
[
"pw"
]
==
$user_sm
[
"pw"
]
&&
$user
[
"nm"
]
==
$user_sm
[
"nm"
])
{
UserModel
::
where
(
$user
[
0
])
->
update
(
array
(
'last_login_time'
=>
Common
::
getTime
(
TIMESTAMP
)));
// 设置session在cookie的保存时间
cookie_set
(
session_name
(),
session_id
(),
SESSION_EXPIRES
);
session_set
(
\
ENUM
::
USER_BACK
,
array
(
$user
[
0
],
Common
::
strToHex
(
$user
[
"nm"
]),
Common
::
strToHex
(
$user
[
"pw"
])));
to_url
(
"admin/home/index"
);
}
}
$this
->
notice
(
'同志,请确定你的账号和密码'
);
}
}
$this
->
view
(
get_defined_vars
(),
'iconShare'
);
$this
->
view
(
get_defined_vars
(),
'iconShare'
);
}
// ********************** 登陆 END **********************
// ********************** 登陆 END **********************
/**
* 数据库初始化
* @param {Object} $var 变量
**/
public
function
createDb
(
$var
=
null
)
{
global
$db
;
Mysql
::
create
(
$db
);
}
/**
* 数据库初始化
* @param {Object} $var 变量
**/
public
function
createDb
(
$var
=
null
)
{
global
$db
;
Mysql
::
create
(
$db
);
}
}
root/areas/admin/controller/UploadController.php
浏览文件 @
98c1bda2
...
...
@@ -5,23 +5,23 @@ use Dfer\Tools\Statics\{Common};
class
UploadController
extends
BaseController
{
/**
* UEDITOR
* 富文本上传组件
* @param {Object} $name
*/
function
umeditorUpload
(
$name
)
{
Common
::
showJsonBase
(
Common
::
uploadFile
(
Common
::
UPLOAD_UMEDITOR_EDITOR
,[
'name'
=>
'upfile'
]));
}
/**
* UEDITOR
* 富文本上传组件
* @param {Object} $name
*/
function
umeditorUpload
(
$name
)
{
Common
::
showJsonBase
(
Common
::
uploadFile
(
Common
::
UPLOAD_UMEDITOR_EDITOR
,[
'name'
=>
'upfile'
]));
}
/**
* WebUploader
* 文件上传组件
* @param {Object} $name
*/
function
webUpload
(
$name
)
{
Common
::
showJsonBase
(
Common
::
uploadFile
(
Common
::
UPLOAD_WEB_UPLOADER
));
}
* WebUploader
* 文件上传组件
* @param {Object} $name
*/
function
webUpload
(
$name
)
{
Common
::
showJsonBase
(
Common
::
uploadFile
(
Common
::
UPLOAD_WEB_UPLOADER
));
}
}
?>
root/areas/admin/model/ConfigModel.php
浏览文件 @
98c1bda2
...
...
@@ -4,6 +4,6 @@ use Dfer\DfPhpCore\Modules\Model;
class
ConfigModel
extends
Model
{
protected
$json
=
[
'val'
];
protected
$jsonAssoc
=
true
;
protected
$json
=
[
'val'
];
protected
$jsonAssoc
=
true
;
}
root/areas/admin/validate/LoginValidate.php
浏览文件 @
98c1bda2
...
...
@@ -4,14 +4,14 @@ use Dfer\DfPhpCore\Modules\Validate;
class
LoginValidate
extends
Validate
{
protected
$rule
=
[
'nm'
=>
'require'
,
'pw'
=>
'require'
];
protected
$message
=
[
'nm.require'
=>
'Account cannot be empty'
,
'pw.require'
=>
'Password cannot be empty'
];
protected
$rule
=
[
'nm'
=>
'require'
,
'pw'
=>
'require'
];
protected
$message
=
[
'nm.require'
=>
'Account cannot be empty'
,
'pw.require'
=>
'Password cannot be empty'
];
protected
$scene
=
[];
protected
$scene
=
[];
}
root/areas/homepage/controller/BaseController.php
浏览文件 @
98c1bda2
...
...
@@ -2,65 +2,65 @@
namespace
areas\homepage\controller
;
use
areas\admin\model\
{
UserModel
,
ConfigModel
,
MessageModel
,
RolesModel
,
UserInfoModel
,
HtmlModel
,
MenuModel
,
CacheModel
};
/**
* 基础类
*/
* 基础类
*/
abstract
class
BaseController
{
/**
* 初始方法
*/
public
function
__construct
()
{
$this
->
initialize
();
}
/**
* 初始方法
*/
public
function
__construct
()
{
$this
->
initialize
();
}
protected
function
initialize
()
{
}
protected
function
initialize
()
{
}
/**
* 视图
*/
public
function
view
(
$params
,
$template
=
'common'
)
{
extract
(
$params
);
include_once
view
(
$template
,
param
(
'area'
));
}
/**
* 视图
*/
public
function
view
(
$params
,
$template
=
'common'
)
{
extract
(
$params
);
include_once
view
(
$template
,
param
(
'area'
));
}
/**
* 收集用户信息
*/
public
function
colUserInfo
()
{
global
$_site
;
$user
=
UserInfoModel
::
where
([
'ip'
=>
IP
])
->
first
();
if
(
$user
)
{
$dt
=
array
(
'browser'
=>
$_SERVER
[
'HTTP_USER_AGENT'
]
??
null
,
'hits'
=>
$user
[
'hits'
]
+
1
,
'time'
=>
$_site
[
'time'
]);
UserInfoModel
::
where
(
$user
[
'id'
])
->
update
(
$dt
);
}
else
{
$dt
=
array
(
'ip'
=>
IP
,
'browser'
=>
$_SERVER
[
'HTTP_USER_AGENT'
],
'hits'
=>
0
,
'first_time'
=>
$_site
[
'time'
],
'time'
=>
$_site
[
'time'
]);
UserInfoModel
::
insert
(
$dt
);
}
}
/**
* 收集用户信息
*/
public
function
colUserInfo
()
{
global
$_site
;
$user
=
UserInfoModel
::
where
([
'ip'
=>
IP
])
->
first
();
if
(
$user
)
{
$dt
=
array
(
'browser'
=>
$_SERVER
[
'HTTP_USER_AGENT'
]
??
null
,
'hits'
=>
$user
[
'hits'
]
+
1
,
'time'
=>
$_site
[
'time'
]);
UserInfoModel
::
where
(
$user
[
'id'
])
->
update
(
$dt
);
}
else
{
$dt
=
array
(
'ip'
=>
IP
,
'browser'
=>
$_SERVER
[
'HTTP_USER_AGENT'
],
'hits'
=>
0
,
'first_time'
=>
$_site
[
'time'
],
'time'
=>
$_site
[
'time'
]);
UserInfoModel
::
insert
(
$dt
);
}
}
/**
* 发起zfb支付
* @param {Object} $subject 订单名称
* @param {Object} $total_amount 付款金额
* @param {Object} $body 商品描述
* @param {Object} $config_url 支付对象
* @param {Object} $para 控制回调页面显示不同的内容
*/
public
function
pay
(
$subject
,
$total_amount
,
$body
,
$config_url
,
$para
=
0
)
{
//商户订单号,商户网站订单系统中唯一订单号,必填
$out_trade_no
=
sprintf
(
"Df-%s-%s-%s"
,
TIMESTAMP
,
rand
(),
IP
);
session_set
(
'dfOrder'
,
$out_trade_no
);
$config_url
=
ROOT
.
sprintf
(
"/module/alipay/%s.php"
,
$config_url
);
$pay_url
=
ROOT
.
'/module/alipay/pagepay/pagepay.php'
;
require
$pay_url
;
}
/**
* 发起zfb支付
* @param {Object} $subject 订单名称
* @param {Object} $total_amount 付款金额
* @param {Object} $body 商品描述
* @param {Object} $config_url 支付对象
* @param {Object} $para 控制回调页面显示不同的内容
*/
public
function
pay
(
$subject
,
$total_amount
,
$body
,
$config_url
,
$para
=
0
)
{
//商户订单号,商户网站订单系统中唯一订单号,必填
$out_trade_no
=
sprintf
(
"Df-%s-%s-%s"
,
TIMESTAMP
,
rand
(),
IP
);
session_set
(
'dfOrder'
,
$out_trade_no
);
$config_url
=
ROOT
.
sprintf
(
"/module/alipay/%s.php"
,
$config_url
);
$pay_url
=
ROOT
.
'/module/alipay/pagepay/pagepay.php'
;
require
$pay_url
;
}
}
?>
root/areas/homepage/controller/HomeController.php
浏览文件 @
98c1bda2
...
...
@@ -6,49 +6,49 @@ use Dfer\DfPhpCore\Modules\Statics\{Mysql,Lang};
class
HomeController
extends
BaseController
{
/**
* 首页
* @param {Object} $param
*/
function
index
(
$param
)
{
$layout
=
ConfigModel
::
where
([
'key'
=>
'layout'
])
->
value
(
'val'
);
$column
=
ArticleModel
::
order
([
"id"
=>
"asc"
])
->
select
();
$link
=
LinkModel
::
select
();
$music
=
MusicModel
::
select
();
// var_dump($column);
//访问量
Mysql
::
run
(
"update dt set val=val+1 where `key`='hits'"
);
$this
->
colUserInfo
();
$this
->
view
(
get_defined_vars
());
}
/**
* 使用说明
* @param {Object} $param
*/
public
function
readme
(
$param
)
{
$output
=
ArticleModel
::
order
(
'asc'
)
->
select
();
$this
->
view
(
get_defined_vars
());
}
// ********************** 留言 START **********************
function
postMsg
()
{
$dt
=
post
(
'data'
);
//var_dump($dt);
$dt
[
"time"
]
=
date
(
"Y-m-d H:i:s"
);
$id
=
0
;
//add
//var_dump($id);die();
$ret
=
MessageModel
::
where
(
$id
)
->
update
(
$dt
);
show_json
(
$ret
,
null
,
'留言成功'
,
'留言失败'
);
}
// ********************** 留言 END **********************
/**
* 首页
* @param {Object} $param
*/
function
index
(
$param
)
{
$layout
=
ConfigModel
::
where
([
'key'
=>
'layout'
])
->
value
(
'val'
);
$column
=
ArticleModel
::
order
([
"id"
=>
"asc"
])
->
select
();
$link
=
LinkModel
::
select
();
$music
=
MusicModel
::
select
();
// var_dump($column);
//访问量
Mysql
::
run
(
"update dt set val=val+1 where `key`='hits'"
);
$this
->
colUserInfo
();
$this
->
view
(
get_defined_vars
());
}
/**
* 使用说明
* @param {Object} $param
*/
public
function
readme
(
$param
)
{
$output
=
ArticleModel
::
order
(
'asc'
)
->
select
();
$this
->
view
(
get_defined_vars
());
}
// ********************** 留言 START **********************
function
postMsg
()
{
$dt
=
post
(
'data'
);
//var_dump($dt);
$dt
[
"time"
]
=
date
(
"Y-m-d H:i:s"
);
$id
=
0
;
//add
//var_dump($id);die();
$ret
=
MessageModel
::
where
(
$id
)
->
update
(
$dt
);
show_json
(
$ret
,
null
,
'留言成功'
,
'留言失败'
);
}
// ********************** 留言 END **********************
}
...
...
root/data/lang/zh-cn.php
浏览文件 @
98c1bda2
<?php
return
[
'Account cannot be empty'
=>
'账号不能为空'
,
'Password cannot be empty'
=>
'密码不能为空'
,
'Account cannot be empty'
=>
'账号不能为空'
,
'Password cannot be empty'
=>
'密码不能为空'
,
];
root/extend/Demo.php
浏览文件 @
98c1bda2
...
...
@@ -3,8 +3,8 @@
/**
* +----------------------------------------------------------------------
* | 拓展示例
* | eg:
* | \Demo::nihao();
* | eg:
* | \Demo::nihao();
* +----------------------------------------------------------------------
* ... .............
* .. .:!o&*&&&&&ooooo&; .
...
...
@@ -36,12 +36,12 @@
*/
class
Demo
{
/**
* 打个招呼
* @param {Object} $var 变量
**/
public
static
function
nihao
(
$var
=
null
)
{
echo
"你好!"
;
}
/**
* 打个招呼
* @param {Object} $var 变量
**/
public
static
function
nihao
(
$var
=
null
)
{
echo
"你好!"
;
}
}
src/RootDirPlugin.php
浏览文件 @
98c1bda2
...
...
@@ -14,16 +14,16 @@ class RootDirPlugin implements PluginInterface
$vendorDir
=
$composer
->
getConfig
()
->
get
(
'vendor-dir'
);
$projectRootDir
=
dirname
(
$vendorDir
)
.
DIRECTORY_SEPARATOR
;
$moduleRootDir
=
$vendorDir
.
DIRECTORY_SEPARATOR
.
'dfer'
.
DIRECTORY_SEPARATOR
.
'df-php-root'
.
DIRECTORY_SEPARATOR
.
'root'
.
DIRECTORY_SEPARATOR
;
if
(
is_dir
(
$moduleRootDir
))
{
echo
$moduleRootDir
.
" >>> "
.
$projectRootDir
.
PHP_EOL
;
echo
$moduleRootDir
.
" >>> "
.
$projectRootDir
.
PHP_EOL
;
echo
"////////////////////////////////////////////////// 文件复制 START //////////////////////////////////////////////////"
.
PHP_EOL
;
Common
::
copyDir
(
$moduleRootDir
,
$projectRootDir
);
echo
"////////////////////////////////////////////////// 文件复制 END //////////////////////////////////////////////////"
.
PHP_EOL
;
echo
PHP_EOL
;
echo
"////////////////////////////////////////////////// 文件删除 START //////////////////////////////////////////////////"
.
PHP_EOL
;
echo
PHP_EOL
;
echo
"////////////////////////////////////////////////// 文件删除 START //////////////////////////////////////////////////"
.
PHP_EOL
;
Common
::
deleteDir
(
$moduleRootDir
);
echo
"////////////////////////////////////////////////// 文件删除 END //////////////////////////////////////////////////"
.
PHP_EOL
;
echo
"////////////////////////////////////////////////// 文件删除 END //////////////////////////////////////////////////"
.
PHP_EOL
;
}
}
...
...
version
浏览文件 @
98c1bda2
1.4.
1
1.4.
2
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录