Commit 5f2dba7b by 王勇飞

Merge branch 'center-manage' of gitlab.gongsibao.com:jiangyong/zhichan into center-manage

parents 142336d7 5b33f505
var system = require("../../../system")
const CtlBase = require("../../ctl.base");
class ArticleCtl extends CtlBase {
constructor() {
super("common", CtlBase.getServiceName(ArticleCtl));
}
async create(p,q,req){
p.creator_id=p.userid
p.creator=p.username
let rtn=await this.service.create(p,q,req)
return system.getResult(rtn)
}
}
module.exports = ArticleCtl;
......@@ -11,8 +11,16 @@ class TreearchCtl extends CtlBase {
return system.getResult(rtn)
}
async getRegions(p,q,req){
let regionjson=await this.service.getRegions();
return system.getResult({regionJson:regionjson})
let regionjson=await this.service.getRegions();
return system.getResult({regionJson:regionjson})
}
async getSysArchJSON(p,q,req){
let sysArchJSON=await this.service.getSysArchJSON();
return system.getResult({sysArchJSON:sysArchJSON})
}
async saveSysArchJSON(p,q,req){
let sysArchJSON=await this.service.saveSysArchJSON(p.sysArchJSON);
return system.getResult({sysArchJSON:sysArchJSON})
}
async saveRegions(p,q,req){
let regionjson=await this.service.saveRegions(p.regionJson);
......
const system=require("../../../system");
const Dao=require("../../dao.base");
class ArticleDao extends Dao{
constructor(){
super(Dao.getModelName(ArticleDao));
}
orderBy(qobj) {
//return {"key":"include","value":{model:this.db.models.app}};
if(!qobj.orderInfo || qobj.orderInfo.length==0){
return [["created_at", "ASC"]];
}else{
return qobj.orderInfo;
}
}
}
module.exports=ArticleDao;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig=system.getSysConfig();
module.exports = (db, DataTypes) => {
return db.define("article", {
title: {
type: DataTypes.STRING,
allowNull: false,
},//和user的from相同,在注册user时,去创建
desc: {//概述
type: DataTypes.STRING,
allowNull: true,
},//和us
listimg: {//简图
type: DataTypes.STRING,
allowNull: true,
},//和us
isPubed:{
type:DataTypes.BOOLEAN,
defaultValue: false
},
htmlcontent: {
type: DataTypes.STRING,
allowNull: true,
},//和user的from相同,在注册user时,去创建
tags: {
type: DataTypes.STRING,
allowNull: true,
},//和user的from相同,在注册user时,去创建
archpath:{//文档路径
type: DataTypes.STRING,
allowNull: false,
},
seq:{
type: DataTypes.INTEGER,
allowNull: true,
defaultValue:0
},
creator_id:{
type: DataTypes.INTEGER,
allowNull: false,
},
creator:{
type: DataTypes.STRING,
allowNull: false,
}
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'p_article',
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}]
// }
]
});
}
......@@ -4,7 +4,8 @@ const appconfig=system.getSysConfig();
module.exports = (db, DataTypes) => {
return db.define("treearch", {
regionJSON: DataTypes.TEXT,//功能清单地址--前端通过loadJson下载数据
productcatJSON:DataTypes.TEXT
productcatJSON:DataTypes.TEXT,
sysArchJSON:DataTypes.TEXT,//系统的文档树
}, {
paranoid: false,//假的删除
underscored: true,
......
......@@ -8,6 +8,17 @@ class TreeArchService extends ServiceBase {
let rs = await this.dao.model.findAll({ attributes: ['regionJSON'] })
return JSON.parse(rs[0].regionJSON)
}
async getSysArchJSON() {
let rs = await this.dao.model.findAll({ attributes: ['sysArchJSON'] })
return JSON.parse(rs[0].sysArchJSON)
}
async saveSysArchJSON(sysArchJSON) {
let rs = await this.dao.model.findAll()
let upobj = rs[0]
upobj.sysArchJSON = JSON.stringify(sysArchJSON)
upobj.save()
return sysArchJSON
}
async saveRegions(regionJson) {
let rs = await this.dao.model.findAll()
let upobj = rs[0]
......
国外
\ No newline at end of file
新疆维吾尔自治区
\ No newline at end of file
......@@ -29,7 +29,7 @@ class ProductService extends ServiceBase {
let tmpdic=await self.findPriceStrategys(stragetyids,t)
stragetyids.forEach(stragetyid => {
if(skucodemap){
p.skucode=skucodemap[stragetyid].pricecode
p.skucode=skucodemap[stragetyid]
}
let pps = {
......@@ -40,7 +40,8 @@ class ProductService extends ServiceBase {
company_id:p.company_id,
skucode:p.skucode?p.skucode:self.getUUID(),
skuname:p.skuname?p.skuname:p.name,
sptags:p.sptags
sptags:p.sptags,
channeltags:p.channeltags
}
productprices.push(pps)
})
......
......@@ -29,7 +29,7 @@ class ProductpriceService extends ServiceBase {
regioninfo["label"] = regionName
//按照名字去取地区编码
let areainfos = rs.filter(f => {
if (f.name == regionName) {
if (f.name.indexOf(regionName)>=0) {
return true
} else {
return false
......
......@@ -35,14 +35,16 @@ function findTitlePath(items, findstr, results) {
let product = {}
product.code = xp.path_code + xp.id
results = []
findTitlePath(rs, xp.region_name, results)
//findTitlePath(rs, xp.region_name, results)
if(results.length==0 || !results[0]){
fs.writeFileSync("./a.txt",xp.region_name)
}
product.regionpath = results[0]
//product.regionpath = results[0]//反查国家标准地区名称
product.regionpath=xp.region_name
product.productcatpath = "产品分类" + xp.path_name
product.name = product.productcatpath + "~" + product.regionpath
product.sptags = xp.servicer_name
product.channeltags="腾讯"
product.desc=product.name
product.company_id=1
//构造策略ids
......
......@@ -31,3 +31,187 @@ console.log(mid)
[
{
"title":"中心功能清单",
"code":"root",
"expand":true,
"orgpath":"root",
"children":[
{
"seq":2,
"code":"businessManagement",
"title":"商机管理",
"nodeKey":1,
"orgpath":"root/businessManagement",
"expand":true,
"children":[
{
"auths":[
"add",
"edit",
"delete",
"export",
"show"],
"seq":2,
"code":"wailtingDispose",
"title":"待处理商机",
"nodeKey":2,
"orgpath":"root/businessManagement/wailtingDispose",
"expand":true,
"children":[
],
"sels":[
],
"titlepath":"中心功能清单/商机管理/待处理商机",
"level":3
},
{
"auths":[
"add",
"edit",
"delete",
"export",
"show"],
"seq":2,
"code":"allDispose",
"title":"全部商机",
"nodeKey":3,
"orgpath":"root/businessManagement/allDispose",
"expand":true,
"children":[
],
"sels":[
],
"titlepath":"中心功能清单/商机管理/全部商机",
"level":3
}],
"titlepath":"中心功能清单/商机管理",
"level":2
},
{
"auths":[
"add",
"edit",
"delete",
"export",
"show"],
"seq":3,
"code":"deliveryManagement",
"title":"资质交付管理",
"nodeKey":4,
"orgpath":"root/deliveryManagement",
"expand":true,
"children":[
{
"auths":[
"add",
"edit",
"delete",
"export",
"show"],
"seq":1,
"code":"deliveryWaiting",
"title":"待我处理",
"nodeKey":5,
"orgpath":"root/deliveryManagement/deliveryWaiting",
"expand":true,
"children":[
],
"sels":[
],
"titlepath":"中心功能清单/资质交付管理/待我处理",
"level":3
},
{
"auths":[
"add",
"edit",
"delete",
"export",
"show"],
"seq":1,
"code":"deliveryAll",
"title":"全部交付单",
"nodeKey":6,
"orgpath":"root/deliveryManagement/deliveryAll",
"expand":true,
"children":[
],
"sels":[
],
"titlepath":"中心功能清单/资质交付管理/全部交付单",
"level":3
}],
"titlepath":"中心功能清单/资质交付管理",
"level":2
},
{
"auths":[
"add",
"edit",
"delete",
"export",
"show"],
"seq":4,
"code":"annualReport",
"title":"年报交付管理",
"nodeKey":7,
"orgpath":"root/annualReport",
"expand":true,
"children":[
{
"auths":[
"add",
"edit",
"delete",
"export",
"show"],
"seq":1,
"code":"annualReportWait",
"title":"待我处理",
"nodeKey":8,
"orgpath":"root/annualReport/annualReportWait",
"expand":true,
"children":[
],
"titlepath":"中心功能清单/年报交付管理/待我处理",
"level":3,
"sels":[
]
},
{
"auths":[
"add",
"edit",
"delete",
"export",
"show"],
"seq":2,
"code":"annualReportAll",
"title":"全部交付单",
"nodeKey":9,
"orgpath":"root/annualReport/annualReportAll",
"expand":true,
"children":[
],
"sels":[
],
"titlepath":"中心功能清单/年报交付管理/全部交付单",
"level":3
}],
"titlepath":"中心功能清单/年报交付管理",
"level":2
}],
"nodeKey":0,
"titlepath":"中心功能清单",
"level":1
}]
......@@ -63,6 +63,7 @@ var settings = {
idle: 1000000
},
debug:false,
timezone:'+08:00',
dialectOptions:{
requestTimeout: 999999,
// instanceName:'DEV'
......
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