Commit aee8f573 by 蒋勇

d

parent 875f76a2
var system = require("../../../system")
const CtlBase = require("../../ctl.base");
class TreearchCtl extends CtlBase {
constructor() {
super("common", CtlBase.getServiceName(TreearchCtl));
}
async getRegions(p,q,req){
let regionjson=await this.service.getRegions();
return system.getResult({regionJson:regionjson})
}
async saveRegions(p,q,req){
let regionjson=await this.service.saveRegions(p.regionJson);
return system.getResult({regionJson:regionjson})
}
async getProductcats(p,q,req){
let productcatJson=await this.service.getProductcats();
return system.getResult({productcatJson:productcatJson})
}
async saveProductcats(p,q,req){
let productcatJson=await this.service.saveProductcats(p.productcatJson);
return system.getResult({productcatJson:productcatJson})
}
}
module.exports = TreearchCtl;
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig=system.getSysConfig();
module.exports = (db, DataTypes) => {
return db.define("region", {
code: {
type: DataTypes.STRING,
allowNull: false,
},//和user的from相同,在注册user时,去创建
name: {
type: DataTypes.STRING,
allowNull: false,
},//和user的from相同,在注册user时,去创建
level: {
type: DataTypes.INTEGER,
allowNull: false,
},//和user的from相同,在注册user时,去创建
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'fh_regions',
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("treearch", {
regionJSON: DataTypes.TEXT,//功能清单地址--前端通过loadJson下载数据
productcatJSON:DataTypes.TEXT
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'p_treearchs',
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");
const appconfig = system.getSysConfig();
class RegionService extends ServiceBase {
constructor() {
super("common", ServiceBase.getDaoName(RegionService));
}
}
module.exports = RegionService;
// (async ()=>{
// const fs=require("fs")
// let areaS=new RegionService();
// let rs=await areaS.dao.model.findAll({attributes:['code','name','level']})
// console.log(rs.length)
// let codemap={}
// let resultroot={
// code:"root",
// title:"全国区域",
// orgpath:"root",
// level:-1,
// titlepath:"全国区域",
// seq:0,
// children:[]
// }
// function buildP(r){
// let rtn= {
// code:r.code+"",
// title:r.name,
// level:r.level,
// seq:0,
// orgpath:"",
// titlepath:"",
// children:[]
// }
// return rtn;
// }
// for(let r of rs){
// if(r.level==1){//表示省
// let p=buildP(r)
// codemap[String(r.code)]=p
// resultroot.children.push(p)
// }
// if(r.level==2){
// let pcode=String(r.code).substring(0,2)
// let pnode=codemap[pcode]
// let second=buildP(r)
// codemap[r.code]=second
// pnode.children.push(second)
// }
// if(r.level==3){
// let secodecode=String(r.code).substring(0,4)
// let secodenode=codemap[secodecode]
// let threenode=buildP(r)
// secodenode.children.push(threenode)
// }
// }
// fs.writeFileSync("./a.json",JSON.stringify([resultroot]))
// // let x=await u.cregister("jiangong")
// // console.log(x)
// // let x=await u.cunregister("jiangong")
// // console.log(x)
// // let t=await u.cmakejwt()
// // console.log(t)
// //let ux=await u.cjsonregister(AppService.newRouteUrl("test-service2"),{name:"test-service2",hosts:["ttest1.com"]})
// //let ux=await u.cjsonregister(AppService.newServiceUrl(),{name:"test-service3",url:"http://zhichan.gongsibao.com"})
// //let ux=await u.cdel(AppService.routeUrl("test-service2"))
// //let ux=await u.cdel(AppService.serviceUrl("test-service2"))
// // let ux=await u.create({name:"test4-service",backend:"zhichan-service",domainName:"domain.com"})
// // console.log(ux);
// // let delrtn=await u.delete({id:2,name:"test4-service"})
// // console.log(delrtn);
// })()
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
class TreeArchService extends ServiceBase {
constructor() {
super("common", ServiceBase.getDaoName(TreeArchService));
}
async getRegions(){
let rs=await this.dao.model.findAll({attributes:['regionJSON']})
return JSON.parse(rs[0].regionJSON)
}
async saveRegions(regionJson){
let rs=await this.dao.model.findAll()
let upobj=rs[0]
upobj.regionJSON=JSON.stringify(regionJson)
upobj.save()
return regionJson
}
async getProductcats(){
let rs=await this.dao.model.findAll({attributes:['productcatJSON']})
return JSON.parse(rs[0].productcatJSON)
}
async saveProductcats(productcatJson){
let rs=await this.dao.model.findAll()
let upobj=rs[0]
upobj.productcatJSON=JSON.stringify(productcatJson)
upobj.save()
return productcatJson
}
}
module.exports = TreeArchService;
// (async ()=>{
// const fs=require("fs")
// let treeS=new TreeArchService();
// let s= fs.readFileSync("./a.json")
// await treeS.dao.model.create({id:1,regionJSON:s})
// console.log("insert ok.....")
// // let x=await u.cregister("jiangong")
// // console.log(x)
// // let x=await u.cunregister("jiangong")
// // console.log(x)
// // let t=await u.cmakejwt()
// // console.log(t)
// //let ux=await u.cjsonregister(AppService.newRouteUrl("test-service2"),{name:"test-service2",hosts:["ttest1.com"]})
// //let ux=await u.cjsonregister(AppService.newServiceUrl(),{name:"test-service3",url:"http://zhichan.gongsibao.com"})
// //let ux=await u.cdel(AppService.routeUrl("test-service2"))
// //let ux=await u.cdel(AppService.serviceUrl("test-service2"))
// // let ux=await u.create({name:"test4-service",backend:"zhichan-service",domainName:"domain.com"})
// // console.log(ux);
// // let delrtn=await u.delete({id:2,name:"test4-service"})
// // console.log(delrtn);
// })()
\ No newline at end of file
******渠道过滤*******查询****从中台获取 todo ----------------------
产品类型 + 地区------产品
产品定价表
产品A + 小规模集团 =200 按次
产品A + 小规模集团 =1000 按时间 1-3工作日
产品A + 小规模集团 =500 按时间 3-5工作日
产品A + 小规模股份 =300
{}
1.渠道管理
-建立渠道( 简码 名称 域名 )
--同时给中台服务建立一个新的路由
......
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