Skip to content

Commit

Permalink
fix aplayer bugs, now work well
Browse files Browse the repository at this point in the history
  • Loading branch information
windawings committed Feb 22, 2017
1 parent 1bd3a27 commit 8776653
Show file tree
Hide file tree
Showing 45 changed files with 1,219 additions and 1,188 deletions.
4 changes: 2 additions & 2 deletions powerdesigner/Workspace.sws
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

<Workspace>
<Local Expanded="Yes">
<Model Expanded="Yes" ID="{9A354C60-C0A4-40DF-8F31-FB4192173965}" Name="MusicBeat" Selected="Yes" Type="{1E597170-9350-11D1-AB3C-0020AF71E433}" URL="MusicBeat.cdm"/>
<Model Expanded="Yes" ID="{1AFE7E8A-6E76-4189-B2A9-6600AC035F40}" Name="MusicBeat" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" URL="MusicBeat.pdm"/>
<Model Expanded="Yes" ID="{9A354C60-C0A4-40DF-8F31-FB4192173965}" Loaded="No" Name="MusicBeat" Type="{1E597170-9350-11D1-AB3C-0020AF71E433}" URL="MusicBeat.cdm"/>
<Model Expanded="Yes" ID="{1AFE7E8A-6E76-4189-B2A9-6600AC035F40}" Name="MusicBeat" Selected="Yes" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" URL="MusicBeat.pdm"/>
</Local>
<BrowserModule Name="Repository"/>
</Workspace>
14 changes: 8 additions & 6 deletions src/main/java/com/musicbeat/web/controller/AuthController.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ public class AuthController extends BaseController {
@Resource
private UserService userService;

@Resource
private RedisService redisService;

/**
* 用户登录Controller
*
Expand Down Expand Up @@ -195,12 +192,17 @@ public class AuthController extends BaseController {
user.setUsername(username);
user.setEmail(email);
user.setPrivilege("user");
user.setPicture("images/user.png");

List<User> emails = userService.findByEmail(email, false);
List<User> users = new ArrayList<>();
List<User> users;

if (username != null && !username.isEmpty()) {
users = userService.findByUserName(username, false);
} else {
// 默认用户名
user.setUsername(user.getEmail().split("@")[0]);
users = userService.findByUserName(username, false);
}

logObj.put(LOG_EMAIL, email);
Expand All @@ -213,7 +215,7 @@ public class AuthController extends BaseController {
logger.info(logObj.toJSONString() + ", Register Error - Duplicate Email");
response.setStatus(SC_CONFLICT);

} else if (!users.isEmpty()) {
} else if (users == null || !users.isEmpty()) {

model.put(RESPONSE_STATUS, RESPONSE_FAIL);
model.put(RESPONSE_MESSAGE, RESPONSE_ERROR_REGISTER_DUPLICATE_USERNAME);
Expand Down Expand Up @@ -316,7 +318,7 @@ public ModelAndView retrieve(@RequestParam("u") String email, @RequestParam("c")
model.put(RESPONSE_MESSAGE, RESPONSE_ERROR_RETRIEVE);

response.setStatus(SC_NOT_FOUND);
mav.setViewName("404api");
mav.setStatus(HttpStatus.NOT_FOUND);

logger.error(logObj.toJSONString() + ", Get Retrieve Page Error");
logger.error(e, e.fillInStackTrace());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ public boolean register(User user) {
String hashPassword = EncryptUtil.SHA256(random);
user.setPassword(hashPassword);

// 默认用户名
if (user.getUsername().isEmpty()) {
user.setUsername(user.getEmail().split("@")[0]);
}

if (this.add(user)) {
if (emailService.sendActiveEmail(user, random)) {
return true;
Expand Down Expand Up @@ -218,6 +213,9 @@ public boolean retrieveVerify(User user, String code) {

@Override
public boolean add(User user) {
if (user.getPassword() != null && user.getPassword().length() != EncryptUtil.SHA256LENGTH) {
user.setPassword(EncryptUtil.SHA256(user.getPassword()));
}
return userMapper.insertSelective(user) == 1;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config/spring/mvc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<mvc:interceptors>
<!-- 用户登录拦截 -->
<mvc:interceptor>
<mvc:mapping path="/api/changePassword"/>
<mvc:mapping path="/api/interceptor"/>
<!--<mvc:exclude-mapping path="/admin/login.do"/>-->
<bean class="com.musicbeat.web.interceptor.UserInterceptor"/>
</mvc:interceptor>
Expand Down
4 changes: 4 additions & 0 deletions src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@
<welcome-file>/WEB-INF/resources/tpls/index.html</welcome-file>
</welcome-file-list>

<error-page>
<error-code>400</error-code>
<location>/WEB-INF/resources/tpls/404.html</location>
</error-page>
<error-page>
<error-code>403</error-code>
<location>/WEB-INF/resources/tpls/404.html</location>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,19 @@ public void testFindByEmail() throws Exception {
*/
@Test
public void testFindAdminByPage() throws Exception {
PageHelper.startPage(1,1);
PageHelper.startPage(1,2);
List<User> result = userService.findAdmin();
result = beatifyPassword(result);
logger.info(JSON.toJSONString(result));

PageHelper.startPage(2,2);
result = userService.findAdmin();
result = beatifyPassword(result);
logger.info(JSON.toJSONString(result));

PageHelper.startPage(3,2);
result = userService.findAdmin();
result = beatifyPassword(result);
logger.info(JSON.toJSONString(result));
}
}
2 changes: 1 addition & 1 deletion websrc/app/lib/css/404.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions websrc/app/lib/js/APlayer.min.js

Large diffs are not rendered by default.

47 changes: 39 additions & 8 deletions websrc/app/modules/admin/admin.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,44 @@ angular
.controller("adminController", ["$scope", adminController]);

function adminController($scope) {
/*========== Accordion ==========*/
jQuery(".panel-heading a").on("click", function() {
if (jQuery(this).parents(".panel-heading").hasClass("active")) {
jQuery(".panel-heading").removeClass("active");
} else {
jQuery(".panel-heading").removeClass("active");
jQuery(this).parents(".panel-heading").addClass("active");
}



/*========== jQuery ==========*/
//获取class为caname的元素
jQuery(".caname").click(function() {
var td = jQuery(this);
var txt = td.text();
var input = jQuery("<input type='text' value='" + txt + "'/>");
td.html(input);
input.click(function() { return false; });

//获取焦点
input.trigger("focus");
//文本框失去焦点后提交内容,重新变为文本
input.blur(function() {
var newtxt = jQuery(this).val();
//判断文本有没有修改
if (newtxt != txt) {
td.html(newtxt);
/**不需要使用数据库的这段可以不需要**/
var caid = jQuery.trim(td.prev().text());
//ajax异步更改数据库,加参数date是解决缓存问题
var url = "../common/Handler2.ashx?caname=" + newtxt + "&caid=" + caid + "&date=" + new Date();
//使用get()方法打开一个一般处理程序,data接受返回的参数(在一般处理程序中返回参数的方法 context.Response.Write("要返回的参数");)
//数据库的修改就在一般处理程序中完成
jQuery.get(url, function(data) {
if(data=="1") {
alert("该类别已存在!");
td.html(txt);
return;
}
alert(data);
td.html(newtxt);
});
} else {
td.html(newtxt);
}
});
});
}
27 changes: 15 additions & 12 deletions websrc/app/modules/admin/admin.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
<!DOCTYPE html>
<html lang="en" ng-app="musicbeat">
<html lang="en">
<head>
<meta charset="UTF-8">
<title>管理员</title>
<link href="css/vendor.css" rel="stylesheet">
<link href="css/app.css" rel="stylesheet">

</head>
<body style="background-color:lightcyan">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>管理员系统</title>

<div ng-include="'tpls/adminHeader.html'"></div>
<link rel="icon" type="image/png" href="images/favicon.png">

<div ng-view="content"></div>
<link href="css/vendor.css" rel="stylesheet">
<link href="css/app.css" rel="stylesheet">

<div ng-include="'tpls/footer.html'"></div>
</head>
<body>
<div ng-include="'tpls/adminHeader.html'"></div>
<div ui-view="viewAdminHome"
style="background-image: url('images/background16.jpg');background-repeat:no-repeat;"></div>

<script src="js/vendor.js"></script>
<script src="js/app.js"></script>
<script src="js/vendor.js"></script>
<script src="js/app.js"></script>

</body>
</html>
66 changes: 66 additions & 0 deletions websrc/app/modules/admin/adminData.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!-- 数据 -->
<div class="tab-pane" id="panel-data">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="row">
<div class="col-md-12">
<h2>数据处理中心</h2>
</div>
<!--下载量-->
<div class="col-md-12">
<div class="panel panel-default" style="background-color: transparent">
<div class="panel-heading font-bold">下载量</div>
<div class="panel-body">
<div ui-jq="plot" ui-options="
[
{ data: {{d0_1}}, label: 'Unique Visits', points: { show: true } },
{ data: {{d0_2}}, label: 'Page Views', bars: { show: true, barWidth: 0.6, fillColor: { colors: [{ opacity: 0.2 }, { opacity: 0.4}] } } }
],
{
colors: [ '{{app.color.info}}','{{app.color.success}}' ],
series: { shadowSize: 2 },
xaxis:{ font: { color: '#ccc' } },
yaxis:{ font: { color: '#ccc' } },
grid: { hoverable: true, clickable: true, borderWidth: 0, color: '#ccc' },
tooltip: true,
tooltipOpts: { content: '%s of %x.1 is %y.4', defaultTheme: false, shifts: { x: 0, y: 20 } }
}
" style="height:120px">
</div>
</div>
</div>
</div>
<!--点击量-->
<div class="col-md-12">
<div class="panel panel-default" style="background-color: transparent">
<div class="panel-heading font-bold">点击量</div>
<div class="panel-body">
<div ui-jq="plot" ui-options="
[
{ data: {{d0_1}}, label: 'Unique Visits', points: { show: true } },
{ data: {{d0_2}}, label: 'Page Views', bars: { show: true, barWidth: 0.6, fillColor: { colors: [{ opacity: 0.2 }, { opacity: 0.4}] } } }
],
{
colors: [ '{{app.color.info}}','{{app.color.success}}' ],
series: { shadowSize: 2 },
xaxis:{ font: { color: '#ccc' } },
yaxis:{ font: { color: '#ccc' } },
grid: { hoverable: true, clickable: true, borderWidth: 0, color: '#ccc' },
tooltip: true,
tooltipOpts: { content: '%s of %x.1 is %y.4', defaultTheme: false, shifts: { x: 0, y: 20 } }
}
" style="height:120px">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-2"></div>
</div>
</div>
</div>
</div>
69 changes: 25 additions & 44 deletions websrc/app/modules/admin/adminHeader.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,25 @@
<header class="header clearfix">
<div class="left">
<div class="logo">
<a ng-href="#">
<img src="images/logo4.gif" class="img-responsive">
</a>
</div>
<!-- end .logo -->
<form class="header-search">
<input type="text" placeholder="Searching">
<button type="submit"><i class="pe-7s-search"></i></button>
</form>
</div> <!-- end .left -->

<div class="right" ng-controller="authWrapperController">
<div ng-hide="session.isAuthed">
<a href="" class="button login-open">Log In</a>
</div>
<div ng-if="session.roleName === 'user'">
<img class="userImg" ng-src="{{session.currentUser.picture}}">
<span class="button" ng-bind-html="session.currentUser.username"></span>
<a href="" class="button login-out" ng-click="logout();">LogOut</a>
</div>
<div ng-if="session.roleName === 'admin'">
<img class="userImg" ng-src="{{session.currentUser.picture}}">
<div class="navigation clearfix">
<nav class="main-nav">
<ul class="music-unstyled">
<!--用户信息-->
<li class="menu-item-has-children">
<a href="" ui-sref="user" class="button"
ng-bind-html="session.currentUser.username"></a>
<ul>
<li><a ui-sref="user">User Info</a></li>
<li><a href="" class="button login-out" ng-click="logout();">LogOut</a></li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</div> <!-- end .left -->

</header>
<header class="header fixed clearfix">
<!--header-->
<div class="navigation clearfix" style="background-color:#070022">
<nav class="main-nav">
<ul class="music-unstyled" style="font-size: 290px">
<!-- 歌手 -->
<li class="menu-item-has-children">
<a class="active" ui-sref="admin.singer" data-toggle="tab" style="line-height: 2em;font-size: 20px">歌手管理</a>
</li>
<!-- 歌曲 -->
<li class="menu-item-has-children">
<a ui-sref="admin.song" data-toggle="tab" style="line-height: 2em;font-size: 20px">歌曲管理</a>
</li>
<!-- 数据统计 -->
<li class="menu-item-has-children">
<a ui-sref="admin.data" data-toggle="tab" style="line-height: 2em;font-size: 20px">数据概览</a>
</li>
<!-- 标签处理 -->
<li class="menu-item-has-children">
<a ui-sref="admin.label" data-toggle="tab" style="line-height: 2em;font-size: 20px">类别管理</a>
</li>
</ul>
</nav> <!-- end .main-nav -->
</div> <!-- end .navigation -->
</header> <!-- end .header -->
Loading

0 comments on commit 8776653

Please sign in to comment.