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