Commit c1649e5a by 兰国旗

laolan

parent 313b83f6
......@@ -16,5 +16,9 @@ class PictureWarehouseCtl extends CtlBase {
const up = await this.service.update(pobj);
return up;
}
async delete(pobj, qobj, req) {
const up = await this.service.delete(pobj);
return up;
}
}
module.exports = PictureWarehouseCtl;
......@@ -20,8 +20,8 @@ class RotationChartCtl extends CtlBase {
return up;
}
async updates(pobj, qobj, req) {
const up = await this.service.updates(pobj);
async delete(pobj, qobj, req) {
const up = await this.service.delete(pobj);
return up;
}
}
......
......@@ -4,6 +4,7 @@ const settings = require("../../../../config/settings");
class CycleproductService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(CycleproductService));
this.redisdel = system.getObject("service.aggregation.redisdelSve");
}
async update(pobj) {
......@@ -16,6 +17,12 @@ class CycleproductService extends ServiceBase {
if (pobj.pic_describe && pobj.pic_describe.length > 19) {
return system.getResultFail(-105, "图片描述最多20位字符");
}
try {
var functionName = "cycleProduct";
await this.redisdel.redisInfo(functionName);
} catch (error) {
console.log(error)
}
return system.getResultSuccess(this.dao.update(pobj));
}
}
......
......@@ -4,20 +4,9 @@ const settings = require("../../../../config/settings");
class PicturewarehouseService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(PicturewarehouseService));
this.redisdel = system.getObject("service.aggregation.redisdelSve");
}
async getImgList(pobj) {
let res = await this.dao.findAndCountAll(pobj);
return system.getResultSuccess(res);
}
async createImginfo(pobj) {
let code = await this.getBusUid("img");
pobj.imginfo.code = code;
if (pobj.imginfo.company_id === undefined) {
pobj.imginfo.company_id = 10;
}
let res = await this.dao.create(pobj.imginfo);
return system.getResultSuccess(res);
}
async create(pobj) {
let code = await this.getBusUid("img");
pobj.code = code;
......@@ -29,24 +18,26 @@ class PicturewarehouseService extends ServiceBase {
async update(pobj) {
let whereParams = {
id: pobj.id
}
let res = await this.dao.findOne(whereParams,[]);
if(!pobj.id){
return system.getResultFail(-124, "未知图片信息");
}
if(!pobj.pic_url){
pobj.pic_url = res.pic_url;
}
if(!pobj.pic_size){
pobj.pic_size = res.pic_size;
if (!pobj.pic_url) {
return system.getResultFail(-123, "图片不能为空");
}
if(!pobj.name){
pobj.name = res.name;
try {
var functionName = "productDetail";
await this.redisdel.redisInfo(functionName);
} catch (error) {
console.log(error)
}
return system.getResultSuccess(this.dao.update(pobj));
}
async delete(pobj) {
try {
var functionName = "productDetail";
await this.redisdel.redisInfo(functionName);
} catch (error) {
console.log(error)
}
return system.getResultSuccess(this.dao.delete(pobj));
}
}
module.exports = PicturewarehouseService;
\ No newline at end of file
......@@ -4,6 +4,7 @@ const settings = require("../../../../config/settings");
class PopularrecommendationService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(PopularrecommendationService));
this.redisdel = system.getObject("service.aggregation.redisdelSve");
}
async update(pobj) {
......@@ -17,6 +18,9 @@ class PopularrecommendationService extends ServiceBase {
if (pobj.pic_describe && pobj.pic_describe.length > 19) {
return system.getResultFail(-105, "图片描述最多20位字符");
}
var functionName = "popularRecommendationList";
await this.redisdel.redisInfo(functionName);
return system.getResultSuccess(this.dao.update(pobj));
}
}
......
const ServiceBase = require("../../sve.base");
const system = require("../../../system");
class RedisdelService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(RedisdelService));
this.redisClient = system.getObject("util.redisClient");
}
async redisInfo(functionName) {
var template = "mediaaggregation";
let shaStr;
let rtn;
shaStr = template + "_" + functionName;
rtn = await this.redisClient.get(shaStr);
if (rtn) {
var res = await this.redisClient.delete(shaStr);
return res;
}
}
}
module.exports = RedisdelService;
\ No newline at end of file
......@@ -5,6 +5,7 @@ const { json } = require("sequelize");
class RotationchartService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(RotationchartService));
this.redisdel = system.getObject("service.aggregation.redisdelSve");
}
async create(pobj) {
let code = await this.getBusUid("mmc");
......@@ -16,7 +17,7 @@ class RotationchartService extends ServiceBase {
if (!pobj.pic_url) {
return system.getResultFail(-101, "图片不能为空");
}
if (pobj.is_enabled==='' || pobj.is_enabled=== null || pobj.is_enabled=== undefined) {
if (pobj.is_enabled === '' || pobj.is_enabled === null || pobj.is_enabled === undefined) {
return system.getResultFail(-103, "是否显示不能为空");
}
if (!pobj.jump_link_type) {
......@@ -25,7 +26,7 @@ class RotationchartService extends ServiceBase {
if (pobj.name && pobj.name.length > 19) {
return system.getResultFail(-105, "图片名称最多20位字符");
}
if(pobj.id!==1){
if (pobj.id !== 1) {
if (!pobj.sequence) {
return system.getResultFail(-102, "排序不能为空");
}
......@@ -36,16 +37,39 @@ class RotationchartService extends ServiceBase {
async update(pobj) {
if (!pobj.pic_url) {
pobj.pic_url = res.pic_url;
return system.getResultFail(-101, "图片不能为空");
}
if (pobj.is_enabled === '' || pobj.is_enabled === null || pobj.is_enabled === undefined) {
return system.getResultFail(-103, "是否显示不能为空");
}
if (!pobj.jump_link_type) {
return system.getResultFail(-104, "连接不能为空");
}
if (pobj.name && pobj.name.length > 19) {
return system.getResultFail(-105, "图片名称最多20位字符");
}
if (pobj.id !== 1) {
if (!pobj.sequence) {
return system.getResultFail(-102, "排序不能为空");
}
}
if (!pobj.name) {
pobj.name = res.name;
try {
var functionName = "rotationChartList";
await this.redisdel.redisInfo(functionName);
} catch (error) {
console.log(error)
}
return system.getResultSuccess(this.dao.update(pobj));
}
async updates(pobj) {
return system.getResultSuccess(this.dao.update(pobj));
async delete(pobj) {
try {
var functionName = "rotationChartList";
await this.redisdel.redisInfo(functionName);
} catch (error) {
console.log(error)
}
return system.getResultSuccess(this.dao.delete(pobj));
}
}
module.exports = RotationchartService;
\ No newline at end of file
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