generated from root/miduo_server
天降礼包
parent
da64e81c43
commit
ce760ad47d
File diff suppressed because it is too large
Load Diff
|
@ -8,9 +8,7 @@ import com.jmfy.model.ServerInfo;
|
|||
import com.jmfy.model.config.SRechargeCommodityConfig;
|
||||
import com.jmfy.model.gm.GiftActivity;
|
||||
import com.jmfy.model.gm.GiftMission;
|
||||
import com.jmfy.utils.FileCacheUtils;
|
||||
import com.jmfy.utils.JsonUtil;
|
||||
import com.jmfy.utils.StringUtil;
|
||||
import com.jmfy.utils.*;
|
||||
import config.SItemConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -27,12 +25,10 @@ import java.util.stream.Collectors;
|
|||
|
||||
@Controller
|
||||
public class GiftActivityController {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ActivityController.class);
|
||||
|
||||
@Resource
|
||||
private ServerInfoDao serverInfoDao;
|
||||
@Resource
|
||||
private ActivityDao activityDao;
|
||||
@Resource
|
||||
private SeqUtils seqUtils;
|
||||
|
||||
/**
|
||||
* 活动信息界面
|
||||
|
@ -41,7 +37,7 @@ public class GiftActivityController {
|
|||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/findGiftActivityInfo", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String findGiftActivityInfo(ModelMap map, HttpServletRequest request) throws Exception {
|
||||
public String findGiftActivityInfo(ModelMap map) throws Exception {
|
||||
List<GiftActivity> allActivityList = activityDao.findAllGiftActivityList();
|
||||
map.addAttribute("allActivityList", allActivityList);
|
||||
return "activity/GiftActivityInfo";
|
||||
|
@ -57,12 +53,9 @@ public class GiftActivityController {
|
|||
public String jumpUpdateGiftActivity(ModelMap map, HttpServletRequest request) throws Exception {
|
||||
String activityId = request.getParameter("activityId");
|
||||
if (!StringUtil.isEmpty(activityId)){
|
||||
GiftActivity oneActivity = activityDao.findOneGiftActivity(activityId);
|
||||
GiftActivity oneActivity = activityDao.findOneGiftActivity(Integer.parseInt(activityId));
|
||||
map.addAttribute("activity", oneActivity);
|
||||
}
|
||||
List<ServerInfo> serverInfos = serverInfoDao.getAllServerInfo();
|
||||
serverInfos.add(0,new ServerInfo(0,"全部"));
|
||||
map.addAttribute("serverInfo", serverInfos);
|
||||
return "activity/UporsetGiftActivity";
|
||||
}
|
||||
|
||||
|
@ -74,7 +67,9 @@ public class GiftActivityController {
|
|||
*/
|
||||
@PostMapping(value = "/updateGiftActivity")
|
||||
public @ResponseBody int updateGiftActivity(@RequestBody GiftActivity activity) throws Exception {
|
||||
if (StringUtil.isEmpty(activity.getId())){
|
||||
if (activity.getId() == 0){
|
||||
activity.setId(seqUtils.getSequence("gift_activity"));
|
||||
activity.setCreateTime(DateUtil.now());
|
||||
activityDao.insertGiftActivity(activity);
|
||||
}else {
|
||||
activityDao.upsetGiftActivity(activity);
|
||||
|
@ -91,7 +86,7 @@ public class GiftActivityController {
|
|||
@RequestMapping(value = "/removeGiftActivity", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody int removeGiftActivity(HttpServletRequest request) throws Exception {
|
||||
// mongo
|
||||
String activityId = request.getParameter("activityId");
|
||||
int activityId = Integer.parseInt(request.getParameter("activityId"));
|
||||
activityDao.deleteGiftActivity(activityId);
|
||||
return 1;
|
||||
}
|
||||
|
@ -104,9 +99,9 @@ public class GiftActivityController {
|
|||
*/
|
||||
@RequestMapping(value = "/findGiftMission", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String findGiftMission(ModelMap map, HttpServletRequest request) throws Exception {
|
||||
String activityId = request.getParameter("activityId");
|
||||
List<GiftMission> missions = activityDao.findGiftMissionList(activityId);
|
||||
map.addAttribute("missions", missions);
|
||||
int activityId = Integer.parseInt(request.getParameter("activityId"));
|
||||
List<GiftMission> giftMission = activityDao.findAllGiftMission(activityId);
|
||||
map.addAttribute("missions", giftMission);
|
||||
map.addAttribute("activityId", activityId);
|
||||
return "activity/GiftMissionInfo";
|
||||
}
|
||||
|
@ -120,7 +115,7 @@ public class GiftActivityController {
|
|||
@RequestMapping(value = "/jumpAddGiftMission", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String jumpAddGiftMission(ModelMap map, HttpServletRequest request) {
|
||||
ArrayList<SRechargeCommodityConfig> giftList = new ArrayList<>(FileCacheUtils.rechargeMap.values());
|
||||
List<SRechargeCommodityConfig> list = giftList.stream().filter(v -> v.getTianJianglibao() == 1).collect(Collectors.toList());
|
||||
List<SRechargeCommodityConfig> list = giftList.stream().filter(v -> v.getOtype() == 5).collect(Collectors.toList());
|
||||
map.addAttribute("giftList",list);
|
||||
String activityId = request.getParameter("activityId");
|
||||
map.addAttribute("activityId", activityId);
|
||||
|
@ -133,14 +128,25 @@ public class GiftActivityController {
|
|||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/addGiftMission", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody int addGiftMission(@RequestBody GiftMission mission) {
|
||||
int result = 1;
|
||||
try {
|
||||
activityDao.insertGiftMission(mission);
|
||||
}catch (Exception e){
|
||||
result = 0;
|
||||
}
|
||||
return result;
|
||||
public @ResponseBody int addGiftMission(HttpServletRequest request) throws Exception {
|
||||
int activityId = Integer.parseInt(request.getParameter("activityId"));
|
||||
// 获取参数
|
||||
int giftId = Integer.parseInt(request.getParameter("id"));
|
||||
int sort = Integer.parseInt(request.getParameter("sort"));
|
||||
String name = request.getParameter("name");
|
||||
String discount = request.getParameter("discount");
|
||||
int limit = Integer.parseInt(request.getParameter("limit"));
|
||||
// 封装
|
||||
GiftMission mission = new GiftMission();
|
||||
mission.setId(giftId);
|
||||
mission.setSort(sort);
|
||||
mission.setBuyLimitCount(limit);
|
||||
mission.setName(name);
|
||||
mission.setDiscount(discount);
|
||||
mission.setActivityId(activityId);
|
||||
|
||||
activityDao.insertGiftMission(mission);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,8 +157,8 @@ public class GiftActivityController {
|
|||
*/
|
||||
@RequestMapping(value = "/removeGiftMission", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody int removeGiftMission(HttpServletRequest request) throws Exception {
|
||||
String missionId = request.getParameter("missionId");
|
||||
activityDao.deleteGiftMission(Integer.parseInt(missionId));
|
||||
int missionId = Integer.parseInt(request.getParameter("missionId"));
|
||||
activityDao.deleteGiftMission(missionId);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,28 +61,11 @@ public class GmController {
|
|||
List<String> serverList = new ArrayList<>();
|
||||
allServerInfo.forEach(v -> serverList.add(v.getServer_id()));
|
||||
String cmd = request.getParameter("content");
|
||||
// 订单返利
|
||||
if (cmd.equals("recharge")) {
|
||||
recharge();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cmd.contains("hefu")) {
|
||||
TaskKit.scheduleWithFixedOne(()->heFuManager.hefu(cmd),0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//根据excel删除道具
|
||||
if (cmd.equals("deleteItem0210")){
|
||||
deleteItem0210();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 修改服务器状态 serverstatus#10001#-2
|
||||
if (cmd.contains("serverstatus")) {
|
||||
String[] split = cmd.split("#");
|
||||
serverInfoDao.updateServerInfo(split[1], split[2]);
|
||||
return 0;
|
||||
// 特殊处理
|
||||
int treatment = specialTreatment(cmd);
|
||||
if (treatment != -1){
|
||||
return treatment;
|
||||
}
|
||||
|
||||
String serverId = request.getParameter("serverId");
|
||||
|
@ -90,19 +73,6 @@ public class GmController {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// 删除道具
|
||||
if (cmd.contains("deletemailiteminfo")){
|
||||
TaskKit.scheduleWithFixedOne(() -> {
|
||||
try {
|
||||
createExcelToItem(cmd,serverId,response);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("删除邮件道具查询报错:{}",e.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
},1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
String[] split = serverId.split(",");
|
||||
for (String str : split) {
|
||||
if (!serverList.contains(str)) {
|
||||
|
@ -136,6 +106,34 @@ public class GmController {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public int specialTreatment(String cmd) throws Exception {
|
||||
// 订单返利
|
||||
if (cmd.equals("recharge")) {
|
||||
recharge();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cmd.contains("hefu")) {
|
||||
TaskKit.scheduleWithFixedOne(()->heFuManager.hefu(cmd),0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//根据excel删除道具
|
||||
if (cmd.equals("deleteItem0210")){
|
||||
deleteItem0210();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 修改服务器状态 serverstatus#10001#-2
|
||||
if (cmd.contains("serverstatus")) {
|
||||
String[] split = cmd.split("#");
|
||||
serverInfoDao.updateServerInfo(split[1], split[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创角删除道具的excel文件
|
||||
* @param content
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ServerInfoController {
|
|||
/**
|
||||
* 各服参数
|
||||
*/
|
||||
private static ExpiryMap<String,CServerOpenTime> serverStatus = new ExpiryMap<>();
|
||||
private static final ExpiryMap<String,CServerOpenTime> serverStatus = new ExpiryMap<>();
|
||||
/**
|
||||
* 游戏服端口状态
|
||||
* key: 服务器id
|
||||
|
@ -252,7 +252,7 @@ public class ServerInfoController {
|
|||
// 正常状态转向未运营状态,验证权限
|
||||
if (info.getStatusInt() != notState && vo.getStatusInt() == notState){
|
||||
boolean verifyPower = commonManager.verifyPower(request, PowersEnum.SERVER_NOT_OPERATION);
|
||||
String account = request.getSession().getAttribute("username")+"";
|
||||
String account = String.valueOf(request.getSession().getAttribute("username"));
|
||||
CAdmin admin = cUserDao.findAdmin(account);
|
||||
if (!verifyPower || admin == null || admin.getIdentity() != IdentityEnum.SYSTEM_ADMIN.getId()){
|
||||
return 2;
|
||||
|
@ -305,15 +305,19 @@ public class ServerInfoController {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!status.equals("-999")){
|
||||
// -5表示维护服务器并踢全部玩家下线,一般用于线上停服更新
|
||||
if (status.equals("-5")){
|
||||
switch (status){
|
||||
case "-5":// -5表示维护服务器并踢全部玩家下线,一般用于线上停服更新
|
||||
serverInfoDao.updateServerInfo(id, "1");
|
||||
TaskKit.scheduleWithFixedOne(()->GMHandler.sendGm(id,"kick 0"),0);
|
||||
}else {
|
||||
break;
|
||||
case "-3":// -3表示重启全部服务器
|
||||
TaskKit.scheduleWithFixedOne(()->GMHandler.sendGm(id,"kick 0"),0);
|
||||
autoServerManager.rebootServer(id);
|
||||
break;
|
||||
default:
|
||||
// 修改服务器信息
|
||||
serverInfoDao.updateServerInfo(id, status);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -506,7 +510,7 @@ public class ServerInfoController {
|
|||
autoServerSetting = new AutoServerSetting();
|
||||
}
|
||||
map.addAttribute("autoServerSetting", autoServerSetting);
|
||||
LOGGER.info("自动开服配置:{}",autoServerSetting.toString());
|
||||
LOGGER.info("自动开服配置:{}", autoServerSetting);
|
||||
return "autoStartServerSetting";
|
||||
}
|
||||
|
||||
|
|
|
@ -17,15 +17,16 @@ public interface ActivityDao {
|
|||
|
||||
//**********************************单笔充值活动*******************************//
|
||||
List<GiftActivity> findAllGiftActivityList() throws Exception;
|
||||
GiftActivity findOneGiftActivity(String activityId) throws Exception;
|
||||
GiftActivity findOneGiftActivity(int activityId) throws Exception;
|
||||
void insertGiftActivity(GiftActivity activity) throws Exception;
|
||||
void upsetGiftActivity(GiftActivity activity) throws Exception;
|
||||
void deleteGiftActivity(String activityId) throws Exception;
|
||||
void deleteGiftActivity(int activityId) throws Exception;
|
||||
|
||||
List<GiftMission> findGiftMissionList(String activityId) throws Exception;
|
||||
GiftMission findOneGiftMission(int missionId) throws Exception;
|
||||
List<GiftMission> findAllGiftMission(int activityId) throws Exception;
|
||||
GiftMission findGiftMission(int missionId) throws Exception;
|
||||
void insertGiftMission(GiftMission mission) throws Exception;
|
||||
void deleteGiftMission(int missionId) throws Exception;
|
||||
void deleteManyGiftMission(int activityId) throws Exception;
|
||||
|
||||
|
||||
//**********************************自动返利活动*******************************//
|
||||
|
|
|
@ -44,20 +44,15 @@ public class ActivityDaoImpl implements ActivityDao {
|
|||
}
|
||||
|
||||
@Override
|
||||
public GiftActivity findOneGiftActivity(String activityId) throws Exception {
|
||||
public GiftActivity findOneGiftActivity(int activityId) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
|
||||
Query query = new Query(Criteria.where("id").is(activityId));
|
||||
Query query = new Query(Criteria.where("_id").is(activityId));
|
||||
return mongoTemplate.findOne(query,GiftActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertGiftActivity(GiftActivity activity) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
|
||||
GiftActivity oneActivity = findOneGiftActivity(activity.getId());
|
||||
if (oneActivity != null){
|
||||
return;
|
||||
}
|
||||
activity.setCreateTime(DateUtil.now());
|
||||
mongoTemplate.insert(activity);
|
||||
}
|
||||
|
||||
|
@ -71,55 +66,52 @@ public class ActivityDaoImpl implements ActivityDao {
|
|||
}
|
||||
// 修改
|
||||
Update update = new Update();
|
||||
if (!StringUtil.isEmpty(activity.getName())){
|
||||
update.set("name", activity.getName());
|
||||
}
|
||||
update.set("name", activity.getName());
|
||||
update.set("startTime", activity.getStartTime());
|
||||
update.set("endTime", activity.getEndTime());
|
||||
update.set("openLimitDay", activity.getOpenLimitDay());
|
||||
update.set("serverIds", activity.getServerIds());
|
||||
Query query = new Query(Criteria.where("id").is(activity.getId()));
|
||||
mongoTemplate.updateMulti(query, update, GiftActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteGiftActivity(String activityId) throws Exception {
|
||||
public void deleteGiftActivity(int activityId) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
|
||||
Query query = new Query(Criteria.where("id").is(activityId));
|
||||
Query query = new Query(Criteria.where("_id").is(activityId));
|
||||
mongoTemplate.remove(query, GiftActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GiftMission> findGiftMissionList(String activityId) throws Exception {
|
||||
public List<GiftMission> findAllGiftMission(int activityId) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
|
||||
List<GiftMission> all = mongoTemplate.findAll(GiftMission.class);
|
||||
if (all == null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return all;
|
||||
Query query = new Query(Criteria.where("activityId").is(activityId));
|
||||
return mongoTemplate.find(query,GiftMission.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GiftMission findOneGiftMission(int id) throws Exception {
|
||||
public GiftMission findGiftMission(int missionId) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
|
||||
Query query = new Query(Criteria.where("id").is(id));
|
||||
Query query = new Query(Criteria.where("_id").is(missionId));
|
||||
return mongoTemplate.findOne(query,GiftMission.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertGiftMission(GiftMission mission) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
|
||||
GiftMission oneGiftMission = findOneGiftMission(mission.getId());
|
||||
if (oneGiftMission != null){
|
||||
throw new Exception("礼包id已存在");
|
||||
}
|
||||
mongoTemplate.insert(mission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteGiftMission(int missionId) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
|
||||
Query query = new Query(Criteria.where("id").is(missionId));
|
||||
Query query = new Query(Criteria.where("_id").is(missionId));
|
||||
mongoTemplate.remove(query, GiftMission.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteManyGiftMission(int activityId) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
|
||||
Query query = new Query(Criteria.where("activityId").is(activityId));
|
||||
mongoTemplate.remove(query, GiftMission.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
package com.jmfy.model.gm;
|
||||
|
||||
import com.jmfy.model.ServerInfo;
|
||||
import com.jmfy.redisProperties.RedisUserKey;
|
||||
import com.jmfy.utils.DateUtil;
|
||||
import com.jmfy.utils.RedisUtil;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
@Document(collection = "c_gift_activity")
|
||||
public class GiftActivity {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
private int id;
|
||||
|
||||
private String name;
|
||||
|
||||
|
@ -28,13 +22,11 @@ public class GiftActivity {
|
|||
|
||||
private long createTime;
|
||||
|
||||
private Set<String> serverIds = new HashSet<>();
|
||||
|
||||
public String getId() {
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
@ -85,28 +77,4 @@ public class GiftActivity {
|
|||
public void setCreateTime(long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Set<String> getServerIds() {
|
||||
return serverIds;
|
||||
}
|
||||
|
||||
public void setServerIds(Set<String> serverIds) {
|
||||
this.serverIds = serverIds;
|
||||
}
|
||||
|
||||
public String getServerNames(){
|
||||
Map<String, ServerInfo> infoMap = RedisUtil.getInstence().getMap(RedisUserKey.SERVER_INFO, ServerInfo.class, -1);
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (String serverId : serverIds) {
|
||||
if (serverId.equals("0")){
|
||||
builder.append("全部");
|
||||
break;
|
||||
}
|
||||
ServerInfo info = infoMap.get(serverId);
|
||||
if (info != null){
|
||||
builder.append(info.getName()).append("|");
|
||||
}
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
|
|||
|
||||
@Document(collection = "c_gift_mission")
|
||||
public class GiftMission {
|
||||
|
||||
|
||||
@Id
|
||||
private int id;
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class GiftMission {
|
|||
|
||||
private int buyLimitCount;
|
||||
|
||||
private String activityId;
|
||||
private int activityId;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
|
@ -70,11 +70,11 @@ public class GiftMission {
|
|||
this.sort = sort;
|
||||
}
|
||||
|
||||
public String getActivityId() {
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public void setActivityId(String activityId) {
|
||||
public void setActivityId(int activityId) {
|
||||
this.activityId = activityId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,32 +154,28 @@
|
|||
|
||||
function upsertMission() {
|
||||
// ID
|
||||
let giftId = props.getValue("valueStr");
|
||||
let id = Number(giftId);
|
||||
let activityId = document.getElementById("activityId").value;
|
||||
let id = Number(props.getValue("valueStr"));
|
||||
let activityId = Number(document.getElementById("activityId").value);
|
||||
let sortId = document.getElementById("sortId").value;
|
||||
let name = document.getElementById("name").value;
|
||||
let discount = document.getElementById("discount").value;
|
||||
let buyLimitCount = document.getElementById("buyLimitCount").value;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data:
|
||||
JSON.stringify({
|
||||
"id": id,
|
||||
"sort": sortId,
|
||||
"name": name,
|
||||
"discount": discount,
|
||||
"buyLimitCount": buyLimitCount,
|
||||
"activityId": activityId
|
||||
})
|
||||
,
|
||||
data: {
|
||||
"id":id,
|
||||
"activityId":activityId,
|
||||
"sort":sortId,
|
||||
"name":name,
|
||||
"discount":discount,
|
||||
"limit":buyLimitCount
|
||||
},
|
||||
url: "/addGiftMission",
|
||||
dataType: "json",
|
||||
contentType: 'application/json',
|
||||
success: function (data) {
|
||||
if (data == 1) {
|
||||
layer.msg('成功!', {icon: 6, time: 1000});
|
||||
}else {
|
||||
layer.msg('参数错误,失败!', {icon: 6, time: 1000});
|
||||
}
|
||||
},
|
||||
error:function () {
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
<th>开启时间</th>
|
||||
<th>结束时间</th>
|
||||
<th>限制开服天数</th>
|
||||
<th>生效区服</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -54,7 +53,6 @@
|
|||
<td th:text="${obj.getStartTimeStr()}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.getEndTimeStr()}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.getOpenLimitDay()}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.getServerNames()}" style="text-align: center;"></td>
|
||||
<td style="text-align: center;">
|
||||
<button type="button" th:id="${obj.getId()}" class="btn btn-primary radius" onclick="return jumpUpdateActivity(this)">
|
||||
修改
|
||||
|
|
|
@ -106,12 +106,14 @@
|
|||
*/
|
||||
function deleteMission(obj) {
|
||||
let missionId = $(obj).attr("id");
|
||||
let activityId = Number(document.getElementById("activityId").value);
|
||||
let name = $(obj).attr("name");
|
||||
let msg = "请确认是否要删除礼包:{"+name+"},\n\n请确认!";
|
||||
if (confirm(msg) === true) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
"activityId": activityId,
|
||||
"missionId": missionId
|
||||
},
|
||||
url: "/removeGiftMission",
|
||||
|
|
|
@ -68,16 +68,7 @@
|
|||
</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" id="startTime" class="input-text Wdate" style="width:180px;" name="startTime">
|
||||
<input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" id="endTime" class="input-text Wdate" style="width:180px;" name="endTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>区服id:
|
||||
</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<!-- 服务器列表 -->
|
||||
<div th:id="serverIds" style="float: left;width: 230px;"></div>
|
||||
- <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" id="endTime" class="input-text Wdate" style="width:180px;" name="endTime">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -125,75 +116,6 @@
|
|||
});
|
||||
});
|
||||
|
||||
var activity = [[${activity}]];
|
||||
|
||||
var serverInfos = xmSelect.render({
|
||||
el: '#serverIds', // div的id值
|
||||
template({name, value}){
|
||||
return name + '<span style="position: absolute; right: 10px; color: #8799a3">'+value+'</span>'
|
||||
},
|
||||
toolbar: { // 工具条【‘全选’,‘清空’】
|
||||
show: true, // 开启工具条
|
||||
showIcon: false, // 隐藏工具条的图标
|
||||
},
|
||||
tips: '选择服务器', // 让默认值不是“请选择”,而是“选择校区”
|
||||
filterable: true, // 开启搜索模式,默认按照name进行搜索
|
||||
height:'260px',
|
||||
model: {
|
||||
label: {
|
||||
type: 'block',
|
||||
block: {
|
||||
//最大显示数量, 0:不限制
|
||||
showCount: 1,
|
||||
//是否显示删除图标
|
||||
showIcon: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
prop: {
|
||||
name: 'name',
|
||||
value: 'server_id',
|
||||
},
|
||||
initValue: getServerInit(),
|
||||
on: function(data){
|
||||
//可以return一个数组, 代表想选中的数据
|
||||
|
||||
//arr: 当前多选已选中的数据
|
||||
var arr = data.arr;
|
||||
//change, 此次选择变化的数据,数组
|
||||
var change = data.change;
|
||||
//isAdd, 此次操作是新增还是删除
|
||||
var isAdd = data.isAdd;
|
||||
|
||||
if(isAdd){
|
||||
var allItem = change.find(function(item){
|
||||
return item.server_id == '0';
|
||||
})
|
||||
if(allItem){
|
||||
return [allItem];
|
||||
}
|
||||
allItem = arr.find(function(item){
|
||||
return item.server_id == '0';
|
||||
})
|
||||
if(allItem){
|
||||
return change;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
data: function () {
|
||||
return [[${serverInfo}]];
|
||||
},
|
||||
});
|
||||
|
||||
function getServerInit(){
|
||||
let result = [];
|
||||
if (activity != null){
|
||||
result = activity.serverIds;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function formatDate(value) {
|
||||
var date = new Date(value);
|
||||
var y = date.getFullYear(),
|
||||
|
@ -226,16 +148,13 @@
|
|||
// ID
|
||||
let activityId = document.getElementById("activityId").value;
|
||||
if (activityId == ""){
|
||||
activityId = null;
|
||||
activityId = 0;
|
||||
}
|
||||
// 标题
|
||||
let name = document.getElementById("name").value;
|
||||
// 开服限制天数
|
||||
let openLimitDay = document.getElementById("openLimitDay").value;
|
||||
// 生效的服务器id
|
||||
let servers = serverInfos.getValue('value');
|
||||
|
||||
if (name == "" || openLimitDay == "" || servers == ""){
|
||||
if (name == "" || openLimitDay == ""){
|
||||
alert("参数不能为空!")
|
||||
return false;
|
||||
}
|
||||
|
@ -257,8 +176,7 @@
|
|||
"name": name,
|
||||
"openLimitDay": openLimitDay,
|
||||
"startTime": DateStart.getTime(),
|
||||
"endTime": DateEnd.getTime(),
|
||||
"serverIds": servers
|
||||
"endTime": DateEnd.getTime()
|
||||
})
|
||||
,
|
||||
url: "/updateGiftActivity",
|
||||
|
|
|
@ -197,9 +197,10 @@
|
|||
},
|
||||
data: [ // 默认是name(相当于我们常传的value值)和value(相当于我们常传的id)
|
||||
{name: '停服', value: -5},
|
||||
{name: '关闭', value: 0},
|
||||
{name: '重启', value: -3},
|
||||
{name: '维护', value: 1},
|
||||
{name: '流畅', value: 2},
|
||||
{name: '关闭', value: 0},
|
||||
{name: '拥挤', value: 3},
|
||||
{name: '爆满', value: 4},
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue