diff --git a/Application/Admin/Controller/GiftbagController.class.php b/Application/Admin/Controller/GiftbagController.class.php index 7e01d8f41..f1b4a4dd2 100644 --- a/Application/Admin/Controller/GiftbagController.class.php +++ b/Application/Admin/Controller/GiftbagController.class.php @@ -102,6 +102,20 @@ class GiftbagController extends ThinkController { public function add(){ if(IS_POST){ + + + + if ($_POST['giftbag_version'] == '3') { + $whereGift['giftbag_version'] = $_POST['giftbag_version']; + $whereGift['game_id'] = $_POST['game_id']; + $_POST['start_time'] = time(); + $giftData = D('giftbag')->field('id')->where($whereGift)->find(); + + if ($giftData) { + $this->error('超级签礼包一个游戏只能有一个!'); + } + } + $Model = D('Giftbag'); // 获取模型的字段信息 $Model = $this->checkAttr($Model,$model['id']); @@ -114,6 +128,10 @@ class GiftbagController extends ThinkController { } } $data = $Model->create(); + if ($_POST['giftbag_version'] == '3') { + $data['start_time'] = time(); + } +// var_dump($data);die(); if($data){ $data['novice'] = str_replace(array("\r\n", "\r", "\n"), ",", $_POST['novice']); $data['server_name']=get_server_name($data['server_id']); diff --git a/Application/Admin/View/Giftbag/add.html b/Application/Admin/View/Giftbag/add.html index 790402671..a1ce0fc1c 100644 --- a/Application/Admin/View/Giftbag/add.html +++ b/Application/Admin/View/Giftbag/add.html @@ -58,7 +58,7 @@
*游戏名称: | |
运营平台 |
+ |
礼包状态: | @@ -97,7 +107,7 @@ |
礼包类型: | @@ -115,13 +125,13 @@ |
*礼包名称: | |
礼包区服: | |
开始周期: | 至 |
激活码: | |
使用说明: | |
礼包内容: | @@ -199,7 +209,15 @@ $('#submit').click(function(){ if($("#game_id").val()){ fun_ajax($("#game_id").val()); } + $(function(){ + $("#gift_platform").change(function() { + var radio = $("#gift_platform input[type='radio']:checked").val(); + $('#giftbag_version').val(radio); + }); + $(".inp_radio").change(function () { + changePage(); + }); $("#game_name").val($("#game_id option:selected").text()); $('.date').datetimepicker({ format: 'yyyy-mm-dd', @@ -226,8 +244,9 @@ $("#game_id").change(function(){ $("#game_name").val($("#game_id option:selected").text()); var ratio_type=$("#game_id").children('option:selected').attr('sdk_version'); $("input[type='radio'][name='giftbag_version'][value='"+ratio_type+"']").prop("checked",true); - $('#giftbag_version').val(ratio_type); + // $('#giftbag_version').val(ratio_type); fun_ajax($("#game_id option:selected").val()); + changePage(); }); function fun_ajax(gid){ @@ -258,5 +277,36 @@ function fun_html(data){ $("#server_id").html(area); } } +function changePage() { + console.log($(".inp_radio:checked").val()) + var type = $(".inp_radio:checked").val(); + if (type == 3) { + var ratio_type=$("#game_id").children('option:selected').attr('sdk_version'); + if (ratio_type == 1) { + $("input[type='radio'][name='giftbag_version'][value='"+ratio_type+"']").prop("checked",true); + updateAlert('超级签只能是苹果运营平台!'); + setTimeout(function() { + $("#tip").removeClass('block tip_right'); + },1500); + } else { + $("#gift_status").hide(); + $($("#gift_status input[type='radio']").eq(1)).prop('checked',true); + $("#gift_type").hide(); + $($("#gift_type input[type='radio']").eq(1)).prop('checked',true); + $("#gift_server").hide(); + $("#server_id").val(""); + $("#gift_time").hide(); + $("input[name='start_time']").val(""); + $("input[name='end_time']").val(""); + } + + } else { + $("#gift_status").show(); + + $("#gift_type").show(); + $("#gift_server").show(); + $("#gift_time").show(); + } +} \ No newline at end of file diff --git a/Data/update.sql b/Data/update.sql index b1cab2369..17a5e3aca 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -157,4 +157,9 @@ CREATE TABLE `tab_protect_log_read` ( `promote_id` int(11) NOT NULL DEFAULT '0' COMMENT '推广员id', `create_time` int(11) DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=25 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; \ No newline at end of file +) ENGINE=MyISAM AUTO_INCREMENT=25 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- 2019-10-17 zyx +-- ---------------------------- +alter table `tab_giftbag` modify COLUMN `giftbag_version` tinyint(2) COMMENT '运营平台 0双平台 1and 2ios 3超级签' \ No newline at end of file |