Commit 2e9f11d9 by lixinming

no message

parent 086a79fd
......@@ -24,7 +24,7 @@ export async function banner() {
let articleInfo = await findOnce(TABLEENUM.文章管理, {id:articleTitle}, ["id", "title"]);
let articleTitleStr = articleInfo && articleInfo.id ? articleInfo.title : '';
result.bannerList.push({imgUrl, title:articleTitleStr, desc, articleUrl});
result.bannerList.push({imgUrl, title:articleTitleStr, desc, articleUrl, id:articleTitle});
}
return result;
}
......@@ -108,7 +108,7 @@ export async function xueHuiGaiKuangBanner() {
let articleInfo = await findOnce(TABLEENUM.文章管理, {id:articleTitle}, ["id", "title"]);
let articleTitleStr = articleInfo && articleInfo.id ? articleInfo.title : '';
result.bannerList.push({imgUrl, title:articleTitleStr, desc, articleUrl});
result.bannerList.push({imgUrl, title:articleTitleStr, desc, articleUrl, id:articleTitle});
}
return result;
}
......@@ -269,7 +269,7 @@ export async function pinPaiXiangMuBanner() {
let articleInfo = await findOnce(TABLEENUM.文章管理, {id:articleTitle}, ["id", "title"]);
let articleTitleStr = articleInfo && articleInfo.id ? articleInfo.title : '';
result.bannerList.push({imgUrl, title:articleTitleStr, desc, articleUrl});
result.bannerList.push({imgUrl, title:articleTitleStr, desc, articleUrl, id:articleTitle});
}
return result;
}
......@@ -297,7 +297,7 @@ export async function pinPaiXiangMu() {
});
/**芳华杯 */
locationParam = [ARTICLEPOSITION.品牌项目_hgh芳华杯];
let fangHuaBeiData = await findToSort(TABLEENUM.文章管理, {articleType:{"$in":locationParam}, display:STATE.}, {articleTime:-1} );
let fangHuaBeiData = await findToSortToPage(TABLEENUM.文章管理, {articleType:{"$in":locationParam}, display:STATE.},["id", "title", "imgUrl", "articleTime", "desc"], {articleTime:-1}, 1, 10 );
fangHuaBeiData.forEach(info => {
let {id, title, imgUrl, articleTime, desc} = info;
result.fangHuaBei.push({
......@@ -326,6 +326,26 @@ export async function pinPaiXiangMu() {
/**
* 芳华杯 更多
*/
export async function fangHuaBei({pageNumber}) {
let findParam = {articleType:{"$in":[ARTICLEPOSITION.品牌项目_hgh芳华杯]}, display:STATE.};
let dataBaseList = await findToSortToPage(TABLEENUM.文章管理, findParam, [], {articleTime:-1}, pageNumber);
let dataCount = await findCount(TABLEENUM.文章管理, findParam);
let dataList = [];
dataBaseList.forEach(info => {
let { id, title, desc, imgUrl, articleTime } = info;
dataList.push({
id, title, desc, imgUrl, articleTime:moment(articleTime).format("YYYY-MM-DD")
});
});
return {dataList, dataCount};
}
/**
* 学术研究列表
* @param param0
* @returns
......@@ -446,7 +466,7 @@ export async function dangJianZiYuan({first, secondary, three, pageNumber}) {
dataCount = await findCount(TABLEENUM.文章管理, findParam);
dataBaseList.forEach(item => {
let {title, desc, articleTime, imgUrl, id} = item;
dataList.push({id, title, desc, articleTime, imgUrl});
dataList.push({id, title, desc, articleTime:moment(articleTime).format("YYYY-MM-DD"), imgUrl});
});
} else {//学习园地
if (secondary == PARTYBUILDSUBTYPEENUM.文字资料) {
......
import moment = require("moment");
import { FILEDIRECTORY, OOSCODE } from "../config/enum";
import { changeEnumValue, eccEnumValue } from "../util/verificationEnum";
const Crypto = require('crypto');
const AssertsKey = 'sbPR0AdDPfjm7v2NSffk5apPm6UClV';
const OSSAccessKeyId = 'LTAI5tD7Finu3fxFMCi3415S';
export function getOss({userId, type, fileName}) {
let limitMstime = moment().add(5, 'minute').utc().format();
eccEnumValue("获取OSS授权", "类型", OOSCODE, type );
var policyText = {
"expiration": limitMstime, //设置该Policy的失效时间,超过这个失效时间之后,就没有办法通过这个policy上传文件了
"conditions": [
["content-length-range", 0, 524288000] // 设置上传文件的大小限制
]
};
let policyBase64 = Buffer.from(JSON.stringify(policyText)).toString('base64');
const FirName = FILEDIRECTORY[changeEnumValue(OOSCODE, type)];
let message = policyBase64;
let hmac = Crypto.createHmac('sha1', AssertsKey);
hmac.update(message);
let signature = hmac.digest('base64');
// let bytes = Crypto.HMAC(Crypto.SHA1, message, AssertsKey, { asBytes: true });
// var signature = Crypto.util.bytesToBase64(hmacDigest);
return {
OSSAccessKeyId:OSSAccessKeyId,
dirName:`${userId}/${FirName}/${new Date().valueOf()}`,
policyBase64,
host:'http://wenhuabu-files.oss-cn-beijing.aliyuncs.com',
signature
};
}
\ No newline at end of file
......@@ -13,8 +13,6 @@ import { updateOneData } from "../../../data/update";
import { changeArticleName, generateSystemId, successResult } from "../../../tools/system";
import { BizError } from "../../../util/bizError";
import { extractData } from "../../../util/piecemeal";
import { changeEnumValue } from "../../../util/verificationEnum";
import { wenZhangQueue } from "../../task";
/**
......@@ -68,8 +66,8 @@ export async function list(secureArgs:any) {
if (title) selectParam.title = title;
if (articleTime) {
selectParam["$and"] = [
{videoTime:{"$gt":articleTime}},
{videoTime:{"$lt":articleTime+(24*3600*1000)}}
{articleTime:{"$gt":articleTime}},
{articleTime:{"$lt":articleTime+(24*3600*1000)}}
];
}
......@@ -128,4 +126,6 @@ export async function getTitleList({type}) {
//todo
export async function statsWenZhangCount(type:number) {
}
\ No newline at end of file
}
......@@ -638,16 +638,19 @@ export enum OOSCODE {
学会概况,
学会领导,
学术研究,
文字资料,
文字资料 = 5,
机构管理logo,
机构动态,
机构下载专区,
banner,
文章管理,
文章管理 = 10,
视频管理,
视频管理封面,
线下付款转账截图,
会费发票
会费发票,
个人会员详情 = 15,
单位会员详情,
注册信息
}
......@@ -11,7 +11,7 @@ export async function findToPage(tableEnumValue:string, param:object, files:obje
}
export async function findToSortToPage(tableEnumValue:string, param:object, files:object, sortParam, pageNumber:number, pageSize?) {
pageSize = pageSize || 10;//默认每页10个
let data = await dataModels[tableEnumValue].find(param, files).sort(sortParam).skip((pageNumber - 1) *pageSize).limit(pageSize);
return data;
......
......@@ -26,6 +26,7 @@ export class httpServer {
// next();
// }
});
// httpServer.use(bodyParser.json({limit:'5mb'}));
// httpServer.use(bodyParser.urlencoded({limit:'5mb', extends:true}));
......
......@@ -6,6 +6,7 @@ import * as authorityBiz from "../../biz/member/authority";
import * as registerBiz from "../../biz/register";
import * as homePageBiz from "../../biz/member/homePage";
import * as rightsMgmtBiz from "../../biz/member/rightsMgmt";
import * as ossBiz from "../../biz/oss";
export const FirstName = '会员管理路由';
export const FirstRouter = '/manage/member';
......@@ -32,7 +33,7 @@ export const Config = {
},
{
apiName:"个人入会流程2",
notMiddleware:true,
notMiddleware:false,
subUrl:'/memberdb/memberregister2',
param:[
{
......@@ -92,7 +93,7 @@ export const Config = {
},
{
apiName:"单位入会流程2",
notMiddleware:true,
notMiddleware:false,
subUrl:'/memberdb/unitmemberregister2',
param:[
{
......@@ -141,7 +142,7 @@ export const Config = {
},
{
apiName:"单位入会流程3",
notMiddleware:true,
notMiddleware:false,
subUrl:'/memberdb/unitmemberregister3',
param:[
{
......@@ -810,6 +811,17 @@ export const Config = {
],
bindBiz:homePageBiz.getCertificate
}
],
"oss授权":[
{
apiName:"获取oss授权必要参数",
subUrl:'/oss/info',
param:[
{key:"type", type:"Number", desc:"文件上传类型"}
],
bindBiz:ossBiz.getOss
},
]
}
......@@ -112,6 +112,14 @@ export const Config = {
],
bindBiz:officialWebsiteBiz.xiangCunZhenXing
},
{
apiName:"芳华杯列表",
subUrl:"/fanghuabei",
param:[
{key:"pageNumber", type:"Number", desc:"单前页"}
],
bindBiz:officialWebsiteBiz.fangHuaBei
}
],
"党建工作":[
{
......
......@@ -218,6 +218,13 @@ export const Config = {
param:[],
defaultParam:enumConfig.XUEHUILINGDAOZHIWEI,
bindBiz:publicBiz.setEnumInterface
},
{
apiName:"上传文件类别",
subUrl:'/uptype',
param:[],
defaultParam:enumConfig.OOSCODE,
bindBiz:publicBiz.setEnumInterface
}
],
......
......@@ -30,7 +30,7 @@ export async function setRouter(httpServer){
// await initDoc(orderRouter.FirstName, orderRouter.Config, orderRouter.FirstRouter);//会费相关
// await initDoc(costRouter.FirstName, costRouter.Config, costRouter.FirstRouter);//支付
}
analysisRouter(httpServer, portalRouter.Config, portalRouter.FirstRouter, false);//网站编辑
analysisRouter(httpServer, portalRouter.Config, portalRouter.FirstRouter, true);//网站编辑
analysisRouter(httpServer, publicRouter.Config, publicRouter.FirstRouter, false);//公用组件
analysisRouter(httpServer, memberRouter.Config, memberRouter.FirstRouter, true);//用户路由
analysisRouter(httpServer, officalWebsiteRouter.Config, officalWebsiteRouter.FirstRouter, false);//官网路由
......
......@@ -59,6 +59,16 @@ export function eccFormParam(name:string, keyTypeConf:object, param:object) {
}
}
break;
case '[String]':
if ( !Array.isArray(param[key]) ) isError = true;
for (let i =0; i < param[key].length; i++) {
let item = param[key][i];
if ( typeof item != 'string' ) {
isError = true;
errorStr = `${key}应是string型数组其中下标${i}${typeof item}`;
}
}
break;
case '[Object]':
if ( !Array.isArray(param[key]) ) isError = true;
for (let i =0; i < param[key].length; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment