切换导航条
此项目
正在载入...
登录
潘浩文
/
scoreshop
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
潘浩文
6 years ago
提交
ffe08e1a7ee516a3a5733aabd26e51d82d2ab3c1
1 个父辈
bd1968f5
1 个管道 的构建
通过
耗费 0 秒
1
变更
2
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
1 行增加
和
158 行删除
app/portal/controller/ActiveController.php
app/portal/controller/PrizeController.php
app/portal/controller/ActiveController.php
查看文件 @
ffe08e1
...
...
@@ -109,161 +109,4 @@ class ActiveController extends WeChatBaseController
}
//兑奖首页
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
;
}
}
}
...
...
app/portal/controller/PrizeController.php
查看文件 @
ffe08e1
...
...
@@ -154,7 +154,7 @@ class PrizeController extends WeChatBaseController
}
else
{
$like
=
0
;
}
$order
=
Db
::
name
(
'prize_order'
)
->
where
([
'prize_id'
=>
$id
,
'users_id'
=>
session
(
'wechat_user'
)[
'users_
id'
],
'status'
=>
1
])
->
find
();
$order
=
Db
::
name
(
'prize_order'
)
->
where
([
'prize_id'
=>
$id
,
'users_id'
=>
$re
[
'
id'
],
'status'
=>
1
])
->
find
();
if
(
$order
){
$order
=
1
;
}
else
{
...
...
请
注册
或
登录
后发表评论