init pages service
This commit is contained in:
1 parent
d3539b6d62
commit
92655b6b7c
11 files changed
+1798
No files matched your search
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
*
|
||||
* @authors Tony.Deng (dengtongyu123@163.com)
|
||||
* @date 2017-11-07 17:54:22
|
||||
* @version $Id$
|
||||
*/
|
||||
const forwarding = require('./forwarding');
|
||||
const url = require('url');
|
||||
|
||||
module.exports = function(app) {
|
||||
|
||||
app.get('/data/songSearch', function(req, res) {
|
||||
let param = url.parse(req.url).query;
|
||||
let json = {};
|
||||
if(param) {
|
||||
forwarding.getSearchSongList(param,req,function(data){
|
||||
//console.log('------接口数据------',data);
|
||||
if(data.status == 1) {
|
||||
json.desc = '';
|
||||
json.result = true;
|
||||
json.data = data.data;
|
||||
res.send(json);
|
||||
}else{
|
||||
json.desc = '请求出错,错误代码:'+data.err_code;
|
||||
json.result = false;
|
||||
json.data = null;
|
||||
res.send(json);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
json.desc = '缺少参数';
|
||||
json.result = false;
|
||||
json.data = null;
|
||||
res.send(json);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/data/newSong', function(req, res) {
|
||||
let param = url.parse(req.url).query;
|
||||
let json = {};
|
||||
if(param) {
|
||||
forwarding.getNewSongList(param,req,function(data){
|
||||
//console.log('------接口数据------',data.data);
|
||||
if(data.data && data.data.length && data.data.length > 0) {
|
||||
json.desc = '';
|
||||
json.result = true;
|
||||
json.data = data.data;
|
||||
res.send(json);
|
||||
}else{
|
||||
json.desc = '请求出错,错误代码:'+data.err_code;
|
||||
json.result = false;
|
||||
json.data = null;
|
||||
res.send(json);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
json.desc = '缺少参数';
|
||||
json.result = false;
|
||||
json.data = null;
|
||||
res.send(json);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/data/songMsg', function(req, res) {
|
||||
let hash = req.query.hash;
|
||||
let json = {};
|
||||
if(hash) {
|
||||
forwarding.getSongMsg(hash,req,function(data){
|
||||
//console.log('------接口数据------',data);
|
||||
if(data.status == 1) {
|
||||
json.desc = '';
|
||||
json.result = true;
|
||||
json.data = data.data;
|
||||
res.send(json);
|
||||
}else{
|
||||
json.desc = '请求出错,错误代码:'+data.err_code;
|
||||
json.result = false;
|
||||
json.data = null;
|
||||
res.send(json);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
json.desc = '缺少参数';
|
||||
json.result = false;
|
||||
json.data = null;
|
||||
res.send(json);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user