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
247c07ed
Commit
247c07ed
authored
Feb 19, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
a3da9b5c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
53 deletions
+13
-53
admin/themes/simplebootx/Admin/Welfare/add.html
+2
-2
admin/themes/simplebootx/Admin/Welfare/edit.html
+4
-13
application/Admin/Controller/WelfareController.class.php
+7
-38
No files found.
admin/themes/simplebootx/Admin/Welfare/add.html
View file @
247c07ed
...
...
@@ -9,9 +9,9 @@
<form
method=
"post"
class=
"form-horizontal js-ajax-form"
action=
"{:U('Welfare/add_post')}"
>
<fieldset>
<div
class=
"control-group"
>
<label
class=
"control-label"
>
数量
</label>
<label
class=
"control-label"
>
礼物
</label>
<div
class=
"controls"
>
<select
name=
"
nums
"
>
<select
name=
"
giftid
"
>
<volist
name=
"gift"
id=
"v"
>
<option
value=
"{$v['id']}"
>
{$v['giftname']}
</option>
</volist>
...
...
admin/themes/simplebootx/Admin/Welfare/edit.html
View file @
247c07ed
...
...
@@ -10,11 +10,11 @@
<input
type=
"hidden"
name=
"id"
value=
"{$data['id']}"
>
<fieldset>
<div
class=
"control-group"
>
<label
class=
"control-label"
>
数量
</label>
<label
class=
"control-label"
>
礼物
</label>
<div
class=
"controls"
>
<select
name=
"
nums
"
>
<volist
name=
"
numslis
t"
id=
"v"
>
<option
value=
"{$v
}"
<
if
condition=
"$data['nums'] eq $v"
>
selected
</if>
>{$v
}
</option>
<select
name=
"
giftid
"
>
<volist
name=
"
gif
t"
id=
"v"
>
<option
value=
"{$v
['id']}"
<
if
condition=
"$data['giftid'] eq $v['id']"
>
selected
</if>
>{$v['giftname']
}
</option>
</volist>
</select>
<span
class=
"form-required"
></span>
...
...
@@ -22,15 +22,6 @@
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
>
倍数
</label>
<div
class=
"controls"
>
<input
type=
"text"
name=
"times"
value=
"{$data['times']}"
>
<span
class=
"form-required"
></span>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
>
中奖概率
</label>
<div
class=
"controls"
>
<input
type=
"text"
name=
"rate"
value=
"{$data['rate']}"
>
% 最小支持0.01%
...
...
application/Admin/Controller/WelfareController.class.php
View file @
247c07ed
...
...
@@ -77,7 +77,7 @@ class WelfareController extends AdminbaseController
function
del
(){
$id
=
intval
(
$_GET
[
'id'
]);
if
(
$id
){
$result
=
M
(
"
luck
_rate"
)
->
delete
(
$id
);
$result
=
M
(
"
welfare
_rate"
)
->
delete
(
$id
);
if
(
$result
){
$this
->
resetcache
();
$this
->
success
(
'删除成功'
);
...
...
@@ -95,24 +95,8 @@ class WelfareController extends AdminbaseController
}
function
add_post
(){
if
(
IS_POST
){
$jackpot
=
M
(
"
luck
_rate"
);
$jackpot
=
M
(
"
welfare
_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
();
if
(
$result
){
$this
->
resetcache
();
...
...
@@ -125,8 +109,8 @@ class WelfareController extends AdminbaseController
function
edit
(){
$id
=
intval
(
$_GET
[
'id'
]);
if
(
$id
){
$data
=
M
(
"
luck
_rate"
)
->
find
(
$id
);
$this
->
assign
(
'
numslist'
,
$this
->
numslist
);
$data
=
M
(
"
welfare
_rate"
)
->
find
(
$id
);
$this
->
assign
(
'
gift'
,
$this
->
getGift
()
);
$this
->
assign
(
'data'
,
$data
);
}
else
{
$this
->
error
(
'数据传入失败!'
);
...
...
@@ -135,23 +119,8 @@ class WelfareController extends AdminbaseController
}
function
edit_post
(){
if
(
IS_POST
){
$jackpot
=
M
(
"
luck
_rate"
);
$jackpot
=
M
(
"
welfare
_rate"
);
$jackpot
->
create
();
$id
=
I
(
'id'
);
$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
}
' and id!=
{
$id
}
"
)
->
find
();
if
(
$check
){
$this
->
error
(
'相同数量、倍数的配置已存在'
);
}
$result
=
$jackpot
->
save
();
if
(
$result
!==
false
){
$this
->
resetcache
();
...
...
@@ -162,9 +131,9 @@ class WelfareController extends AdminbaseController
}
}
function
resetcache
(){
$key
=
'
luck
_rate'
;
$key
=
'
welfare
_rate'
;
$level
=
M
(
"
luck_rate"
)
->
order
(
"id desc
"
)
->
select
();
$level
=
M
(
"
welfare_rate"
)
->
where
(
'id!=1'
)
->
order
(
"id rate
"
)
->
select
();
if
(
$level
){
setcaches
(
$key
,
$level
);
}
...
...
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