generated from root/miduo_server
gm发送邮件
parent
0bc872f1c7
commit
ef9d72c9d8
|
@ -0,0 +1,35 @@
|
|||
package com.jmfy.controller;
|
||||
|
||||
|
||||
import com.jmfy.dao.MailDao;
|
||||
import com.jmfy.model.Constant;
|
||||
import com.jmfy.model.PersonalMail;
|
||||
import com.jmfy.model.ServerMail;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@Controller
|
||||
public class MailController {
|
||||
|
||||
@Autowired
|
||||
public MailDao mailDao;
|
||||
|
||||
|
||||
|
||||
@PostMapping(value = "/sendSysMail")
|
||||
public @ResponseBody
|
||||
int sendSysMail(@RequestBody ServerMail mail) throws Exception {
|
||||
mailDao.sendSysMail(mail);
|
||||
return 0;
|
||||
}
|
||||
@PostMapping(value = "/sendPersonalMail")
|
||||
public @ResponseBody
|
||||
int sendPersonalMail(@RequestBody PersonalMail mail){
|
||||
mailDao.sendPersonalMail(mail);
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.jmfy.dao;
|
||||
|
||||
import com.jmfy.model.PersonalMail;
|
||||
import com.jmfy.model.ServerMail;
|
||||
|
||||
public interface MailDao {
|
||||
|
||||
void sendSysMail(ServerMail mail) throws Exception;
|
||||
|
||||
void sendPersonalMail(PersonalMail mail);
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.jmfy.dao.impl;
|
||||
|
||||
import com.jmfy.dao.MailDao;
|
||||
import com.jmfy.model.*;
|
||||
import com.jmfy.redisProperties.RedisUserKey;
|
||||
import com.jmfy.utils.Connect;
|
||||
import com.jmfy.utils.MongoName;
|
||||
import com.jmfy.utils.RedisUtil;
|
||||
import com.mongodb.WriteResult;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.data.mongodb.core.query.Update;
|
||||
import org.springframework.data.redis.cache.RedisCacheKey;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
public class MailDaoImpl implements MailDao {
|
||||
@Resource
|
||||
private Connect connect;
|
||||
public static final String colon = ":";
|
||||
@Override
|
||||
public void sendSysMail(ServerMail mail) throws Exception {
|
||||
String mongoKey = "systemMailManager.systemMailMap."+mail.getVersion();
|
||||
String dbName = MongoName.getMongoDBName(mail.getServerId());
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
|
||||
Query query = new Query();
|
||||
SystemMail sysMail = new SystemMail();
|
||||
sysMail.setId(mail.getVersion());
|
||||
sysMail.setContent(mail.getMailContent());
|
||||
sysMail.setMongoKey(mongoKey);
|
||||
sysMail.setTitle(mail.getMailTitle());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(int i = 0 ; i <mail.getItemIds().size();i++){
|
||||
sb.append(mail.getItemIds().get(i)).append("#").append(mail.getItemNums().get(i));
|
||||
if(i!=mail.getItemIds().size()-1){
|
||||
sb.append("|");
|
||||
}
|
||||
}
|
||||
sysMail.setReward(sb.toString());
|
||||
|
||||
query.addCriteria(Criteria.where("_id").is(mail.getServerId())); //_id区分引号 "1"和1
|
||||
Update update = Update.update(mongoKey, sysMail);
|
||||
WriteResult upsert = mongoTemplate.upsert(query, update, "mailingSystem"); //有则更新,没有则新增
|
||||
System.out.println(upsert.getN());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPersonalMail(PersonalMail mail) {
|
||||
String[] uid = mail.getUserId().split("#");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(int i = 0 ; i <mail.getItemIds().size();i++){
|
||||
sb.append(mail.getItemIds().get(i)).append("#").append(mail.getItemNums().get(i));
|
||||
if(i!=mail.getItemIds().size()-1){
|
||||
sb.append("|");
|
||||
}
|
||||
}
|
||||
for(int i = 0 ;i<uid.length;i++){
|
||||
MailPersonalCache mailPersonalCache = new MailPersonalCache();
|
||||
mailPersonalCache.setTitle(mail.getMailTitle());
|
||||
mailPersonalCache.setContent(mail.getMailContent());
|
||||
mailPersonalCache.setReward(sb.toString());
|
||||
// mailPersonalCache.setTime(Integer.parseInt(mail.getSendTime()));
|
||||
RedisUtil.getInstence().putMapEntry(String.valueOf(mail.getServerId()),RedisUserKey.READY_TO_USER_MAIL+RedisUserKey.Delimiter_colon,uid[i],mailPersonalCache,240);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.jmfy.model;
|
||||
|
||||
|
||||
public class MailPersonalCache {
|
||||
private String title;
|
||||
private String content;
|
||||
private String from;
|
||||
private String reward;
|
||||
private int time;
|
||||
|
||||
public MailPersonalCache() {
|
||||
from = "sys";
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public void setFrom(String from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(int time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public void setReward(String reward) {
|
||||
this.reward = reward;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.jmfy.model;
|
||||
|
||||
public class PersonalMail extends ServerMail {
|
||||
public String userId;
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String uid) {
|
||||
this.userId = uid;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package com.jmfy.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ServerMail {
|
||||
|
||||
private int serverId;
|
||||
|
||||
private String mailTitle;
|
||||
|
||||
private String mailContent;
|
||||
|
||||
private int isAttach;
|
||||
|
||||
private List<Integer> itemIds;
|
||||
|
||||
private List<Integer> itemNums;
|
||||
|
||||
private String sendTime;
|
||||
|
||||
private int version;
|
||||
|
||||
// "mailTitle": mailTitle,
|
||||
// "mailContent": mailContent,
|
||||
// "isAttach": isAttach,
|
||||
// "itemIds[]": itemIds,
|
||||
// "itemNums[]": itemNums,
|
||||
// "itemTypes[]": itemTypes,
|
||||
// "sendTime": sendTime,
|
||||
// "playerRTime": playerRTime,
|
||||
// "effectTime": effectTime,
|
||||
// "version": version
|
||||
public int getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
|
||||
public void setServerId(int serverId) {
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
public String getMailTitle() {
|
||||
return mailTitle;
|
||||
}
|
||||
|
||||
public String getMailContent() {
|
||||
return mailContent;
|
||||
}
|
||||
|
||||
public int isAttach() {
|
||||
return isAttach;
|
||||
}
|
||||
|
||||
public void setMailTitle(String mailTitle) {
|
||||
this.mailTitle = mailTitle;
|
||||
}
|
||||
|
||||
public void setMailContent(String mailContent) {
|
||||
this.mailContent = mailContent;
|
||||
}
|
||||
|
||||
public void setAttach(int attach) {
|
||||
this.isAttach = attach;
|
||||
}
|
||||
|
||||
public int getIsAttach() {
|
||||
return isAttach;
|
||||
}
|
||||
|
||||
public String getSendTime() {
|
||||
return sendTime;
|
||||
}
|
||||
|
||||
public void setIsAttach(int isAttach) {
|
||||
this.isAttach = isAttach;
|
||||
}
|
||||
|
||||
public void setSendTime(String sendTime) {
|
||||
this.sendTime = sendTime;
|
||||
}
|
||||
|
||||
public List<Integer> getItemIds() {
|
||||
return itemIds;
|
||||
}
|
||||
|
||||
public void setItemIds(List<Integer> itemIds) {
|
||||
this.itemIds = itemIds;
|
||||
}
|
||||
|
||||
public List<Integer> getItemNums() {
|
||||
return itemNums;
|
||||
}
|
||||
|
||||
public void setItemNums(List<Integer> itemNums) {
|
||||
this.itemNums = itemNums;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
package com.jmfy.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SystemMail {
|
||||
private int _id ;
|
||||
private String title; //邮件标题
|
||||
|
||||
private List<Integer> userList; //邮件发送列表 若为空,则全服发送
|
||||
|
||||
private String content;
|
||||
|
||||
private int sendTime;
|
||||
|
||||
private String reward; //奖励
|
||||
|
||||
private int effectiveTime; // 秒
|
||||
|
||||
private String name ; // 发送者
|
||||
|
||||
/**
|
||||
* 用户注册截止时间 0 : 所有用户时间
|
||||
*/
|
||||
private long registerEndTime;
|
||||
|
||||
/**
|
||||
* 版本号以,分割,用于对指定版本前端发送邮件,为0则是全部版本
|
||||
*/
|
||||
private String version = "0";
|
||||
|
||||
private int rootId;
|
||||
|
||||
private String mongoKey;
|
||||
|
||||
public SystemMail(){
|
||||
this.name = "sys";
|
||||
this.version = "0";
|
||||
this.userList = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
public SystemMail(int id,String title,List<Integer> userList,String content,int sendTime, String reward,
|
||||
int effectiveTime,String name,long registerEndTime,String version){
|
||||
this._id = id;
|
||||
this.title = title;
|
||||
this.userList = userList;
|
||||
this.content = content;
|
||||
this.sendTime = sendTime;
|
||||
this.reward = reward;
|
||||
this.effectiveTime = effectiveTime;
|
||||
this.name = name;
|
||||
this.registerEndTime = registerEndTime;
|
||||
this.version = version;
|
||||
}
|
||||
public int getId() {
|
||||
return _id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public List<Integer> getUserList() {
|
||||
return userList;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public int getSendTime() {
|
||||
return sendTime;
|
||||
}
|
||||
|
||||
public String getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public int getEffectiveTime() {
|
||||
return effectiveTime;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public long getRegisterEndTime() {
|
||||
return registerEndTime;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public int get_id() {
|
||||
return _id;
|
||||
}
|
||||
|
||||
public int getRootId() {
|
||||
return rootId;
|
||||
}
|
||||
|
||||
public String getMongoKey() {
|
||||
return mongoKey;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this._id = id;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void setUserList(List<Integer> userList) {
|
||||
this.userList = userList;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public void setSendTime(int sendTime) {
|
||||
this.sendTime = sendTime;
|
||||
}
|
||||
|
||||
public void setReward(String reward) {
|
||||
this.reward = reward;
|
||||
}
|
||||
|
||||
public void setEffectiveTime(int effectiveTime) {
|
||||
this.effectiveTime = effectiveTime;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setRegisterEndTime(long registerEndTime) {
|
||||
this.registerEndTime = registerEndTime;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public void setRootId(int rootId) {
|
||||
this.rootId = rootId;
|
||||
}
|
||||
|
||||
public void setMongoKey(String mongoKey) {
|
||||
this.mongoKey = mongoKey;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,8 @@ public class RedisUserKey {
|
|||
public final static String SERVER_OPEN_TIME_KEY = "Server_Open_Time_Key";
|
||||
//问卷调查
|
||||
public static final String QUESTION_FROMBACK = "QUESTION_FROMBACK";
|
||||
public static final String READY_TO_USER_MAIL = "READY_TO_USER_MAIL";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,14 @@ import com.mongodb.client.MongoIterable;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.mongodb.MongoDbFactory;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
|
||||
import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;
|
||||
import org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper;
|
||||
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
|
||||
import org.springframework.data.mongodb.core.convert.MongoConverter;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
@ -28,7 +35,8 @@ public class Connect {
|
|||
MongoIterable<String> databaseNames = mongoClient.listDatabaseNames();
|
||||
for (String dbName : databaseNames) {
|
||||
LOGGER.info("gameMongodb-->dbName={}", dbName);
|
||||
MongoTemplate mongoTemplate = new MongoTemplate(mongoClient, dbName);
|
||||
MongoDbFactory mongoDbFactory = (new SimpleMongoDbFactory(mongoClient, dbName));
|
||||
MongoTemplate mongoTemplate = new MongoTemplate(mongoDbFactory, mappingMongoConverter(mongoDbFactory));
|
||||
oldMongomaps.put(dbName, mongoTemplate);
|
||||
}
|
||||
}
|
||||
|
@ -40,5 +48,11 @@ public class Connect {
|
|||
MongoTemplate mongoTemplate = oldMongomaps.get(dbName);
|
||||
return mongoTemplate;
|
||||
}
|
||||
public MappingMongoConverter mappingMongoConverter( MongoDbFactory mongoDbFactory) {
|
||||
DefaultDbRefResolver dbRefResolver = new DefaultDbRefResolver(mongoDbFactory);
|
||||
MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, new MongoMappingContext());
|
||||
converter.setTypeMapper(new DefaultMongoTypeMapper(null));
|
||||
return converter;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,289 @@
|
|||
<!--_meta 作为公共模版分离出去-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<link rel="Bookmark" href="../favicon.ico" />
|
||||
<link rel="Shortcut Icon" href="../favicon.ico" />
|
||||
<!--[if lt IE 9]>
|
||||
<script type="text/javascript" src="../lib/html5shiv.js"></script>
|
||||
<script type="text/javascript" src="../lib/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" type="text/css" href="../h-ui/css/H-ui.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../h-ui.admin/css/H-ui.admin.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../h-ui.admin/skin/default/skin.css" id="skin" />
|
||||
<link rel="stylesheet" type="text/css" href="../h-ui.admin/css/style.css" />
|
||||
<!--[if IE 6]>
|
||||
<script type="text/javascript" src="../lib/DD_belatedPNG_0.0.8a-min.js" ></script>
|
||||
<script>DD_belatedPNG.fix('*');</script>
|
||||
<![endif]-->
|
||||
<!--/meta 作为公共模版分离出去-->
|
||||
|
||||
<title>基本设置</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="breadcrumb"><i class="Hui-iconfont"></i> 首页
|
||||
<span class="c-gray en">></span>
|
||||
GM管理
|
||||
<span class="c-gray en">></span>
|
||||
单人、多人邮件
|
||||
<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont"></i></a>
|
||||
</nav>
|
||||
<div class="page-container">
|
||||
<form class="form form-horizontal" id="form-article-add" action="http://60.1.1.212:9076/idip/manager" method="post">
|
||||
<div id="tab-system" class="HuiTab">
|
||||
<div class="tabBar cl">
|
||||
<span>单人、多人邮件</span>
|
||||
</div>
|
||||
<div class="tabCon">
|
||||
<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">
|
||||
<input type="text" name="serverId" placeholder="指定多个服务器: 服务器id,服务器id...,全服邮件服务器id为0" value="" class="input-text"/>
|
||||
<span class="SERVERID"></span>
|
||||
</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">
|
||||
<input type="text" name="userId" value="" class="input-text"/>
|
||||
<span class="SERVERID"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
邮件标题:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" name="mailTitle" placeholder="" value="" class="input-text"/>
|
||||
<span class="MAILTITLE"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
邮件正文:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<textarea class="textarea" name="mailContent"></textarea>
|
||||
<span class="MAILCONTENT"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
是否带附件:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<select name="isAttach" class="input-text" id="isAttach">
|
||||
<option value="1" selected = "selected" >有</option>
|
||||
<option value="0" >无</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="row cl">-->
|
||||
<!--<label class="form-label col-xs-4 col-sm-2">附件:</label>-->
|
||||
<!--<div class="formControls col-xs-8 col-sm-9">-->
|
||||
<!--<input type="text" name="attach" placeholder="itemId#num#type|itemId#num#type" value="" class="input-text"/>-->
|
||||
<!--<span class="ATTACH"></span>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
附件:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<div id="InputsWrapper">
|
||||
<div>
|
||||
物品id:<input type="text" name="itemId" id="itemId_1" style="width: 150px" />
|
||||
物品数量:<input type="text" name="itemNum" id="itemNum_1" style="width: 150px" />
|
||||
物品类型:<input type="text" name="itemType" id="itemType_1" style="width: 150px"/>
|
||||
<a href="#" class="removeclass"></a>
|
||||
<a href="#" id="AddMoreFileBox" class="btn btn-info">+</a>
|
||||
<span class="REWARD"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
奖励发放时间:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'SendTime\')}' })" id="SendTime" class="input-text Wdate" style="width:180px;" name="sendTime">
|
||||
<span class="SENDTIME"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">有效时间:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" name="effectTime" placeholder="0:永久, 其他 (秒)" value="" class="input-text"/>
|
||||
<span class="EFFECTTIME"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">版本号:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" name="version" placeholder="0:所有版本号, 其他客户端版本号" value="" class="input-text"/>
|
||||
<span class="VERSION"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
|
||||
<button onClick="return sendSysMail();" class="btn btn-primary radius" type="button" ><i class="Hui-iconfont"></i> 发送邮件</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<!--_footer 作为公共模版分离出去-->
|
||||
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
|
||||
<script type="text/javascript" src="../h-ui/js/H-ui.min.js"></script>
|
||||
<script type="text/javascript" src="../h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
|
||||
|
||||
<!--请在下方写此页面业务相关的脚本-->
|
||||
<script type="text/javascript" src="../lib/My97DatePicker/4.8/WdatePicker.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/validate-methods.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/messages_zh.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('.skin-minimal input').iCheck({
|
||||
checkboxClass: 'icheckbox-blue',
|
||||
radioClass: 'iradio-blue',
|
||||
increaseArea: '20%'
|
||||
});
|
||||
$("#tab-system").Huitab({
|
||||
index:0
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
var MaxInputs = 20;
|
||||
var InputsWrapper = $("#InputsWrapper");
|
||||
var AddButton = $("#AddMoreFileBox");
|
||||
|
||||
var x = InputsWrapper.length;
|
||||
var FieldCount=1;
|
||||
|
||||
$(AddButton).click(function (e)
|
||||
{
|
||||
if(x <= MaxInputs)
|
||||
{
|
||||
FieldCount++;
|
||||
$(InputsWrapper).append('<div>' +
|
||||
'物品id:<input type="text" name="itemId" id="itemId_'+ FieldCount +'" style="width: 150px" /> ' +
|
||||
'物品数量:<input type="text" name="itemNum" id="itemNum_'+FieldCount+'" style="width: 150px" /> 物品类型:<input type="text" name="itemType" id="itemType_'+FieldCount+'" style="width: 150px" /><a href="#" class="removeclass">×</a></div>');
|
||||
x++;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$("body").on("click",".removeclass", function(e){ //user click on remove text
|
||||
if( x > 1 ) {
|
||||
$(this).parent('div').remove(); //remove text box
|
||||
x--; //decrement textbox
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
||||
});
|
||||
function sendSysMail() {
|
||||
var erroCode = $('.SERVERID');
|
||||
var serverId = $("input[name='serverId']").val();
|
||||
var mailTitle = $("input[name='mailTitle']").val();
|
||||
var mailContent = $("textarea[name='mailContent']").val();
|
||||
var attach = $("input[name='attach']").val();
|
||||
var isAttach = document.getElementById("isAttach").value;
|
||||
var userId = $("input[name='userId']").val();
|
||||
var sendTime = $("input[name='sendTime']").val();
|
||||
var playerRTime = $("input[name='playerRTime']").val();
|
||||
var effectTime = $("input[name='effectTime']").val();
|
||||
var version = $("input[name='version']").val();
|
||||
var itemIds = [];
|
||||
$("input[name='itemId']").each(function () {
|
||||
itemIds.push($(this).val());
|
||||
});
|
||||
var itemNums =[];
|
||||
$("input[name='itemNum']").each(function(){
|
||||
itemNums.push($(this).val());
|
||||
});
|
||||
var itemTypes =[];
|
||||
$("input[name='itemType']").each(function(){
|
||||
itemTypes.push($(this).val());
|
||||
});
|
||||
if (serverId === '' || serverId == null) {
|
||||
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
|
||||
return false;
|
||||
}
|
||||
if (mailTitle === '' || mailTitle == null) {
|
||||
erroCode = $('.MAILTITLE');
|
||||
erroCode.html('<span style="color: red; ">邮件标题不能为空!</span>');
|
||||
return false;
|
||||
}
|
||||
if (mailContent === '' || mailContent == null) {
|
||||
erroCode = $('.MAILCONTENT');
|
||||
erroCode.html('<span style="color: red; ">邮件内容不能为空!</span>');
|
||||
return false;
|
||||
}
|
||||
if(isAttach ===1){
|
||||
if (attach === '' || attach == null) {
|
||||
erroCode = $('.ATTACH');
|
||||
erroCode.html('<span style="color: red; ">附件不能为空!</span>');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (version === '' || version == null) {
|
||||
erroCode = $('.VERSION');
|
||||
erroCode.html('<span style="color: red; ">版本号不能为空!</span>');
|
||||
return false;
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data:
|
||||
JSON.stringify({
|
||||
"serverId": serverId,
|
||||
"mailTitle": mailTitle,
|
||||
"mailContent": mailContent,
|
||||
"isAttach": isAttach,
|
||||
"userId":userId,
|
||||
"itemIds": itemIds,
|
||||
"itemNums": itemNums,
|
||||
// "itemTypes[]": itemTypes,
|
||||
"sendTime": sendTime,
|
||||
// "playerRTime": playerRTime,
|
||||
// "effectTime": effectTime,
|
||||
"version": version
|
||||
}),
|
||||
dataType: "json",
|
||||
contentType:'application/json',
|
||||
|
||||
url: "/sendPersonalMail",
|
||||
success: function (data) {
|
||||
if (data == 0) {
|
||||
layer.msg('发送邮件成功!', {icon: 6, time: 1000});
|
||||
}
|
||||
if (data == 1) {
|
||||
layer.msg('发送邮件失败!', {icon: 6, time: 1000});
|
||||
}
|
||||
if (data === 2) {
|
||||
layer.msg('发送邮件失败 道具不能为空!', {icon: 6, time: 1000});
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
</script>
|
||||
<!--/请在上方写此页面业务相关的脚本-->
|
||||
</body>
|
||||
</html>
|
|
@ -249,21 +249,26 @@ function sendSysMail() {
|
|||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
data:
|
||||
JSON.stringify({
|
||||
"serverId": serverId,
|
||||
"mailTitle": mailTitle,
|
||||
"mailContent": mailContent,
|
||||
"isAttach": isAttach,
|
||||
"itemIds[]": itemIds,
|
||||
"itemNums[]": itemNums,
|
||||
"itemTypes[]": itemTypes,
|
||||
"itemIds": itemIds,
|
||||
"itemNums": itemNums,
|
||||
// "itemTypes[]": itemTypes,
|
||||
"sendTime": sendTime,
|
||||
"playerRTime": playerRTime,
|
||||
"effectTime": effectTime,
|
||||
// "playerRTime": playerRTime,
|
||||
// "effectTime": effectTime,
|
||||
"version": version
|
||||
},
|
||||
})
|
||||
,
|
||||
url: "/sendSysMail",
|
||||
success: function (data) {
|
||||
dataType: "json",
|
||||
contentType:'application/json',
|
||||
|
||||
success: function (data) {
|
||||
if (data == 0) {
|
||||
layer.msg('发送全服邮件成功!', {icon: 6, time: 1000});
|
||||
}
|
||||
|
|
|
@ -78,20 +78,20 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!--<div th: th:switch="${powersVo.GMinfo}">-->
|
||||
<!--<div th:case="0">-->
|
||||
<!--<dl id="menu-GM">-->
|
||||
<!--<dt><i class="Hui-iconfont"></i> GM管理<i class="Hui-iconfont menu_dropdown-arrow"></i></dt>-->
|
||||
<!--<dd>-->
|
||||
<!--<ul>-->
|
||||
<!--<li><a data-href="/html/sendMail.html" data-title="单人,多人邮件" href="javascript:;">单人,多人邮件</a></li>-->
|
||||
<!--<li><a data-href="/html/sendSysMail.html" data-title="全服邮件" href="javascript:;">全服邮件</a></li>-->
|
||||
<div th: th:switch="${powersVo.GMinfo}">
|
||||
<div th:case="0">
|
||||
<dl id="menu-GM">
|
||||
<dt><i class="Hui-iconfont"></i> GM管理<i class="Hui-iconfont menu_dropdown-arrow"></i></dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li><a data-href="/html/sendPersonalMail.html" data-title="单人,多人邮件" href="javascript:;">单人,多人邮件</a></li>
|
||||
<li><a data-href="/html/sendSysMail.html" data-title="全服邮件" href="javascript:;">全服邮件</a></li>
|
||||
<!--<li><a data-href="/html/recoverItem.html" data-title="回收道具" href="javascript:;">回收道具</a></li>-->
|
||||
<!--</ul>-->
|
||||
<!--</dd>-->
|
||||
<!--</dl>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<div th: th:switch="${powersVo.TitleGame}">
|
||||
<div th:case="0">
|
||||
<dl id="menu-Title">
|
||||
|
|
Loading…
Reference in New Issue