切换导航条
此项目
正在载入...
登录
潘浩文
/
scoreshop
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
潘浩文
6 years ago
提交
876b100e39d9104a01c6c8f1d7b2892e5b3fea6a
1 个父辈
f72b93a2
1 个管道 的构建
通过
耗费 0 秒
1
变更
3
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
466 行增加
和
1 行删除
app/portal/controller/ActiveController.php
public/themes/simpleboot3/portal/active/active.html
public/themes/simpleboot3/portal/index.html
app/portal/controller/ActiveController.php
0 → 100644
查看文件 @
876b100
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
namespace
app\portal\controller
;
use
app\portal\service\LikeService
;
use
cmf\controller\HomeBaseController
;
use
cmf\controller\WeChatBaseController
;
use
EasyWeChat\Foundation\Application
;
use
think\Db
;
class
ActiveController
extends
WeChatBaseController
{
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
checkWeChatUserLogin
();
}
//品牌详情
public
function
brandDetail
()
{
$re
=
$this
->
checkUser
();
$id
=
$this
->
request
->
param
(
'id'
);
$data
=
Db
::
name
(
'brand'
)
->
alias
(
'b'
)
->
join
(
'brand_category bc1'
,
'b.category_id=bc1.id'
)
->
join
(
'brand_category bc2'
,
'b.floor_id=bc2.id'
)
->
where
(
'b.id'
,
$id
)
->
field
(
'b.*,bc1.name as cname,bc2.name as fname'
)
->
find
();
$data
[
'content'
]
=
cmf_replace_content_file_url
(
htmlspecialchars_decode
(
$data
[
'content'
]));
$like
=
Db
::
name
(
'like'
)
->
where
([
'cid'
=>
$id
,
'users_id'
=>
$re
[
'id'
],
'status'
=>
1
])
->
find
();
if
(
$like
){
$like
=
1
;
}
else
{
$like
=
0
;
}
$comment
=
Db
::
name
(
'comment'
)
->
alias
(
'c'
)
->
join
(
'users u'
,
'c.users_id=u.id'
)
->
join
(
'brand b'
,
'c.cid=b.id'
)
->
where
([
'b.id'
=>
$id
,
'c.status'
=>
1
])
->
field
(
'c.*,u.*'
)
->
select
();
$this
->
assign
(
'comment'
,
$comment
);
$this
->
assign
(
'like'
,
$like
);
$this
->
assign
(
'list'
,
$data
);
return
$this
->
fetch
(
'brand_detail'
);
}
//品牌评论页面
public
function
comment
(){
$this
->
checkUser
();
$id
=
$this
->
request
->
param
(
'id'
);
$this
->
assign
(
'id'
,
$id
);
return
$this
->
fetch
();
}
public
function
commentPost
(){
$re
=
$this
->
checkUser
();
$param
=
$this
->
request
->
param
();
$param
[
'create_time'
]
=
time
();
$param
[
'status'
]
=
1
;
$param
[
'users_id'
]
=
$re
[
'id'
];
$result
=
Db
::
name
(
'comment'
)
->
where
([
'users_id'
=>
$param
[
'users_id'
],
'status'
=>
1
,
'cid'
=>
$param
[
'cid'
]])
->
find
();
if
(
$result
){
return
2
;
}
$re1
=
Db
::
name
(
'comment'
)
->
insert
(
$param
);
$re2
=
Db
::
name
(
'brand'
)
->
where
(
'id'
,
$param
[
'cid'
])
->
setInc
(
'comment'
,
1
);
if
(
$re1
&&
$re2
)
{
$url
=
url
(
'portal/brand/brandDetail'
,
array
(
'id'
=>
$param
[
'cid'
]));
return
$url
;
}
else
{
return
0
;
}
}
//点赞ajax接口
public
function
like
(){
$re
=
$this
->
checkUser
();
$param
=
$this
->
request
->
param
();
$like
=
new
LikeService
();
return
$like
->
like
(
$param
[
'id'
],
1
,
$re
[
'id'
]);
}
//活动首页
public
function
active
(){
$this
->
checkUser
();
$banner
=
Db
::
name
(
'active'
)
->
where
(
'is_top'
,
1
)
->
field
(
'thumbnail'
)
->
select
();
$this
->
assign
(
'banner'
,
$banner
);
$data
=
Db
::
name
(
'active'
)
->
where
(
'status'
,
1
)
->
select
();
$this
->
assign
(
'list'
,
$data
);
return
$this
->
fetch
();
}
//活动首页ajax
public
function
activeAjax
(){
$this
->
checkUser
();
$status
=
$this
->
request
->
param
(
'status'
);
$data
=
Db
::
name
(
'active'
)
->
where
(
'status'
,
$status
)
->
select
();
$this
->
assign
(
'list'
,
$data
);
return
$this
->
fetch
();
}
//活动详情
public
function
activeDetail
()
{
$id
=
$this
->
request
->
param
(
'id'
);
$data
=
Db
::
name
(
'active'
)
->
where
(
'id'
,
$id
)
->
find
();
$data
[
'more'
]
=
json_decode
(
$data
[
'more'
],
true
);
$data
[
'content'
]
=
cmf_replace_content_file_url
(
htmlspecialchars_decode
(
$data
[
'content'
]));
$like
=
Db
::
name
(
'like'
)
->
where
([
'cid'
=>
$id
,
'users_id'
=>
session
(
'wechat_user'
)[
'users_id'
],
'status'
=>
2
])
->
find
();
if
(
$like
){
$like
=
1
;
}
else
{
$like
=
0
;
}
$this
->
assign
(
'like'
,
$like
);
$this
->
assign
(
'list'
,
$data
);
return
$this
->
fetch
();
}
//兑奖首页
public
function
prize
(){
$user
=
Db
::
name
(
'users'
)
->
where
(
'id'
,
session
(
'wechat_user'
)[
'users_id'
])
->
find
();
$prize
=
Db
::
name
(
'prize'
)
->
where
(
'status'
,
1
)
->
select
();
$category
=
Db
::
name
(
'prize_category'
)
->
select
();
$this
->
assign
(
'user'
,
$user
);
$this
->
assign
(
'prize'
,
$prize
);
$this
->
assign
(
'category'
,
$category
);
return
$this
->
fetch
();
}
//兑奖首页ajax
public
function
prizeAjax
(){
$category
=
$this
->
request
->
param
(
'category'
);
$where
[
'status'
]
=
1
;
if
(
!
empty
(
$category
)){
$where
[
'category_id'
]
=
$category
;
}
$prize
=
Db
::
name
(
'prize'
)
->
where
(
$where
)
->
select
();
return
$prize
;
}
//兑奖详情页
public
function
prizeDetail
(){
$id
=
$this
->
request
->
param
(
'id'
);
$data
=
Db
::
name
(
'prize'
)
->
where
(
'id'
,
$id
)
->
find
();
$data
[
'more'
]
=
json_decode
(
$data
[
'more'
],
true
);
$data
[
'content'
]
=
cmf_replace_content_file_url
(
htmlspecialchars_decode
(
$data
[
'content'
]));
$like
=
Db
::
name
(
'like'
)
->
where
([
'cid'
=>
$id
,
'users_id'
=>
session
(
'wechat_user'
)[
'users_id'
],
'status'
=>
3
])
->
find
();
if
(
$like
){
$like
=
1
;
}
else
{
$like
=
0
;
}
$order
=
Db
::
name
(
'prize_order'
)
->
where
([
'prize_id'
=>
$id
,
'users_id'
=>
session
(
'wechat_user'
)[
'users_id'
],
'status'
=>
1
])
->
find
();
if
(
$order
){
$order
=
1
;
}
else
{
$order
=
0
;
}
$this
->
assign
(
'order'
,
$order
);
$this
->
assign
(
'like'
,
$like
);
$this
->
assign
(
'list'
,
$data
);
return
$this
->
fetch
();
}
public
function
getPrize
(){
$id
=
$this
->
request
->
param
(
'id'
);
$data
[
'prize_id'
]
=
$id
;
$data
[
'users_id'
]
=
session
(
'wechat_user'
)[
'users_id'
];
$data
[
'create_time'
]
=
time
();
Db
::
name
(
'prize_order'
)
->
insert
(
$data
);
return
1
;
}
//上传小票
public
function
upload
(){
$options
=
[
'app_id'
=>
config
(
'wechat_config.app_id'
),
'secret'
=>
config
(
'wechat_config.secret'
),
'payment'
=>
config
(
'wechat_config.payment'
),
];
$app
=
new
Application
(
$options
);
$js
=
$app
->
js
;
$jss
=
$js
->
config
([
'chooseImage'
,
'uploadImage'
,
'previewImage'
],
$debug
=
false
,
$beta
=
false
,
$json
=
true
);
$this
->
assign
(
'js'
,
$jss
);
return
$this
->
fetch
();
}
//上传小票提交
public
function
uploadPost
(){
$param
=
$this
->
request
->
param
();
$options
=
[
'app_id'
=>
config
(
'wechat_config.app_id'
),
'secret'
=>
config
(
'wechat_config.secret'
),
'payment'
=>
config
(
'wechat_config.payment'
),
];
$app
=
new
Application
(
$options
);
// 获取 access token 实例
$access_token
=
$app
->
access_token
;
return
$this
->
getmedia
(
$access_token
,
$param
[
'media'
],
date
(
'Ymd'
));
}
private
function
getmedia
(
$access_token
,
$media_id
,
$foldername
)
{
$url
=
"http://file.api.weixin.qq.com/cgi-bin/media/get?access_token="
.
$access_token
.
"&media_id="
.
$media_id
;
if
(
!
file_exists
(
"./upload/"
.
$foldername
))
{
mkdir
(
"./upload/"
.
$foldername
,
0777
,
true
);
}
$file_name
=
date
(
'YmdHis'
)
.
rand
(
1000
,
9999
)
.
'.jpg'
;
$targetName
=
'./upload/'
.
$foldername
.
'/'
.
$file_name
;
$saveName
=
$foldername
.
'/'
.
$file_name
;
$ch
=
curl_init
(
$url
);
// 初始化
$fp
=
fopen
(
$targetName
,
'wb'
);
// 打开写入
curl_setopt
(
$ch
,
CURLOPT_FILE
,
$fp
);
// 设置输出文件的位置,值是一个资源类型
curl_setopt
(
$ch
,
CURLOPT_HEADER
,
0
);
curl_exec
(
$ch
);
curl_close
(
$ch
);
fclose
(
$fp
);
return
$saveName
;
}
//兑奖记录
public
function
prizeRecord
(){
$status
=
$this
->
request
->
param
(
'status'
);
$where
[
'p.status'
]
=!
empty
(
$status
)
?
$status
:
0
;
$data
=
Db
::
name
(
'prize_order'
)
->
alias
(
'po'
)
->
join
(
'prize p'
.
'po.prize_id=p.id'
)
->
where
(
$where
)
->
select
();
$this
->
assign
(
'list'
,
$data
);
return
$this
->
fetch
();
}
//个人首页
public
function
userIndex
(){
$last
=
Db
::
name
(
'users_score_log'
)
->
where
([
'users_id'
=>
session
(
'wechat_user'
)[
'users_id'
],
'action'
=>
'签到'
])
->
max
(
'create_time'
);
if
(
date
(
'Ymd'
,
time
())
>
date
(
'Ymd'
,
$last
))
{
$is_qiandao
=
0
;
}
else
{
$is_qiandao
=
1
;
}
$data
=
Db
::
name
(
'users'
)
->
where
(
'id'
,
session
(
'wechat_user'
)[
'users_id'
])
->
find
();
$this
->
assign
(
'list'
,
$data
);
$this
->
assign
(
'qiandao'
,
$is_qiandao
);
return
$this
->
fetch
();
}
public
function
scoreRecord
(){
$score
=
Db
::
name
(
'users'
)
->
where
(
'id'
,
session
(
'wechat_user'
)[
'users_id'
])
->
find
()[
'score'
];
$data
=
Db
::
name
(
'users_score_log'
)
->
where
(
'users_id'
,
session
(
'wechat_user'
)[
'users_id'
])
->
select
();
$this
->
assign
(
'score'
,
$score
);
$this
->
assign
(
'list'
,
$data
);
return
$this
->
fetch
();
}
//每日签到功能
public
function
qiandao
(){
$last
=
Db
::
name
(
'users_score_log'
)
->
where
([
'users_id'
=>
session
(
'wechat_user'
)[
'users_id'
],
'action'
=>
'签到'
])
->
max
(
'create_time'
);
if
(
date
(
'Ymd'
,
time
())
>
date
(
'Ymd'
,
$last
))
{
$data
[
'score'
]
=
10
;
$data
[
'users_id'
]
=
session
(
'users_id'
);
$data
[
'create_time'
]
=
time
();
$data
[
'action'
]
=
'签到'
;
Db
::
name
(
'users_score_log'
)
->
insert
(
$data
);
Db
::
name
(
'users'
)
->
where
(
'id'
,
session
(
'wechat_user'
)[
'users_id'
])
->
setInc
(
'score'
,
10
);
return
1
;
}
else
{
return
0
;
}
}
}
...
...
public/themes/simpleboot3/portal/active/active.html
0 → 100644
查看文件 @
876b100
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<link
rel=
"stylesheet"
href=
"__TMPL__/public/assets/css/base.css"
>
<link
rel=
"stylesheet"
href=
"__TMPL__/public/assets/css/swiper.css"
>
<script
type=
"text/javascript"
src=
"__TMPL__/public/assets/js/base.js"
></script>
<title>
活动
</title>
<style>
body
,
html
{
background
:
#F5F6FA
;
}
.head
{
height
:
3.6rem
;
}
.swiper-container
{
height
:
3.6rem
;
}
.swiper-slide
{
height
:
3.6rem
;
}
.swiper-slide
img
{
width
:
100%
;
height
:
100%
;
}
.kind
{
box-sizing
:
border-box
;
width
:
7.5rem
;
height
:
1rem
;
background
:
#fff
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
margin-top
:
0.16rem
;
}
.kind_type
{
display
:
flex
;
align-items
:
center
;
width
:
33.333%
;
height
:
1rem
;
vertical-align
:
middle
;
border-right
:
1px
solid
#f5f5f5
;
padding
:
0
0.4rem
;
}
.kind_img
{
width
:
0.28rem
;
height
:
0.28rem
;
font-size
:
0
;
}
.kind_img
img
{
width
:
100%
;
height
:
100%
;
}
.kind_name
{
font-size
:
0.3rem
;
color
:
#252729
;
height
:
0.28rem
;
line-height
:
0.28rem
;
margin-left
:
0.15rem
;
}
.item_img
{
width
:
1.8rem
;
height
:
1.8rem
;
}
.item_img
{
width
:
1.8rem
;
height
:
1.8rem
;
}
.item_img
img
{
width
:
100%
;
height
:
100%
;
}
.list_item
{
display
:
flex
;
padding
:
0.35rem
0.39rem
;
background
:
#fff
;
margin-top
:
0.16rem
;
}
.item_name
{
color
:
#000000
;
font-size
:
0.32rem
;
margin-top
:
0.1rem
;
width
:
4.3rem
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
.item_date
{
color
:
#666666
;
font-size
:
0.26rem
;
margin-top
:
0.7rem
;
}
.flooritem
{
margin-left
:
0.44rem
;
}
</style>
</head>
<body>
<div
class=
"container"
>
<div
class=
"head"
>
<div
class=
"swiper-container"
>
<div
class=
"swiper-wrapper"
>
<foreach
name=
"banner"
item=
"vo"
>
<div
class=
"swiper-slide"
>
<img
src=
"{:cmf_get_image_preview_url($vo.thumbnail)}"
alt=
""
>
</div>
</foreach>
</div>
<div
class=
"swiper-pagination"
></div>
</div>
</div>
<div
class=
"kind"
>
<div
class=
"kind_type active"
>
<p
class=
"kind_img"
>
<img
src=
"__TMPL__/public/assets/images/img/huiyuan.png"
alt=
""
>
</p>
<p
class=
"kind_name"
>
会员活动
</p>
</div>
<div
class=
"kind_type"
>
<p
class=
"kind_img"
>
<img
src=
"__TMPL__/public/assets/images/img/shop.png"
alt=
""
>
</p>
<p
class=
"kind_name"
>
商家活动
</p>
</div>
<div
class=
"kind_type"
>
<p
class=
"kind_img"
>
<img
src=
"__TMPL__/public/assets/images/img/shang.png"
alt=
""
>
</p>
<p
class=
"kind_name"
>
商户活动
</p>
</div>
</div>
<div
class=
"list"
>
<foreach
name=
"list"
ietm=
"vo"
>
<div
class=
"list_item"
>
<div
class=
"item_img"
>
<img
src=
"{:cmf_get_image_preview_url($vo.thumbnail)}"
alt=
""
>
</div>
<div
class=
"flooritem"
>
<p
class=
"item_name"
>
{$vo.name}
</p>
<p
class=
"item_date"
>
{:date('Y-m-d',$vo['active_time'])}-{:date('Y-m-d',$vo['end_time'])}
</p>
</div>
</div>
</foreach>
</div>
</div>
<script
type=
"text/javascript"
src=
"__TMPL__/public/assets/js/jquery.min.js"
></script>
<script
type=
"text/javascript"
src=
"__TMPL__/public/assets/js/swiper.min.js"
></script>
<script>
var
mySwiper
=
new
Swiper
(
'.swiper-container'
,
{
pagination
:
{
el
:
'.swiper-pagination'
,
},
autoplay
:
true
,
//可选选项,自动滑动
})
//活动详情页
$
(
".list_item"
).
click
(
function
(){
window
.
location
.
href
=
'activedetail.html'
})
</script>
</body>
</html>
...
...
public/themes/simpleboot3/portal/index.html
查看文件 @
876b100
...
...
@@ -121,7 +121,7 @@
<div
class=
"swiper-pagination"
></div>
</div>
<div
class=
"bottom"
>
<img
src=
"__TMPL__/public/assets/img/bannerbottom.png"
alt=
""
>
<img
src=
"__TMPL__/public/assets/im
ages/im
g/bannerbottom.png"
alt=
""
>
</div>
</div>
...
...
请
注册
或
登录
后发表评论