Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
亲子游项目
backend
Commits
fb00509d
Commit
fb00509d
authored
Oct 03, 2018
by
wanggang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改后台BUG,细节
parent
18ed0222
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1141 additions
and
1682 deletions
+1141
-1682
application/admin/controller/Admin.php
+16
-16
application/admin/controller/Banner.php
+81
-70
application/admin/controller/Guide.php
+61
-55
application/admin/controller/Index.php
+6
-6
application/admin/controller/Order.php
+192
-178
application/admin/controller/Project.php
+371
-336
application/admin/view/banner/index.html
+5
-1
application/admin/view/banner/update.html
+10
-6
application/admin/view/bannner/index.html
+0
-95
application/admin/view/guide/create.html
+0
-176
application/admin/view/guide/index.html
+4
-0
application/admin/view/guide/update.html
+14
-4
application/admin/view/guide/update2.html
+0
-92
application/admin/view/order/comment.html
+7
-3
application/admin/view/order/index.html
+7
-3
application/admin/view/order/refund.html
+9
-3
application/admin/view/project/addCatalogs.html
+0
-75
application/admin/view/project/catalogs.html
+5
-1
application/admin/view/project/create1.html
+0
-324
application/admin/view/project/editcatalogs.html
+15
-4
application/admin/view/project/index.html
+98
-36
application/admin/view/project/updateproject.html
+233
-197
application/admin/view/user/index.html
+3
-1
application/mob/view/guide/read.html
+4
-0
No files found.
application/admin/controller/Admin.php
View file @
fb00509d
...
...
@@ -18,7 +18,7 @@ class Admin extends AuthBase
$map
=
array
();
if
(
$keyword
)
{
$map
[
'name'
]
=
[
'like'
,
"%"
.
$keyword
.
"%"
];
$map
[
'name'
]
=
[
'like'
,
"%"
.
$keyword
.
"%"
];
}
$admins
=
AmdinModel
::
where
(
$map
)
->
order
(
'id'
,
'desc'
)
->
paginate
(
20
,
false
,
[
...
...
@@ -34,7 +34,7 @@ class Admin extends AuthBase
/**
* 显示指定的资源
*
* @param int
$id
* @param int $id
* @return \think\Response
*/
public
function
read
(
$id
)
...
...
@@ -42,16 +42,16 @@ class Admin extends AuthBase
$admin
=
AmdinModel
::
get
(
trim
(
$id
));
if
(
$admin
)
{
$data
[
'user'
]
=
$admin
;
return
json_encode
([
'error'
=>
0
,
'msg'
=>
'获取成功'
,
'data'
=>
$data
]);
return
json_encode
([
'error'
=>
0
,
'msg'
=>
'获取成功'
,
'data'
=>
$data
]);
}
else
{
return
json_encode
([
'error'
=>
1
,
'msg'
=>
'获取失败'
]);
return
json_encode
([
'error'
=>
1
,
'msg'
=>
'获取失败'
]);
}
}
/**
* 更新
*
* @param int
$id
* @param int $id
* @return \think\Response
*/
public
function
update
(
$id
)
...
...
@@ -66,26 +66,26 @@ class Admin extends AuthBase
$admin
->
name
=
$name
;
$update
=
true
;
}
if
(
$password
&&
md5
(
$password
)
!=
$admin
->
password
)
{
if
(
$password
&&
md5
(
$password
)
!=
$admin
->
password
)
{
$admin
->
password
=
md5
(
$password
);
$update
=
true
;
}
if
(
$update
&&
$admin
->
save
())
{
// 更改当前管理员的session名称
if
(
session
(
"uid"
)
==
$admin
->
id
)
{
if
(
session
(
"uid"
)
==
$admin
->
id
)
{
session
(
'username'
,
$admin
->
name
);
}
return
json_encode
([
'error'
=>
0
,
'msg'
=>
'更新成功'
]);
}
else
{
return
json_encode
([
'error'
=>
1
,
'msg'
=>
'没有任何修改'
]);
return
json_encode
([
'error'
=>
0
,
'msg'
=>
'更新成功'
]);
}
else
{
return
json_encode
([
'error'
=>
1
,
'msg'
=>
'没有任何修改'
]);
}
}
else
{
return
json_encode
([
'error'
=>
1
,
'msg'
=>
'未找到对象'
]);
}
else
{
return
json_encode
([
'error'
=>
1
,
'msg'
=>
'未找到对象'
]);
}
}
else
{
return
json_encode
([
'error'
=>
1
,
'msg'
=>
'请求方法错误'
]);
}
else
{
return
json_encode
([
'error'
=>
1
,
'msg'
=>
'请求方法错误'
]);
}
}
}
application/admin/controller/Banner.php
View file @
fb00509d
<?php
namespace
app\admin\controller
;
use
app\admin\controller\AuthBase
;
use
app\common\model\Admin
as
AdminModel
;
use
app\admin\controller\Upload
;
class
Banner
extends
AuthBase
{
public
function
_initialize
(){
parent
::
_initialize
();
}
public
function
index
(){
$status
=
input
(
'get.status'
);
$condition
=
[];
if
(
$status
){
$condition
[
'status'
]
=
$status
;
class
Banner
extends
AuthBase
{
public
function
_initialize
()
{
parent
::
_initialize
();
}
$banner_model
=
model
(
'banner'
);
$banner_list
=
$banner_model
->
where
(
$condition
)
->
order
(
'created_at'
,
'desc'
)
->
paginate
(
10
,
false
,[
'query'
=>
[
'status'
=>
$status
]]);
$this
->
assign
(
'banner_list'
,
$banner_list
);
return
$this
->
fetch
();
}
public
function
create
(){
if
(
request
()
->
isPost
()){
$data
=
input
(
'post.'
);
$banner_model
=
model
(
'banner'
);
$upload
=
new
Upload
();
$result
=
$upload
->
sava
(
input
(
'file.image'
));
if
(
!
$result
[
'error'
]){
$image
=
$result
[
'result'
][
'url'
];
$data
[
'image'
]
=
$image
;
}
$res
=
$banner_model
->
data
(
$data
)
->
save
();
if
(
$res
){
$this
->
success
(
'添加成功'
,
url
(
'admin/banner/index'
),
''
,
1
);
}
else
{
$this
->
error
(
'添加失败'
,
''
,
''
,
1
);
}
}
else
{
return
$this
->
fetch
();
public
function
index
()
{
$status
=
input
(
'get.status'
);
$condition
=
[];
if
(
$status
)
{
$condition
[
'status'
]
=
$status
;
}
$banner_model
=
model
(
'banner'
);
$banner_list
=
$banner_model
->
where
(
$condition
)
->
order
(
'created_at'
,
'desc'
)
->
paginate
(
10
,
false
,
[
'query'
=>
[
'status'
=>
$status
]]);
$this
->
assign
(
'banner_list'
,
$banner_list
);
return
$this
->
fetch
();
}
}
public
function
update
(
$id
){
$banner_model
=
model
(
'banner'
);
$resource_model
=
model
(
'resource'
);
if
(
request
()
->
isPost
()){
$data
=
input
(
'post.'
);
if
(
input
(
'file.image'
)){
$banner_info
=
(
$banner_model
->
find
(
'id'
));
$old_image
=
$banner_info
[
'image'
];
$upload
=
new
Upload
();
$result
=
$upload
->
sava
(
input
(
'file.image'
));
if
(
!
$result
[
'error'
]){
$resource_model
->
where
(
'address'
,
$old_image
)
->
delete
();
$image
=
$result
[
'result'
][
'url'
];
$data
[
'image'
]
=
$image
;
//新建banner
public
function
create
()
{
if
(
request
()
->
isPost
())
{
$data
=
input
(
'post.'
);
$banner_model
=
model
(
'banner'
);
$upload
=
new
Upload
();
$result
=
$upload
->
sava
(
input
(
'file.image'
));
if
(
!
$result
[
'error'
])
{
$image
=
$result
[
'result'
][
'url'
];
$data
[
'image'
]
=
$image
;
}
$res
=
$banner_model
->
data
(
$data
)
->
save
();
if
(
$res
)
{
$this
->
success
(
'添加成功'
,
url
(
'admin/banner/index'
),
''
,
1
);
}
else
{
$this
->
error
(
'添加失败'
,
$_SERVER
[
'HTTP_REFERER'
],
''
,
1
);
}
}
else
{
$this
->
assign
(
'banner_info'
,
0
);
return
$this
->
fetch
(
'update'
);
}
}
$res
=
$banner_model
->
save
(
$data
,[
'id'
=>
$id
]);
if
(
$res
){
$this
->
success
(
'修改成功'
,
url
(
'admin/banner/index'
),
''
,
1
);
}
else
{
$this
->
error
(
'修改失败'
,
''
,
''
,
1
);
}
}
else
{
$banner_info
=
$banner_model
->
find
(
$id
);
$this
->
assign
(
'banner_info'
,
$banner_info
);
return
$this
->
fetch
();
}
}
public
function
delete
(){
$id
=
input
(
'post.id'
);
$res
=
model
(
'banner'
)
->
destroy
(
$id
);
$banner_info
=
model
(
'banner'
)
->
find
(
$id
);
$old_image
=
$banner_info
[
'image'
];
model
(
'resource'
)
->
where
(
'address'
,
$old_image
)
->
delete
();
if
(
$res
){
$this
->
success
(
'删除成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'删除失败'
,
''
,
''
,
1
);
//更新banner
public
function
update
(
$id
)
{
$banner_model
=
model
(
'banner'
);
if
(
request
()
->
isPost
())
{
$data
=
input
(
'post.'
);
if
(
input
(
'file.image'
))
{
$banner_info
=
(
$banner_model
->
find
(
'id'
));
$old_image
=
$banner_info
[
'image'
];
$upload
=
new
Upload
();
$result
=
$upload
->
sava
(
input
(
'file.image'
));
if
(
!
$result
[
'error'
])
{
$image
=
$result
[
'result'
][
'url'
];
$data
[
'image'
]
=
$image
;
}
}
$res
=
$banner_model
->
save
(
$data
,
[
'id'
=>
$id
]);
if
(
$res
)
{
$this
->
success
(
'修改成功'
,
url
(
'admin/banner/index'
),
''
,
1
);
}
else
{
$this
->
error
(
'修改失败'
,
$_SERVER
[
'HTTP_REFERER'
],
''
,
1
);
}
}
else
{
$banner_info
=
$banner_model
->
find
(
$id
);
$this
->
assign
(
'banner_info'
,
$banner_info
);
return
$this
->
fetch
();
}
}
//删除banner
public
function
delete
()
{
$id
=
input
(
'post.id'
);
$res
=
model
(
'banner'
)
->
destroy
(
$id
);
$banner_info
=
model
(
'banner'
)
->
find
(
$id
);
$old_image
=
$banner_info
[
'image'
];
model
(
'resource'
)
->
where
(
'address'
,
$old_image
)
->
delete
();
if
(
$res
)
{
$this
->
success
(
'删除成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'删除失败'
,
''
,
''
,
1
);
}
}
}
}
application/admin/controller/Guide.php
View file @
fb00509d
<?php
namespace
app\admin\controller
;
use
think\Db
;
...
...
@@ -16,19 +17,26 @@ class Guide extends AuthBase
// 模糊查询title
if
(
$title
)
{
$map
[
'title'
]
=
[
'like'
,
"%"
.
$title
.
"%"
];
$map
[
'title'
]
=
[
'like'
,
"%"
.
$title
.
"%"
];
}
$posts
=
PostModel
::
where
(
$map
)
->
order
(
'id desc'
)
->
paginate
(
10
);
$posts
=
model
(
'guide'
)
->
where
(
$map
)
->
order
(
'id desc'
)
->
paginate
(
10
);
$this
->
assign
(
'articles'
,
$posts
);
return
view
(
"index"
);
}
//新建攻略
public
function
create
()
{
$tag_model
=
model
(
"tags"
);
$tag_list
=
$tag_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'tag_list'
,
$tag_list
);
//反显数据处理,新建则设为空
$tag_list
=
$tag_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'tag_list'
,
$tag_list
);
$this
->
assign
(
'article'
,
0
);
$this
->
assign
(
'tag_arr'
,
[]);
$this
->
assign
(
'tags'
,
''
);
if
(
request
()
->
isPost
())
{
$type
=
input
(
"post.type"
);
$data
=
array
(
...
...
@@ -36,10 +44,10 @@ class Guide extends AuthBase
'tags'
=>
input
(
"post.tags"
),
'poster'
=>
input
(
'file.poster'
)
);
if
(
$type
==
1
)
{
$data
[
'content'
]
=
input
(
"post.content"
);
}
else
{
$data
[
'content'
]
=
input
(
"post.href"
);
if
(
$type
==
1
)
{
$data
[
'content'
]
=
input
(
"post.content"
);
}
else
{
$data
[
'content'
]
=
input
(
"post.href"
);
}
$validate
=
validate
(
'Post'
);
if
(
!
$validate
->
scene
(
'create'
)
->
check
(
$data
))
{
...
...
@@ -47,10 +55,10 @@ class Guide extends AuthBase
$this
->
assign
(
'msg'
,
$msg
);
return
view
();
}
//
上传封面到七牛云
//
上传封面到七牛云
$upload
=
new
Upload
();
$result
=
$upload
->
sava
(
input
(
'file.poster'
));
if
(
$result
[
'error'
])
{
$result
=
$upload
->
sava
(
input
(
'file.poster'
));
if
(
$result
[
'error'
])
{
$this
->
assign
(
'msg'
,
$result
[
'error'
]);
return
view
();
}
...
...
@@ -61,48 +69,49 @@ class Guide extends AuthBase
'title'
=>
$data
[
'title'
],
'type'
=>
$type
,
'intro'
=>
input
(
'post.intro'
),
'content'
=>
htmlspecialchars
(
$data
[
'content'
])
'content'
=>
htmlspecialchars
_decode
(
$data
[
'content'
])
]);
if
(
$article
->
save
())
{
$this
->
redirect
(
url
(
'@admin/Guide/index'
)
);
}
else
{
return
view
(
);
}
$this
->
success
(
'添加成功'
,
url
(
'@admin/Guide/index'
),
''
,
1
);
}
else
{
$this
->
error
(
'添加失败'
,
$_SERVER
[
'HTTP_REFERER'
],
''
,
1
);
}
}
else
{
return
view
();
return
view
(
'update'
);
}
}
/**
* 修改
文章
* 修改
攻略
*
* @return \think\Response
*/
public
function
update
(
$id
)
{
//反显数据处理
$tag_model
=
model
(
"tags"
);
$tag_list
=
$tag_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'tag_list'
,
$tag_list
);
$tag_list
=
$tag_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'tag_list'
,
$tag_list
);
$article
=
PostModel
::
get
(
$id
);
$tags
=
$article
[
'tags'
];
$this
->
assign
(
'tags'
,
$tags
);
if
(
$tags
!=
''
)
{
$tag_arr
=
explode
(
','
,
$tags
);
}
else
{
$tags
=
$article
[
'tags'
];
$this
->
assign
(
'tags'
,
$tags
);
if
(
$tags
!=
''
)
{
$tag_arr
=
explode
(
','
,
$tags
);
}
else
{
$tag_arr
=
[];
}
$this
->
assign
(
'tag_arr'
,
$tag_arr
);
$this
->
assign
(
'tag_arr'
,
$tag_arr
);
if
(
request
()
->
isPost
())
{
$type
=
input
(
"post.type"
);
$data
=
array
(
'title'
=>
input
(
"post.title"
),
'tags'
=>
input
(
"post.tags"
)
);
if
(
$type
==
1
)
{
$data
[
'content'
]
=
input
(
"post.content"
);
}
else
{
$data
[
'content'
]
=
input
(
"post.href"
);
if
(
$type
==
1
)
{
$data
[
'content'
]
=
input
(
"post.content"
);
}
else
{
$data
[
'content'
]
=
input
(
"post.href"
);
}
$validate
=
validate
(
'Post'
);
if
(
!
$validate
->
scene
(
'update'
)
->
check
(
$data
))
{
...
...
@@ -115,59 +124,56 @@ class Guide extends AuthBase
'title'
=>
$data
[
'title'
],
'intro'
=>
input
(
'post.intro'
),
'type'
=>
$type
,
'content'
=>
htmlspecialchars
(
$data
[
'content'
])
'content'
=>
htmlspecialchars
_decode
(
$data
[
'content'
])
];
if
(
input
(
'file.poster'
)){
// 上传封面到七牛云
$upload
=
new
Upload
();
$result
=
$upload
->
sava
(
input
(
'file.poster'
));
if
(
$result
[
'error'
]){
$this
->
assign
(
'msg'
,
$result
[
'error'
]);
return
view
();
}
// 将资源目录该图的引用设为0
// $resource_model = model('Resource');
// $res = $resource_model->where('address',input('post.old_poster'))->setDec("use_num");
$condition
[
'poster'
]
=
$result
[
'result'
][
'url'
];
if
(
input
(
'file.poster'
))
{
//上传封面到七牛云
$upload
=
new
Upload
();
$result
=
$upload
->
sava
(
input
(
'file.poster'
));
if
(
$result
[
'error'
])
{
$this
->
assign
(
'msg'
,
$result
[
'error'
]);
return
view
();
}
$condition
[
'poster'
]
=
$result
[
'result'
][
'url'
];
}
$res
=
model
(
'post'
)
->
save
(
$condition
,
[
'id'
=>
$id
]);
$res
=
model
(
'post'
)
->
save
(
$condition
,
[
'id'
=>
$id
]);
if
(
$res
)
{
$this
->
redirect
(
url
(
'@admin/Guide/index'
)
);
$this
->
success
(
'修改成功'
,
url
(
'@admin/Guide/index'
),
''
,
1
);
}
else
{
return
view
(
);
$this
->
success
(
'修改失败'
,
$_SERVER
[
'HTTP_REFERER'
],
''
,
1
);
}
}
else
{
}
else
{
$this
->
assign
(
'article'
,
$article
);
return
view
();
}
}
/**
* 删除
文章
* 删除
攻略
*
* @return \think\Response
*/
*/
public
function
delete
()
{
$result
[
"error"
]
=
0
;
$result
[
"msg"
]
=
'删除成功'
;
if
(
request
()
->
isPost
()
)
{
if
(
request
()
->
isPost
()
)
{
$id
=
input
(
"post.id"
);
$article
=
PostModel
::
get
(
$id
);
if
(
$article
)
{
if
(
$article
->
delete
()
)
{
if
(
$article
)
{
if
(
$article
->
delete
())
{
}
else
{
}
else
{
$result
[
"error"
]
=
1
;
$result
[
"msg"
]
=
'删除失败!'
;
}
}
else
{
}
else
{
$result
[
"error"
]
=
1
;
$result
[
"msg"
]
=
'删除对象不存在'
;
}
}
else
{
}
else
{
$result
[
"error"
]
=
1
;
$result
[
"msg"
]
=
'不支持的请求方法'
;
}
...
...
application/admin/controller/Index.php
View file @
fb00509d
...
...
@@ -20,26 +20,26 @@ class Index extends AuthBase
$comment_model
=
model
(
'comment'
);
$refund_model
=
model
(
'refund'
);
//
统计用户总数
//
统计用户总数
$user_num
=
$user_model
->
count
();
$this
->
assign
(
'user_num'
,
$user_num
);
//
统计今日新增用户数
//
统计今日新增用户数
$user_num_today
=
$user_model
->
where
(
'created_at'
,
'>'
,
date
(
'Y-m-d'
,
time
())
.
' 00:00:00'
)
->
count
();
$this
->
assign
(
'user_num_today'
,
$user_num_today
);
//
统计订单总数
//
统计订单总数
$order_num
=
$order_model
->
count
();
$this
->
assign
(
'order_num'
,
$order_num
);
//
统计今日订单总数
//
统计今日订单总数
$order_num_today
=
$order_model
->
where
(
'created_at'
,
'>'
,
date
(
'Y-m-d'
,
time
())
.
' 00:00:00'
)
->
count
();
$this
->
assign
(
'order_num_today'
,
$order_num_today
);
//
统计待审核退款
//
统计待审核退款
$wait_num_r
=
$refund_model
->
where
(
'status'
,
1
)
->
count
();
$this
->
assign
(
'wait_num_r'
,
$wait_num_r
);
//
统计待审核评论
//
统计待审核评论
$wait_num_c
=
$comment_model
->
where
(
'status'
,
1
)
->
count
();
$this
->
assign
(
'wait_num_c'
,
$wait_num_c
);
...
...
application/admin/controller/Order.php
View file @
fb00509d
<?php
namespace
app\admin\controller
;
use
app\admin\controller\AuthBase
;
class
Order
extends
AuthBase
{
protected
$order_model
;
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
order_model
=
model
(
'Order'
);
}
// 订单列表
public
function
index
(){
$status
=
input
(
'get.status'
,
'-1'
);
$id
=
input
(
'get.id'
);
$start_time
=
input
(
'get.start_time'
);
$end_time
=
input
(
'get.end_time'
);
$type
=
input
(
'get.type'
);
$condition
=
[];
if
(
$status
!=
'-1'
){
$condition
[
'status'
]
=
$status
;
}
if
(
$id
){
$condition
[
'id'
]
=
$id
;
}
if
(
$type
){
$condition
[
'type'
]
=
$type
;
}
if
(
$start_time
&&
$end_time
){
$condition
[
'created_at'
]
=
[
'between'
,[
$start_time
.
' 00:00:00'
,
$end_time
.
' 00:00:00'
]];
}
else
{
if
(
$start_time
){
$condition
[
'created_at'
]
=
[
'>'
,
$start_time
.
' 00:00:00'
];
}
elseif
(
$end_time
){
$condition
[
'created_at'
]
=
[
'<'
,
$end_time
.
' 00:00:00'
];
}
}
$order_list
=
$this
->
order_model
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
paginate
(
10
,
false
,[
'query'
=>
[
'status'
=>
$status
,
'start_time'
=>
$start_time
,
'end_time'
=>
$end_time
,
'type'
=>
$type
]]);
$this
->
assign
(
"order_list"
,
$order_list
);
$this
->
assign
(
"status"
,
$status
);
return
$this
->
fetch
();
}
public
function
orderOutput
(){
$status
=
input
(
'get.status'
,
'-1'
);
$start_time
=
input
(
'get.start_time'
);
$end_time
=
input
(
'get.end_time'
);
$type
=
input
(
'get.type'
);
$condition
=
[];
if
(
$status
!=
'-1'
){
$condition
[
'status'
]
=
$status
;
}
if
(
$type
){
$condition
[
'type'
]
=
$type
;
}
if
(
$start_time
&&
$end_time
){
$condition
[
'created_at'
]
=
[
'between'
,[
$start_time
.
' 00:00:00'
,
$end_time
.
' 00:00:00'
]];
}
else
{
if
(
$start_time
){
$condition
[
'created_at'
]
=
[
'>'
,
$start_time
.
' 00:00:00'
];
}
elseif
(
$end_time
){
$condition
[
'created_at'
]
=
[
'<'
,
$end_time
.
' 00:00:00'
];
}
}
$order_list
=
$this
->
order_model
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
select
();
// 导出用户信息、活动信息、订单信息,如:姓名、手机号、活动名称、价格、家庭组数、大人数量、孩子数量、孩子年龄、备注等
//导出到excel数据处理
$mulit_arr
=
[];
$mulit_arr
[
'data'
]
=
[];
$cont
=
[[
'订单标题'
,
'订单来源'
,
'用户名'
,
'电话'
,
'vip购买信息'
,
'活动名称'
,
'活动价格'
,
'家庭组数'
,
'大人数量'
,
'孩子数量'
,
'孩子年龄'
,
'订单总价'
,
'下单时间'
,
'订单状态'
]];
// [
// 'data'=>
// [
// [
// ['昵称','性别','电话','是否是会员','注册时间','更新时间','会员到期时间'],
// ['a','b','c'],
// ['d','e','f']
// ]
// ],
// 'sheet'=>
// [
// ['title'=>'工作空间1名称'],
// ['title'=>'工作空间2名称'],
// ]
// ];
foreach
(
$order_list
as
$vo
){
$arr
=
[];
$arr
[]
=
$vo
[
'title'
];
$arr
[]
=
$vo
[
'type'
]
==
1
?
'活动报名'
:
'购买会员卡订单'
;
$arr
[]
=
$vo
->
user_info
[
'nickname'
];
$arr
[]
=
$vo
->
user_info
[
'phone'
];
$arr
[]
=
isset
(
$vo
[
'extras'
][
'vip_endtime'
])
?
$vo
[
'extras'
][
'vip_endtime'
]
.
'到期'
:
''
;
$arr
[]
=
$vo
->
project
[
'title'
];
$arr
[]
=
$vo
->
project
[
'price'
];
$arr
[]
=
isset
(
$vo
[
'extras'
][
'sign_limits'
])
?
$vo
[
'extras'
][
'sign_limits'
]
:
''
;
$arr
[]
=
isset
(
$vo
[
'extras'
][
'adult_number'
])
?
$vo
[
'extras'
][
'adult_number'
]
:
''
;
$arr
[]
=
isset
(
$vo
[
'extras'
][
'children_number'
])
?
$vo
[
'extras'
][
'children_number'
]
:
''
;
$arr
[]
=
isset
(
$vo
[
'extras'
][
'children_age'
])
?
$vo
[
'extras'
][
'children_age'
]
:
''
;
$arr
[]
=
$vo
[
'total_fee'
];
$arr
[]
=
$vo
[
'created_at'
];
$arr
[]
=
$vo
->
status_text
;
protected
$order_model
;
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
order_model
=
model
(
'Order'
);
}
// $arr[] = $vo['extras'];
// $arr[] = $vo['extras'];
// $arr[] = $vo['extras'];
// $arr[] = $vo['extras'];
// $arr[] = $vo['extras'];
$cont
[]
=
$arr
;
}
$mulit_arr
[
'data'
][]
=
$cont
;
$mulit_arr
[
'sheet'
]
=
[[
'title'
=>
'用户信息表'
]];
// dump($mulit_arr);
// return;
/*调用*/
$title
=
'订单表'
;
//这是标题
$Subject
=
''
;
//这是备注
$Description
=
'美行者订单导出'
;
//这是描述;
$Keywords
=
''
;
//这是关键字
$Category
=
''
;
//这是分类
$filename
=
'美行者订单导出'
;
//文件名
$obj
=
new
OutputExcel
();
$obj
->
export
(
$mulit_arr
,
$filename
,
$title
,
$Subject
,
$Description
,
$Keywords
,
$Category
);
}
// 退款审核
public
function
refund
(){
$id
=
input
(
'get.id'
);
$status
=
input
(
'get.status'
,
'-1'
);
$condition
=
[];
if
(
$status
!=
'-1'
){
$condition
[
'status'
]
=
$status
;
}
if
(
$id
){
$condition
[
'id'
]
=
$id
;
}
$refund_list
=
model
(
'Refund'
)
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
paginate
(
10
,
false
,[
'query'
=>
[
'status'
=>
$status
]]);
$this
->
assign
(
'status'
,
$status
);
$this
->
assign
(
'refund_list'
,
$refund_list
);
return
$this
->
fetch
();
}
// 评论审核
public
function
comment
(){
$id
=
input
(
'get.id'
);
$status
=
input
(
'get.status'
,
'-1'
);
$condition
=
[];
if
(
$status
!=
'-1'
){
$condition
[
'status'
]
=
$status
;
}
if
(
$id
){
$condition
[
'id'
]
=
$id
;
}
$comment_list
=
model
(
'comment'
)
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
paginate
(
10
,
false
,[
'query'
=>
[
'status'
=>
$status
]]);
$this
->
assign
(
'status'
,
$status
);
$this
->
assign
(
'comment_list'
,
$comment_list
);
return
$this
->
fetch
();
}
public
function
commentStatus
(
$status
,
$id
){
$comment_model
=
model
(
'comment'
);
$res
=
$comment_model
->
save
([
'status'
=>
$status
],[
'id'
=>
$id
]);
if
(
$status
==
2
){
$is_comment
=
3
;
}
elseif
(
$status
==
3
){
$is_comment
=
2
;
//订单列表
public
function
index
()
{
//搜索筛选
$status
=
input
(
'get.status'
,
'-1'
);
$id
=
input
(
'get.id'
);
$start_time
=
input
(
'get.start_time'
);
$end_time
=
input
(
'get.end_time'
);
$type
=
input
(
'get.type'
);
$condition
=
[];
//判断如果存在筛选字段,将其添加到筛选数组$condition中
if
(
$status
!=
'-1'
)
{
$condition
[
'status'
]
=
$status
;
}
if
(
$id
)
{
$condition
[
'id'
]
=
$id
;
}
if
(
$type
)
{
$condition
[
'type'
]
=
$type
;
}
if
(
$start_time
&&
$end_time
)
{
$condition
[
'created_at'
]
=
[
'between'
,
[
$start_time
.
' 00:00:00'
,
$end_time
.
' 00:00:00'
]];
}
else
{
if
(
$start_time
)
{
$condition
[
'created_at'
]
=
[
'>'
,
$start_time
.
' 00:00:00'
];
}
elseif
(
$end_time
)
{
$condition
[
'created_at'
]
=
[
'<'
,
$end_time
.
' 00:00:00'
];
}
}
//根据筛选条件查询
$order_list
=
$this
->
order_model
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
paginate
(
10
,
false
,
[
'query'
=>
[
'status'
=>
$status
,
'start_time'
=>
$start_time
,
'end_time'
=>
$end_time
,
'type'
=>
$type
]]);
$this
->
assign
(
"order_list"
,
$order_list
);
$this
->
assign
(
"status"
,
$status
);
return
$this
->
fetch
();
}
$status_str
=
array
(
'2'
=>
'请求成功,已审核通过该评论'
,
'3'
=>
'请求成功,该评论审核不通过'
);
if
(
$res
){
$comment_info
=
$comment_model
->
get
(
$id
);
if
(
$comment_info
){
$set_order_res
=
model
(
'order'
)
->
save
([
'is_comment'
=>
$is_comment
],[
'id'
=>
$comment_info
[
'order_id'
]]);
}
$this
->
success
(
$status_str
[
$status
]);
}
else
{
$this
->
error
(
'修改失败,本次审核无效'
);
//订单表导出
public
function
orderOutput
()
{
//根据筛选条件查询数据
$status
=
input
(
'get.status'
,
'-1'
);
$start_time
=
input
(
'get.start_time'
);
$end_time
=
input
(
'get.end_time'
);
$type
=
input
(
'get.type'
);
$condition
=
[];
if
(
$status
!=
'-1'
)
{
$condition
[
'status'
]
=
$status
;
}
if
(
$type
)
{
$condition
[
'type'
]
=
$type
;
}
if
(
$start_time
&&
$end_time
)
{
$condition
[
'created_at'
]
=
[
'between'
,
[
$start_time
.
' 00:00:00'
,
$end_time
.
' 00:00:00'
]];
}
else
{
if
(
$start_time
)
{
$condition
[
'created_at'
]
=
[
'>'
,
$start_time
.
' 00:00:00'
];
}
elseif
(
$end_time
)
{
$condition
[
'created_at'
]
=
[
'<'
,
$end_time
.
' 00:00:00'
];
}
}
$order_list
=
$this
->
order_model
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
select
();
//导出用户信息、活动信息、订单信息,如:姓名、手机号、活动名称、价格、家庭组数、大人数量、孩子数量、孩子年龄、备注等
//导出到excel之前数据处理
$mulit_arr
=
[];
$mulit_arr
[
'data'
]
=
[];
$cont
=
[[
'订单标题'
,
'订单来源'
,
'用户名'
,
'电话'
,
'vip购买信息'
,
'活动名称'
,
'活动价格'
,
'家庭组数'
,
'大人数量'
,
'孩子数量'
,
'孩子年龄'
,
'订单总价'
,
'下单时间'
,
'订单状态'
]];
foreach
(
$order_list
as
$vo
)
{
$arr
=
[];
$arr
[]
=
$vo
[
'title'
];
$arr
[]
=
$vo
[
'type'
]
==
1
?
'活动报名'
:
'购买会员卡订单'
;
$arr
[]
=
$vo
->
user_info
[
'nickname'
];
$arr
[]
=
$vo
->
user_info
[
'phone'
];
$arr
[]
=
isset
(
$vo
[
'extras'
][
'vip_endtime'
])
?
$vo
[
'extras'
][
'vip_endtime'
]
.
'到期'
:
''
;
$arr
[]
=
$vo
->
project
[
'title'
];
$arr
[]
=
$vo
->
project
[
'price'
];
$arr
[]
=
isset
(
$vo
[
'extras'
][
'sign_limits'
])
?
$vo
[
'extras'
][
'sign_limits'
]
:
''
;
$arr
[]
=
isset
(
$vo
[
'extras'
][
'adult_number'
])
?
$vo
[
'extras'
][
'adult_number'
]
:
''
;
$arr
[]
=
isset
(
$vo
[
'extras'
][
'children_number'
])
?
$vo
[
'extras'
][
'children_number'
]
:
''
;
$arr
[]
=
isset
(
$vo
[
'extras'
][
'children_age'
])
?
$vo
[
'extras'
][
'children_age'
]
:
''
;
$arr
[]
=
$vo
[
'total_fee'
];
$arr
[]
=
$vo
[
'created_at'
];
$arr
[]
=
$vo
->
status_text
;
$cont
[]
=
$arr
;
}
$mulit_arr
[
'data'
][]
=
$cont
;
$mulit_arr
[
'sheet'
]
=
[[
'title'
=>
'用户信息表'
]];
$title
=
'订单表'
;
//这是标题
$Subject
=
''
;
//这是备注
$Description
=
'美行者订单导出'
;
//这是描述;
$Keywords
=
''
;
//这是关键字
$Category
=
''
;
//这是分类
$filename
=
'美行者订单导出'
;
//文件名
$obj
=
new
OutputExcel
();
/*调用excle导出类*/
$obj
->
export
(
$mulit_arr
,
$filename
,
$title
,
$Subject
,
$Description
,
$Keywords
,
$Category
);
}
}
public
function
refundStatus
(
$status
,
$id
){
//退款审核 未完成
public
function
refund
()
{
$id
=
input
(
'get.id'
);
$status
=
input
(
'get.status'
,
'-1'
);
$condition
=
[];
if
(
$status
!=
'-1'
)
{
$condition
[
'status'
]
=
$status
;
}
if
(
$id
)
{
$condition
[
'id'
]
=
$id
;
}
$refund_list
=
model
(
'Refund'
)
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
paginate
(
10
,
false
,
[
'query'
=>
[
'status'
=>
$status
]]);
$this
->
assign
(
'status'
,
$status
);
$this
->
assign
(
'refund_list'
,
$refund_list
);
return
$this
->
fetch
();
}
//评论审核
public
function
comment
()
{
$id
=
input
(
'get.id'
);
$status
=
input
(
'get.status'
,
'-1'
);
$condition
=
[];
if
(
$status
!=
'-1'
)
{
$condition
[
'status'
]
=
$status
;
}
if
(
$id
)
{
$condition
[
'id'
]
=
$id
;
}
$comment_list
=
model
(
'comment'
)
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
paginate
(
10
,
false
,
[
'query'
=>
[
'status'
=>
$status
]]);
$this
->
assign
(
'status'
,
$status
);
$this
->
assign
(
'comment_list'
,
$comment_list
);
return
$this
->
fetch
();
}
public
function
commentStatus
(
$status
,
$id
)
{
$comment_model
=
model
(
'comment'
);
$res
=
$comment_model
->
save
([
'status'
=>
$status
],
[
'id'
=>
$id
]);
if
(
$status
==
2
)
{
$is_comment
=
3
;
}
elseif
(
$status
==
3
)
{
$is_comment
=
2
;
}
$status_str
=
array
(
'2'
=>
'请求成功,已审核通过该评论'
,
'3'
=>
'请求成功,该评论审核不通过'
);
if
(
$res
)
{
$comment_info
=
$comment_model
->
get
(
$id
);
if
(
$comment_info
)
{
$save_condition
=
[];
$save_condition
[
'is_comment'
]
=
$is_comment
;
$order_info
=
model
(
'order'
)
->
get
(
$comment_info
[
'order_id'
]);
if
(
$status
==
2
)
{
//评论审核成功
//如果订单状态为待评价,则修改状态为已完成
if
(
$order_info
[
'status'
]
==
config
(
'order_status.wait_comment'
))
{
$save_condition
[
'status'
]
=
config
(
'order_status.complete'
);
};
}
elseif
(
$status
==
3
)
{
//评论审核失败
if
(
$order_info
[
'status'
]
==
config
(
'order_status.complete'
))
{
$save_condition
[
'status'
]
=
config
(
'order_status.wait_comment'
);
}
}
$set_order_res
=
model
(
'order'
)
->
save
(
$save_condition
,
[
'id'
=>
$comment_info
[
'order_id'
]]);
}
$this
->
success
(
$status_str
[
$status
]);
}
else
{
$this
->
error
(
'修改失败,本次审核无效'
);
}
}
public
function
refundStatus
(
$status
,
$id
)
{
$refund_model
=
model
(
'refund'
);
$res
=
$refund_model
->
save
([
'status'
=>
$status
],
[
'id'
=>
$id
]);
if
(
$status
==
2
)
{
$res
=
$refund_model
->
save
([
'status'
=>
$status
],
[
'id'
=>
$id
]);
if
(
$status
==
2
)
{
$is_refund
=
3
;
}
elseif
(
$status
==
3
)
{
}
elseif
(
$status
==
3
)
{
$is_refund
=
2
;
}
$status_str
=
array
(
'2'
=>
'请求成功,已退款'
,
'3'
=>
'请求成功,已驳回该退款申请'
'2'
=>
'请求成功,已退款'
,
'3'
=>
'请求成功,已驳回该退款申请'
);
if
(
$res
)
{
if
(
$res
)
{
$refund_info
=
$refund_model
->
get
(
$id
);
if
(
$refund_info
)
{
$set_order_res
=
model
(
'order'
)
->
save
([
'is_refund'
=>
$is_refund
],[
'id'
=>
$refund_info
[
'order_id'
]]);
if
(
$refund_info
)
{
$set_order_res
=
model
(
'order'
)
->
save
([
'is_refund'
=>
$is_refund
],
[
'id'
=>
$refund_info
[
'order_id'
]]);
}
$this
->
success
(
$status_str
[
$status
]);
}
else
{
}
else
{
$this
->
error
(
'修改失败,本次审核无效'
);
}
}
...
...
application/admin/controller/Project.php
View file @
fb00509d
...
...
@@ -5,7 +5,9 @@
* Date: 2018/9/13
* Time: 20:59
*/
namespace
app\admin\controller
;
use
app\admin\controller\AuthBase
;
use
app\common\model\Admin
as
AdminModel
;
use
app\admin\controller\Upload
;
...
...
@@ -16,6 +18,7 @@ class Project extends AuthBase
protected
$city_model
;
protected
$catalog_model
;
protected
$project_model
;
public
function
_initialize
()
{
$this
->
project_model
=
model
(
"project"
);
...
...
@@ -24,433 +27,465 @@ class Project extends AuthBase
$this
->
catalog_model
=
model
(
"Catalogs"
);
parent
::
_initialize
();
}
//活动列表
public
function
index
(){
// $title = input('get.title','');
// $city = input('get.city','');
// $tags = input('get.tags','');
// $catalogs = input('get.catalogs','');
// $this->project_mode->where('title','like',"%".$title."%")
// ->where(function($query,$tags){
// $tag_arr = explode(',',$tags);
//
// });
$title
=
input
(
'get.title'
);
$type
=
input
(
'get.type'
);
$catalog_id
=
input
(
'get.catalog_id'
);
$condition
=
[];
if
(
$title
){
$condition
[
'title'
]
=
[
'like'
,
"%"
.
$title
.
"%"
];
}
if
(
$type
){
$condition
[
'type'
]
=
$type
;
}
if
(
$catalog_id
){
$condition
[
'catalog_id'
]
=
$catalog_id
;
}
$catalog_list
=
$this
->
catalog_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'catalog_list'
,
$catalog_list
);
$project_list
=
$this
->
project_model
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
paginate
(
10
,
false
,[
'query'
=>
[
'title'
=>
$title
,
'type'
=>
$type
,
'catalog_id'
=>
$catalog_id
]]);
$this
->
assign
(
'project_list'
,
$project_list
);
return
$this
->
fetch
(
''
);
}
// 添加项目
public
function
create
(){
//活动列表
public
function
index
()
{
if
(
request
()
->
isPost
())
{
// 引入上传类
$upload
=
new
Upload
();
$file
=
input
(
'file.'
);
$data
=
input
(
'post.'
);
$poster
=
''
;
$kf_qrcode
=
''
;
$banners
=
[];
if
(
$data
[
'type'
]
==
2
){
$result
=
$upload
->
sava
(
$file
[
'kf_qrcode'
]);
if
(
!
$result
[
'error'
]){
$kf_qrcode
=
$result
[
'result'
][
'url'
];
$data
[
'kf_qrcode'
]
=
$kf_qrcode
;
}
$title
=
input
(
'get.title'
);
$type
=
input
(
'get.type'
);
$catalog_id
=
input
(
'get.catalog_id'
);
$condition
=
[];
if
(
$title
)
{
$condition
[
'title'
]
=
[
'like'
,
"%"
.
$title
.
"%"
];
}
$result
=
$upload
->
sava
(
$file
[
'poster'
]);
if
(
!
$result
[
'error'
]){
$poster
=
$result
[
'result'
][
'url'
];
$data
[
'poster'
]
=
$poster
;
if
(
$type
)
{
$condition
[
'type'
]
=
$type
;
}
foreach
(
$file
[
'banners'
]
as
$name
=>
$f
)
{
$result
=
$upload
->
sava
(
$f
);
if
(
!
$result
[
'error'
]){
$banners
[]
=
$result
[
'result'
][
'url'
];
$data
[
'banners'
]
=
json_encode
(
$banners
);
}
if
(
$catalog_id
)
{
$condition
[
'catalog_id'
]
=
$catalog_id
;
}
// $result = $upload -> sava(input('file.banners'));
//写入数据库
// $data['description'] = htmlspecialchars($data['description']);
$res
=
$this
->
project_model
->
data
(
$data
)
->
save
();
if
(
$res
){
$this
->
success
(
'添加成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'添加到数据库失败'
,
''
,
''
,
1
);
$catalog_list
=
$this
->
catalog_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'catalog_list'
,
$catalog_list
);
$project_list
=
$this
->
project_model
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
paginate
(
10
,
false
,
[
'query'
=>
[
'title'
=>
$title
,
'type'
=>
$type
,
'catalog_id'
=>
$catalog_id
]]);
$this
->
assign
(
'project_list'
,
$project_list
);
return
$this
->
fetch
(
''
);
}
// 添加项目
public
function
create
()
{
if
(
request
()
->
isPost
())
{
// 引入上传类
$upload
=
new
Upload
();
$file
=
input
(
'file.'
);
$data
=
input
(
'post.'
);
$poster
=
''
;
$kf_qrcode
=
''
;
$banners
=
[];
//如果是商家则保存客服二维码
if
(
$data
[
'type'
]
==
2
)
{
$result
=
$upload
->
sava
(
$file
[
'kf_qrcode'
]);
if
(
!
$result
[
'error'
])
{
$kf_qrcode
=
$result
[
'result'
][
'url'
];
$data
[
'kf_qrcode'
]
=
$kf_qrcode
;
}
}
//保存封面
$result
=
$upload
->
sava
(
$file
[
'poster'
]);
if
(
!
$result
[
'error'
])
{
$poster
=
$result
[
'result'
][
'url'
];
$data
[
'poster'
]
=
$poster
;
}
//遍历banner数组并保存
foreach
(
$file
[
'banners'
]
as
$name
=>
$f
)
{
$result
=
$upload
->
sava
(
$f
);
if
(
!
$result
[
'error'
])
{
$banners
[]
=
$result
[
'result'
][
'url'
];
$data
[
'banners'
]
=
json_encode
(
$banners
);
}
}
//写入数据库
$res
=
$this
->
project_model
->
data
(
$data
)
->
save
();
if
(
$res
)
{
$this
->
success
(
'添加成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'添加到数据库失败'
,
''
,
''
,
1
);
}
}
else
{
$tag_list
=
$this
->
tag_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'tag_list'
,
$tag_list
);
$catalog_list
=
$this
->
catalog_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'catalog_list'
,
$catalog_list
);
$city_list
=
$this
->
city_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'city_list'
,
$city_list
);
$this
->
assign
(
'project_info'
,
0
);
$this
->
assign
(
'tags'
,
0
);
return
$this
->
fetch
(
'updateproject'
);
}
}
else
{
$tag_list
=
$this
->
tag_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'tag_list'
,
$tag_list
);
$catalog_list
=
$this
->
catalog_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'catalog_list'
,
$catalog_list
);
$city_list
=
$this
->
city_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'city_list'
,
$city_list
);
return
$this
->
fetch
();
}
}
public
function
delete
(){
$id
=
input
(
'post.id'
);
$used
=
model
(
'Orders'
)
->
where
(
'pid'
,
$id
)
->
count
();
if
(
$used
>
0
){
$this
->
error
(
'该项目已有用户下单,不可删除!'
,
''
,
''
,
1
);
}
//删除项目、商家
public
function
delete
()
{
$id
=
input
(
'post.id'
);
$used
=
model
(
'Orders'
)
->
where
(
'pid'
,
$id
)
->
count
();
if
(
$used
>
0
)
{
$this
->
error
(
'该项目已有用户下单,不可删除!'
,
''
,
''
,
1
);
}
$res
=
model
(
'project'
)
->
destroy
(
$id
);
if
(
$res
)
{
$this
->
success
(
'删除成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'删除失败'
,
''
,
''
,
1
);
}
$res
=
model
(
'project'
)
->
destroy
(
$id
);
if
(
$res
)
{
$this
->
success
(
'删除成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'删除失败'
,
''
,
''
,
1
);
}
}
// 修改项目
public
function
updateProject
(
$id
){
if
(
request
()
->
isPost
())
{
// 引入上传类
$id
=
input
(
'post.id'
);
$upload
=
new
Upload
();
$file
=
input
(
'file.'
);
$data
=
input
(
'post.'
);
$data
=
array_merge
(
array_diff
(
$data
,
array
(
'id'
=>
$id
)));
$poster
=
''
;
$kf_qrcode
=
''
;
$banners
=
[];
$project_info
=
$this
->
project_model
->
find
(
$id
);
// 修改项目
public
function
updateProject
(
$id
)
{
$old_banners
=
json_decode
(
$project_info
[
'banners_native'
]);
$old_poster
=
$project_info
[
'poster'
];
$old_kf_qrcode
=
$project_info
[
'kf_qrcode'
];
if
(
request
()
->
isPost
())
{
// 引入上传类
$id
=
input
(
'post.id'
);
$upload
=
new
Upload
();
$file
=
input
(
'file.'
);
$data
=
input
(
'post.'
);
$data
=
array_merge
(
array_diff
(
$data
,
array
(
'id'
=>
$id
)));
$poster
=
''
;
$kf_qrcode
=
''
;
$banners
=
[];
$project_info
=
$this
->
project_model
->
find
(
$id
);
// $resource_model = model('resource');
$old_banners
=
json_decode
(
$project_info
[
'banners_native'
]);
$old_poster
=
$project_info
[
'poster'
];
$old_kf_qrcode
=
$project_info
[
'kf_qrcode'
];
if
(
$data
[
'type'
]
==
2
){
if
(
input
(
'file.kf_qrcode'
)){
$result
=
$upload
->
sava
(
input
(
'file.kf_qrcode'
));
if
(
!
$result
[
'error'
]){
// $resource_model -> where('address',$old_kf_qrcode)->delete();
$kf_qrcode
=
$result
[
'result'
][
'url'
];
$data
[
'kf_qrcode'
]
=
$kf_qrcode
;
//如果是商家则保存客服二维码
if
(
$data
[
'type'
]
==
2
)
{
if
(
input
(
'file.kf_qrcode'
))
{
$result
=
$upload
->
sava
(
input
(
'file.kf_qrcode'
));
if
(
!
$result
[
'error'
])
{
$kf_qrcode
=
$result
[
'result'
][
'url'
];
$data
[
'kf_qrcode'
]
=
$kf_qrcode
;
}
}
}
}
}
if
(
input
(
'file.poster'
)){
$result
=
$upload
->
sava
(
input
(
'file.poster'
));
if
(
!
$result
[
'error'
]){
// $resource_model -> where('address',$old_poster)->delete();
$poster
=
$result
[
'result'
][
'url'
];
$data
[
'poster'
]
=
$poster
;
}
}
if
(
input
(
'file.banners'
)){
$file_banners
=
input
(
'file.banners'
);
foreach
(
$file_banners
as
$name
=>
$f
)
{
$result
=
$upload
->
sava
(
$f
);
if
(
!
$result
[
'error'
]){
$banners
[]
=
$result
[
'result'
][
'url'
];
//保存封面
if
(
input
(
'file.poster'
))
{
$result
=
$upload
->
sava
(
input
(
'file.poster'
));
if
(
!
$result
[
'error'
])
{
$poster
=
$result
[
'result'
][
'url'
];
$data
[
'poster'
]
=
$poster
;
}
}
//遍历banner数组并保存
if
(
input
(
'file.banners'
))
{
$file_banners
=
input
(
'file.banners'
);
foreach
(
$file_banners
as
$name
=>
$f
)
{
$result
=
$upload
->
sava
(
$f
);
if
(
!
$result
[
'error'
])
{
$banners
[]
=
$result
[
'result'
][
'url'
];
}
}
$data
[
'banners'
]
=
json_encode
(
array_merge
(
$banners
,
$old_banners
));
}
}
$data
[
'banners'
]
=
json_encode
(
array_merge
(
$banners
,
$old_banners
));
}
// $result = $upload -> sava(input('file.banners'));
//写入数据库
// $data['description'] = htmlspecialchars($data['description']);
$res
=
$this
->
project_model
->
save
(
$data
,[
'id'
=>
$id
]);
if
(
$res
){
$this
->
success
(
'修改成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'修改失败'
,
''
,
''
,
1
);
//写入数据库
$res
=
$this
->
project_model
->
save
(
$data
,
[
'id'
=>
$id
]);
if
(
$res
)
{
$this
->
success
(
'修改成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'修改失败'
,
''
,
''
,
1
);
}
}
else
{
$project_info
=
$this
->
project_model
->
find
(
$id
);
// return;
$this
->
assign
(
'project_info'
,
$project_info
);
//反显,处理项目/商品已使用标签
$value
=
$project_info
->
tags_id_str
;
$value
=
trim
(
$value
,
'|'
);
$tags
=
explode
(
'|'
,
$value
);
$this
->
assign
(
'tags'
,
$tags
);
//反显,读取所有tags
$tag_list
=
$this
->
tag_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'tag_list'
,
$tag_list
);
//反显,读取所有分类
$catalog_list
=
$this
->
catalog_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'catalog_list'
,
$catalog_list
);
//反显,读取所有城市
$city_list
=
$this
->
city_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'city_list'
,
$city_list
);
return
$this
->
fetch
();
}
}
else
{
$project_info
=
$this
->
project_model
->
find
(
$id
);
// return;
$this
->
assign
(
'project_info'
,
$project_info
);
$value
=
$project_info
->
tags_id_str
;
$value
=
trim
(
$value
,
'|'
);
$tags
=
explode
(
'|'
,
$value
);
$this
->
assign
(
'tags'
,
$tags
);
$tag_list
=
$this
->
tag_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'tag_list'
,
$tag_list
);
$catalog_list
=
$this
->
catalog_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'catalog_list'
,
$catalog_list
);
$city_list
=
$this
->
city_model
->
order
(
'sort'
,
'asc'
)
->
select
();
$this
->
assign
(
'city_list'
,
$city_list
);
return
$this
->
fetch
();
}
}
// 标签管理
public
function
tags
(){
$title
=
input
(
'get.name'
,
''
);
$tag_list
=
$this
->
tag_model
->
where
(
'name'
,
'like'
,
"%"
.
$title
.
"%"
)
->
order
(
'sort'
,
'asc'
)
->
paginate
(
15
,
false
,[
'query'
=>
[
'name'
=>
$title
]]);
$this
->
assign
(
"tag_list"
,
$tag_list
);
public
function
tags
()
{
$title
=
input
(
'get.name'
,
''
);
$tag_list
=
$this
->
tag_model
->
where
(
'name'
,
'like'
,
"%"
.
$title
.
"%"
)
->
order
(
'sort'
,
'asc'
)
->
paginate
(
15
,
false
,
[
'query'
=>
[
'name'
=>
$title
]]);
$this
->
assign
(
"tag_list"
,
$tag_list
);
return
$this
->
fetch
(
''
);
}
public
function
addTag
(){
//添加标签
public
function
addTag
()
{
$data
=
array
(
'name'
=>
trim
(
input
(
'post.name'
)),
'sort'
=>
input
(
'post.sort'
,
0
),
'sort'
=>
input
(
'post.sort'
,
0
),
);
$validate
=
validate
(
'Project'
);
if
(
!
$validate
->
scene
(
'addTag'
)
->
check
(
$data
))
{
$this
->
error
(
$validate
->
getError
(),
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
if
(
!
$validate
->
scene
(
'addTag'
)
->
check
(
$data
))
{
$this
->
error
(
$validate
->
getError
(),
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$res
=
$this
->
tag_model
->
data
(
$data
)
->
save
();
if
(
!
$res
)
{
$this
->
error
(
'添加失败'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
if
(
!
$res
)
{
$this
->
error
(
'添加失败'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$this
->
redirect
(
$_SERVER
[
"HTTP_REFERER"
]);
}
}
}
public
function
editTag
(
$id
){
$this
->
assign
(
'id'
,
$id
);
$tag_info
=
$this
->
tag_model
->
where
(
'id'
,
$id
)
->
find
();
$this
->
assign
(
'tag_info'
,
$tag_info
);
public
function
editTag
(
$id
)
{
$this
->
assign
(
'id'
,
$id
);
$tag_info
=
$this
->
tag_model
->
where
(
'id'
,
$id
)
->
find
();
$this
->
assign
(
'tag_info'
,
$tag_info
);
return
$this
->
fetch
();
}
public
function
updateTag
(){
//修改标签
public
function
updateTag
()
{
$id
=
input
(
'post.id'
);
$data
=
array
(
'id'
=>
$id
,
'name'
=>
trim
(
input
(
'post.name'
)),
'sort'
=>
input
(
'post.sort'
,
0
)
'sort'
=>
input
(
'post.sort'
,
0
)
);
$validate
=
validate
(
'Project'
);
if
(
!
$validate
->
scene
(
'updateTag'
)
->
check
(
$data
))
{
$this
->
error
(
$validate
->
getError
(),
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$res
=
$this
->
tag_model
->
save
(
$data
,
[
'id'
=>
$id
]);
if
(
!
$res
)
{
$this
->
error
(
'修改失败'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
if
(
!
$validate
->
scene
(
'updateTag'
)
->
check
(
$data
))
{
$this
->
error
(
$validate
->
getError
(),
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$res
=
$this
->
tag_model
->
save
(
$data
,
[
'id'
=>
$id
]);
if
(
!
$res
)
{
$this
->
error
(
'修改失败'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$this
->
redirect
(
url
(
'admin/project/tags'
));
}
}
}
public
function
deleteTag
(){
$id
=
input
(
'post.id'
);
$used
=
$this
->
project_model
->
where
(
'tags'
,
'like'
,
"%"
.
'|'
.
$id
.
'|'
.
"%"
)
->
count
();
if
(
$used
>
0
){
$this
->
error
(
'该标签已在项目中引用,不可删除!'
,
''
,
''
,
1
);
}
$res
=
model
(
'tags'
)
->
destroy
(
$id
);
if
(
$res
){
$this
->
success
(
'删除成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'删除失败'
,
''
,
''
,
1
);
}
//删除标签
public
function
deleteTag
()
{
$id
=
input
(
'post.id'
);
$used
=
$this
->
project_model
->
where
(
'tags'
,
'like'
,
"%"
.
'|'
.
$id
.
'|'
.
"%"
)
->
count
();
if
(
$used
>
0
)
{
$this
->
error
(
'该标签已在项目中引用,不可删除!'
,
''
,
''
,
1
);
}
$res
=
model
(
'tags'
)
->
destroy
(
$id
);
if
(
$res
)
{
$this
->
success
(
'删除成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'删除失败'
,
''
,
''
,
1
);
}
}
// 城市管理
public
function
citys
(){
$title
=
input
(
'get.name'
,
''
);
$tag_list
=
$this
->
city_model
->
where
(
'name'
,
'like'
,
"%"
.
$title
.
"%"
)
->
order
(
'sort'
,
'asc'
)
->
paginate
(
15
,
false
,[
'query'
=>
[
'name'
=>
$title
]]);
$this
->
assign
(
"tag_list"
,
$tag_list
);
//城市管理
public
function
citys
()
{
$title
=
input
(
'get.name'
,
''
);
$tag_list
=
$this
->
city_model
->
where
(
'name'
,
'like'
,
"%"
.
$title
.
"%"
)
->
order
(
'sort'
,
'asc'
)
->
paginate
(
15
,
false
,
[
'query'
=>
[
'name'
=>
$title
]]);
$this
->
assign
(
"tag_list"
,
$tag_list
);
return
$this
->
fetch
(
''
);
}
public
function
addCity
(){
//添加城市
public
function
addCity
()
{
$data
=
array
(
'name'
=>
trim
(
input
(
'post.name'
)),
'sort'
=>
input
(
'post.sort'
,
0
),
'sort'
=>
input
(
'post.sort'
,
0
),
);
$validate
=
validate
(
'Project'
);
if
(
!
$validate
->
scene
(
'addTag'
)
->
check
(
$data
))
{
$this
->
error
(
$validate
->
getError
(),
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
if
(
!
$validate
->
scene
(
'addTag'
)
->
check
(
$data
))
{
$this
->
error
(
$validate
->
getError
(),
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$res
=
$this
->
city_model
->
data
(
$data
)
->
save
();
if
(
!
$res
)
{
$this
->
error
(
'添加失败'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
if
(
!
$res
)
{
$this
->
error
(
'添加失败'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$this
->
redirect
(
$_SERVER
[
"HTTP_REFERER"
]);
}
}
}
public
function
editCity
(
$id
){
$this
->
assign
(
'id'
,
$id
);
$tag_info
=
$this
->
city_model
->
where
(
'id'
,
$id
)
->
find
();
$this
->
assign
(
'tag_info'
,
$tag_info
);
public
function
editCity
(
$id
)
{
$this
->
assign
(
'id'
,
$id
);
$tag_info
=
$this
->
city_model
->
where
(
'id'
,
$id
)
->
find
();
$this
->
assign
(
'tag_info'
,
$tag_info
);
return
$this
->
fetch
();
}
public
function
updateCity
(){
//编辑城市
public
function
updateCity
()
{
$id
=
input
(
'post.id'
);
$data
=
array
(
'id'
=>
$id
,
'name'
=>
trim
(
input
(
'post.name'
)),
'sort'
=>
input
(
'post.sort'
,
0
)
'sort'
=>
input
(
'post.sort'
,
0
)
);
$validate
=
validate
(
'Project'
);
if
(
!
$validate
->
scene
(
'updateTag'
)
->
check
(
$data
))
{
$this
->
error
(
$validate
->
getError
(),
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$res
=
$this
->
city_model
->
save
(
$data
,
[
'id'
=>
$id
]);
if
(
!
$res
)
{
$this
->
error
(
'修改失败'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
if
(
!
$validate
->
scene
(
'updateTag'
)
->
check
(
$data
))
{
$this
->
error
(
$validate
->
getError
(),
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$res
=
$this
->
city_model
->
save
(
$data
,
[
'id'
=>
$id
]);
if
(
!
$res
)
{
$this
->
error
(
'修改失败'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$this
->
redirect
(
url
(
'admin/project/citys'
));
}
}
}
public
function
deleteCity
(){
$id
=
input
(
'post.id'
);
$used
=
$this
->
project_model
->
where
(
'city'
,
$id
)
->
count
();
if
(
$used
>
0
){
$this
->
error
(
'该城市已在项目中引用,不可删除!'
,
''
,
''
,
1
);
}
//删除城市
public
function
deleteCity
()
{
$id
=
input
(
'post.id'
);
$used
=
$this
->
project_model
->
where
(
'city'
,
$id
)
->
count
();
if
(
$used
>
0
)
{
$this
->
error
(
'该城市已在项目中引用,不可删除!'
,
''
,
''
,
1
);
}
$res
=
model
(
'citys'
)
->
destroy
(
$id
);
if
(
$res
)
{
$this
->
success
(
'删除成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'删除失败'
,
''
,
''
,
1
);
}
$res
=
model
(
'citys'
)
->
destroy
(
$id
);
if
(
$res
)
{
$this
->
success
(
'删除成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'删除失败'
,
''
,
''
,
1
);
}
}
// 分类管理
public
function
catalogs
(){
$title
=
input
(
'get.name'
,
''
);
$tag_list
=
$this
->
catalog_model
->
where
(
'name'
,
'like'
,
"%"
.
$title
.
"%"
)
->
order
(
'sort'
,
'asc'
)
->
paginate
(
15
,
false
,[
'query'
=>
[
'name'
=>
$title
]]);
$this
->
assign
(
"tag_list"
,
$tag_list
);
public
function
catalogs
()
{
$title
=
input
(
'get.name'
,
''
);
$tag_list
=
$this
->
catalog_model
->
where
(
'name'
,
'like'
,
"%"
.
$title
.
"%"
)
->
order
(
'sort'
,
'asc'
)
->
paginate
(
15
,
false
,
[
'query'
=>
[
'name'
=>
$title
]]);
$this
->
assign
(
"tag_list"
,
$tag_list
);
return
$this
->
fetch
(
''
);
}
public
function
addCatalogs
(){
if
(
request
()
->
isPost
())
{
$data
=
array
(
'name'
=>
trim
(
input
(
'post.name'
)),
'sort'
=>
input
(
'post.sort'
,
0
),
'poster'
=>
input
(
'file.poster'
)
);
$validate
=
validate
(
'Project'
);
if
(
!
$validate
->
scene
(
'addCatalogs'
)
->
check
(
$data
)){
$this
->
error
(
$validate
->
getError
(),
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$upload
=
new
Upload
();
$result
=
$upload
->
sava
(
input
(
'file.poster'
));
if
(
$result
[
'error'
]){
$this
->
assign
(
'msg'
,
$result
[
'error'
]);
return
view
();
}
$data
[
'poster'
]
=
$result
[
'result'
][
'url'
];
$res
=
$this
->
catalog_model
->
data
(
$data
)
->
save
();
if
(
!
$res
){
$this
->
error
(
'添加失败'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$this
->
success
(
'添加成功'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
//添加分类
public
function
addCatalogs
()
{
if
(
request
()
->
isPost
())
{
$data
=
array
(
'name'
=>
trim
(
input
(
'post.name'
)),
'sort'
=>
input
(
'post.sort'
,
0
),
'poster'
=>
input
(
'file.poster'
)
);
$validate
=
validate
(
'Project'
);
if
(
!
$validate
->
scene
(
'addCatalogs'
)
->
check
(
$data
))
{
$this
->
error
(
$validate
->
getError
(),
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$upload
=
new
Upload
();
$result
=
$upload
->
sava
(
input
(
'file.poster'
));
if
(
$result
[
'error'
])
{
$this
->
assign
(
'msg'
,
$result
[
'error'
]);
return
view
();
}
$data
[
'poster'
]
=
$result
[
'result'
][
'url'
];
$res
=
$this
->
catalog_model
->
data
(
$data
)
->
save
();
if
(
!
$res
)
{
$this
->
error
(
'添加失败'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$this
->
success
(
'添加成功'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
}
}
else
{
$this
->
assign
(
'id'
,
null
);
$this
->
assign
(
'tag_info'
,
0
);
return
$this
->
fetch
(
'editcatalogs'
);
}
}
else
{
return
$this
->
fetch
();
}
}
public
function
editCatalogs
(
$id
){
$this
->
assign
(
'id'
,
$id
);
$tag_info
=
$this
->
catalog_model
->
where
(
'id'
,
$id
)
->
find
();
$this
->
assign
(
'tag_info'
,
$tag_info
);
public
function
editCatalogs
(
$id
)
{
$this
->
assign
(
'id'
,
$id
);
$tag_info
=
$this
->
catalog_model
->
where
(
'id'
,
$id
)
->
find
();
$this
->
assign
(
'tag_info'
,
$tag_info
);
return
$this
->
fetch
();
}
public
function
updateCatalogs
(){
//编辑分类
public
function
updateCatalogs
()
{
$id
=
input
(
'post.id'
);
$data
=
array
(
'id'
=>
$id
,
'name'
=>
trim
(
input
(
'post.name'
)),
'sort'
=>
input
(
'post.sort'
,
0
)
'sort'
=>
input
(
'post.sort'
,
0
)
);
$validate
=
validate
(
'Project'
);
if
(
!
$validate
->
scene
(
'updateTag'
)
->
check
(
$data
)){
$this
->
error
(
$validate
->
getError
(),
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
if
(
input
(
'file.poster'
)){
// 上传封面到七牛云
$upload
=
new
Upload
();
$result
=
$upload
->
sava
(
input
(
'file.poster'
));
if
(
$result
[
'error'
]){
$this
->
assign
(
'msg'
,
$result
[
'error'
]);
return
view
();
}
// 将资源目录该图的引用设为0
// $resource_model = model('Resource');
// $res = $resource_model->where('address',input('post.old_poster'))->setDec("use_num");
$data
[
'poster'
]
=
$result
[
'result'
][
'url'
];
if
(
!
$validate
->
scene
(
'updateTag'
)
->
check
(
$data
))
{
$this
->
error
(
$validate
->
getError
(),
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
if
(
input
(
'file.poster'
))
{
// 上传封面到七牛云
$upload
=
new
Upload
();
$result
=
$upload
->
sava
(
input
(
'file.poster'
));
if
(
$result
[
'error'
])
{
$this
->
assign
(
'msg'
,
$result
[
'error'
]);
return
view
();
}
$data
[
'poster'
]
=
$result
[
'result'
][
'url'
];
}
$res
=
$this
->
catalog_model
->
save
(
$data
,
[
'id'
=>
$id
]);
if
(
!
$res
)
{
$this
->
error
(
'修改失败'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$res
=
$this
->
catalog_model
->
save
(
$data
,
[
'id'
=>
$id
]);
if
(
!
$res
)
{
$this
->
error
(
'修改失败'
,
$_SERVER
[
"HTTP_REFERER"
],
''
,
1
);
}
else
{
$this
->
redirect
(
url
(
'admin/project/catalogs'
));
}
}
}
public
function
deleteCatalog
(){
$id
=
input
(
'post.id'
);
$used
=
$this
->
project_model
->
where
(
'catalog_id'
,
$id
)
->
count
();
if
(
$used
>
0
){
$this
->
error
(
'该分类下有项目,不可删除!'
,
''
,
''
,
1
);
}
// $catalog_info = model('catalogs')->find($id);
// $old_image = $catalog_info['poster'];
// model('resource') -> where('address',$old_image)->delete();
$res
=
model
(
'catalogs'
)
->
destroy
(
$id
);
if
(
$res
){
$this
->
success
(
'删除成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'删除失败'
,
''
,
''
,
1
);
}
//删除分类
public
function
deleteCatalog
()
{
$id
=
input
(
'post.id'
);
$used
=
$this
->
project_model
->
where
(
'catalog_id'
,
$id
)
->
count
();
if
(
$used
>
0
)
{
$this
->
error
(
'该分类下有项目,不可删除!'
,
''
,
''
,
1
);
}
$res
=
model
(
'catalogs'
)
->
destroy
(
$id
);
if
(
$res
)
{
$this
->
success
(
'删除成功'
,
''
,
''
,
1
);
}
else
{
$this
->
error
(
'删除失败'
,
''
,
''
,
1
);
}
}
// 处理删除某一张bannner图
public
function
deleteBanners
(){
$id
=
input
(
'post.id'
);
$address
=
input
(
'post.address'
);
// $resource_model = model('resource');
// $del_res = $resource_model -> where('address',$address)->delete();
$project_info
=
$this
->
project_model
->
find
(
$id
);
$banners
=
json_decode
(
$project_info
[
'banners_native'
]);
$new_banners
=
array_merge
(
array_diff
(
$banners
,
array
(
$address
)));
$up_res
=
0
;
if
(
$new_banners
!=
$banners
){
$up_res
=
$this
->
project_model
->
save
([
'banners'
=>
json_encode
(
$new_banners
)
],[
'id'
=>
$id
]);
}
if
(
$up_res
){
return
array
(
'success'
=>
'成功删除该图'
,
'data'
=>
input
(
'post.'
),
'old_banners'
=>
$banners
,
'new_banner'
=>
$new_banners
,
// 'del_res' => $del_res
);
}
else
{
return
array
(
'error'
=>
'删除失败,该图片不可能已经被删除'
,
'data'
=>
input
(
'post.'
),
'old_banners'
=>
$banners
,
'new_banner'
=>
$new_banners
,
// 'del_res' => $del_res
);
}
public
function
deleteBanners
()
{
$id
=
input
(
'post.id'
);
$address
=
input
(
'post.address'
);
$project_info
=
$this
->
project_model
->
find
(
$id
);
$banners
=
json_decode
(
$project_info
[
'banners_native'
]);
$new_banners
=
array_merge
(
array_diff
(
$banners
,
array
(
$address
)));
$up_res
=
0
;
if
(
$new_banners
!=
$banners
)
{
$up_res
=
$this
->
project_model
->
save
([
'banners'
=>
json_encode
(
$new_banners
)
],
[
'id'
=>
$id
]);
}
if
(
$up_res
)
{
return
array
(
'success'
=>
'成功删除该图'
,
'data'
=>
input
(
'post.'
),
'old_banners'
=>
$banners
,
'new_banner'
=>
$new_banners
,
);
}
else
{
return
array
(
'error'
=>
'删除失败,该图片不存在或已经被删除'
,
'data'
=>
input
(
'post.'
),
'old_banners'
=>
$banners
,
'new_banner'
=>
$new_banners
,
);
}
}
//设置置顶排序
public
function
setHeat
(){
$heat
=
input
(
'post.heat'
);
$id
=
input
(
'post.id'
);
$res
=
model
(
'project'
)
->
save
([
'heat'
=>
$heat
],[
'id'
=>
$id
]);
if
(
$res
){
$this
->
success
(
'修改置顶排序成功'
);
}
else
{
$this
->
success
(
'修改置顶排序失败'
);
}
}
}
application/admin/view/banner/index.html
View file @
fb00509d
...
...
@@ -49,7 +49,11 @@
{volist name="banner_list" id="vo" key="k" empty="暂时没有数据"}
<tr
id=
"tr_{$vo.id}"
>
<td>
{$vo.id}
</td>
<td><img
src=
"{$vo.image}"
style=
"width:170px"
alt=
""
></td>
<td>
<a
href=
"<?=$vo->image?>"
target=
"_blank"
data-fancybox=
"images"
>
<img
src=
"<?=$vo->image?>"
width=
'100'
height=
'50'
>
</a>
</td>
<td>
{if condition="$vo.type==1"}
小程序页面路径
...
...
application/admin/view/banner/update.html
View file @
fb00509d
...
...
@@ -14,7 +14,12 @@
<section
class=
"wrapper"
>
<h3
class=
""
>
<a
href=
"<?php echo url('@admin/Post/index')?>"
>
<i
class=
"fa fa-angle-right"
></i>
<a
href=
"{:url('admin/banner/index')}"
>
轮播图管理
</a>
<i
class=
"fa fa-angle-right"
></i>
修改
<i
class=
"fa fa-angle-right"
></i>
<a
href=
"{:url('admin/banner/index')}"
>
轮播图管理
</a>
<i
class=
"fa fa-angle-right"
></i>
{if condition="$banner_info"}
修改轮播图
{else/}
添加轮播图
{/if}
</a>
</h3>
<hr>
...
...
@@ -32,7 +37,7 @@
<div
class=
"row margin-bottom"
>
<div
class=
"col-md-12"
>
<form
name=
"myFrom"
id=
"myFrom"
class=
"form-horizontal"
enctype=
"multipart/form-data"
method=
"POST"
action=
"{:url('admin/banner/update',['id'=>$banner_info.id])}"
id=
"article-create-form"
>
<form
name=
"myFrom"
id=
"myFrom"
class=
"form-horizontal"
enctype=
"multipart/form-data"
method=
"POST"
{
if
condition=
"$banner_info"
}
action=
"{:url('admin/banner/update',['id'=>$banner_info.id])}"
{
else
/}
action=
"{:url('admin/banner/create')}"
{/
if
}
id=
"article-create-form"
>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
图片
</label>
<div
class=
"col-lg-10 col-md-8 col-lg-6"
>
...
...
@@ -96,15 +101,14 @@ initFileInput($("#input-b1"),"{$banner_info.image}");
// 单文件上传
function
initFileInput
(
el
,
initArr
,
initConfig
){
var
initialPreview
=
[];
initialPreview
.
push
(
initArr
);
if
(
initArr
){
initialPreview
.
push
(
initArr
);
}
el
.
fileinput
({
language
:
'zh'
,
uploadExtraData
:{
'name'
:
name
},
initialPreview
:
initialPreview
,
uploadExtraData
:{
'name'
:
'banner-choose'
},
// initialPreviewConfig: initConfig,
autoReplace
:
true
,
showUpload
:
false
,
//是否显示上 传按钮
initialPreviewShowDelete
:
true
,
initialPreviewAsData
:
true
,
dropZoneEnabled
:
false
,
...
...
application/admin/view/bannner/index.html
deleted
100644 → 0
View file @
18ed0222
{layout name="public/layout_main"}
<section
class=
"wrapper"
>
<h3><i
class=
"fa fa-angle-right"
></i>
分类管理
</h3>
<!-- 分割线 -->
<hr>
<div
class=
"row margin-bottom"
>
<div
class=
"col-md-12"
>
<form
class=
"form-inline pull-left"
method=
"GET"
action=
"{:url('admin/project/Catalogs')}"
>
<div
class=
"form-group margin-right"
>
<label
for=
"name"
>
分类名
</label>
<input
class=
"form-control"
type=
"text"
name=
"name"
id=
"name"
value=
"<?php echo input('title');?>"
/>
</div>
<button
type=
"submit"
class=
"btn btn-primary"
>
搜索
</button>
</form>
<div
class=
" pull-right"
>
<a
href=
"{:url('admin/project/addCatalogs')}"
class=
"btn btn-success"
>
添加分类
</a>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<div
class=
"table-responsive"
>
<table
class=
"table table-bordered table-striped"
>
<!--<colgroup>-->
<!--<col style="width: 2%;">-->
<!--<col style="width: 80%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 10%;">-->
<!--</colgroup>-->
<thead>
<tr>
<th>
#
</th>
<th>
分类名称
</th>
<th>
分类图标
</th>
<th>
引用次数
</th>
<th>
排序
</th>
<th>
发布时间
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody>
{volist name="tag_list" id="vo" key="k" empty="暂时没有数据"}
<tr>
<td>
{$k}
</td>
<td>
{$vo.name}
</td>
<td><img
style=
"width:170px"
src=
"{$vo.poster}"
alt=
""
></td>
<td>
{$vo.used_num}
</td>
<td>
{$vo.sort}
</td>
<td>
{$vo.created_at}
</td>
<td>
<a
href=
"{:url('admin/project/editCatalogs',['id'=>$vo.id])}"
class=
"btn btn-xs btn-primary"
><i
class=
"fa fa-pencil"
></i></a>
<a
href=
"###"
class=
"btn btn-xs btn-danger"
><i
class=
"fa fa-trash"
></i></a>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
{$tag_list->render()}
</div>
</div>
</section>
<script
type=
"text/javascript"
>
$
(
"#myModal"
).
modal
();
// 文档加载完毕之后,会进入该方法
$
(
function
(){
$
(
".btn-delete"
).
click
(
function
(){
var
_this
=
$
(
this
);
var
url
=
"delete"
;
var
oid
=
_this
.
attr
(
'oid'
);
showDialog
(
"提示"
,
"确定删除这篇文章吗?"
,
function
()
{
// ajax post 方法
$
.
post
(
url
,
{
id
:
oid
},
function
(
res
)
{
var
res
=
JSON
.
parse
(
res
);
if
(
res
.
error
==
1
)
{
// javascript 的默认弹出提示方法
alert
(
res
.
msg
);
}
else
{
_this
.
remove
();
$
(
"#tr_"
+
oid
).
fadeOut
();
}
});
});
});
});
</script>
application/admin/view/guide/create.html
deleted
100644 → 0
View file @
18ed0222
{layout name="public/fullscreen"}
<link
rel=
"stylesheet"
href=
"/static/fileinput/css/fileinput.css"
>
<link
rel=
"stylesheet"
href=
"/static/bootstrap-select/css/bootstrap-select.min.css"
>
<style
type=
"text/css"
>
.progress-bar
{
text-align
:
center
;
}
.dropdown-menu
{
z-index
:
100000
;
}
</style>
<section
class=
"wrapper"
>
<h3
class=
""
>
<a
href=
"<?php echo url('@admin/Guide/index')?>"
>
<i
class=
"fa fa-angle-right"
></i>
<a
href=
"{:url('admin/Guide/index')}"
>
美行攻略
</a>
<i
class=
"fa fa-angle-right"
></i>
发布攻略
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div
class=
"row margin-bottom"
>
<div
class=
"col-md-12"
>
<div
class=
"alert alert-danger alert-dismissible fade in"
role=
"alert"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div
class=
"row margin-bottom"
>
<div
class=
"col-md-12"
>
<form
name=
"myFrom"
class=
"form-horizontal"
enctype=
"multipart/form-data"
method=
"POST"
action=
"<?php echo url("
@
admin
/
Guide
/
create
")?
>
" id="article-create-form">
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
攻略标题
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
type=
"text"
class=
"form-control validate[required]"
name=
"title"
id=
"title"
placeholder=
"请输入美行攻略的标题"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
攻略简介
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<textarea
name=
"intro"
id=
""
cols=
"30"
rows=
"3"
class=
"form-control"
placeholder=
"请输入美行攻略的简单描述"
></textarea>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
攻略封面
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
id=
"input-b1"
name=
"poster"
type=
"file"
>
<span
class=
"form-group-tip"
>
* 尺寸建议:260px*190px
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
攻略标签
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
type=
"hidden"
name=
"tags"
id=
"tags"
value=
""
>
<select
class=
"selectpicker form-control"
id=
"tags_select"
multiple
data-live-search=
"true"
onchange=
"setTags()"
>
{volist name="tag_list" name="tag_list" id="vo"}
<option
value=
"{$vo.id}"
>
{$vo.name}
</option>
{/volist}
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
攻略类型
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<select
class=
"form-control"
name=
"type"
id=
"post_type"
>
<option
value=
"1"
>
手动编写文章
</option>
<option
value=
"2"
>
链接到网络文章
</option>
</select>
</div>
</div>
<div
class=
"form-group"
id=
"href"
style=
"display: none"
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
请输入url
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
type=
"text"
name=
"href"
class=
"form-control"
>
<code>
http:// + 网址 或 https:// + 网址
</code>
</div>
</div>
<div
class=
"form-group"
id=
"content"
>
<label
for=
"content"
class=
"col-sm-2 control-label text-right"
>
攻略详情
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<!-- 加载编辑器的容器 -->
<script
id=
"post_container"
name=
"content"
type=
"text/plain"
style=
"width: 100%"
>
</script>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<button
type=
"submit"
class=
"btn btn-success"
id=
"btn-save"
>
提交
</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script
type=
"text/javascript"
src=
"/static/fileinput/js/fileinput.min.js"
></script>
<script
type=
"text/javascript"
src=
"/static/fileinput/js/locales/zh.js"
></script>
<script
type=
"text/javascript"
src=
"/static/bootstrap-select/js/bootstrap-select.min.js"
></script>
<script
type=
"text/javascript"
src=
"/static/bootstrap-select/js/i18n/defaults-zh_CN.js"
></script>
<!-- 配置文件 -->
<script
type=
"text/javascript"
src=
"/static/ueditor/ueditor.config.js"
></script>
<!-- 编辑器源码文件 -->
<script
type=
"text/javascript"
src=
"/static/ueditor/ueditor.all.js"
></script>
<script
type=
"text/javascript"
>
$
(
function
(){
// 即时显示封面图
$
(
'#poster'
).
change
(
function
(
e
){
var
file
=
e
.
target
.
files
[
0
];
preview
(
file
,
0
);
});
var
type
=
$
(
"#post_type"
).
val
();
if
(
type
==
1
){
$
(
"#content"
).
show
();
$
(
"#href"
).
hide
();
}
else
{
$
(
"#href"
).
show
();
$
(
"#content"
).
hide
();
}
});
$
(
"#post_type"
).
change
(
function
(){
var
type
=
$
(
this
).
val
();
if
(
type
==
1
){
$
(
"#content"
).
show
();
$
(
"#href"
).
hide
();
}
else
{
$
(
"#href"
).
show
();
$
(
"#content"
).
hide
();
}
});
// 初始化文件上传
$
(
"#input-b1"
).
fileinput
({
language
:
'zh'
,
showUpload
:
false
,
//是否显示上传按钮
allowedFileExtensions
:
[
'bmp'
,
'jpg'
,
'png'
,
'tif'
,
'gif'
,
'pcx'
,
'tga'
,
'exif'
,
'fpx'
,
'svg'
,
'cdr'
,
'pcd'
,
'dxf'
,
'ufo'
,
'eps'
,
'raw'
,
'WMF'
,
'webp'
],
//接收的文件后缀
})
function
setTags
(){
var
slected
=
$
(
"#tags_select"
).
val
();
if
(
slected
){
$
(
"#tags"
).
val
(
slected
.
toString
());
}
else
{
$
(
"#tags"
).
val
(
""
);
}
}
UE
.
getEditor
(
'post_container'
,
{
//编辑区域大小
'initialFrameHeight'
:
'350'
,
'elementPathEnabled'
:
false
,
'autoHeight'
:
true
,
'autoHeightEnabled'
:
true
,
'autoFloatEnabled'
:
true
,
'iframeCssUrl'
:
'/static/ueditor/themes/iframe.css'
,
// 引入css
//定制菜单
'toolbars'
:
[
[
'fullscreen'
,
'source'
,
'undo'
,
'redo'
,
'|'
,
'fontsize'
,
'bold'
,
'italic'
,
'underline'
,
'fontborder'
,
'strikethrough'
,
'removeformat'
,
'formatmatch'
,
'blockquote'
,
'pasteplain'
,
'|'
,
'forecolor'
,
'backcolor'
,
'|'
,
'lineheight'
,
'|'
,
'indent'
,
'|'
,
'insertimage'
,
'|'
,
'justifyleft'
,
//居左对齐
'justifyright'
,
//居右对齐
'justifycenter'
,
//居中对齐
'justifyjustify'
,
//两端对齐
],
]
});
</script>
application/admin/view/guide/index.html
View file @
fb00509d
...
...
@@ -31,6 +31,7 @@
<th>
攻略标题
</th>
<th>
类型
</th>
<th>
简介
</th>
<th>
标签
</th>
<th>
封面
</th>
<th>
发布时间
</th>
<th>
操作
</th>
...
...
@@ -53,6 +54,9 @@
</td>
<td>
<?=$article->type=='1'?'自建文章':'网络文章';?>
</td>
<td
style=
"max-width:200px;"
>
<?=$article->intro;?>
</td>
<td
style=
"max-width: 200px"
>
{volist name="$article.tags" id="tag" key="k"}{if condition="$k!=1"}/{/if}{$tag}{/volist}
</td>
<td>
<a
href=
"<?=$article->poster?>"
target=
"_blank"
data-fancybox=
"images"
>
<img
src=
"<?=$article->poster?>"
width=
'100'
height=
'50'
>
...
...
application/admin/view/guide/update.html
View file @
fb00509d
...
...
@@ -13,7 +13,12 @@
<section
class=
"wrapper"
>
<h3
class=
""
>
<a
href=
"<?php echo url('@admin/Guide/index')?>"
>
<i
class=
"fa fa-angle-right"
></i>
<a
href=
"{:url('admin/Guide/index')}"
>
美行攻略
</a>
<i
class=
"fa fa-angle-right"
></i>
修改攻略
<i
class=
"fa fa-angle-right"
></i>
<a
href=
"{:url('admin/Guide/index')}"
>
美行攻略
</a>
<i
class=
"fa fa-angle-right"
></i>
{if condition="$article"}
修改攻略
{else/}
发布攻略
{/if}
</a>
</h3>
<hr>
...
...
@@ -31,7 +36,7 @@
<div
class=
"row margin-bottom"
>
<div
class=
"col-md-12"
>
<form
name=
"myFrom"
class=
"form-horizontal"
enctype=
"multipart/form-data"
method=
"POST"
action=
"<?php echo url("
@
admin
/
Guide
/
update
/
id
/".$
article
['
id
'])?
>
"
id="article-create-form">
<form
name=
"myFrom"
class=
"form-horizontal"
enctype=
"multipart/form-data"
method=
"POST"
{
if
condition=
"$article"
}
action=
"{:url('admin/Guide/update',['id'=>$article['id']])}"
{
else
/}
action=
"{:url('admin/Guide/create')}"
{/
if
}
id=
"article-create-form"
>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
攻略标题
</label>
<div
class=
"col-sm-20 col-md-8 col-lg-6"
>
...
...
@@ -48,8 +53,11 @@
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
攻略封面
</label>
<div
class=
"col-sm-20 col-md-8 col-lg-6"
>
<input
type=
"hidden"
name=
'old_poster'
value=
"{$article.poster}"
>
<img
src=
"{$article.poster}"
style=
"width:170px;margin-bottom:10px"
alt=
""
id=
"poster_view"
>
<a
href=
"{$article.poster}"
target=
"_blank"
data-fancybox=
"images"
id=
"poster_view"
>
<img
src=
"{$article.poster}"
style=
"width:170px;margin-bottom:10px"
>
</a>
<input
id=
"input-b1"
name=
"poster"
type=
"file"
>
<span
class=
"form-group-tip"
>
* 尺寸建议:260px*190px
</span>
</div>
</div>
<div
class=
"form-group"
>
...
...
@@ -99,7 +107,7 @@
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<button
type=
"submit"
class=
"btn btn-success"
id=
"btn-save"
>
修改
</button>
<button
type=
"submit"
class=
"btn btn-success"
id=
"btn-save"
>
提交
</button>
</div>
</div>
</form>
...
...
@@ -148,6 +156,8 @@ $("#post_type").change(function(){
var
fileInput
=
$
(
"#input-b1"
).
fileinput
({
language
:
'zh'
,
showUpload
:
false
,
//是否显示上传按钮
showClose
:
false
,
showRemove
:
false
,
allowedFileExtensions
:
[
'bmp'
,
'jpg'
,
'png'
,
'tif'
,
'gif'
,
'pcx'
,
'tga'
,
'exif'
,
'fpx'
,
'svg'
,
'cdr'
,
'pcd'
,
'dxf'
,
'ufo'
,
'eps'
,
'raw'
,
'WMF'
,
'webp'
],
//接收的文件后缀
})
$
(
"#input-b1"
).
change
(
function
(
data
){
...
...
application/admin/view/guide/update2.html
deleted
100644 → 0
View file @
18ed0222
{layout name="public/layout_main"}
<style
type=
"text/css"
>
.progress-bar
{
text-align
:
center
;
}
</style>
<section
class=
"wrapper"
>
<h3
class=
"top-back"
>
<a
href=
"<?php echo url('@admin/Post/index')?>"
>
<i
class=
"fa fa-angle-left"
></i>
编辑文章
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg !== ''):?>
<div
class=
"row margin-bottom"
>
<div
class=
"col-md-12"
>
<div
class=
"alert alert-danger alert-dismissible fade in"
role=
"alert"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div
class=
"row margin-bottom"
>
<div
class=
"col-md-12"
>
<form
class=
"form-horizontal"
enctype=
"multipart/form-data"
method=
"POST"
id=
"robot-create-form"
>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
文章标题
</label>
<div
class=
"col-lg-8"
>
<input
type=
"text"
class=
"form-control validate[required]"
name=
"title"
id=
"title"
value=
"<?php echo $article->title;?>"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"content"
class=
"col-sm-2 control-label text-right"
>
文章内容
</label>
<div
class=
"col-lg-8"
>
<!-- 加载编辑器的容器 -->
<script
id=
"post_container"
name=
"content"
type=
"text/plain"
>
<
?
php
echo
htmlspecialchars_decode
(
$article
->
content
);
?
>
</script>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<button
type=
"submit"
class=
"btn btn-default"
>
提交
</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 配置文件 -->
<script
type=
"text/javascript"
src=
"/static/ueditor/ueditor.config.js"
></script>
<!-- 编辑器源码文件 -->
<script
type=
"text/javascript"
src=
"/static/ueditor/ueditor.all.js"
></script>
<script
type=
"text/javascript"
>
var
ue
=
UE
.
getEditor
(
'post_container'
,{
// 图片上传配置路径
'serverUrl'
:
"{:url('@admin/Ueditor/index')}"
,
'elementPathEnabled'
:
false
,
// autoHeight: true,
'autoHeightEnabled'
:
false
,
//编辑区域大小
'initialFrameHeight'
:
'300'
,
//定制菜单
'toolbars'
:
[
[
'fullscreen'
,
'source'
,
'undo'
,
'redo'
,
'|'
,
'fontsize'
,
'bold'
,
'italic'
,
'underline'
,
'fontborder'
,
'strikethrough'
,
'removeformat'
,
'formatmatch'
,
'blockquote'
,
'pasteplain'
,
'|'
,
'forecolor'
,
'backcolor'
,
'|'
,
'lineheight'
,
'|'
,
'indent'
,
'|'
,
'insertimage'
,
'|'
,
'justifyleft'
,
//居左对齐
'justifyright'
,
//居右对齐
'justifycenter'
,
//居中对齐
'justifyjustify'
,
//两端对齐
],
]
});
/*
* 初始化分类
*/
$
(
function
()
{
});
</script>
\ No newline at end of file
application/admin/view/order/comment.html
View file @
fb00509d
...
...
@@ -40,9 +40,13 @@
{volist name="$comment_list" id="vo" key="k" empty="暂时没有数据"}
<tr>
<td>
{$vo.id}
</td>
<td>
<img
src=
"{$vo.project.poster}"
style=
"width:70px;display:block;margin:0 auto;"
alt=
""
>
<p
style=
"padding:0;margin:0;text-align:center"
>
{$vo.project.title}
</p>
<td
style=
"text-align: center"
>
{if condition="$vo.project"}
<a
href=
"{$vo.project.poster}"
target=
"_blank"
data-fancybox=
"images"
>
<img
src=
"{$vo.project.poster}"
width=
'100'
height=
'50'
>
</a>
<p
style=
"padding:0;margin:0;"
>
{$vo.project.title}
</p>
{/if}
</td>
<td>
<p
style=
"padding:0;margin:0;text-align:center"
>
{$vo.user.nickname}
</p>
...
...
application/admin/view/order/index.html
View file @
fb00509d
...
...
@@ -69,9 +69,13 @@
购买会员卡订单
{/if}
</td>
<td>
<img
src=
"{$vo.project.poster}"
style=
"width:70px;display:block;margin:0 auto;"
alt=
""
>
<p
style=
"padding:0;margin:0;text-align:center"
>
{$vo.project.title}
</p>
<td
style=
"text-align: center"
>
{if condition="$vo.project"}
<a
href=
"{$vo.project.poster}"
target=
"_blank"
data-fancybox=
"images"
>
<img
src=
"{$vo.project.poster}"
width=
'100'
height=
'50'
>
</a>
<p
style=
"padding:0;margin:0;"
>
{$vo.project.title}
</p>
{/if}
</td>
<td>
<p
style=
"padding:0;margin:0;text-align:center"
>
{$vo.user_info.nickname}
</p>
...
...
application/admin/view/order/refund.html
View file @
fb00509d
...
...
@@ -52,9 +52,15 @@
购买会员卡订单
{/if}
</td>
<td>
<img
src=
"{$vo.order.project.poster}"
style=
"width:70px;display:block;margin:0 auto;"
alt=
""
>
<p
style=
"padding:0;margin:0;text-align:center"
>
{$vo.order.project.title}
</p>
<td
style=
"text-align: center"
>
{if condition="$vo.order.project"}
<a
href=
"{$vo.order.project.poster}"
target=
"_blank"
data-fancybox=
"images"
>
<img
src=
"{$vo.order.project.poster}"
width=
'100'
height=
'50'
>
</a>
<p
style=
"padding:0;margin:0;"
>
{$vo.order.project.title}
</p>
{/if}
<!--<img src="{$vo.order.project.poster}" style="width:70px;display:block;margin:0 auto;" alt="">-->
<!--<p style="padding:0;margin:0;text-align:center">{$vo.order.project.title}</p>-->
</td>
<td>
<p
style=
"padding:0;margin:0;text-align:center"
>
{$vo.order.user_info.nickname}
</p>
...
...
application/admin/view/project/addCatalogs.html
deleted
100644 → 0
View file @
18ed0222
{layout name="public/layout_main"}
<link
rel=
"stylesheet"
href=
"/static/fileinput/css/fileinput.css"
>
<section
class=
"wrapper"
>
<h3><i
class=
"fa fa-angle-right"
></i>
<a
href=
"{:url('admin/project/catalogs')}"
>
分类管理
</a>
<i
class=
"fa fa-angle-right"
></i>
修改分类
</h3>
<!-- 分割线 -->
<hr>
<div
class=
"col-xs-12"
>
<form
method=
"post"
class=
"form-horizontal"
enctype=
"multipart/form-data"
action=
"{:url('admin/project/addCatalogs')}"
>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
分类名
</label>
<div
class=
"col-lg-10"
>
<input
type=
"text"
class=
"form-control"
name=
"name"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
分类图标
</label>
<div
class=
"col-lg-10"
>
<input
type=
"hidden"
name=
'old_poster'
>
<input
id=
"input-b1"
name=
"poster"
type=
"file"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
排序
</label>
<div
class=
"col-lg-10"
>
<input
type=
"number"
class=
"form-control"
name=
"sort"
>
</div>
</div>
<button
type=
"submit"
class=
"btn btn-success"
>
修改
</button>
</form>
</div>
</section>
<!-- 文件上传和select插件 -->
<script
type=
"text/javascript"
src=
"/static/fileinput/js/fileinput.min.js"
></script>
<script
type=
"text/javascript"
src=
"/static/fileinput/js/locales/zh.js"
></script>
<script
type=
"text/javascript"
>
// 文档加载完毕之后,会进入该方法
// 初始化文件上传
var
fileInput
=
$
(
"#input-b1"
).
fileinput
({
language
:
'zh'
,
showUpload
:
false
,
//是否显示上传按钮
allowedFileExtensions
:
[
'bmp'
,
'jpg'
,
'png'
,
'tif'
,
'gif'
,
'pcx'
,
'tga'
,
'exif'
,
'fpx'
,
'svg'
,
'cdr'
,
'pcd'
,
'dxf'
,
'ufo'
,
'eps'
,
'raw'
,
'WMF'
,
'webp'
],
//接收的文件后缀
})
$
(
"#input-b1"
).
change
(
function
(
data
){
if
(
this
.
files
.
length
>
0
){
$
(
"#poster_view"
).
hide
();
}
else
{
$
(
"#poster_view"
).
show
();
}
})
$
(
"#input-b1"
).
on
(
"fileclear"
,
function
(
event
,
data
,
msg
){
$
(
"#poster_view"
).
show
();
});
$
(
function
(){
$
(
".btn-delete"
).
click
(
function
(){
var
_this
=
$
(
this
);
var
url
=
"delete"
;
var
oid
=
_this
.
attr
(
'oid'
);
showDialog
(
"提示"
,
"确定删除这篇文章吗?"
,
function
()
{
// ajax post 方法
$
.
post
(
url
,
{
id
:
oid
},
function
(
res
)
{
var
res
=
JSON
.
parse
(
res
);
if
(
res
.
error
==
1
)
{
// javascript 的默认弹出提示方法
alert
(
res
.
msg
);
}
else
{
_this
.
remove
();
$
(
"#tr_"
+
oid
).
fadeOut
();
}
});
});
});
});
</script>
application/admin/view/project/catalogs.html
View file @
fb00509d
...
...
@@ -45,7 +45,11 @@
<tr
id=
"tr_{$vo.id}"
>
<td>
{$vo.id}
</td>
<td>
{$vo.name}
</td>
<td><img
style=
"width:90px"
src=
"{$vo.poster}"
alt=
""
></td>
<td>
<a
href=
"<?=$vo->poster?>"
target=
"_blank"
data-fancybox=
"images"
>
<img
src=
"<?=$vo->poster?>"
width=
'100'
height=
'50'
>
</a>
</td>
<td>
{$vo.sort}
</td>
<td>
{$vo.created_at}
</td>
<td>
...
...
application/admin/view/project/create1.html
deleted
100644 → 0
View file @
18ed0222
{layout name="public/layout_main"}
<link
rel=
"stylesheet"
href=
"/static/validation/css/validationEngine.jquery.css"
>
<link
rel=
"stylesheet"
href=
"/static/fileinput/css/fileinput.css"
>
<link
rel=
"stylesheet"
href=
"/static/bootstrap-select/css/bootstrap-select.min.css"
>
<link
rel=
"stylesheet"
href=
"/static/datetimepicker/css/bootstrap-datetimepicker.min.css"
>
<style
type=
"text/css"
>
.progress-bar
{
text-align
:
center
;
}
.dropdown-menu
{
z-index
:
100000
;
}
.control-label
{
width
:
150px
;
}
</style>
<section
class=
"wrapper"
>
<h3
class=
""
>
<a
href=
"<?php echo url('@admin/Guide/index')?>"
>
<i
class=
"fa fa-angle-right"
></i>
发布活动、商家
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div
class=
"row margin-bottom"
>
<div
class=
"col-md-12"
>
<div
class=
"alert alert-danger alert-dismissible fade in"
role=
"alert"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div
class=
"row margin-bottom"
>
<div
class=
"col-md-12"
>
<form
name=
"myFrom"
id=
"myFrom"
class=
"form-horizontal"
enctype=
"multipart/form-data"
method=
"POST"
action=
"<?php echo url("
@
admin
/
project
/
create
")?
>
" id="article-create-form">
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
类型
</label>
<div
class=
"col-lg-10"
>
<select
name=
"type"
id=
"peoject_type"
class=
"form-control"
>
<option
value=
"1"
>
活动
</option>
<option
value=
"2"
>
商家
</option>
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
名称
</label>
<div
class=
"col-lg-10"
>
<input
type=
"text"
class=
"form-control validate[required]"
name=
"title"
id=
"title"
placeholder=
"活动/商家名称"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
国内/国外
</label>
<div
class=
"col-lg-10"
>
<select
name=
"region_type"
id=
""
class=
"form-control"
>
<option
value=
"1"
>
国内
</option>
<option
value=
"2"
>
国外
</option>
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
活动时间
</label>
<div
class=
"col-lg-10"
>
<input
type=
"text"
class=
"form-control validate[required,custom[dateTime]]"
name=
"time_period"
id=
"start"
placeholder=
"请填写活动时间"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
报名截止时间
</label>
<div
class=
"col-lg-10"
>
<input
type=
"text"
class=
"form-control validate[required,custom[dateTime]]"
name=
"sign_endtime"
id=
"end"
placeholder=
"请填写报名截止时间"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
组数限制
</label>
<div
class=
"col-lg-10"
>
<input
type=
"text"
class=
"form-control validate[required,custom[number]]"
name=
"sign_limits"
placeholder=
"限制家庭组数"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
分类
</label>
<div
class=
"col-lg-10"
>
<select
class=
"form-control"
name=
'catalog_id'
>
{volist name="catalog_list" id="vo"}
<option
value=
"{$vo.id}"
>
{$vo.name}
</option>
{/volist}
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
城市
</label>
<div
class=
"col-lg-10"
>
<select
class=
"form-control"
name=
'city'
>
{volist name="city_list" id="vo"}
<option
value=
"{$vo.id}"
>
{$vo.name}
</option>
{/volist}
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
标签
</label>
<div
class=
"col-lg-10"
>
<input
type=
"hidden"
name=
"tags"
id=
"tags"
value=
""
>
<select
class=
"selectpicker form-control"
id=
"tags_select"
multiple
data-live-search=
"true"
onchange=
"setTags()"
>
{volist name="tag_list" id="vo"}
<option
value=
"{$vo.id}"
>
{$vo.name}
</option>
{/volist}
</select>
</div>
</div>
<input
type=
"hidden"
id=
"poster"
name=
"poster"
>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
封面
</label>
<div
class=
"col-lg-10"
>
<input
id=
"input-b1"
name=
"poster-choose"
type=
"file"
>
</div>
</div>
<input
type=
"hidden"
name=
"banners"
id=
"banners"
>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
轮播图
</label>
<div
class=
"col-lg-10"
>
<input
id=
"input-b2"
name=
"banner-choose"
multiple=
"multiple"
type=
"file"
>
</div>
</div>
<input
type=
"hidden"
name=
"kf_qrcode"
id=
"kf_qrcode"
>
<div
class=
"form-group"
id=
"qrcode"
style=
"display:none"
>
<label
for=
"title"
class=
"col-sm-1 control-label text-right"
>
客服二维码
</label>
<div
class=
"col-lg-10"
>
<input
id=
"input-b3"
name=
"qrcode-choose"
type=
"file"
>
</div>
</div>
<div
class=
"form-group"
id=
"content"
>
<label
for=
"content"
class=
"col-sm-1 control-label text-right"
>
详细介绍
</label>
<div
class=
"col-lg-10"
>
<!-- 加载编辑器的容器 -->
<script
id=
"post_container"
name=
"description"
type=
"text/plain"
style=
"width: 100%"
>
</script>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<button
type=
"submit"
class=
"btn btn-default"
id=
"btn-save"
>
提交
</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script
type=
"text/javascript"
src=
"/static/fileinput/js/fileinput.min.js"
></script>
<script
type=
"text/javascript"
src=
"/static/fileinput/js/locales/zh.js"
></script>
<script
type=
"text/javascript"
src=
"/static/bootstrap-select/js/bootstrap-select.min.js"
></script>
<script
type=
"text/javascript"
src=
"/static/bootstrap-select/js/i18n/defaults-zh_CN.js"
></script>
<script
type=
"text/javascript"
src=
"/static/validation/js/jquery.validationEngine-zh_CN.js"
></script>
<script
type=
"text/javascript"
src=
"/static/validation/js/jquery.validationEngine.js"
></script>
<script
type=
"text/javascript"
src=
"/static/datetimepicker/js/bootstrap-datetimepicker.min.js"
></script>
<script
type=
"text/javascript"
src=
"/static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
></script>
<!-- 配置文件 -->
<script
type=
"text/javascript"
src=
"/static/ueditor/ueditor.config.js"
></script>
<!-- 编辑器源码文件 -->
<script
type=
"text/javascript"
src=
"/static/ueditor/ueditor.all.js"
></script>
<script
type=
"text/javascript"
>
$
(
function
(){
$
(
"#myFrom"
).
validationEngine
();
// 即时显示封面图
$
(
'#poster'
).
change
(
function
(
e
){
var
file
=
e
.
target
.
files
[
0
];
preview
(
file
,
0
);
});
});
$
(
"#peoject_type"
).
change
(
function
(){
if
(
$
(
this
).
val
()
==
2
){
$
(
"#qrcode"
).
show
();
}
else
{
$
(
"#qrcode"
).
hide
();
}
});
$
(
"#start"
).
datetimepicker
({
language
:
'zh-CN'
,
autoclose
:
true
,
format
:
'yyyy-mm-dd hh:ii:00'
});
$
(
"#end"
).
datetimepicker
({
language
:
'zh-CN'
,
autoclose
:
true
,
format
:
'yyyy-mm-dd hh:ii:00'
});
// 初始化文件上传
initFileInput
(
$
(
"#input-b1"
),
"poster-choose"
,
true
,
$
(
"#poster"
));
initFileInput
(
$
(
"#input-b3"
),
"qrcode-choose"
,
true
,
$
(
"#kf_qrcode"
));
// 单文件上传
function
initFileInput
(
el
,
name
,
overwrite
,
save
){
el
.
fileinput
({
language
:
'zh'
,
uploadExtraData
:{
'name'
:
name
},
uploadUrl
:
"{:url('admin/Upload/savaAsync')}"
,
//上传的地址
// initialPreviewAsData: true,
dropZoneEnabled
:
false
,
// showRemove :false,
// autoReplace : overwrite,
// showUpload:true, //是否显示上 传按钮
// dropZoneEnabled: false,
// overwriteInitial:overwrite,
// showUploadedThumbs:true,
maxFileCount
:
1
,
allowedFileExtensions
:
[
'bmp'
,
'jpg'
,
'png'
,
'tif'
,
'gif'
,
'pcx'
,
'tga'
,
'exif'
,
'fpx'
,
'svg'
,
'cdr'
,
'pcd'
,
'dxf'
,
'ufo'
,
'eps'
,
'raw'
,
'WMF'
,
'webp'
],
//接收的文件后缀
}).
on
(
"fileuploaded"
,
function
(
event
,
data
,
previewId
){
$
(
"#"
+
previewId
).
attr
(
"data-server-id"
,
data
.
response
.
result
.
server_id
);
$
(
"#"
+
previewId
).
attr
(
"data-url"
,
data
.
response
.
result
.
url
);
// banners.push(data.response.result.url);
// $("#banners").val(JSON.stringify(banners));
save
.
val
(
data
.
response
.
result
.
url
);
// console.log(event);
// console.log(data.response.result.url);
// console.log(previewId);
}).
on
(
'filesuccessremove'
,
function
(
event
,
id
)
{
var
dp
=
$
(
"#"
+
id
).
data
(
"server-id"
);
var
url
=
$
(
"#"
+
id
).
data
(
"url"
)
// banners.splice($.inArray(url,banners),1);
// banners.splice($.inArray(url,banners),1);
save
.
val
(
''
);
$
.
post
(
"{:url('admin/Upload/deleteAsync')}"
,
{
'id'
:
dp
},
function
(
data
){
if
(
data
.
code
==
0
){
return
false
;
}
},
function
(
err
){
return
false
;
})
})
}
// 多文件上传
var
banners
=
[];
$
(
"#input-b2"
).
fileinput
({
language
:
'zh'
,
// initialPreview: [
// 'http://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/FullMoon2010.jpg/631px-FullMoon2010.jpg',
// 'http://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/Earth_Eastern_Hemisphere.jpg/600px-Earth_Eastern_Hemisphere.jpg'
// ],
uploadExtraData
:{
'name'
:
'banner-choose'
},
// initialPreviewConfig: [{
// url: '{:url('admin/project/upProjectPoster')}',// 预展示图片的删除调取路径
// key: 100,// 可修改 场景2中会用的
// extra: {id: 100} //调用删除路径所传参数
// }],
initialPreviewShowDelete
:
true
,
initialPreviewAsData
:
true
,
uploadUrl
:
"{:url('admin/Upload/savaAsync')}"
,
//上传的地址
dropZoneEnabled
:
false
,
showRemove
:
false
,
autoReplace
:
false
,
showUpload
:
true
,
//是否显示上 传按钮
dropZoneEnabled
:
false
,
overwriteInitial
:
false
,
showUploadedThumbs
:
true
,
allowedFileExtensions
:
[
'bmp'
,
'jpg'
,
'png'
,
'tif'
,
'gif'
,
'pcx'
,
'tga'
,
'exif'
,
'fpx'
,
'svg'
,
'cdr'
,
'pcd'
,
'dxf'
,
'ufo'
,
'eps'
,
'raw'
,
'WMF'
,
'webp'
],
//接收的文件后缀
}).
on
(
"fileuploaded"
,
function
(
event
,
data
,
previewId
){
$
(
"#"
+
previewId
).
attr
(
"data-server-id"
,
data
.
response
.
result
.
server_id
);
$
(
"#"
+
previewId
).
attr
(
"data-url"
,
data
.
response
.
result
.
url
);
banners
.
push
(
data
.
response
.
result
.
url
);
$
(
"#banners"
).
val
(
JSON
.
stringify
(
banners
));
// console.log(event);
// console.log(data.response.result.url);
// console.log(previewId);
}).
on
(
'filesuccessremove'
,
function
(
event
,
id
)
{
var
dp
=
$
(
"#"
+
id
).
data
(
"server-id"
);
var
url
=
$
(
"#"
+
id
).
data
(
"url"
)
// banners.splice($.inArray(url,banners),1);
banners
.
splice
(
$
.
inArray
(
url
,
banners
),
1
);
$
(
"#banners"
).
val
(
JSON
.
stringify
(
banners
));
$
.
post
(
"{:url('admin/Upload/deleteAsync')}"
,
{
'id'
:
dp
},
function
(
data
){
if
(
data
.
code
==
0
){
return
false
;
}
},
function
(
err
){
return
false
;
})
})
function
setTags
(){
var
slected
=
$
(
"#tags_select"
).
val
();
if
(
slected
){
$
(
"#tags"
).
val
(
slected
.
toString
());
}
else
{
$
(
"#tags"
).
val
(
""
);
}
}
UE
.
getEditor
(
'post_container'
,
{
//编辑区域大小
'initialFrameHeight'
:
'350'
,
'elementPathEnabled'
:
false
,
'autoHeight'
:
true
,
'autoHeightEnabled'
:
true
,
'autoFloatEnabled'
:
true
,
'iframeCssUrl'
:
'/static/ueditor/themes/iframe.css'
,
// 引入css
//定制菜单
'toolbars'
:
[
[
'fullscreen'
,
'source'
,
'undo'
,
'redo'
,
'|'
,
'fontsize'
,
'bold'
,
'italic'
,
'underline'
,
'fontborder'
,
'strikethrough'
,
'removeformat'
,
'formatmatch'
,
'blockquote'
,
'pasteplain'
,
'|'
,
'forecolor'
,
'backcolor'
,
'|'
,
'lineheight'
,
'|'
,
'indent'
,
'|'
,
'insertimage'
,
'|'
,
'justifyleft'
,
//居左对齐
'justifyright'
,
//居右对齐
'justifycenter'
,
//居中对齐
'justifyjustify'
,
//两端对齐
],
]
});
function
test
(){
console
.
log
(
document
.
getElementById
(
"input-b2"
).
files
);
}
</script>
application/admin/view/project/editcatalogs.html
View file @
fb00509d
{layout name="public/layout_main"}
<link
rel=
"stylesheet"
href=
"/static/fileinput/css/fileinput.css"
>
<section
class=
"wrapper"
>
<h3><i
class=
"fa fa-angle-right"
></i>
<a
href=
"{:url('admin/project/catalogs')}"
>
分类管理
</a>
<i
class=
"fa fa-angle-right"
></i>
修改分类
</h3>
<h3><i
class=
"fa fa-angle-right"
></i>
<a
href=
"{:url('admin/project/catalogs')}"
>
分类管理
</a>
<i
class=
"fa fa-angle-right"
></i>
{if condition="$tag_info"}
修改分类
{else/}
添加分类
{/if}
</h3>
<!-- 分割线 -->
<hr>
<div
class=
"col-xs-12"
>
<form
method=
"post"
class=
"form-horizontal"
enctype=
"multipart/form-data"
action=
"{:url('admin/project/updateCatalogs')}"
>
<form
method=
"post"
class=
"form-horizontal"
enctype=
"multipart/form-data"
{
if
condition=
"$tag_info"
}
action=
"{:url('admin/project/updateCatalogs')}"
{
else
/}
action=
"{:url('admin/project/addCatalogs')}"
{/
if
}
>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
分类名
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
...
...
@@ -17,8 +23,11 @@
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
文章封面
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
type=
"hidden"
name=
'old_poster'
value=
"{$tag_info.poster}"
>
<img
src=
"{$tag_info.poster}"
style=
"width:170px;margin-bottom:10px"
alt=
""
id=
"poster_view"
>
<a
href=
"{$tag_info.poster}"
target=
"_blank"
data-fancybox=
"images"
id=
"poster_view"
>
<img
src=
"{$tag_info.poster}"
style=
"width:170px;margin-bottom:10px"
>
</a>
<input
id=
"input-b1"
name=
"poster"
type=
"file"
>
<span
class=
"form-group-tip"
>
* 尺寸建议:90px*90px
</span>
</div>
</div>
<div
class=
"form-group"
>
...
...
@@ -29,7 +38,7 @@
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<button
type=
"submit"
class=
"btn btn-success"
>
修改
</button>
<button
type=
"submit"
class=
"btn btn-success"
>
提交
</button>
</div>
</div>
</form>
...
...
@@ -45,6 +54,8 @@
var
fileInput
=
$
(
"#input-b1"
).
fileinput
({
language
:
'zh'
,
showUpload
:
false
,
//是否显示上传按钮
showRemove
:
false
,
showClose
:
false
,
allowedFileExtensions
:
[
'bmp'
,
'jpg'
,
'png'
,
'tif'
,
'gif'
,
'pcx'
,
'tga'
,
'exif'
,
'fpx'
,
'svg'
,
'cdr'
,
'pcd'
,
'dxf'
,
'ufo'
,
'eps'
,
'raw'
,
'WMF'
,
'webp'
],
//接收的文件后缀
})
$
(
"#input-b1"
).
change
(
function
(
data
){
...
...
application/admin/view/project/index.html
View file @
fb00509d
{layout name="public/layout_main"}
<style>
.table-detail-left
{
float
:
left
;
width
:
40%
;
}
.table-detail-right
{
float
:
left
;
width
:
60%
;
}
.table-detail-row
{
margin-bottom
:
5px
;
padding-left
:
80px
;
}
.table-detail-row
span
{
display
:
inline-block
;
width
:
70px
;
text-align
:
right
;
margin-left
:
-80px
;
}
.table-detail-full
{
width
:
100%
;
float
:
left
;
}
</style>
<section
class=
"wrapper"
>
<h3><i
class=
"fa fa-angle-right"
></i>
活动商家列表
</h3>
<!-- 分割线 -->
...
...
@@ -53,15 +77,10 @@
<th>
封面图
</th>
<th>
国内/国外
</th>
<th>
城市
</th>
<th>
活动时间
</th>
<th>
报名截止时间
</th>
<th>
分类
</th>
<th>
标签
</th>
<th>
价格
</th>
<th>
会员价
</th>
<th>
活动/商家信息
</th>
<th>
状态
</th>
<th>
总量
</th>
<th>
已售
</th>
<th>
推荐置顶
</th>
<th>
操作
</th>
</tr>
</thead>
...
...
@@ -70,7 +89,11 @@
<tr
id=
"tr_{$vo.id}"
>
<td>
{$vo.id}
</td>
<td>
{$vo.title}
</td>
<td><img
style=
"width:90px"
src=
"{$vo.poster}"
alt=
""
></td>
<td>
<a
href=
"<?=$vo->poster?>"
target=
"_blank"
data-fancybox=
"images"
>
<img
src=
"<?=$vo->poster?>"
width=
'100'
height=
'50'
>
</a>
</td>
<td>
{if condition="$vo.region_type==1"}
国内
...
...
@@ -79,17 +102,40 @@
{/if}
</td>
<td>
{$vo.city_str.name}
</td>
<td>
{$vo.time_period}
</td>
<td>
{$vo.sign_endtime}
</td>
<td>
{$vo.catalog_id_str.name}
</td>
<td
width=
"170px"
>
{$vo.tags}
<td
style=
"width: 500px"
>
{if condition="$vo.type==1"}
<div
class=
"clearfix"
style=
"width: 500px"
>
<div
class=
"table-detail-left"
>
<p
class=
"table-detail-row"
><span>
类
型:
</span>
活动
</p>
<p
class=
"table-detail-row"
><span>
晚
数:
</span>
{$vo.night_num}
</p>
<p
class=
"table-detail-row"
><span>
价
格:
</span>
¥{$vo.price}
</p>
<p
class=
"table-detail-row"
><span>
会员价:
</span>
¥{$vo.vip_price}
</p>
</div>
<div
class=
"table-detail-right"
>
<p
class=
"table-detail-row"
><span>
总
组
数:
</span>
{$vo.sign_limits}
</p>
<p
class=
"table-detail-row"
><span>
已售组数:
</span>
{$vo.sign_num}
</p>
<p
class=
"table-detail-row"
><span>
活动时间:
</span>
{$vo.time_period}
</p>
<p
class=
"table-detail-row"
><span>
报名截至:
</span>
{$vo.sign_endtime}
</p>
</div>
<div
class=
"table-detail-full"
>
<p
class=
"table-detail-row"
><span>
所在地:
</span>
{$vo.location}
</p>
<p
class=
"table-detail-row"
><span>
标
签:
</span>
{$vo.tags}
</p>
</div>
</div>
{else/}
<div
class=
"clearfix"
style=
"width: 500px"
>
<p
class=
"table-detail-row"
><span>
类
型:
</span>
商家
</p>
<p
class=
"table-detail-row"
><span>
所在地:
</span>
{$vo.location}
</p>
<p
class=
"table-detail-row"
><span>
标
签:
</span>
{$vo.tags}
</p>
</div>
{/if}
</td>
<td>
{$vo.price}
</td>
<td>
{$vo.vip_price}
</td>
<td>
{$vo.sign_endtime_str}
</td>
<td>
{$vo.sign_limits}
</td>
<td>
{$vo.sign_num}
</td>
<td>
<input
type=
"number"
size=
"4"
style=
"width:50px"
onchange=
"setHeat(this,{$vo.id},{$vo.heat})"
value=
"{$vo.heat}"
>
</td>
<td>
<a
href=
"{:url('admin/project/updateProject',['id'=>$vo.id])}"
class=
"btn btn-xs btn-primary"
><i
class=
"fa fa-pencil"
></i></a>
<a
href=
"javascript:"
oid=
"{$vo.id}"
class=
"btn btn-xs btn-danger btn-delete"
><i
class=
"fa fa-trash"
></i></a>
...
...
@@ -109,26 +155,42 @@
</section>
<script
type=
"text/javascript"
>
$
(
"#myModal"
).
modal
();
// 设置推荐置顶
function
setHeat
(
that
,
id
,
oldHeat
){
var
heat
=
$
(
that
).
val
();
if
(
heat
<
0
){
$
(
that
).
val
(
oldHeat
);
return
;
}
$
.
post
(
"{:url('admin/project/setHeat')}"
,
{
id
:
id
,
heat
:
heat
},
function
(
res
)
{
// var res = JSON.parse(res);
if
(
res
.
code
==
0
)
{
// javascript 的默认弹出提示方法
alert
(
res
.
msg
);
$
(
that
).
val
(
oldHeat
);
}
});
}
// 文档加载完毕之后,会进入该方法
$
(
function
(){
$
(
".btn-delete"
).
click
(
function
(){
var
_this
=
$
(
this
);
var
url
=
"{:url('admin/project/delete')}"
;
var
oid
=
_this
.
attr
(
'oid'
);
showDialog
(
"提示"
,
"确定删除该项目/商家吗?"
,
function
(){
// ajax post 方法
$
.
post
(
url
,
{
id
:
oid
},
function
(
res
)
{
// var res = JSON.parse(res);
if
(
res
.
code
==
1
){
// javascript 的默认弹出提示方法
_this
.
remove
();
$
(
"#tr_"
+
oid
).
fadeOut
();
}
else
{
alert
(
res
.
msg
);
}
});
});
});
$
(
function
()
{
$
(
".btn-delete"
).
click
(
function
()
{
var
_this
=
$
(
this
);
var
url
=
"{:url('admin/project/delete')}"
;
var
oid
=
_this
.
attr
(
'oid'
);
showDialog
(
"提示"
,
"确定删除该项目/商家吗?"
,
function
()
{
// ajax post 方法
$
.
post
(
url
,
{
id
:
oid
},
function
(
res
)
{
// var res = JSON.parse(res);
if
(
res
.
code
==
1
)
{
// javascript 的默认弹出提示方法
_this
.
remove
();
$
(
"#tr_"
+
oid
).
fadeOut
();
}
else
{
alert
(
res
.
msg
);
}
});
});
});
});
</script>
application/admin/view/project/updateproject.html
View file @
fb00509d
...
...
@@ -16,7 +16,8 @@
</style>
<section
class=
"wrapper"
>
<h3
class=
""
>
<i
class=
"fa fa-angle-right"
></i>
<a
href=
"{:url('admin/project/index')}"
>
活动/商家列表
</a>
<i
class=
"fa fa-angle-right"
></i>
修改活动/商家
<i
class=
"fa fa-angle-right"
></i>
<a
href=
"{:url('admin/project/index')}"
>
活动/商家列表
</a>
<i
class=
"fa fa-angle-right"
></i>
{if condition="$project_info"}修改活动/商家 {else/} 创建活动/商家{/if}
</h3>
<hr>
...
...
@@ -59,24 +60,30 @@
</select>
</div>
</div>
<div
class=
"form-group
"
>
<div
class=
"form-group
type_toggle"
{
if
condition=
"$project_info.type==2"
}
style=
"display:none"
{/
if
}
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
活动时间
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
type=
"text"
class=
"form-control validate[required]"
name=
"time_period"
id=
"start"
placeholder=
"请填写活动时间"
value=
"{$project_info.time_period}"
>
</div>
</div>
<div
class=
"form-group
"
>
<div
class=
"form-group
type_toggle"
{
if
condition=
"$project_info.type==2"
}
style=
"display:none"
{/
if
}
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
报名截止时间
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
type=
"text"
class=
"form-control validate[required,custom[dateTime]]"
name=
"sign_endtime"
id=
"end"
value=
"{$project_info.sign_endtime}"
placeholder=
"请填写报名截止时间"
>
</div>
</div>
<div
class=
"form-group
"
>
<div
class=
"form-group
type_toggle"
{
if
condition=
"$project_info.type==2"
}
style=
"display:none"
{/
if
}
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
组数限制
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
type=
"text"
class=
"form-control validate[required,custom[number]]"
name=
"sign_limits"
id=
"sign_limits"
value=
"{$project_info.sign_limits}"
placeholder=
"限制家庭组数"
>
</div>
</div>
<div
class=
"form-group type_toggle"
{
if
condition=
"$project_info.type==2"
}
style=
"display:none"
{/
if
}
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
晚数
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
type=
"text"
class=
"form-control validate[required,custom[number]]"
name=
"night_num"
id=
"night_num"
value=
"{$project_info.sign_limits}"
placeholder=
"晚数"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
分类
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
...
...
@@ -102,18 +109,36 @@
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<select
class=
"selectpicker form-control"
id=
"tags_select"
multiple
data-live-search=
"true"
>
{volist name="tag_list" id="vo"}
<option
value=
"{$vo.id}"
{
if
condition=
"in_array($vo.id,$tags)"
}
selected
{/
if
}
>
{$vo.name}
</option>
<option
value=
"{$vo.id}"
{
if
condition=
"
$tags&&
in_array($vo.id,$tags)"
}
selected
{/
if
}
>
{$vo.name}
</option>
{/volist}
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
地点
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
type=
"text"
class=
"form-control validate[required]"
name=
"location"
id=
"location"
placeholder=
"地点"
value=
"{$project_info.location}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
经纬度
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6 "
>
<div
class=
"input-group"
>
<span
class=
"input-group-addon"
>
经度
</span>
<input
type=
"text"
class=
"form-control validate[required]"
name=
"longitude"
id=
"longitude"
placeholder=
"经度"
value=
"{$project_info.longitude}"
>
<span
class=
"input-group-addon"
>
纬度
</span>
<input
type=
"text"
class=
"form-control validate[required]"
name=
"latitude"
id=
"latitude"
placeholder=
"纬度"
value=
"{$project_info.latitude}"
>
</div>
<span
class=
"form-group-tip"
>
经纬度在地图上搜索并复制粘贴过来即可,
<a
href=
"http://www.gpsspg.com/maps.htm"
target=
"_blank"
>
立即查看地图
</a>
。
</span>
</div>
</div>
<div
class=
"form-group type_toggle"
{
if
condition=
"$project_info.type==2"
}
style=
"display:none"
{/
if
}
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
价格
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
type=
"text"
class=
"form-control validate[required,custom[number]]"
name=
""
id=
"price"
placeholder=
"价格"
value=
"{$project_info.price}"
>
</div>
</div>
<div
class=
"form-group
"
>
<div
class=
"form-group
type_toggle"
{
if
condition=
"$project_info.type==2"
}
style=
"display:none"
{/
if
}
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
会员价
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
type=
"text"
class=
"form-control validate[required,custom[number]]"
name=
""
id=
"vip_price"
placeholder=
"价格"
value=
"{$project_info.vip_price}"
>
...
...
@@ -124,6 +149,7 @@
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
封面
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
id=
"input-b1"
name=
""
type=
"file"
>
<span
class=
"form-group-tip"
>
* 尺寸建议:260px*190px
</span>
</div>
</div>
...
...
@@ -132,13 +158,15 @@
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
轮播图
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
id=
"input-b2"
name=
""
multiple
type=
"file"
>
<span
class=
"form-group-tip"
>
* 尺寸建议:260px*190px
</span>
</div>
</div>
<!-- <input type="hidden" name="kf_qrcode" id="kf_qrcode"> -->
<div
class=
"form-group
"
id=
"qrcode"
{
if
condition=
"$project_info.type!=2"
}
style=
"display:none"
{/
if
}
>
<div
class=
"form-group
type_toggle_2"
id=
"qrcode"
{
if
condition=
"$project_info.type!=2"
}
style=
"display:none"
{/
if
}
>
<label
for=
"title"
class=
"col-sm-2 control-label text-right"
>
客服二维码
</label>
<div
class=
"col-sm-10 col-md-8 col-lg-6"
>
<input
id=
"input-b3"
name=
""
type=
"file"
>
<span
class=
"form-group-tip"
>
* 尺寸建议:100px*100px
</span>
</div>
</div>
...
...
@@ -154,7 +182,7 @@
</form>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-20"
>
<button
class=
"btn btn-success"
id=
"btn-save"
>
修改
</button>
<button
class=
"btn btn-success"
id=
"btn-save"
>
保存
</button>
</div>
</div>
</div>
...
...
@@ -178,207 +206,215 @@
<script
type=
"text/javascript"
>
$
(
function
(){
$
(
"#myFrom"
).
validationEngine
();
// 即时显示封面图
// $('#poster').change(function(e){
// var file = e.target.files[0];
// preview(file, 0);
// });
});
$
(
"#peoject_type"
).
change
(
function
(){
if
(
$
(
this
).
val
()
==
2
){
$
(
"#qrcode"
).
show
();
}
else
{
$
(
"#qrcode"
).
hide
();
}
});
$
(
"#peoject_type"
).
change
(
function
(){
if
(
$
(
this
).
val
()
==
1
){
$
(
".type_toggle"
).
fadeIn
();
$
(
".type_toggle_2"
).
fadeOut
();
$
(
".type_toggle"
).
children
(
'input'
).
removeAttr
(
'disabled'
);
}
else
{
$
(
".type_toggle"
).
fadeOut
();
$
(
".type_toggle"
).
find
(
'input'
).
attr
(
'disabled'
,
true
);
$
(
".type_toggle_2"
).
fadeIn
();
}
});
// 初始化时间选择器
// $("#start").datetimepicker({
// language: 'zh-CN',
// autoclose: true,
// format: 'yyyy-mm-dd hh:ii:00'
// });
$
(
"#end"
).
datetimepicker
({
language
:
'zh-CN'
,
autoclose
:
true
,
format
:
'yyyy-mm-dd hh:ii:00'
});
$
(
"#end"
).
datetimepicker
({
language
:
'zh-CN'
,
autoclose
:
true
,
format
:
'yyyy-mm-dd hh:ii:00'
});
// 文件上传反显数据初始化
var
deleteUrl
=
"{:url('admin/project/deleteBanners')}"
;
var
project_id
=
"{$project_info.id}"
;
var
posterInit
=
"{$project_info.poster}"
;
var
qrcodeInit
=
"{$project_info.kf_qrcode}"
;
var
deleteUrl
=
"{:url('admin/project/deleteBanners')}"
;
var
project_id
=
""
;
var
posterInit
=
""
;
var
qrcodeInit
=
""
;
var
bannersInit
=
[];
var
bannerConfig
=
[];
var
saveUrl
=
"{:url('admin/project/create')}"
;
{
if
condition
=
"$project_info"
}
project_id
=
"{$project_info.id}"
;
posterInit
=
"{$project_info.poster}"
;
qrcodeInit
=
"{$project_info.kf_qrcode}"
;
bannersInit
=
{
$project_info
.
banners_native
};
saveUrl
=
"{:url('admin/project/updateProject')}"
;
{
/if
}
var
bannersInit
=
{
$project_info
.
banners_native
};
var
bannerConfig
=
[];
for
(
var
i
=
0
;
i
<
bannersInit
.
length
;
i
++
){
var
obj
=
{
url
:
deleteUrl
,
extra
:
{
id
:
project_id
,
address
:
bannersInit
[
i
]
}
}
bannerConfig
.
push
(
obj
);
}
for
(
var
i
=
0
;
i
<
bannersInit
.
length
;
i
++
){
var
obj
=
{
url
:
deleteUrl
,
extra
:
{
id
:
project_id
,
address
:
bannersInit
[
i
]
}
}
bannerConfig
.
push
(
obj
);
}
// 初始化文件上传
initFileInput
(
$
(
"#input-b1"
),
posterInit
);
initFileInput
(
$
(
"#input-b3"
),
qrcodeInit
);
initFileInput
(
$
(
"#input-b1"
),
posterInit
);
initFileInput
(
$
(
"#input-b3"
),
qrcodeInit
);
// 单文件上传
function
initFileInput
(
el
,
initArr
,
initConfig
){
var
initialPreview
=
[];
initialPreview
.
push
(
initArr
);
el
.
fileinput
({
language
:
'zh'
,
uploadExtraData
:{
'name'
:
name
},
initialPreview
:
initialPreview
,
uploadExtraData
:{
'name'
:
'banner-choose'
},
// initialPreviewConfig: initConfig,
autoReplace
:
true
,
showUpload
:
false
,
//是否显示上 传按钮
initialPreviewShowDelete
:
true
,
initialPreviewAsData
:
true
,
dropZoneEnabled
:
false
,
showRemove
:
false
,
showUpload
:
false
,
//是否显示上 传按钮
overwriteInitial
:
true
,
showUploadedThumbs
:
false
,
allowedFileExtensions
:
[
'bmp'
,
'jpg'
,
'png'
,
'tif'
,
'gif'
,
'pcx'
,
'tga'
,
'exif'
,
'fpx'
,
'svg'
,
'cdr'
,
'pcd'
,
'dxf'
,
'ufo'
,
'eps'
,
'raw'
,
'WMF'
,
'webp'
],
//接收的文件后缀
})
}
function
initFileInput
(
el
,
initArr
,
initConfig
){
var
initialPreview
=
[];
if
(
initArr
){
initialPreview
.
push
(
initArr
);
}
el
.
fileinput
({
language
:
'zh'
,
initialPreview
:
initialPreview
,
uploadExtraData
:{
'name'
:
'banner-choose'
},
// initialPreviewConfig: initConfig,
autoReplace
:
true
,
showUpload
:
false
,
//是否显示上 传按钮
initialPreviewShowDelete
:
true
,
initialPreviewAsData
:
true
,
dropZoneEnabled
:
false
,
showRemove
:
false
,
overwriteInitial
:
true
,
showUploadedThumbs
:
false
,
showClose
:
false
,
allowedFileExtensions
:
[
'bmp'
,
'jpg'
,
'png'
,
'tif'
,
'gif'
,
'pcx'
,
'tga'
,
'exif'
,
'fpx'
,
'svg'
,
'cdr'
,
'pcd'
,
'dxf'
,
'ufo'
,
'eps'
,
'raw'
,
'WMF'
,
'webp'
],
//接收的文件后缀
})
}
// 多文件上传
var
fileUpload
=
$
(
"#input-b2"
).
fileinput
({
language
:
'zh'
,
initialPreview
:
bannersInit
,
uploadExtraData
:{
'name'
:
'banner-choose'
},
// initialPreviewConfig: [{
// url: '{:url('admin/project/upProjectPoster')}',// 预展示图片的删除调取路径
// key: 100,// 可修改 场景2中会用的
// extra: {id: 100} //调用删除路径所传参数
// }],
initialPreviewConfig
:
bannerConfig
,
initialPreviewShowDelete
:
true
,
initialPreviewAsData
:
true
,
dropZoneEnabled
:
false
,
showRemove
:
false
,
autoReplace
:
true
,
showUpload
:
false
,
//是否显示上 传按钮
dropZoneEnabled
:
false
,
overwriteInitial
:
false
,
showUploadedThumbs
:
false
,
removeLabel
:
'remove'
,
allowedFileExtensions
:
[
'bmp'
,
'jpg'
,
'png'
,
'tif'
,
'gif'
,
'pcx'
,
'tga'
,
'exif'
,
'fpx'
,
'svg'
,
'cdr'
,
'pcd'
,
'dxf'
,
'ufo'
,
'eps'
,
'raw'
,
'WMF'
,
'webp'
],
//接收的文件后缀
}).
on
(
'filepredelete'
,
function
(
event
,
key
,
three
,
four
)
{
if
(
!
confirm
(
'将立即从数据库中删除该图片,且不可撤回,是否继续'
)){
four
.
abort
();
}
});
var
fileUpload
=
$
(
"#input-b2"
).
fileinput
({
language
:
'zh'
,
initialPreview
:
bannersInit
,
uploadExtraData
:{
'name'
:
'banner-choose'
},
initialPreviewConfig
:
bannerConfig
,
initialPreviewShowDelete
:
true
,
initialPreviewAsData
:
true
,
dropZoneEnabled
:
false
,
showRemove
:
false
,
showClose
:
false
,
autoReplace
:
true
,
showUpload
:
false
,
//是否显示上 传按钮
overwriteInitial
:
false
,
showUploadedThumbs
:
false
,
removeLabel
:
'remove'
,
allowedFileExtensions
:
[
'bmp'
,
'jpg'
,
'png'
,
'tif'
,
'gif'
,
'pcx'
,
'tga'
,
'exif'
,
'fpx'
,
'svg'
,
'cdr'
,
'pcd'
,
'dxf'
,
'ufo'
,
'eps'
,
'raw'
,
'WMF'
,
'webp'
],
//接收的文件后缀
}).
on
(
'filepredelete'
,
function
(
event
,
key
,
three
,
four
)
{
if
(
!
confirm
(
'将立即从数据库中删除该图片,且不可撤回,是否继续'
)){
four
.
abort
();
}
});
// function setTags(that,name){
// var slected = $(that).val();
// if(slected){
// $("input[name=\'"+name+"\']").val(slected.toString());
// }else{
// $("input[name=\'"+name+"\']").val("");
// }
// }
var
ueditor
=
UE
.
getEditor
(
'post_container'
,
{
//编辑区域大小
'initialFrameHeight'
:
'350'
,
'elementPathEnabled'
:
false
,
'autoHeight'
:
true
,
'autoHeightEnabled'
:
true
,
'autoFloatEnabled'
:
true
,
'iframeCssUrl'
:
'/static/ueditor/themes/iframe.css'
,
// 引入css
//定制菜单
'toolbars'
:
[
[
'fullscreen'
,
'source'
,
'undo'
,
'redo'
,
'|'
,
'fontsize'
,
'bold'
,
'italic'
,
'underline'
,
'fontborder'
,
'strikethrough'
,
'removeformat'
,
'formatmatch'
,
'blockquote'
,
'pasteplain'
,
'|'
,
'forecolor'
,
'backcolor'
,
'|'
,
'lineheight'
,
'|'
,
'indent'
,
'|'
,
'insertimage'
,
'|'
,
'justifyleft'
,
//居左对齐
'justifyright'
,
//居右对齐
'justifycenter'
,
//居中对齐
'justifyjustify'
,
//两端对齐
],
]
});
$
(
"#btn-save"
).
click
(
function
(){
$
(
this
).
attr
(
"disabled"
,
"true"
);
var
validate
=
$
(
'#myFrom'
).
validationEngine
(
'validate'
)
if
(
!
validate
){
$
(
this
).
removeAttr
(
"disabled"
);
return
;
}
var
poster
=
$
(
'#input-b1'
).
fileinput
(
'getFileStack'
);
var
banners
=
$
(
'#input-b2'
).
fileinput
(
'getFileStack'
);
var
qcode
=
$
(
'#input-b3'
).
fileinput
(
'getFileStack'
);
var
ueditor
=
UE
.
getEditor
(
'post_container'
,
{
//编辑区域大小
'initialFrameHeight'
:
'350'
,
'elementPathEnabled'
:
false
,
'autoHeight'
:
true
,
'autoHeightEnabled'
:
true
,
'autoFloatEnabled'
:
true
,
'iframeCssUrl'
:
'/static/ueditor/themes/iframe.css'
,
// 引入css
//定制菜单
'toolbars'
:
[
[
'fullscreen'
,
'source'
,
'undo'
,
'redo'
,
'|'
,
'fontsize'
,
'bold'
,
'italic'
,
'underline'
,
'fontborder'
,
'strikethrough'
,
'removeformat'
,
'formatmatch'
,
'blockquote'
,
'pasteplain'
,
'|'
,
'forecolor'
,
'backcolor'
,
'|'
,
'lineheight'
,
'|'
,
'indent'
,
'|'
,
'insertimage'
,
'|'
,
'justifyleft'
,
//居左对齐
'justifyright'
,
//居右对齐
'justifycenter'
,
//居中对齐
'justifyjustify'
,
//两端对齐
],
]
});
//表单AJAX提交 ,使用formData
$
(
"#btn-save"
).
click
(
function
(){
$
(
this
).
attr
(
"disabled"
,
"true"
);
var
validate
=
$
(
'#myFrom'
).
validationEngine
(
'validate'
)
if
(
!
validate
){
$
(
this
).
removeAttr
(
"disabled"
);
return
;
}
var
poster
=
$
(
'#input-b1'
).
fileinput
(
'getFileStack'
);
var
banners
=
$
(
'#input-b2'
).
fileinput
(
'getFileStack'
);
var
qcode
=
$
(
'#input-b3'
).
fileinput
(
'getFileStack'
);
var
formValue
=
new
FormData
();
formValue
.
append
(
'id'
,
"{$project_info.id}"
);
formValue
.
append
(
'type'
,
$
(
"#peoject_type"
).
val
());
formValue
.
append
(
'title'
,
$
(
"#title"
).
val
());
formValue
.
append
(
'region_type'
,
$
(
"#region_type"
).
val
());
formValue
.
append
(
'time_period'
,
$
(
"#start"
).
val
());
formValue
.
append
(
'sign_endtime'
,
$
(
"#end"
).
val
());
formValue
.
append
(
'sign_limits'
,
$
(
"#sign_limits"
).
val
());
formValue
.
append
(
'catalog_id'
,
$
(
"#catalog_id"
).
val
());
formValue
.
append
(
'city'
,
$
(
"#city"
).
val
());
var
tagArr
=
$
(
"#tags_select"
).
val
();
var
tagStr
=
null
;
if
(
tagArr
){
for
(
var
i
=
0
;
i
<
tagArr
.
length
;
i
++
){
if
(
i
==
0
){
tagStr
=
'|'
;
}
tagStr
+=
tagArr
[
i
]
+
'|'
;
}
}
formValue
.
append
(
'tags'
,
tagStr
);
formValue
.
append
(
'price'
,
$
(
"#price"
).
val
());
formValue
.
append
(
'vip_price'
,
$
(
"#vip_price"
).
val
());
formValue
.
append
(
'description'
,
ueditor
.
getContent
());
// var formValue = new FormData(document.getElementById('myFrom'));
var
formValue
=
new
FormData
();
formValue
.
append
(
'id'
,
"{$project_info.id}"
);
formValue
.
append
(
'type'
,
$
(
"#peoject_type"
).
val
());
formValue
.
append
(
'title'
,
$
(
"#title"
).
val
());
formValue
.
append
(
'region_type'
,
$
(
"#region_type"
).
val
());
formValue
.
append
(
'catalog_id'
,
$
(
"#catalog_id"
).
val
());
formValue
.
append
(
'city'
,
$
(
"#city"
).
val
());
formValue
.
append
(
'location'
,
$
(
"#location"
).
val
());
formValue
.
append
(
'longitude'
,
$
(
"#longitude"
).
val
());
formValue
.
append
(
'latitude'
,
$
(
"#latitude"
).
val
());
if
(
$
(
"#peoject_type"
).
val
()
==
1
){
formValue
.
append
(
'time_period'
,
$
(
"#start"
).
val
());
formValue
.
append
(
'sign_endtime'
,
$
(
"#end"
).
val
());
formValue
.
append
(
'sign_limits'
,
$
(
"#sign_limits"
).
val
());
formValue
.
append
(
'night_num'
,
$
(
"#night_num"
).
val
());
formValue
.
append
(
'price'
,
$
(
"#price"
).
val
());
formValue
.
append
(
'vip_price'
,
$
(
"#vip_price"
).
val
());
}
else
{
formValue
.
append
(
'time_period'
,
''
);
formValue
.
append
(
'sign_endtime'
,
null
);
formValue
.
append
(
'sign_limits'
,
null
);
formValue
.
append
(
'night_num'
,
null
);
formValue
.
append
(
'price'
,
null
);
formValue
.
append
(
'vip_price'
,
null
);
}
var
tagArr
=
$
(
"#tags_select"
).
val
();
var
tagStr
=
null
;
if
(
tagArr
){
for
(
var
i
=
0
;
i
<
tagArr
.
length
;
i
++
){
if
(
i
==
0
){
tagStr
=
'|'
;
}
tagStr
+=
tagArr
[
i
]
+
'|'
;
}
}
formValue
.
append
(
'tags'
,
tagStr
);
formValue
.
append
(
'description'
,
ueditor
.
getContent
());
// var formValue = new FormData(document.getElementById('myFrom'));
// formValue.append('poster[]',poster);
if
(
poster
.
length
>
0
){
formValue
.
append
(
'poster'
,
poster
[
0
]);
}
if
(
banners
.
length
>
0
){
for
(
var
i
=
0
;
i
<
banners
.
length
;
i
++
){
formValue
.
append
(
'banners[]'
,
banners
[
i
]);
}
}
if
(
$
(
"#peoject_type"
).
val
()
==
2
){
if
(
qcode
.
length
>
0
){
formValue
.
append
(
'kf_qrcode'
,
qcode
[
0
]);
}
}
$
.
ajax
({
url
:
saveUrl
,
type
:
"POST"
,
data
:
formValue
,
processData
:
false
,
// 不处理数据
contentType
:
false
,
// 不设置内容类型
success
:
function
(
data
){
if
(
data
[
'code'
]
==
1
)
{
showDialog
(
"提示"
,
data
[
'msg'
],
function
()
{
window
.
location
.
href
=
"{:url('admin/project/index')}"
;
});
}
else
{
showDialog
(
"提示"
,
data
[
'msg'
],
function
()
{
$
(
"#btn-save"
).
removeAttr
(
"disabled"
);
});
}
}
});
});
});
// formValue.append('poster[]',poster);
if
(
poster
.
length
>
0
){
formValue
.
append
(
'poster'
,
poster
[
0
]);
}
if
(
banners
.
length
>
0
){
for
(
var
i
=
0
;
i
<
banners
.
length
;
i
++
){
formValue
.
append
(
'banners[]'
,
banners
[
i
]);
}
}
if
(
$
(
"#peoject_type"
).
val
()
==
2
){
if
(
qcode
.
length
>
0
){
formValue
.
append
(
'kf_qrcode'
,
qcode
[
0
]);
}
}
$
.
ajax
({
url
:
"{:url('admin/project/updateProject')}"
,
type
:
"POST"
,
data
:
formValue
,
processData
:
false
,
// 不处理数据
contentType
:
false
,
// 不设置内容类型
success
:
function
(
data
){
if
(
data
[
'code'
]
==
1
)
{
showDialog
(
"提示"
,
data
[
'msg'
],
function
()
{
window
.
location
.
href
=
"{:url('admin/project/index')}"
;
});
}
else
{
showDialog
(
"提示"
,
data
[
'msg'
],
function
()
{
$
(
"#btn-save"
).
removeAttr
(
"disabled"
);
});
}
}
});
});
</script>
application/admin/view/user/index.html
View file @
fb00509d
...
...
@@ -58,7 +58,9 @@
{volist name="user_list" id="vo" key="k" empty="暂时没有数据"}
<tr
id=
"tr_{$vo.id}"
>
<td>
{$vo.id}
</td>
<td><img
src=
"{$vo.avatar}"
onerror=
"this.src='/static/img/default_avatar.png'"
alt=
""
style=
"width:40px;margin-right: 5px"
>
{$vo.nickname}
</td>
<td>
<img
src=
"{$vo.avatar}"
onerror=
"this.src='/static/img/default_avatar.png'"
alt=
""
style=
"width:40px;margin-right: 5px"
>
{$vo.nickname}
</td>
<td>
<!--{$vo.gender}-->
{if condition="$vo.gender == 1"}
...
...
application/mob/view/guide/read.html
View file @
fb00509d
...
...
@@ -15,6 +15,9 @@
#first_div
{
padding
:
15px
10px
;
}
#first_div
img
{
width
:
100%
;
}
#seconde_div
{
color
:
#494949
;
padding-top
:
15px
;
...
...
@@ -29,6 +32,7 @@
<section
class=
"wrapper"
>
<div
id=
"first_div"
>
<img
src=
"{$post.poster}"
alt=
""
>
<span
class=
"post_title"
>
<?=$post->title?>
</span>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment