Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
xiaozhan
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
冷斌
xiaozhan
Commits
e52579f0
Commit
e52579f0
authored
Mar 06, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
343bced4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
33 deletions
+34
-33
application/Admin/Controller/LuckrateController.class.php
+34
-33
No files found.
application/Admin/Controller/LuckrateController.class.php
View file @
e52579f0
...
...
@@ -6,16 +6,17 @@
namespace
Admin\Controller
;
use
Common\Controller\AdminbaseController
;
class
LuckrateController
extends
AdminbaseController
{
var
$numslist
=
[
'1'
,
'10'
,
'66'
,
'88'
,
'100'
,
'520'
,
'1314'
];
// var $numslist=['1','10','66','88','100','520','1314'];
protected
$numslist
=
[
'1'
];
function
index
(){
$giftid
=
I
(
'giftid'
);
$map
[
'giftid'
]
=
$giftid
;
$giftinfo
=
M
(
'gift'
)
->
field
(
'giftname'
)
->
where
(
"id=
{
$giftid
}
"
)
->
find
();
$jackpot
=
M
(
"luck_rate"
);
$count
=
$jackpot
->
where
(
$map
)
->
count
();
$page
=
$this
->
page
(
$count
,
20
);
...
...
@@ -30,82 +31,82 @@ class LuckrateController extends AdminbaseController {
$this
->
assign
(
'giftinfo'
,
$giftinfo
);
$this
->
assign
(
"page"
,
$page
->
show
(
'Admin'
));
$this
->
display
();
}
function
del
(){
$id
=
intval
(
$_GET
[
'id'
]);
if
(
$id
){
$result
=
M
(
"luck_rate"
)
->
delete
(
$id
);
$result
=
M
(
"luck_rate"
)
->
delete
(
$id
);
if
(
$result
){
$this
->
resetcache
();
$this
->
success
(
'删除成功'
);
}
else
{
$this
->
error
(
'删除失败'
);
}
}
else
{
}
}
else
{
$this
->
error
(
'数据传入失败!'
);
}
$this
->
display
();
}
$this
->
display
();
}
function
add
(){
$giftid
=
I
(
'giftid'
);
$this
->
assign
(
'giftid'
,
$giftid
);
$this
->
assign
(
'numslist'
,
$this
->
numslist
);
$this
->
display
();
$this
->
display
();
}
function
add_post
(){
if
(
IS_POST
){
$jackpot
=
M
(
"luck_rate"
);
$jackpot
->
create
();
$giftid
=
I
(
'giftid'
);
$nums
=
I
(
'nums'
);
$times
=
I
(
'times'
);
if
(
$times
<
0
){
$this
->
error
(
'中奖倍数不能小于0'
);
}
$check
=
$jackpot
->
where
(
"giftid='
{
$giftid
}
' and nums='
{
$nums
}
' and times = '
{
$times
}
'"
)
->
find
();
if
(
$check
){
$this
->
error
(
'相同数量、倍数的配置已存在'
);
}
$jackpot
->
addtime
=
time
();
$result
=
$jackpot
->
add
();
$result
=
$jackpot
->
add
();
if
(
$result
){
$this
->
resetcache
();
$this
->
success
(
'添加成功'
);
}
else
{
$this
->
error
(
'添加失败'
);
}
}
}
}
}
function
edit
(){
$id
=
intval
(
$_GET
[
'id'
]);
if
(
$id
){
$data
=
M
(
"luck_rate"
)
->
find
(
$id
);
$this
->
assign
(
'numslist'
,
$this
->
numslist
);
$this
->
assign
(
'data'
,
$data
);
}
else
{
$this
->
assign
(
'data'
,
$data
);
}
else
{
$this
->
error
(
'数据传入失败!'
);
}
$this
->
display
();
}
$this
->
display
();
}
function
edit_post
(){
if
(
IS_POST
){
if
(
IS_POST
){
$jackpot
=
M
(
"luck_rate"
);
$jackpot
->
create
();
$id
=
I
(
'id'
);
$giftid
=
I
(
'giftid'
);
$nums
=
I
(
'nums'
);
...
...
@@ -114,20 +115,20 @@ class LuckrateController extends AdminbaseController {
if
(
$times
<
0
){
$this
->
error
(
'中奖倍数不能小于0'
);
}
$check
=
$jackpot
->
where
(
"giftid='
{
$giftid
}
' and nums='
{
$nums
}
' and times = '
{
$times
}
' and id!=
{
$id
}
"
)
->
find
();
if
(
$check
){
$this
->
error
(
'相同数量、倍数的配置已存在'
);
}
$result
=
$jackpot
->
save
();
$result
=
$jackpot
->
save
();
if
(
$result
!==
false
){
$this
->
resetcache
();
$this
->
success
(
'修改成功'
);
}
else
{
$this
->
error
(
'修改失败'
);
}
}
}
}
function
resetcache
(){
$key
=
'luck_rate'
;
...
...
@@ -136,8 +137,8 @@ class LuckrateController extends AdminbaseController {
if
(
$level
){
setcaches
(
$key
,
$level
);
}
return
1
;
}
}
}
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