Commit 925c6588 by 冷斌

add

parent 3435a9f1
...@@ -3,167 +3,56 @@ ...@@ -3,167 +3,56 @@
<body> <body>
<div class="wrap"> <div class="wrap">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li ><a href="{:U('Gift/index')}">礼物列表</a></li> <li ><a href="{:U('Luckrate/index',array('giftid'=>$giftid))}">列表</a></li>
<li class="active"><a >礼物添加</a></li> <li class="active"><a >添加</a></li>
</ul> </ul>
<form method="post" class="form-horizontal js-ajax-form" action="{:U('Gift/add_post')}"> <form method="post" class="form-horizontal js-ajax-form" action="{:U('Luckrate/add_post')}">
<fieldset> <fieldset>
<div class="control-group" style="display:none;"> <input type="hidden" name="giftid" value="{$giftid}">
<label class="control-label">礼物分类</label> <div class="control-group">
<label class="control-label">数量</label>
<div class="controls"> <div class="controls">
<select name="sid"> <select name="nums">
<option value="0">默认分类</option> <volist name="numslist" id="v">
<volist name="gift_sort" id="vo"> <option value="{$v}">{$v}</option>
<option value="{$key}">{$vo}</option>
</volist> </volist>
</select> </select>
<span class="form-required">*</span>
</div>
</div>
<div class="control-group">
<label class="control-label">礼物类型</label>
<div class="controls" id="type">
<label class="radio inline" for="type_0"><input type="radio" name="type" value="0" id="type_0" checked >普通礼物</label>
<label class="radio inline" for="type_1"><input type="radio" name="type" value="1" id="type_1" >豪华礼物</label>
<span class="form-required">*</span>
</div>
</div>
<div class="control-group">
<label class="control-label">礼物标识</label>
<div class="controls" style="position:relative;" id="mark">
<label class="radio inline" for="mark_0"><input type="radio" name="mark" value="0" id="mark_0" checked >普通</label>
<label class="radio inline" for="mark_1"><input type="radio" name="mark" value="1" id="mark_1" >热门</label>
<label class="radio inline" for="mark_2"><input type="radio" name="mark" value="2" id="mark_2" >守护</label>
<label class="radio inline" for="mark_3"><input type="radio" name="mark" value="3" id="mark_3" >幸运</label>
<span class="form-required">*</span>
<div id="tips" style="position: absolute;left: 300px;top: 0;display:none;">
<span style="color:#ff0000">幸运礼物说明</span><br>
1.用户送出去幸运礼物时,幸运礼物的价值将分成三份,分别为主播、奖池和平台,后台可以设置主播和奖池获得的比例,剩下的归属于平台,主播和奖池的比例不要超过100%【谨记】<br>
2.后台可设置某个礼物为幸运礼物<br>
3.成为幸运礼物后,可设置幸运礼物的的中奖设置以及奖池设置,以下是幸运礼物和奖池说明<br>
a)在中奖设置中可设置每个礼物每组每个倍数的中奖概率【如:小黄瓜 每组送10个中10倍的概率为 5%,小黄瓜 每组送100个中10倍的概率为 <br>6%】,当用户中奖后,返还的奖励以当组礼物总价值为基数返还【如送了一组10个的,总价值为100,中了10倍,那么会获得1000萌豆】<br>
b)奖池说明:奖池分为三个阶段,后台可设置每个奖池的金额下限,直接当奖池里边的金额达到最低的金额限制时,奖池才会开启,当有用户中奖时,会赢走奖池内的所有奖金<br>
c)幸运礼物与奖池说明:后台可设置每个幸运礼物每个组数相对于奖池每个阶段的中奖概率【如:小黄瓜每组10个对于奖池1阶段的中奖概率为0.01%,】,建议设置:礼物价值越高中奖概率越高,每组数量越多中奖概率越大<br>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">序号</label>
<div class="controls">
<input type="text" name="orderno" value="0">
<span class="form-required">*</span>
</div>
</div>
<div class="control-group">
<label class="control-label">礼物名称</label>
<div class="controls">
<input type="text" name="giftname">
<span class="form-required">*</span>
</div>
</div>
<div class="control-group">
<label class="control-label">所需点数</label>
<div class="controls">
<input type="text" name="needcoin">
<span class="form-required">*</span>
</div>
</div>
<div class="control-group" style="display:none;">
<label class="control-label">小图</label>
<div class="controls">
<input type="hidden" name="gifticon_mini" id="thumb1" value="">
<a href="javascript:void(0);" onclick="flashupload('thumb_images', '附件上传','thumb1',thumb_images,'1,jpg|jpeg|gif|png,1,,,1','','','');return false;">
<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="thumb1_preview" width="135" style="cursor: hand" />
</a>
<input type="button" class="btn btn-small" onclick="$('#thumb1_preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');$('#thumb1').val('');return false;" value="取消图片">
<span class="form-required"></span> <span class="form-required"></span>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<label class="control-label">图片</label> <label class="control-label">倍数</label>
<div class="controls"> <div class="controls">
<input type="hidden" name="gifticon" id="thumb2" value=""> <input type="text" name="times" value="0">
<a href="javascript:void(0);" onclick="flashupload('thumb_images', '附件上传','thumb2',thumb_images,'1,jpg|jpeg|gif|png,1,,,1','','','');return false;">
<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="thumb2_preview" width="135" style="cursor: hand" />
</a>
<input type="button" class="btn btn-small" onclick="$('#thumb2_preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');$('#thumb2').val('');return false;" value="取消图片">
<span class="form-required"></span> <span class="form-required"></span>
</div> </div>
</div> </div>
<div class="control-group" id="swftype">
<label class="control-label">动画类型</label>
<div class="controls">
<label class="radio inline" for="swftype_0"><input type="radio" name="swftype" value="0" id="swftype_0" checked >GIF</label>
<label class="radio inline" for="swftype_1"><input type="radio" name="swftype" value="1" id="swftype_1" >SVGA</label>
<div class="control-group">
<label class="control-label">是否全站</label>
<div class="controls" id="type">
<label class="radio inline" for="type_0"><input type="radio" name="type" value="0" id="type_0" checked ></label>
<label class="radio inline" for="type_1"><input type="radio" name="type" value="1" id="type_1" ></label>
<span class="form-required">*</span> <span class="form-required">*</span>
</div> </div>
</div> </div>
<div class="control-group">
<label class="control-label">动画图片</label>
<div class="controls">
<input type="hidden" name="swf" id="thumb3" value="">
<a href="javascript:void(0);" onclick="flashupload('thumb_images', '附件上传','thumb3',thumb_images,'1,gif,1,,,1','','','');return false;" id="swftype_bd_0">
<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="thumb3_preview" width="135" style="cursor: hand" />
</a>
<a href="javascript:void(0);" id="swftype_bd_1" style="display:none">
<input type="file" name="file">
</a>
<input type="button" class="btn btn-small" onclick="$('#thumb3_preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');$('#thumb3').val('');return false;" value="取消图片">
<span class="form-required"></span>
</div>
</div>
<div class="control-group"> <div class="control-group">
<label class="control-label">动画时间</label> <label class="control-label">中奖概率</label>
<div class="controls"> <div class="controls">
<input type="text" name="swftime" value="0">秒 精度:小数点后两位 <input type="text" name="rate" value="0">% 最小支持0.00001%
<span class="form-required">*</span> <span class="form-required"></span>
</div> </div>
</div> </div>
</fieldset> </fieldset>
<div class="form-actions"> <div class="form-actions">
<button type="submit" class="btn btn-primary js-ajax-submit">{:L('ADD')}</button> <button type="submit" class="btn btn-primary js-ajax-submit">{:L('ADD')}</button>
<a class="btn" href="{:U('Gift/index')}">{:L('BACK')}</a> <a class="btn" href="{:U('Luckrate/index',array('giftid'=>$giftid))}">{:L('BACK')}</a>
</div> </div>
</form> </form>
</div> </div>
<script src="__PUBLIC__/js/common.js"></script> <script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/content_addtop.js"></script>
<script>
(function(){
$("#swftype label.radio").on('click',function(){
var v=$("input",this).val();
var b=$("#swftype_bd_"+v);
b.siblings().hide();
b.show();
})
$("#type label.radio").on('click',function(){
var v=$("input",this).val();
if(v==0){
$("#mark_3").removeAttr('disabled')
}else{
if($("#mark_3").attr("checked")){
$("#mark_0").attr('checked','checked');
$("#tips").hide();
}
$("#mark_3").attr('disabled','disabled');
}
})
$("#mark label.radio").on('change',function(){
var v=$("input",this).val();
if(v==3){
$("#tips").show();
}else{
$("#tips").hide();
}
})
})()
</script>
</body> </body>
</html> </html>
...@@ -3,178 +3,55 @@ ...@@ -3,178 +3,55 @@
<body> <body>
<div class="wrap"> <div class="wrap">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li ><a href="{:U('Gift/index')}">礼物列表</a></li> <li ><a href="{:U('Luckrate/index',array('giftid'=>$data['giftid']))}">列表</a></li>
<li class="active"><a >编辑</a></li> <li class="active"><a >编辑</a></li>
</ul> </ul>
<form method="post" class="form-horizontal js-ajax-form" action="{:U('Gift/edit_post')}"> <form method="post" class="form-horizontal js-ajax-form" action="{:U('Luckrate/edit_post')}">
<input type="hidden" name="id" value="{$gift['id']}"> <input type="hidden" name="id" value="{$data['id']}">
<fieldset> <fieldset>
<div class="control-group" style="display:none;"> <div class="control-group">
<label class="control-label">礼物分类</label> <label class="control-label">数量</label>
<div class="controls"> <div class="controls">
<select name="sid"> <select name="nums">
<option value="0">默认分类</option> <volist name="numslist" id="v">
<volist name="gift_sort" id="vo"> <option value="{$v}" <if condition="$data['nums'] eq $v">selected</if>>{$v}</option>
<option value="{$key}" <if condition="$gift['sid'] eq '$key'">selected</if> >{$vo}</option>
</volist> </volist>
</select> </select>
<span class="form-required">*</span>
</div>
</div>
<div class="control-group">
<label class="control-label">礼物类型</label>
<div class="controls" id="type">
<label class="radio inline" for="type_0"><input type="radio" name="type" value="0" id="type_0" <if condition="$gift['type'] eq '0'">checked</if> >普通礼物</label>
<label class="radio inline" for="type_1"><input type="radio" name="type" value="1" id="type_1" <if condition="$gift['type'] eq '1'">checked</if> >豪华礼物</label>
<span class="form-required">*</span>
</div>
</div>
<div class="control-group">
<label class="control-label">礼物标识</label>
<div class="controls" style="position:relative;" id="mark">
<label class="radio inline" for="mark_0"><input type="radio" name="mark" value="0" id="mark_0" <if condition="$gift['mark'] eq '0'">checked</if> >普通</label>
<label class="radio inline" for="mark_1"><input type="radio" name="mark" value="1" id="mark_1" <if condition="$gift['mark'] eq '1'">checked</if> >热门</label>
<label class="radio inline" for="mark_2"><input type="radio" name="mark" value="2" id="mark_2" <if condition="$gift['mark'] eq '2'">checked</if> >守护</label>
<label class="radio inline" for="mark_3"><input type="radio" name="mark" value="3" id="mark_3" <if condition="$gift['mark'] eq '3'">checked</if> >幸运</label>
<span class="form-required">*</span>
<div id="tips" style="position: absolute;left: 300px;top: 0;<if condition="$gift['mark'] neq '3'">display:none;</if>">
<span style="color:#ff0000">幸运礼物说明</span><br>
1.用户送出去幸运礼物时,幸运礼物的价值将分成三份,分别为主播、奖池和平台,后台可以设置主播和奖池获得的比例,剩下的归属于平台,主播和奖池的比例不要超过100%【谨记】<br>
2.后台可设置某个礼物为幸运礼物<br>
3.成为幸运礼物后,可设置幸运礼物的的中奖设置以及奖池设置,以下是幸运礼物和奖池说明<br>
a)在中奖设置中可设置每个礼物每组每个倍数的中奖概率【如:小黄瓜 每组送10个中10倍的概率为 5%,小黄瓜 每组送100个中10倍的概率为 <br>6%】,当用户中奖后,返还的奖励以当组礼物总价值为基数返还【如送了一组10个的,总价值为100,中了10倍,那么会获得1000萌豆】<br>
b)奖池说明:奖池分为三个阶段,后台可设置每个奖池的金额下限,直接当奖池里边的金额达到最低的金额限制时,奖池才会开启,当有用户中奖时,会赢走奖池内的所有奖金<br>
c)幸运礼物与奖池说明:后台可设置每个幸运礼物每个组数相对于奖池每个阶段的中奖概率【如:小黄瓜每组10个对于奖池1阶段的中奖概率为0.01%,】,建议设置:礼物价值越高中奖概率越高,每组数量越多中奖概率越大<br>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">序号</label>
<div class="controls">
<input type="text" name="orderno" value="{$gift['orderno']}">
<span class="form-required">*</span>
</div>
</div>
<div class="control-group">
<label class="control-label">礼物名称</label>
<div class="controls">
<input type="text" name="giftname" value="{$gift['giftname']}">
<span class="form-required">*</span>
</div>
</div>
<div class="control-group">
<label class="control-label">所需点数</label>
<div class="controls">
<input type="text" name="needcoin" value="{$gift['needcoin']}">
<span class="form-required">*</span>
</div>
</div>
<div class="control-group" style="display:none;">
<label class="control-label">小图</label>
<div class="controls">
<input type="hidden" name="gifticon_mini" id="thumb1" value="{$gift['gifticon_mini']}">
<a href="javascript:void(0);" onclick="flashupload('thumb_images', '附件上传','thumb1',thumb_images,'1,jpg|jpeg|gif|png,1,,,1','','','');return false;">
<if condition="$gift['gifticon_mini'] neq ''">
<img src="{$gift['gifticon_mini']}" id="thumb1_preview" width="135" style="cursor: hand" />
<else/>
<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="thumb1_preview" width="135" style="cursor: hand" />
</if>
</a>
<input type="button" class="btn btn-small" onclick="$('#thumb1_preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');$('#thumb1').val('');return false;" value="取消图片">
<span class="form-required"></span> <span class="form-required"></span>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<label class="control-label">图片</label> <label class="control-label">倍数</label>
<div class="controls"> <div class="controls">
<input type="hidden" name="gifticon" id="thumb2" value="{$gift['gifticon']}"> <input type="text" name="times" value="{$data['times']}">
<a href="javascript:void(0);" onclick="flashupload('thumb_images', '附件上传','thumb2',thumb_images,'1,jpg|jpeg|gif|png,1,,,1','','','');return false;">
<if condition="$gift['gifticon'] neq ''">
<img src="{$gift['gifticon']}" id="thumb2_preview" width="135" style="cursor: hand" />
<else/>
<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="thumb2_preview" width="135" style="cursor: hand" />
</if>
</a>
<input type="button" class="btn btn-small" onclick="$('#thumb2_preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');$('#thumb2').val('');return false;" value="取消图片">
<span class="form-required"></span> <span class="form-required"></span>
</div> </div>
</div> </div>
<div class="control-group" id="swftype">
<label class="control-label">动画类型</label> <div class="control-group">
<label class="control-label">是否全站</label>
<div class="controls"> <div class="controls">
<label class="radio inline" for="swftype_0"><input type="radio" name="swftype" value="0" id="swftype_0" <if condition="$gift['swftype'] eq '0'">checked</if> >gif</label> <label class="radio inline" for="type_0"><input type="radio" name="isall" value="0" id="type_0" <if condition="$data['isall'] eq 0">checked</if> >否</label>
<label class="radio inline" for="swftype_1"><input type="radio" name="swftype" value="1" id="swftype_1" <if condition="$gift['swftype'] eq '1'">checked</if> >svga</label> <label class="radio inline" for="type_1"><input type="radio" name="isall" value="1" id="type_1" <if condition="$data['isall'] eq 1">checked</if>>是</label>
<span class="form-required">*</span> <span class="form-required">*</span>
</div> </div>
</div> </div>
<div class="control-group">
<label class="control-label">动画图片</label>
<div class="controls">
<input type="hidden" name="swf" id="thumb3" value="{$gift['swf']}">
<a class="swftype_bd" href="javascript:void(0);" onclick="flashupload('thumb_images', '附件上传','thumb3',thumb_images,'1,gif,1,,,1','','','');return false;" id="swftype_bd_0" <if condition="$gift['swftype'] eq '1'">style="display:none;"</if>>
<if condition="$gift['swf'] neq '' && $gift['swftype'] eq '0'" >
<img src="{$gift['swf']}" id="thumb3_preview" width="135" style="cursor: hand" />
<else/>
<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="thumb3_preview" width="135" style="cursor: hand" />
</if>
</a>
<a class="swftype_bd" href="javascript:void(0);" id="swftype_bd_1" <if condition="$gift['swftype'] eq '0'">style="display:none;" </if> >
<input type="text" value="{$gift['swf']}" style="width:500px;"> <input type="file" name="file">
</a>
<input type="button" class="btn btn-small" onclick="$('#thumb3_preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');$('#thumb3').val('');return false;" value="取消图片">
<span class="form-required"></span>
</div>
</div>
<div class="control-group"> <div class="control-group">
<label class="control-label">动画时间</label> <label class="control-label">中奖概率</label>
<div class="controls"> <div class="controls">
<input type="text" name="swftime" value="{$gift['swftime']}">秒 精度:小数点后两位 <input type="text" name="rate" value="{$data['rate']}">% 最小支持0.00001%
<span class="form-required"></span> <span class="form-required"></span>
</div> </div>
</div> </div>
</fieldset> </fieldset>
<div class="form-actions"> <div class="form-actions">
<button type="submit" class="btn btn-primary js-ajax-submit">{:L('EDIT')}</button> <button type="submit" class="btn btn-primary js-ajax-submit">{:L('EDIT')}</button>
<a class="btn" href="{:U('Gift/index')}">{:L('BACK')}</a> <a class="btn" href="{:U('Luckrate/index',array('giftid'=>$data['giftid']))}">{:L('BACK')}</a>
</div> </div>
</form> </form>
</div> </div>
<script src="__PUBLIC__/js/common.js"></script> <script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/content_addtop.js"></script>
<script>
(function(){
$("#swftype label.radio").on('click',function(){
var v=$("input",this).val();
var b=$("#swftype_bd_"+v);
b.siblings(".swftype_bd").hide();
b.show();
})
$("#type label.radio").on('click',function(){
var v=$("input",this).val();
if(v==0){
$("#mark_3").removeAttr('disabled')
}else{
if($("#mark_3").attr("checked")){
$("#mark_0").attr('checked','checked');
$("#tips").hide();
}
$("#mark_3").attr('disabled','disabled');
}
})
$("#mark label.radio").on('change',function(){
var v=$("input",this).val();
if(v==3){
$("#tips").show();
}else{
$("#tips").hide();
}
})
})()
</script>
</body> </body>
</html> </html>
...@@ -4,83 +4,43 @@ ...@@ -4,83 +4,43 @@
<body> <body>
<div class="wrap"> <div class="wrap">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a >礼物列表</a></li> <li><a href="{:U('Gift/index')}">礼物列表</a></li>
<li><a href="{:U('Gift/add')}">礼物添加</a></li> <li class="active"><a >列表</a></li>
<li><a href="{:U('Luckrate/add',array('giftid'=>$giftid))}">添加</a></li>
</ul> </ul>
<form method="post" class="js-ajax-form" action="{:U('Gift/listorders')}"> <form class="well form-search" name="form1" method="post" action="">
<div class="table-actions"> {$giftinfo['giftname']}
<button class="btn btn-primary btn-small js-ajax-submit" type="submit">{:L('SORT')}</button> </form>
</div> <form method="post" class="js-ajax-form">
<table class="table table-hover table-bordered"> <table class="table table-hover table-bordered">
<thead> <thead>
<tr> <tr>
<th>排序</th>
<th align="center">ID</th> <th align="center">ID</th>
<th>类型</th> <th>数量</th>
<!-- <th>分类</th> --> <th>倍数</th>
<th>标识</th> <th>中奖概率</th>
<th>名称</th> <th>是否全站通知</th>
<th>所需点数</th>
<!-- <th>礼物小图 (25 X 25)</th> -->
<th>图片</th>
<th>动画类型</th>
<th>动画</th>
<th>动画时长</th>
<th>发布时间</th>
<th align="center">{:L('ACTIONS')}</th> <th align="center">{:L('ACTIONS')}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<foreach name="lists" item="vo"> <foreach name="lists" item="vo">
<tr> <tr>
<td><input name="listorders[{$vo['id']}]" type="text" size="3" value="{$vo['orderno']}" class="input input-order"></td>
<td align="center">{$vo.id}</td> <td align="center">{$vo.id}</td>
<td>{$type[$vo['type']]}</td> <td>{$vo['nums']}</td>
<!-- <td>{$gift_sort[$vo['sid']]}</td> --> <td>{$vo['times']}</td>
<td>{$mark[$vo['mark']]}</td> <td>{$vo['rate']}%</td>
<td>{$vo['giftname']}</td> <td><if condition="$vo['isall'] eq 1"><else/></if></td>
<td>{$vo['needcoin']}</td>
<!-- <td><img width="25" height="25" src="{$vo['gifticon_mini']}" /></td> -->
<td><img width="25" height="25" src="{$vo['gifticon']}" /></td>
<td><if condition="$vo['type'] eq 1">{$swftype[$vo['swftype']]}</if></td>
<td><if condition="$vo['swf']">
<if condition="$vo['swftype'] eq 1">
{$vo['swf']}
<else/>
<img width="100" height="100" src="{$vo['swf']}" />
</if>
</if>
</td>
<td>{$vo['swftime']}</td>
<td>{$vo.addtime|date="Y-m-d H:i:s",###}</td>
<td align="center"> <td align="center">
<if condition="$vo['type'] eq 0 && $vo['mark'] eq 3"> <a href="{:U('Luckrate/edit',array('id'=>$vo['id']))}" >编辑</a>
<a href="{:U('Luckrate/index',array('giftid'=>$vo['id']))}" >中奖设置</a>
|
<a href="{:U('Jackpotrate/index',array('giftid'=>$vo['id']))}" >奖池设置</a>
| |
</if> <a href="{:U('Luckrate/del',array('id'=>$vo['id']))}" class="js-ajax-dialog-btn" data-msg="您确定要删除吗?">删除</a>
<if condition="$vo['isjusung'] eq 0 ">
<a href="{:U('Gift/recomm',array('id'=>$vo['id']))}" >推荐周星榜</a> |
<else/>
<a href="{:U('Gift/cancel',array('id'=>$vo['id']))}" >取消周星榜 |
</if>
<a href="{:U('Gift/edit',array('id'=>$vo['id']))}" >编辑</a>
|
<a href="{:U('Gift/del',array('id'=>$vo['id']))}" class="js-ajax-dialog-btn" data-msg="您确定要删除吗?">删除</a>
</td> </td>
</tr> </tr>
</foreach> </foreach>
</tbody> </tbody>
</table> </table>
<div class="pagination">{$page}</div> <div class="pagination">{$page}</div>
<div class="table-actions">
<button class="btn btn-primary btn-small js-ajax-submit" type="submit">{:L('SORT')}</button>
</div>
</form> </form>
</div> </div>
<script src="__PUBLIC__/js/common.js"></script> <script src="__PUBLIC__/js/common.js"></script>
......
...@@ -7,40 +7,38 @@ use Common\Controller\AdminbaseController; ...@@ -7,40 +7,38 @@ use Common\Controller\AdminbaseController;
class WelfareController extends AdminbaseController class WelfareController extends AdminbaseController
{ {
var $numslist=['1','10','66','88','100','520','1314'];
var $type=array("0"=>"普通礼物","1"=>"豪华礼物");
var $mark=array("0"=>"普通","1"=>"热门","2"=>"守护","3"=>"幸运");
var $swftype=array("0"=>"GIF","1"=>"SVGA");
function index(){ function index(){
$giftid=I('giftid');
$map['giftid']=$giftid;
/* $gift_sort=M("gift_sort")->getField("id,sortname"); $giftinfo=M('gift')
$gift_sort[0]="默认分类"; ->field('giftname')
$this->assign('gift_sort', $gift_sort); */ ->where("id={$giftid}")
->find();
$gift_model=M("gift"); $jackpot=M("luck_rate");
$count=$gift_model->count(); $count=$jackpot->where($map)->count();
$page = $this->page($count, 20); $page = $this->page($count, 20);
$lists = $gift_model $lists = $jackpot
//->where() ->where($map)
->order("orderno, addtime desc") ->order("id desc")
->limit($page->firstRow . ',' . $page->listRows) ->limit($page->firstRow . ',' . $page->listRows)
->select(); ->select();
$this->assign('lists', $lists); $this->assign('lists', $lists);
$this->assign('type', $this->type); $this->assign('giftid', $giftid);
$this->assign('mark', $this->mark); $this->assign('giftinfo', $giftinfo);
$this->assign('swftype', $this->swftype);
$this->assign("page", $page->show('Admin')); $this->assign("page", $page->show('Admin'));
$this->display(); $this->display();
} }
function del(){ function del(){
$id=intval($_GET['id']); $id=intval($_GET['id']);
if($id){ if($id){
$result=M("gift")->delete($id); $result=M("luck_rate")->delete($id);
if($result){ if($result){
$action="删除礼物:{$id}";
setAdminLog($action);
$this->resetcache(); $this->resetcache();
$this->success('删除成功'); $this->success('删除成功');
}else{ }else{
...@@ -51,58 +49,34 @@ class WelfareController extends AdminbaseController ...@@ -51,58 +49,34 @@ class WelfareController extends AdminbaseController
} }
$this->display(); $this->display();
} }
function add(){ function add(){
// $gift_sort=M("gift_sort")->getField("id,sortname"); $giftid=I('giftid');
// $this->assign('gift_sort', $gift_sort); $this->assign('giftid', $giftid);
$this->assign('numslist', $this->numslist);
$this->display(); $this->display();
} }
function add_post(){ function add_post(){
if(IS_POST){ if(IS_POST){
$gift=M("gift"); $jackpot=M("luck_rate");
$gift->create(); $jackpot->create();
$gift->addtime=time();
$type=I('type');
$swftype=I('swftype');
if($type==1 && $swftype==1){
if($_FILES){
$savepath=date('Ymd').'/';
//上传处理类
$config=array(
'rootPath' => './'.C("UPLOADPATH"),
'savePath' => $savepath,
'maxSize' => 11048576,
'saveName' => array('uniqid',''),
'exts' => array('svga'),
'autoSub' => false,
);
$upload = new \Think\Upload($config);//
$info=$upload->upload();
//开始上传
if ($info) {
//上传成功
//写入附件数据库信息
$first=array_shift($info);
if(!empty($first['url'])){
$url=$first['url'];
}else{
$url=C("TMPL_PARSE_STRING.__UPLOAD__").$savepath.$first['savename'];
}
$gift->swf=$url; $giftid=I('giftid');
} else { $nums=I('nums');
//上传失败,返回错误 $times=I('times');
$this->error($upload->getError());
}
if($times < 0){
$this->error('中奖倍数不能小于0');
} }
$check = $jackpot->where("giftid='{$giftid}' and nums='{$nums}' and times = '{$times}'")->find();
if($check){
$this->error('相同数量、倍数的配置已存在');
} }
$result=$gift->add(); $jackpot->addtime=time();
$result=$jackpot->add();
if($result){ if($result){
$action="添加礼物:{$result}";
setAdminLog($action);
$this->resetcache(); $this->resetcache();
$this->success('添加成功'); $this->success('添加成功');
}else{ }else{
...@@ -113,59 +87,37 @@ class WelfareController extends AdminbaseController ...@@ -113,59 +87,37 @@ class WelfareController extends AdminbaseController
function edit(){ function edit(){
$id=intval($_GET['id']); $id=intval($_GET['id']);
if($id){ if($id){
$gift=M("gift")->find($id); $data=M("luck_rate")->find($id);
$this->assign('gift', $gift);
$this->assign('numslist', $this->numslist);
$this->assign('data', $data);
}else{ }else{
$this->error('数据传入失败!'); $this->error('数据传入失败!');
} }
$this->display(); $this->display();
} }
function edit_post(){ function edit_post(){
if(IS_POST){ if(IS_POST){
$gift=M("gift"); $jackpot=M("luck_rate");
$gift->create(); $jackpot->create();
$type=I('type');
$swftype=I('swftype');
if($type==1 && $swftype==1){
if($_FILES){
$savepath=date('Ymd').'/';
//上传处理类
$config=array(
'rootPath' => './'.C("UPLOADPATH"),
'savePath' => $savepath,
'maxSize' => 11048576,
'saveName' => array('uniqid',''),
'exts' => array('svga'),
'autoSub' => false,
);
$upload = new \Think\Upload($config);//
$info=$upload->upload();
//开始上传
if ($info) {
//上传成功
//写入附件数据库信息
$first=array_shift($info);
if(!empty($first['url'])){
$url=$first['url'];
}else{
$url=C("TMPL_PARSE_STRING.__UPLOAD__").$savepath.$first['savename'];
}
$gift->swf=$url; $id=I('id');
} else { $giftid=I('giftid');
//上传失败,返回错误 $nums=I('nums');
$this->error($upload->getError()); $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=$gift->save(); $result=$jackpot->save();
if($result!==false){ if($result!==false){
$action="修改礼物:{$_POST['id']}";
setAdminLog($action);
$this->resetcache(); $this->resetcache();
$this->success('修改成功'); $this->success('修改成功');
}else{ }else{
...@@ -173,4 +125,14 @@ class WelfareController extends AdminbaseController ...@@ -173,4 +125,14 @@ class WelfareController extends AdminbaseController
} }
} }
} }
function resetcache(){
$key='luck_rate';
$level= M("luck_rate")->order("id desc")->select();
if($level){
setcaches($key,$level);
}
return 1;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment