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
c8af6d1f
Commit
c8af6d1f
authored
Nov 06, 2018
by
LiuJunYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二维码图片
parent
e4851f9d
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
90 additions
and
52 deletions
+90
-52
application/admin/controller/Guide.php
+2
-2
application/admin/controller/Project.php
+17
-7
application/admin/view/guide/update.html
+2
-2
application/admin/view/project/index.html
+21
-15
application/admin/view/project/updateproject.html
+3
-3
application/api/controller/Project.php
+20
-12
application/common/model/Project.php
+25
-11
No files found.
application/admin/controller/Guide.php
View file @
c8af6d1f
...
...
@@ -106,7 +106,7 @@ class Guide extends AuthBase
$type
=
input
(
"post.type"
);
$data
=
array
(
'title'
=>
input
(
"post.title"
),
'tags'
=>
input
(
"post.tags"
)
'tags'
=>
input
(
"post.tags
/a
"
)
);
if
(
$type
==
1
)
{
$data
[
'content'
]
=
input
(
"post.content"
);
...
...
@@ -120,7 +120,7 @@ class Guide extends AuthBase
return
view
();
}
$condition
=
[
'tags'
=>
$data
[
'tags'
]
,
'tags'
=>
implode
(
','
,
$data
[
'tags'
])
,
'title'
=>
$data
[
'title'
],
'intro'
=>
input
(
'post.intro'
),
'type'
=>
$type
,
...
...
application/admin/controller/Project.php
View file @
c8af6d1f
...
...
@@ -51,7 +51,9 @@ class Project extends AuthBase
$this
->
assign
(
'catalog_list'
,
$catalog_list
);
$project_list
=
$this
->
project_model
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
where
(
$condition
)
->
order
(
'sort'
,
'desc'
)
->
order
(
'id desc'
)
->
paginate
(
10
,
false
,
[
'query'
=>
[
'title'
=>
$title
,
'type'
=>
$type
,
'catalog_id'
=>
$catalog_id
]]);
$this
->
assign
(
'project_list'
,
$project_list
);
return
$this
->
fetch
(
''
);
...
...
@@ -140,7 +142,6 @@ class Project extends AuthBase
// 修改项目
public
function
updateProject
(
$id
)
{
if
(
request
()
->
isPost
())
{
// 引入上传类
$id
=
input
(
'post.id'
);
...
...
@@ -159,9 +160,10 @@ class Project extends AuthBase
//如果是商家则保存客服二维码
if
(
$data
[
'type'
]
==
2
)
{
if
(
input
(
'file.kf_qrcode'
))
{
$result
=
$upload
->
sava
(
input
(
'file.kf_qrcode'
));
if
(
!
$result
[
'error'
])
{
$kf_qrcode
=
$result
[
'result'
][
'url'
];
$file
=
request
()
->
file
(
'kf_qrcode'
);
$info
=
$file
->
move
(
'./static/qrcode/'
);
if
(
$info
)
{
$kf_qrcode
=
"/static/qrcode/"
.
$info
->
getSaveName
();
$data
[
'kf_qrcode'
]
=
$kf_qrcode
;
}
}
...
...
@@ -523,9 +525,17 @@ class Project extends AuthBase
$id
=
input
(
'post.id'
);
$res
=
model
(
'project'
)
->
save
([
'heat'
=>
$heat
],[
'id'
=>
$id
]);
if
(
$res
){
$this
->
success
(
'
修改置顶排序
成功'
);
$this
->
success
(
'
开启
成功'
);
}
else
{
$this
->
success
(
'
修改置顶排序
失败'
);
$this
->
success
(
'
开启
失败'
);
}
}
//设置排序
public
function
setSort
()
{
$project
=
new
\app\common\model\Project
();
$project
->
allowField
(
'id'
,
'sort'
)
->
update
(
input
(
'post.'
));
halt
(
$project
->
getLastSql
());
}
}
application/admin/view/guide/update.html
View file @
c8af6d1f
...
...
@@ -63,8 +63,8 @@
<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"
>
<
input
type=
"hidden"
name=
"tags"
id=
"tags"
value=
"{$tags}"
>
<select
class=
"selectpicker form-control"
name=
"tags"
multiple
data-live-search=
"true"
>
<
!--<input type="hidden" name="tags[]" id="tags" value="{$tags}">--
>
<select
class=
"selectpicker form-control"
name=
"tags
[]
"
multiple
data-live-search=
"true"
>
{volist name="tag_list" name="tag_list" id="vo"}
<option
{
if
condition=
"in_array($vo.id,$tag_arr)"
}
selected
{/
if
}
value=
"{$vo.id}"
>
{$vo.name}
</option>
{/volist}
...
...
application/admin/view/project/index.html
View file @
c8af6d1f
{layout name="public/layout_main"}
<script
src=
"/static/js/bootstrap-switch.js"
></script>
<style>
.table-detail-left
{
...
...
@@ -81,6 +82,7 @@
<th>
活动/商家信息
</th>
<th>
状态
</th>
<th>
推荐置顶
</th>
<th>
排序
</th>
<th>
操作
</th>
</tr>
</thead>
...
...
@@ -134,7 +136,12 @@
</td>
<td>
{$vo.sign_endtime_str}
</td>
<td>
<input
type=
"number"
size=
"4"
style=
"width:50px"
onchange=
"setHeat(this,{$vo.id},{$vo.heat})"
value=
"{$vo.heat}"
>
<div
data-id=
"{$vo.id}"
class=
"switch"
checked
data-on-label=
"开启"
data-off-label=
"关闭"
data-off=
"success"
>
<input
type=
"checkbox"
name=
"heat"
{$
vo
.
heat
?
'
checked
'
:
''
;}
/>
</div>
</td>
<td>
<input
type=
"number"
size=
"4"
style=
"width:50px"
onchange=
"setSort(this.value,{$vo.id})"
value=
"{$vo.sort}"
>
</td>
<td>
<a
href=
"{:url('admin/project/updateProject',['id'=>$vo.id])}"
class=
"btn btn-xs btn-primary"
><i
class=
"fa fa-pencil"
></i></a>
...
...
@@ -155,22 +162,21 @@
</section>
<script
type=
"text/javascript"
>
// 设置推荐置顶
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
);
}
$
(
'.switch'
).
on
(
'switch-change'
,
function
(
e
,
data
)
{
var
heat
=
data
.
value
?
1
:
0
;
var
id
=
$
(
this
).
attr
(
'data-id'
);
$
.
post
(
"{:url('setHeat')}"
,{
id
:
id
,
heat
:
heat
},
function
(
res
)
{
location
.
reload
();
});
});
//设置排序
function
setSort
(
sort
,
id
){
$
.
post
(
"{:url('setSort')}"
,{
id
:
id
,
sort
:
sort
},
function
()
{
location
.
reload
();
});
}
// 文档加载完毕之后,会进入该方法
$
(
function
()
{
$
(
".btn-delete"
).
click
(
function
()
{
...
...
application/admin/view/project/updateproject.html
View file @
c8af6d1f
...
...
@@ -88,7 +88,7 @@
<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
}
>
<div
class=
"form-group type_toggle"
>
<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=
"晚数"
>
...
...
@@ -132,13 +132,13 @@
<span
class=
"form-group-tip"
>
经纬度在地图上搜索并复制粘贴过来即可,
<a
href=
"http://www.gpsspg.com/maps.htm"
target=
"_blank"
>
立即查看地图
</a>
。
</span>
</div>
</div>
<div
class=
"form-group"
{
if
condition=
"$project_info.type==2"
}
style=
"display:none"
{/
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"
>
<input
type=
"text"
class=
"form-control validate[required,custom[number]]"
name=
""
id=
"price"
placeholder=
"价格"
value=
"{$project_info.price}"
>
</div>
</div>
<div
class=
"form-group type_toggle"
{
if
condition=
"$project_info.type==2"
}
style=
"display:none"
{/
if
}
>
<div
class=
"form-group type_toggle"
>
<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}"
>
...
...
application/api/controller/Project.php
View file @
c8af6d1f
...
...
@@ -74,6 +74,7 @@ class Project extends Base
}
$project
=
ProjectModel
::
all
(
function
(
$query
)
use
(
$map
,
$p
,
$page
)
{
$query
->
where
(
$map
)
->
order
(
'sort'
,
'desc'
)
->
page
(
$p
,
$page
);
});
...
...
@@ -92,6 +93,7 @@ class Project extends Base
//最新活动-只显示3个
$newProjects
=
ProjectModel
::
all
(
function
(
$query
)
{
$query
->
where
(
'type'
,
1
)
->
order
(
'sort'
,
'desc'
)
->
order
(
'id'
,
'desc'
)
->
limit
(
6
);
});
...
...
@@ -99,9 +101,9 @@ class Project extends Base
//爆款专区-只显示3个
$heatProjects
=
ProjectModel
::
all
(
function
(
$query
)
{
$query
->
where
(
'type'
,
1
)
$query
->
where
(
'type'
,
2
)
->
where
(
'heat'
,
'neq'
,
0
)
->
order
(
'
hea
t'
,
'desc'
)
->
order
(
'
sor
t'
,
'desc'
)
->
order
(
'id'
,
'desc'
)
->
limit
(
6
);
});
...
...
@@ -110,6 +112,8 @@ class Project extends Base
// 酒店预订
$businessProjects
=
ProjectModel
::
all
(
function
(
$query
)
{
$query
->
where
(
'catalog_id'
,
5
)
->
where
(
'type'
,
2
)
->
order
(
'sort'
,
'desc'
)
->
order
(
'id'
,
'desc'
)
->
limit
(
4
);
});
...
...
@@ -118,7 +122,7 @@ class Project extends Base
//美行攻略
$guides
=
GuideModel
::
all
(
function
(
$query
)
{
$query
->
order
(
'id'
,
'desc'
)
->
limit
(
4
);
->
limit
(
6
);
});
$guides
=
$guides
?
collection
(
$guides
)
->
toArray
()
:
[];
...
...
@@ -137,18 +141,19 @@ class Project extends Base
*/
public
function
newProjects
(
$p
=
1
,
$page
=
8
)
{
$type
=
input
(
'post.type'
)
?
input
(
'post.type'
)
:
1
;
if
(
$type
==
1
)
{
$type
=
input
(
'post.type'
)
?
input
(
'post.type'
)
:
1
;
if
(
$type
==
1
)
{
$newProjects
=
ProjectModel
::
all
(
function
(
$query
)
use
(
$p
,
$page
)
{
$query
->
where
(
'type'
,
1
)
->
order
(
'sort'
,
'desc'
)
->
order
(
'id'
,
'desc'
)
->
page
(
$p
,
$page
);
});
}
elseif
(
$type
==
2
)
{
}
elseif
(
$type
==
2
)
{
$newProjects
=
ProjectModel
::
all
(
function
(
$query
)
use
(
$p
,
$page
)
{
$query
->
where
(
'type'
,
1
)
$query
->
where
(
'type'
,
2
)
->
where
(
'heat'
,
'neq'
,
0
)
->
order
(
'
heat'
,
'desc'
)
->
order
(
'
sort'
,
'desc'
)
->
order
(
'id'
,
'desc'
)
->
page
(
$p
,
$page
);
});
...
...
@@ -192,6 +197,8 @@ class Project extends Base
{
$businessProjects
=
ProjectModel
::
all
(
function
(
$query
)
use
(
$p
,
$page
)
{
$query
->
where
(
'catalog_id'
,
5
)
->
where
(
'type'
,
2
)
->
order
(
'sort'
,
'desc'
)
->
order
(
'id'
,
'desc'
)
->
page
(
$p
,
$page
);
});
...
...
@@ -210,7 +217,8 @@ class Project extends Base
public
function
guides
(
$p
=
1
,
$page
=
8
)
{
$guides
=
GuideModel
::
all
(
function
(
$query
)
use
(
$p
,
$page
)
{
$query
->
order
(
'id'
,
'desc'
)
$query
->
order
(
'sort'
,
'desc'
)
->
order
(
'id'
,
'desc'
)
->
page
(
$p
,
$page
);
});
$guides
=
$guides
?
collection
(
$guides
)
->
toArray
()
:
[];
...
...
@@ -236,7 +244,7 @@ class Project extends Base
if
(
$data
->
delete
(
true
))
{
$project
->
collect_num
--
;
$project
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'取消收藏成功!'
,
'collect'
=>
'remove'
];
return
[
'code'
=>
0
,
'msg'
=>
'取消收藏成功!'
,
'collect'
=>
'remove'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'取消收藏失败,请重试!'
];
}
...
...
@@ -249,7 +257,7 @@ class Project extends Base
if
(
$result
)
{
$project
->
collect_num
++
;
$project
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'收藏成功!'
,
'collect'
=>
'add'
];
return
[
'code'
=>
0
,
'msg'
=>
'收藏成功!'
,
'collect'
=>
'add'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'收藏失败,请重试!'
];
}
...
...
@@ -300,7 +308,7 @@ class Project extends Base
// 已过期
$project
[
'status'
]
=
1
;
$project
[
'status_text'
]
=
'预约下次'
;
}
else
{
}
else
{
if
(
intval
(
$project
[
'sign_limits'
])
<=
intval
(
$project
[
'sign_num'
]))
{
// 已售罄
$project
[
'status'
]
=
2
;
...
...
application/common/model/Project.php
View file @
c8af6d1f
...
...
@@ -24,12 +24,12 @@ class Project extends BaseModel
//标签处理
public
function
getTagsAttr
(
$value
)
{
$value
=
trim
(
$value
,
'|'
);
$value
=
trim
(
$value
,
'|'
);
$tags
=
explode
(
'|'
,
$value
);
$tags
=
TagsModel
::
where
(
'id'
,
'in'
,
$tags
)
->
order
(
'sort'
,
'desc'
)
->
column
(
'name'
);
return
implode
(
' / '
,
$tags
);
return
implode
(
' / '
,
$tags
);
}
//活动时间标签
...
...
@@ -40,7 +40,7 @@ class Project extends BaseModel
//活动
if
(
$endTime
>
time
())
{
//未结束
return
'剩余'
.
ceil
((
$endTime
-
time
())
/
86400
)
.
'天'
;
return
'剩余'
.
ceil
((
$endTime
-
time
())
/
86400
)
.
'天'
;
}
else
{
return
'预约下次'
;
}
...
...
@@ -51,37 +51,51 @@ class Project extends BaseModel
}
//城市名称处理
public
function
getCityStrAttr
(
$value
,
$data
){
public
function
getCityStrAttr
(
$value
,
$data
)
{
$city_id
=
$data
[
'city'
];
return
CitydModel
::
get
(
$city_id
);
}
//分类名称处理
public
function
getCatalogIdStrAttr
(
$value
,
$data
){
public
function
getCatalogIdStrAttr
(
$value
,
$data
)
{
$catalog_id
=
$data
[
'catalog_id'
];
return
CatalogModel
::
get
(
$catalog_id
);
}
//需要用到tags ID
public
function
getTagsIdStrAttr
(
$value
,
$data
){
public
function
getTagsIdStrAttr
(
$value
,
$data
)
{
return
$data
[
'tags'
];
}
public
function
getBannersAttr
(
$value
)
{
$data
=
json_decode
(
$value
,
true
);
$data
=
json_decode
(
$value
,
true
);
$banners
=
[];
foreach
(
$data
as
$k
=>
$v
)
{
$banners
[]
=
[
'image'
=>
$v
];
foreach
(
$data
as
$k
=>
$v
)
{
$banners
[]
=
[
'image'
=>
$v
];
}
return
$banners
;
}
// 需要用到banners字段的原始格式
public
function
getBannersNativeAttr
(
$value
,
$data
){
public
function
getBannersNativeAttr
(
$value
,
$data
)
{
return
$data
[
'banners'
];
}
public
function
setDescriptionAttr
(
$value
)
{
return
str_replace
(
'&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1'
,
''
,
$value
);
return
str_replace
(
'&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1'
,
''
,
$value
);
}
public
function
getKfQrcodeAttr
(
$value
)
{
if
(
strpos
(
'http'
,
$value
))
{
return
$value
;
}
return
"https://app.maveler.com/"
.
$value
;
}
}
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