Commit fea6c177 by 兰国旗

聚合后台管理二期

parent 999083b8
var system = require("../../../system")
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
var cacheBaseComp = null;
class BottomMenuConfigCtl extends CtlBase {
constructor() {
super("aggregation", CtlBase.getServiceName(BottomMenuConfigCtl));
}
async create(pobj, qobj, req) {
pobj.company_id = req && req.xctx && req.xctx.companyid ?req.xctx.companyid : "";
const up = await this.service.create(pobj);
return up;
}
async update(pobj, qobj, req) {
const up = await this.service.update(pobj);
return up;
}
}
module.exports = BottomMenuConfigCtl;
var system = require("../../../system")
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
var cacheBaseComp = null;
class ClueMaintenanceCtl extends CtlBase {
constructor() {
super("aggregation", CtlBase.getServiceName(ClueMaintenanceCtl));
}
async create(pobj, qobj, req) {
pobj.company_id = req && req.xctx && req.xctx.companyid ?req.xctx.companyid : "";
const up = await this.service.create(pobj);
return up;
}
async update(pobj, qobj, req) {
const up = await this.service.update(pobj);
return up;
}
}
module.exports = ClueMaintenanceCtl;
var system = require("../../../system")
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
var cacheBaseComp = null;
class CycleProductCtl extends CtlBase {
constructor() {
super("aggregation", CtlBase.getServiceName(CycleProductCtl));
}
async create(pobj, qobj, req) {
pobj.company_id = req && req.xctx && req.xctx.companyid ?req.xctx.companyid : "";
const up = await this.service.create(pobj);
return up;
}
async update(pobj, qobj, req) {
const up = await this.service.update(pobj);
return up;
}
}
module.exports = CycleProductCtl;
var system = require("../../../system")
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
var cacheBaseComp = null;
class PictureWarehouseCtl extends CtlBase {
constructor() {
super("aggregation", CtlBase.getServiceName(PictureWarehouseCtl));
}
async create(pobj, qobj, req) {
pobj.company_id = req && req.xctx && req.xctx.companyid ?req.xctx.companyid : "";
const up = await this.service.create(pobj);
return up;
}
async update(pobj, qobj, req) {
const up = await this.service.update(pobj);
return up;
}
}
module.exports = PictureWarehouseCtl;
var system = require("../../../system")
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
var cacheBaseComp = null;
class PopularRecommendationCtl extends CtlBase {
constructor() {
super("aggregation", CtlBase.getServiceName(PopularRecommendationCtl));
}
async create(pobj, qobj, req) {
pobj.company_id = req && req.xctx && req.xctx.companyid ?req.xctx.companyid : "";
const up = await this.service.create(pobj);
return up;
}
async update(pobj, qobj, req) {
const up = await this.service.update(pobj);
return up;
}
}
module.exports = PopularRecommendationCtl;
var system = require("../../../system")
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
var cacheBaseComp = null;
class ProductCtl extends CtlBase {
constructor() {
super("aggregation", CtlBase.getServiceName(ProductCtl));
}
async create(pobj, qobj, req) {
pobj.company_id = req && req.xctx && req.xctx.companyid ?req.xctx.companyid : "";
const up = await this.service.create(pobj);
return up;
}
async update(pobj, qobj, req) {
const up = await this.service.update(pobj);
return up;
}
}
module.exports = ProductCtl;
var system = require("../../../system")
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
var cacheBaseComp = null;
class ProductTypeCtl extends CtlBase {
constructor() {
super("aggregation", CtlBase.getServiceName(ProductTypeCtl));
}
async create(pobj, qobj, req) {
pobj.company_id = req && req.xctx && req.xctx.companyid ?req.xctx.companyid : "";
const up = await this.service.create(pobj);
return up;
}
async update(pobj, qobj, req) {
const up = await this.service.update(pobj);
return up;
}
}
module.exports = ProductTypeCtl;
var system = require("../../../system")
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
var cacheBaseComp = null;
class RotationChartCtl extends CtlBase {
constructor() {
super("aggregation", CtlBase.getServiceName(RotationChartCtl));
}
async create(pobj, qobj, req) {
pobj.company_id = req && req.xctx && req.xctx.companyid ? req.xctx.companyid : "";
const up = await this.service.create(pobj);
return up;
}
async update(pobj, qobj, req) {
const up = await this.service.update(pobj);
return up;
}
}
module.exports = RotationChartCtl;
var system = require("../../../system")
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
var cacheBaseComp = null;
class SecondLevelNeedConfigCtl extends CtlBase {
constructor() {
super("aggregation", CtlBase.getServiceName(SecondLevelNeedConfigCtl));
}
async create(pobj, qobj, req) {
pobj.company_id = req && req.xctx && req.xctx.companyid ?req.xctx.companyid : "";
const up = await this.service.create(pobj);
return up;
}
async update(pobj, qobj, req) {
const up = await this.service.update(pobj);
return up;
}
}
module.exports = SecondLevelNeedConfigCtl;
const system=require("../../../system");
const Dao=require("../../dao.base");
class ProducttypeDao extends Dao{
constructor(){
super(Dao.getModelName(ProducttypeDao));
}
async refQuery(qobj) {
var w = qobj.refwhere ? qobj.refwhere : {};
w["p_id"] = 0;
if (qobj.levelinfo) {
w[qobj.levelinfo.levelfield] = qobj.levelinfo.level;
}
if (qobj.parentinfo) {
w[qobj.parentinfo.parentfield] = qobj.parentinfo.parentcode;
}
//如果需要控制数据权限
if (qobj.datapriv) {
w["id"] = { [this.db.Op.in]: qobj.datapriv };
}
if (qobj.likestr) {
w[qobj.fields[0]] = { [this.db.Op.like]: "%" + qobj.likestr + "%" };
return this.model.findAll({ where: w, attributes: qobj.fields });
} else {
return this.model.findAll({ where: w, attributes: qobj.fields });
}
}
}
module.exports=ProducttypeDao;
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
/**
* 表单信息表
*/
module.exports = (db, DataTypes) => {
return db.define("bottommenuconfig", {
name: {
type: DataTypes.STRING
},
company_id: {
type: DataTypes.INTEGER
},
button_position: {
type: DataTypes.STRING
},
is_distinguishtime: {
type: DataTypes.STRING
},
strategy_date: {
type: DataTypes.INTEGER
},
strategy_time: {
type: DataTypes.STRING
},
button_type: {
type: DataTypes.STRING
},
button_name: {
type: DataTypes.STRING
},
call_number: {
type: DataTypes.INTEGER
},
else_button_type: {
type: DataTypes.STRING
},
else_button_name: {
type: DataTypes.INTEGER
},
else_call_number: {
type: DataTypes.STRING
},
},
{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'mc_bottom_menu_config',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
/**
* 表单信息表
*/
module.exports = (db, DataTypes) => {
return db.define("cluemaintenance", {
code: {
type: DataTypes.STRING
},
name: {
type: DataTypes.STRING
},
company_id: {
type: DataTypes.INTEGER
},
formitem_type: {
type: DataTypes.STRING
},
formitem_type_name: {
type: DataTypes.INTEGER
},
clue_info: {
type: DataTypes.JSON
},
original_requirements: {
type: DataTypes.STRING
},
product_id: {
type: DataTypes.INTEGER
},
},
{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'mc_clue_maintenance',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
/**
* 表单信息表
*/
module.exports = (db, DataTypes) => {
return db.define("cycleproduct", {
code: {
type: DataTypes.STRING
},
company_id: {
type: DataTypes.INTEGER
},
cycle_type: {
type: DataTypes.STRING
},
pic_describe: {
type: DataTypes.STRING
},
cycle_type_name: {
type: DataTypes.INTEGER
},
pic_url: {
type: DataTypes.STRING
},
sequence: {
type: DataTypes.INTEGER
},
jump_link_type: {
type: DataTypes.INTEGER
},
jump_link: {
type: DataTypes.STRING
},
},
{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'mc_cycle_product',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
/**
*图片材料表
*/
module.exports = (db, DataTypes) => {
return db.define("picturewarehouse", {
code: {
type: DataTypes.STRING
},
pic_size: {
type: DataTypes.STRING
},
name: {
type: DataTypes.STRING
},
company_id: {
type: DataTypes.INTEGER
},
pic_url: {
type: DataTypes.STRING
},
notes: {
type: DataTypes.STRING
}
},
{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'c_picture_warehouse',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
/**
* 表单信息表
*/
module.exports = (db, DataTypes) => {
return db.define("popularrecommendation", {
code: {
type: DataTypes.STRING
},
company_id: {
type: DataTypes.INTEGER
},
pic_position: {
type: DataTypes.STRING
},
pic_position_name: {
type: DataTypes.STRING
},
pic_describe: {
type: DataTypes.STRING
},
is_enabled: {
type: DataTypes.INTEGER
},
pic_url: {
type: DataTypes.STRING
},
jump_link_type: {
type: DataTypes.INTEGER
},
jump_link: {
type: DataTypes.STRING
}
},
{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'mc_popular_recommendation',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
/**
* 表单信息表
*/
module.exports = (db, DataTypes) => {
return db.define("product", {
code: {
type: DataTypes.STRING
},
is_enabled: {
type: DataTypes.INTEGER
},
name: {
type: DataTypes.STRING
},
company_id: {
type: DataTypes.INTEGER
},
product_type_code: {
type: DataTypes.STRING
},
product_type_id: {
type: DataTypes.INTEGER
},
sales_volume: {
type: DataTypes.INTEGER
},
product_type_name: {
type: DataTypes.STRING
},
selling_point: {
type: DataTypes.STRING
},
price_type: {
type: DataTypes.INTEGER
},
price: {
type: DataTypes.INTEGER
},
product_detail_url: {
type: DataTypes.STRING
},
list_thumbnail_url: {
type: DataTypes.STRING
},
is_recommend: {
type: DataTypes.INTEGER
},
service_Introduction_info: {
type: DataTypes.TEXT
},
process_flow_info: {
type: DataTypes.TEXT
},
information_required_info: {
type: DataTypes.TEXT
},
can_get_info: {
type: DataTypes.TEXT
},
our_advantage_info: {
type: DataTypes.TEXT
},
},
{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'mc_product',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
/**
* 表单信息表
*/
module.exports = (db, DataTypes) => {
return db.define("producttype", {
code: {
type: DataTypes.STRING
},
name: {
type: DataTypes.STRING
},
company_id: {
type: DataTypes.INTEGER
},
p_code: {
type: DataTypes.STRING
},
p_id: {
type: DataTypes.INTEGER
},
pic_url: {
type: DataTypes.STRING
},
jump_link: {
type: DataTypes.STRING
},
p_name: {
type: DataTypes.STRING
},
jump_link_type: {
type: DataTypes.INTEGER
},
sequence: {
type: DataTypes.INTEGER
}
},
{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'mc_product_type',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
/**
* 轮播图表
*/
module.exports = (db, DataTypes) => {
return db.define("rotationchart", {
code: {
type: DataTypes.STRING
},
name: {
type: DataTypes.STRING
},
company_id: {
type: DataTypes.INTEGER
},
is_enabled: {
type: DataTypes.INTEGER
},
pic_url: {
type: DataTypes.STRING
},
pic_type_name: {
type: DataTypes.STRING
},
pic_type: {
type: DataTypes.STRING
},
sequence: {
type: DataTypes.INTEGER
},
jump_link_type: {
type: DataTypes.INTEGER
},
jump_link: {
type: DataTypes.STRING
}
},
{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'mc_rotation_chart',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
/**
* 表单信息表
*/
module.exports = (db, DataTypes) => {
return db.define("secondlevelneedconfig", {
code: {
type: DataTypes.STRING
},
name: {
type: DataTypes.STRING
},
company_id: {
type: DataTypes.INTEGER
},
top_pic_url: {
type: DataTypes.STRING
},
recommend_product_quantity: {
type: DataTypes.INTEGER
},
recommend_product: {
type: DataTypes.JSON
},
},
{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'mc_second_level_need_config',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class BottommenuconfigService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(BottommenuconfigService));
}
async create(pobj) {
if (!pobj.button_name) {
return system.getResultFail(-101, "按钮文案不能为空");
}
if (!pobj.is_distinguishtime) {
return system.getResultFail(-102, "分时策略不能为空");
}
if (!pobj.strategy_date) {
return system.getResultFail(-103, "策略日期不能为空");
}
if (!pobj.strategy_time) {
return system.getResultFail(-104, "策略时段不能为空");
}
if (!pobj.button_type) {
return system.getResultFail(-105, "按钮形式不能为空");
}
if (!pobj.button_name) {
return system.getResultFail(-106, "按钮文案不能为空");
}
if (!pobj.call_number) {
return system.getResultFail(-107, "呼叫号码不能为空");
}
if (!pobj.else_button_type) {
return system.getResultFail(-108, "其他按钮形式不能为空");
}
if (!pobj.else_button_name) {
return system.getResultFail(-109, "其他按钮文案不能为空");
}
if (!pobj.else_call_number) {
return system.getResultFail(-110, "其他呼叫号码不能为空");
}
return system.getResultSuccess(this.dao.create(pobj));
}
async update(pobj) {
return system.getResultSuccess(this.dao.update(pobj));
}
}
module.exports = BottommenuconfigService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class CluemaintenanceService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(CluemaintenanceService));
}
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;
if (!pobj.pic_url) {
return system.getResultFail(-123, "图片不能为空");
}
return system.getResultSuccess(this.dao.create(pobj));
}
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.name){
pobj.name = res.name;
}
return system.getResultSuccess(this.dao.update(pobj));
}
}
module.exports = CluemaintenanceService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class CycleproductService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(CycleproductService));
}
async update(pobj) {
if (!pobj.pic_url) {
return system.getResultFail(-101, "图片不能为空");
}
if (!pobj.jump_link_type) {
return system.getResultFail(-104, "连接不能为空");
}
if (pobj.pic_describe && pobj.pic_describe.length > 19) {
return system.getResultFail(-105, "图片描述最多20位字符");
}
return system.getResultSuccess(this.dao.update(pobj));
}
}
module.exports = CycleproductService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class PicturewarehouseService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(PicturewarehouseService));
}
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;
if (!pobj.pic_url) {
return system.getResultFail(-123, "图片不能为空");
}
return system.getResultSuccess(this.dao.create(pobj));
}
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.name){
pobj.name = res.name;
}
return system.getResultSuccess(this.dao.update(pobj));
}
}
module.exports = PicturewarehouseService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class PopularrecommendationService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(PopularrecommendationService));
}
async update(pobj) {
if (!pobj.pic_url) {
return system.getResultFail(-101, "图片不能为空");
}
if (!pobj.jump_link_type) {
return system.getResultFail(-104, "连接不能为空");
}
if (pobj.pic_describe && pobj.pic_describe.length > 19) {
return system.getResultFail(-105, "图片描述最多20位字符");
}
return system.getResultSuccess(this.dao.update(pobj));
}
}
module.exports = PopularrecommendationService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class ProductService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(ProductService));
}
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;
if (!pobj.pic_url) {
return system.getResultFail(-123, "图片不能为空");
}
return system.getResultSuccess(this.dao.create(pobj));
}
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.name){
pobj.name = res.name;
}
return system.getResultSuccess(this.dao.update(pobj));
}
}
module.exports = ProductService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class ProducttypeService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(ProducttypeService));
}
async create(pobj) {
let code = await this.getBusUid("mmc");
pobj.code = code;
if (!pobj.code) {
return system.getResultFail(-101, "编码不能为空");
}
if (!pobj.pic_url) {
return system.getResultFail(-102, "图标不能为空");
}
if (!pobj.sequence) {
return system.getResultFail(-103, "排序不能为空");
}
if (!pobj.jump_link_type && !pobj.jump_link) {
return system.getResultFail(-104, "连接不能为空");
}
if (pobj.name) {
return system.getResultFail(-105, "名称不能为空");
}
if (pobj.name && pobj.name.length > 3) {
return system.getResultFail(-106, "名称最多4位字符");
}
return system.getResultSuccess(this.dao.create(pobj));
}
async update(pobj) {
if (!pobj.pic_url) {
return system.getResultFail(-101, "图标不能为空");
}
if (!pobj.sequence) {
return system.getResultFail(-102, "排序不能为空");
}
if (!pobj.jump_link_type && !pobj.jump_link) {
return system.getResultFail(-104, "连接不能为空");
}
if (pobj.name) {
return system.getResultFail(-105, "名称不能为空");
}
if (pobj.name && pobj.name.length > 3) {
return system.getResultFail(-106, "名称最多4位字符");
}
return system.getResultSuccess(this.dao.update(pobj));
}
}
module.exports = ProducttypeService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class RotationchartService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(RotationchartService));
}
async create(pobj) {
let code = await this.getBusUid("mmc");
pobj.code = code;
if (!pobj.code) {
return system.getResultFail(-101, "编码不能为空");
}
if (!pobj.pic_url) {
return system.getResultFail(-101, "图片不能为空");
}
if (!pobj.is_enabled) {
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, "排序不能为空");
}
}
return system.getResultSuccess(this.dao.create(pobj));
}
async update(pobj) {
if (!pobj.pic_url) {
pobj.pic_url = res.pic_url;
}
if (!pobj.name) {
pobj.name = res.name;
}
return system.getResultSuccess(this.dao.update(pobj));
}
}
module.exports = RotationchartService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class SecondlevelneedconfigService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(SecondlevelneedconfigService));
}
async update(pobj) {
let code = await this.getBusUid("mmc");
pobj.code = code;
if (!pobj.code) {
return system.getResultFail(-101, "编码不能为空");
}
if (!pobj.top_pic_url) {
return system.getResultFail(-102, "顶部图标不能为空");
}
if (!pobj.recommend_product_quantity) {
return system.getResultFail(-103, "推荐产品数量不能为空");
}
return system.getResultSuccess(this.dao.update(pobj));
}
}
module.exports = SecondlevelneedconfigService;
\ 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