Commit f3ea4a47 by wangyong

feat: (agriculture) 磐农项目

parent 6531e823
.DS_Store
app/front/entry/public/.DS_Store
# modules
node_modules/ node_modules/
# localsetting
app/config/localsettings.js app/config/localsettings.js
app/front/entry/public/.DS_Store
\ No newline at end of file # change history
.history/
\ No newline at end of file
...@@ -2,121 +2,123 @@ const system = require("../system"); ...@@ -2,121 +2,123 @@ const system = require("../system");
const settings = require("../../config/settings"); const settings = require("../../config/settings");
const uuidv4 = require('uuid/v4'); const uuidv4 = require('uuid/v4');
class CtlBase { class CtlBase {
constructor(gname, sname) { constructor(gname, sname) {
this.serviceName = sname; this.serviceName = sname;
this.service = system.getObject("service." + gname + "." + sname); this.service = system.getObject("service." + gname + "." + sname);
this.cacheManager = system.getObject("db.common.cacheManager"); this.cacheManager = system.getObject("db.common.cacheManager");
this.logClient = system.getObject("util.logClient"); this.logClient = system.getObject("util.logClient");
} }
static getServiceName(ClassObj) { static getServiceName(ClassObj) {
return ClassObj["name"].substring(0, ClassObj["name"].lastIndexOf("Ctl")).toLowerCase() + "Sve"; return ClassObj["name"].substring(0, ClassObj["name"].lastIndexOf("Ctl")).toLowerCase() + "Sve";
}
async update(pobj, qobj, req) {
const up = await this.service.update(pobj);
return system.getResult(up);
}
async create(pobj, qobj, req) {
const up = await this.service.create(pobj);
return system.getResult(up);
}
async delete(pobj, qobj, req) {
const up = await this.service.delete(pobj);
return system.getResult(up);
}
async findAndCountAll(pobj, qobj, req) {
//设置查询条件
console.log(pobj)
const rs = await this.service.findAndCountAll(pobj);
return system.getResult(rs);
}
async refQuery(pobj, qobj, req) {
pobj.refwhere.app_id = pobj.app_id;
pobj.refwhere.company_id = pobj.company_id;
let rtn = await this.service.refQuery(pobj);
return rtn
}
async setContextParams(pobj, qobj, req) {
let custtags = req.headers["x-consumetag"] ? req.headers["x-consumetag"].split("|") : null;
let lastindex = custtags ? custtags.length - 1 : 0;
//当自由用户注册时,需要根据前端传来的companykey,查询出公司,给companyid赋值
req.xctx = {
appkey: req.headers["xappkey"],//用于系统管理区分应用,比如角色
fromappkey: req.headers["xfromappkey"],//来源APP,如果没有来源与appkey相同
companyid: custtags ? custtags[0].split("_")[1] : null,
fromcompanykey: req.headers["xfromcompanykey"],//专用于自由用户注册,自由用户用于一定属于某个存在的公司
password: custtags ? custtags[lastindex].split("_")[1] : null,
username: req.headers["x-consumer-username"],
userid: req.headers["x-consumer-custom-id"],
username: req.headers["x-consumer-username"],
credid: req.headers["x-credential-identifier"],
regrole: req.headers["xregrole"],
bizpath: req.headers["xbizpath"],
opath: req.headers['xopath'],
ptags: req.headers['xptags'],
codename: req.headers["xcodename"],
codetitle: req.headers["xcodetitle"] ? decodeURI(req.headers["xcodetitle"]) : '',
} }
if (req.xctx.ptags && req.xctx.ptags != "") { async update(pobj, qobj, req) {
pobj.opath = req.xctx.ptags const up = await this.service.update(pobj);
} else { return system.getResult(up);
pobj.opath = req.xctx.opath
} }
async create(pobj, qobj, req) {
if (!req.xctx.appkey) { console.log('---------------------aaa------------------');
return [-200, "请求头缺少应用x-app-key"] console.log(res);
} else { const up = await this.service.create(pobj);
// let app=await this.cacheManager["AppCache"].cache(req.xctx.fromappkey); return system.getResult(up);
// req.xctx.appid=app.id;
// if(!pobj.app_id){
// pobj.app_id=app.id;//传递参数对象里注入app_id
// }
} }
//平台注册时,companyid,companykey都为空 async delete(pobj, qobj, req) {
//自由注册时,companykey不能为空 const up = await this.service.delete(pobj);
// if(!req.xctx.companyid && !req.xctx.companykey){ return system.getResult(up);
// return [-200,"请求头缺少应用x-app-key"]
// }
if (!req.xctx.companyid && req.xctx.fromcompanykey && req.xctx.fromcompanykey != "null" && req.xctx.fromcompanykey != "undefined") {
let comptmp = await this.cacheManager["CompanyCache"].cache(req.xctx.fromcompanykey);
req.xctx.companyid = comptmp.id;
} }
if (req.xctx.companyid) {//在请求传递数据对象注入公司id async findAndCountAll(pobj, qobj, req) {
pobj.company_id = req.xctx.companyid; //设置查询条件
console.log(pobj)
const rs = await this.service.findAndCountAll(pobj);
return system.getResult(rs);
} }
if (req.xctx.userid) {//在请求传递数据对象注入公司id async refQuery(pobj, qobj, req) {
pobj.userid = req.xctx.userid; pobj.refwhere.app_id = pobj.app_id;
pobj.refwhere.company_id = pobj.company_id;
let rtn = await this.service.refQuery(pobj);
return rtn
} }
if (req.xctx.username) {//在请求传递数据对象注入公司名称 async setContextParams(pobj, qobj, req) {
pobj.username = req.xctx.username; let custtags = req.headers["x-consumetag"] ? req.headers["x-consumetag"].split("|") : null;
let lastindex = custtags ? custtags.length - 1 : 0;
//当自由用户注册时,需要根据前端传来的companykey,查询出公司,给companyid赋值
req.xctx = {
appkey: req.headers["xappkey"], //用于系统管理区分应用,比如角色
fromappkey: req.headers["xfromappkey"], //来源APP,如果没有来源与appkey相同
companyid: custtags ? custtags[0].split("_")[1] : null,
fromcompanykey: req.headers["xfromcompanykey"], //专用于自由用户注册,自由用户用于一定属于某个存在的公司
password: custtags ? custtags[lastindex].split("_")[1] : null,
username: req.headers["x-consumer-username"],
userid: req.headers["x-consumer-custom-id"],
username: req.headers["x-consumer-username"],
credid: req.headers["x-credential-identifier"],
regrole: req.headers["xregrole"],
bizpath: req.headers["xbizpath"],
opath: req.headers['xopath'],
ptags: req.headers['xptags'],
codename: req.headers["xcodename"],
codetitle: req.headers["xcodetitle"] ? decodeURI(req.headers["xcodetitle"]) : '',
}
if (req.xctx.ptags && req.xctx.ptags != "") {
pobj.opath = req.xctx.ptags
} else {
pobj.opath = req.xctx.opath
}
if (!req.xctx.appkey) {
return [-200, "请求头缺少应用x-app-key"]
} else {
// let app=await this.cacheManager["AppCache"].cache(req.xctx.fromappkey);
// req.xctx.appid=app.id;
// if(!pobj.app_id){
// pobj.app_id=app.id;//传递参数对象里注入app_id
// }
}
//平台注册时,companyid,companykey都为空
//自由注册时,companykey不能为空
// if(!req.xctx.companyid && !req.xctx.companykey){
// return [-200,"请求头缺少应用x-app-key"]
// }
if (!req.xctx.companyid && req.xctx.fromcompanykey && req.xctx.fromcompanykey != "null" && req.xctx.fromcompanykey != "undefined") {
let comptmp = await this.cacheManager["CompanyCache"].cache(req.xctx.fromcompanykey);
req.xctx.companyid = comptmp.id;
}
if (req.xctx.companyid) { //在请求传递数据对象注入公司id
pobj.company_id = req.xctx.companyid;
}
if (req.xctx.userid) { //在请求传递数据对象注入公司id
pobj.userid = req.xctx.userid;
}
if (req.xctx.username) { //在请求传递数据对象注入公司名称
pobj.username = req.xctx.username;
}
pobj.bizpath = req.xctx.bizpath;
} }
pobj.bizpath = req.xctx.bizpath; async doexec(methodname, pobj, query, req) {
} try {
async doexec(methodname, pobj, query, req) { let xarg = await this.setContextParams(pobj, query, req);
try { if (xarg && xarg[0] < 0) {
let xarg = await this.setContextParams(pobj, query, req); return system.getResultFail(...xarg);
if (xarg && xarg[0] < 0) { }
return system.getResultFail(...xarg); //从请求头里面取appkey_consumename
} // var consumeName=req.headers[""]
//从请求头里面取appkey_consumename // var appkey=
// var consumeName=req.headers[""] // if( this.session["appkey_consumename"]) {
// var appkey=
// if( this.session["appkey_consumename"]) {
// }else{ // }else{
// //从头里取,从redis中取出缓存对象赋值到控制基类的session属性 // //从头里取,从redis中取出缓存对象赋值到控制基类的session属性
// //appkey_consumename // //appkey_consumename
// this.session={}; // this.session={};
// } // }
//req.session=redis缓存的上下文对象 //req.session=redis缓存的上下文对象
var rtn = await this[methodname](pobj, query, req); var rtn = await this[methodname](pobj, query, req);
this.logClient.log(pobj, req, rtn) this.logClient.log(pobj, req, rtn)
return rtn; return rtn;
} catch (e) { } catch (e) {
this.logClient.log(pobj, req, null, e.stack); this.logClient.log(pobj, req, null, e.stack);
console.log(e.stack, "出现异常,请联系管理员......."); console.log(e.stack, "出现异常,请联系管理员.......");
return system.getResultFail(-200, "出现异常,请联系管理员"); return system.getResultFail(-200, "出现异常,请联系管理员");
}
} }
}
} }
module.exports = CtlBase; module.exports = CtlBase;
\ No newline at end of file
const CtlBase = require("../../ctl.base");
/**
* @module agriculture/
* @class accountingCtl
* 会计 ctl
*/
class accountingCtl extends CtlBase {
constructor() {
super("agriculture", CtlBase.getServiceName(accountingCtl));
}
}
module.exports = accountingCtl;
\ No newline at end of file
const CtlBase = require("../../ctl.base");
/**
* @module agriculture
* @class accountsetCtl
* 帐套 ctl
*/
class accountsetCtl extends CtlBase {
constructor() {
super("agriculture", CtlBase.getServiceName(accountsetCtl));
}
}
module.exports = accountsetCtl;
\ No newline at end of file
var system = require("../../../system");
const CtlBase = require("../../ctl.base");
/**
* @module agriculture
* @class servicelistCtl
* 服务单ctl
*/
class servicebillCtl extends CtlBase {
constructor() {
super("agriculture", CtlBase.getServiceName(servicebillCtl));
}
async create(obj) {
//TODO: 复写create 校验服务单是否已存在
const res = await this.service.findOne({ bizId: obj.bizId });
if (res != null) {
return system.getResult({ massage: "该服务单已创建" });
}
const cre_res = await this.service.create(obj);
return system.getResult(cre_res);
}
async updateStatus(obj) {
const rs = await this.service.updateStatus(obj);
return system.getResult(rs);
}
async updateAndPush(obj) {
const rs = await this.service.updateAndPush(obj);
return system.getResult(rs);
}
async updateAndFeedback(obj) {
const rs = await this.service.updateAndFeedback(obj);
return system.getResult(rs);
}
}
module.exports = servicebillCtl;
\ No newline at end of file
/**
* 会计表
* @param db
* @param DataTypes
* @returns {Model|void|*}
*/
module.exports = (db, DataTypes) => {
return db.define("accounting", {
name: { // 姓名
allowNull: false,
type: DataTypes.STRING
},
agentAccountId: { //易代账ID
allowNull: true,
type: DataTypes.STRING
},
sex: { //性别
allowNull: false,
type: DataTypes.STRING
},
age: { //年龄
allowNull: false,
type: DataTypes.STRING
},
mobile: { //电话
allowNull: true,
type: DataTypes.INTEGER
}
}, {
paranoid: false, //假的删除
underscored: true,
version: true,
freezeTableName: true,
tableName: 'accounting',
validate: {},
indexes: []
});
}
\ No newline at end of file
/**
* 账套表
* @param db
* @param DataTypes
* @returns {Model|void|*}
*/
module.exports = (db, DataTypes) => {
return db.define("accountset", {
manageId: { // 工作台管理ID
allowNull: false,
type: DataTypes.STRING
},
custName: { //客户名称
allowNull: false,
type: DataTypes.STRING
},
code: { //助记码
allowNull: true,
type: DataTypes.STRING
},
corpAddress: { //公司地址
allowNull: true,
type: DataTypes.STRING
},
opsCertificate: { //营业执照
allowNull: true,
type: DataTypes.STRING
},
legalRepresentative: { //法人
allowNull: true,
type: DataTypes.STRING
},
legalRepresentativeSsn: { //法人身份证号
allowNull: true,
type: DataTypes.STRING
},
contactName: { //联系人
allowNull: true,
type: DataTypes.STRING
},
contactTel: { //联系方式
allowNull: true,
type: DataTypes.STRING
},
corpName: { //企业名称
allowNull: false,
type: DataTypes.STRING
},
taxiationArea: { //报税地区
allowNull: false,
type: DataTypes.STRING
},
taxIndustryId: { //行业
allowNull: false,
type: DataTypes.STRING
},
serviceTypeEnum: { //服务类型:枚举型,包括ACCOUTING-记账服务、INDUSTRY_COMMERCE-工商服务、BOTH-记账与工商服务。
allowNull: false,
type: DataTypes.STRING
},
taxNo: { //税号
allowNull: false,
type: DataTypes.STRING
},
certDueDate: { //证书到期日
allowNull: true,
type: DataTypes.STRING
},
taxCpNo: { //计算机代码
allowNull: true,
type: DataTypes.STRING
},
hasTaxCtrl: { //是否有税控机
allowNull: true,
type: DataTypes.BOOLEAN,
defaultValue: false
},
taxClaimTypeEnum: { //所得税申报类型:枚举型,包括NATIONAL-国税、LOCAL-地税
allowNull: true,
type: DataTypes.STRING
},
taxDep: { //税管所
allowNull: true,
type: DataTypes.STRING
},
taxManager: { //专管员
allowNull: true,
type: DataTypes.STRING
},
taxPhone: { //税务联系电话
allowNull: true,
type: DataTypes.STRING
},
comments: { //备注
allowNull: true,
type: DataTypes.STRING
},
accountantEmployeeId: { //所属会计
allowNull: false,
type: DataTypes.STRING
},
taxClaimMethodEnum: { //申报方式:TAX_DECLARATION-税款申报;ZERO_DECLARATION-零申报;
allowNull: false,
type: DataTypes.STRING
},
isBuild: { //是否建账
allowNull: false,
type: DataTypes.BOOLEAN,
defaultValue: true
},
accountBook: { //账套信息
allowNull: true,
type: DataTypes.JSON
}
}, {
paranoid: false, //假的删除
underscored: true,
version: true,
freezeTableName: true,
tableName: 'accountset',
validate: {},
indexes: []
});
}
\ No newline at end of file
/**
* 服务单
* @param db
* @param DataTypes
* @returns {Model|void|*}
*/
module.exports = (db, DataTypes) => {
return db.define("servicebill", {
bizId: { // 服务单id
allowNull: false,
type: DataTypes.INTEGER
},
orderNo: {
allowNull: false,
type: DataTypes.INTEGER
},
contactName: { //联系人名称
allowNull: true,
type: DataTypes.STRING
},
contactMobile: { //联系人电话
allowNull: false,
type: DataTypes.STRING
},
timeUnit: { //时间单位年:year
allowNull: false,
type: DataTypes.STRING
},
quantity: { //数量
allowNull: true,
type: DataTypes.INTEGER
},
note: { //备注
allowNull: true,
type: DataTypes.STRING
},
companyInfo: { //公司信息
allowNull: false,
type: DataTypes.JSON
},
orderNo: { //订单号
allowNull: true,
type: DataTypes.STRING
},
status: { //服务单状态
allowNull: false,
type: DataTypes.STRING,
defaultValue: 0,
},
feedback_notes: { //服务单状态审核描述
allowNull: true,
type: DataTypes.STRING
},
accountantEmployeeId: { //所属会计ID
allowNull: true,
type: DataTypes.INTEGER
},
accountantEmployeeName: { //所属会计姓名
allowNull: true,
type: DataTypes.INTEGER
},
accountantAgentAccountId: { //所属会计易代账ID
allowNull: true,
type: DataTypes.INTEGER
}
// companyInfo: { // 对象
// companyName // 公司名称
// taxpayerType // 纳税性质 NORMAL_TAXPAYER 一般纳税人; SMALL_TAXPAYER 小规模纳税人
// acctgSystemId // 会计制度 10001=2013 小企业会计准 则;10002=2007 企业会计准 则;10003=民间非营利组织会 计制度; 10004=工会会计制度
// companyForm // 企业形式 1 公司; 2 合伙企业; 3 个独; 4 个体工商户
// industry //所属行业
// taxpayerNumber // 税号
// companyArea // 公司区域
// }
}, {
paranoid: false, //假的删除
underscored: true,
version: true,
freezeTableName: true,
tableName: 'service_bill',
validate: {},
indexes: []
});
}
\ No newline at end of file
const ServiceBase = require("../../sve.base");
class AccountingService extends ServiceBase {
constructor() {
super("agriculture", ServiceBase.getDaoName(AccountingService));
}
async findAndCountAll(obj) {
const apps = await super.findAndCountAll(obj);
return apps;
}
}
module.exports = AccountingService;
\ No newline at end of file
const ServiceBase = require("../../sve.base");
class AccountsetService extends ServiceBase {
constructor() {
super("agriculture", ServiceBase.getDaoName(AccountsetService));
}
async findAndCountAll(obj) {
const apps = await super.findAndCountAll(obj);
return apps;
}
async create(obj) {
const res = await this.dao.update(obj);
return res;
}
}
module.exports = AccountsetService;
\ No newline at end of file
const ServiceBase = require("../../sve.base");
const ydzPush = require("./../../../utils/ydzClient");
const settings = require("./../../../../config/settings");
const System = require("../../../system");
const moment = require("moment");
const toQft = require("./../../../utils/toQft/index")
class ServicebillService extends ServiceBase {
constructor() {
super("agriculture", ServiceBase.getDaoName(ServicebillService));
this.accountsetSve = system.getObject("service.agriculture.accountsetSve");
}
async findAndCountAll(obj) {
var self = this;
console.log('---------------findAndCountAll ------------------');
const apps = await super.findAndCountAll(obj);
return apps;
}
async updateStatus(obj) {
obj.id = obj.bizId;
const res = await this.dao.update(obj);
return res;
}
async updateAndPush(obj) { //服务单分配会计推企服通回传会计信息、并推易代账新建帐套
const res = await this.dao.update(obj);
const findService = await this.dao.findOne({ bizId: obj.bizId });
if (findService) {
let data = {
custName: findService.contactName, //客户名称
corpName: findService.companyInfo.companyName, //企业名称
taxiationArea: findService.companyInfo.companyArea, //报税地区
taxIndustryId: findService.companyInfo.industry, //行业
serviceTypeEnum: "ACCOUTING", // 服务类型:枚举型,包括ACCOUTING-记账服务、INDUSTRY_COMMERCE-工商服务、BOTH-记账与工商服务。
taxNo: findService.companyInfo.taxpayerNumber, // 税号
accountantEmployeeId: obj.accountantAgentAccountId, //所属会计
taxClaimMethodEnum: "TAX_DECLARATION", //申报方式:TAX_DECLARATION-税款申报;ZERO_DECLARATION-零申报;
isBuild: true //是否建账
}
console.log(data);
//TODO: 推企服通回传会计信息
// dev gsbweb.qifu-dev.gongsibao.com/api/opreceive/service/notice
// pro gsbweb.qifu.gongsibao.com/api/opreceive/service/notice
// pushQiFuTong({"actionType":"accountingInfo","actionBody": backData});
// TODO: 分配会计并推送易代账新建帐套 回传后新建本地帐套
const accountset = await ydzPush.pushYiDaZhang(user, data);
const res = await this.accountsetSve.create(accountset);
// TODO: 推送企服通帐套信息
// pushQiFuTong({"actionType":"booksInfo","actionBody": res});
} else {
console.log('查无此单:' + obj.bizId);
}
return res;
}
async updateAndFeedback(obj) { //服务单审核并推送企服通
const res = await this.dao.update(obj);
const findOne = await this.dao.findOne({ bizId: obj.bizId });
const deadline = moment(findOne.updated_at).add(findOne.quantity, 'years');
let backData = {};
if (findOne) {
backData.bizId = findOne.bizId;
backData.auditResult = findOne.status;
if (backData.auditResult == 1) { //审核通过
backData.serviceStartTime = findOne.updated_at;
backData.serviceEndTime = deadline;
}
if (backData.auditResult == 2) { // 审核未通过
backData.note = findOne.feedback_notes;
}
//TODO: 推送企服通
// pushQiFuTong({"actionType":"feedback","actionBody": backData});
} else {
console.log('查无此单:' + obj.bizId);
}
}
}
module.exports = ServicebillService;
\ No newline at end of file
const axios = require("axios");
const settings = require("../../config/settings");
const system = require("../system");
const centerChannelUrl = settings.centerChannelUrl();
/**
* 请求易代账
* 封装 获取 userpin token
*/
const pushYiDaZhang = async(data = {}) => {
const ydzUrl = settings.ydzUrl();
const { appKey, appSecret } = settings.ydzKey();
// const openToken = getOpenTokenByAppKey(appKey, appSecret);
const header = {
"Content-Type": "application/json",
"appKey": appKey,
"appSecret": appSecret,
"openToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NfdG9rZW4iOiI4MjE3MjExMS0xOGIzLTQ4YzgtYTUzMi01ZjVkZjE3ZmM0MTMiLCJzdWIiOiJpc3YiLCJhdWQiOiJpc3YiLCJuYmYiOjE2MDQ2NTcxNDEsImFwcElkIjoiMTA2NSIsInNjb3BlIjoiYXV0aF9hbGwiLCJpc3MiOiJjaGFuamV0IiwiZXhwIjoxNjA1MTc1NTQxLCJ1c2VySWQiOiI2MTAwMDQzMjU3NSIsImlhdCI6MTYwNDY1NzE0MSwib3JnSWQiOiI5MDAwMTIwNTYyNSIsIm9yZ0FjY291bnQiOiJ1MzEzbWN2czR5d2EifQ.j-97chbDAVZQ060EYaLqC6UldYdgdsA4FFrKmCT2tbo"
}
const manageId = await this.getManageIdByOpenToken(header);
await this.postRequest(`${ydzUrl}/ydz/easyacctg/customer/create/{${manageId}}`, data, header);
}
const getOpenTokenByAppKey = async(appKey, appSecret) => {
const data = await this.postRequest(`${ydzUrl}/api/opreceive/accessAuth/getAppTokenByAppKey`, {
"Content-Type": "application/json",
"appKey": appKey,
"appSecret": appSecret
});
return data.token
}
const getManageIdByOpenToken = async(header) => {
const data = await this.postRequest(`${centerChannelUrl}/ydz/setup/openAccess/MainTenant/findMainTenant`, {}, header);
return { manageId: data.id }
}
const postRequest = async(url, data, headers = {}) => {
try {
console.log(` ${url} : 请求信息 ------- `);
console.log(JSON.stringify(data))
console.log(JSON.stringify(headers))
let result = await axios.post(`${url}`, data, {
headers: {
'Content-Type': 'application/json',
...headers
}
});
result = result.data;
console.log(` ${url} : 返回信息 ------- `);
console.log(result);
system.execLogs(
`请求易代账`, {
url,
data,
headers
},
'交付请求',
result,
null
).catch(err => {
console.log(`日志写入错误 ${url}`)
});
if (result.status === 0) {
return result.data
} else {
throw new Error(result.msg)
}
} catch (err) {
console.log(` ${url} : 返回错误信息 ------- `);
console.log(err)
throw (err)
}
}
module.exports = {
pushYiDaZhang,
getManageIdByOpenToken,
getAppTokenByAppKey,
postRequest
}
\ No newline at end of file
var path = require('path'); var path = require('path');
var ENVINPUT = { var ENVINPUT = {
DB_HOST: process.env.DB_HOST, DB_HOST: process.env.DB_HOST,
DB_PORT: process.env.DB_PORT, DB_PORT: process.env.DB_PORT,
DB_USER: process.env.DB_USER, DB_USER: process.env.DB_USER,
DB_PWD: process.env.DB_PWD, DB_PWD: process.env.DB_PWD,
DB_NAME: process.env.DELIVERY_DB_NAME, DB_NAME: process.env.DELIVERY_DB_NAME,
REDIS_HOST: process.env.REDIS_HOST, REDIS_HOST: process.env.REDIS_HOST,
REDIS_PORT: process.env.REDIS_PORT, REDIS_PORT: process.env.REDIS_PORT,
REDIS_PWD: process.env.REDIS_PWD, REDIS_PWD: process.env.REDIS_PWD,
REDIS_DB: process.env.PAAS_REDIS_DB, REDIS_DB: process.env.PAAS_REDIS_DB,
APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "dev" APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "dev"
}; };
var settings = { var settings = {
env: ENVINPUT.APP_ENV, env: ENVINPUT.APP_ENV,
salt: "%iatpD1gcxz7iF#B", salt: "%iatpD1gcxz7iF#B",
defaultpwd: "gsb2020", defaultpwd: "gsb2020",
basepath: path.normalize(path.join(__dirname, '../..')), basepath: path.normalize(path.join(__dirname, '../..')),
port: process.env.NODE_PORT || 8002, port: process.env.NODE_PORT || 8002,
logindex: "center_manage", logindex: "center_manage",
appname: "icp_deliver", appname: "icp_deliver",
appKey: "202003231118", appKey: "202003231118",
secret: "7cbb846246874167b5c7e01cd0016c99", secret: "7cbb846246874167b5c7e01cd0016c99",
kongurl: function () { if (this.env == "dev") { var localsettings = require("./localsettings"); return localsettings.kongurl; } else { return ENVINPUT.KONG_ADMIAN; } }, kongurl: function() { if (this.env == "dev") { var localsettings = require("./localsettings"); return localsettings.kongurl; } else { return ENVINPUT.KONG_ADMIAN; } },
txurl: function () { txurl: function() {
if (this.env == "dev") { var localsettings = require("./localsettings"); return localsettings.txurl; } if (this.env == "dev") { var localsettings = require("./localsettings"); return localsettings.txurl; } else { return "http://brg-user-center-service"; }
else { return "http://brg-user-center-service"; } },
}, logUrl: function() {
logUrl: function () { if (this.env == "dev") {
if (this.env == "dev") { return "http://192.168.18.101:4019/api/queueAction/producer/springBoard";
return "http://192.168.18.101:4019/api/queueAction/producer/springBoard"; } else {
} else { return "http://logs-sytxpublic-msgq-service.chaolai/api/queueAction/producer/springBoard";
return "http://logs-sytxpublic-msgq-service.chaolai/api/queueAction/producer/springBoard"; }
},
requrl: function() {
if (this.env == "dev") {
return "http://192.168.1.128:4018";
} else {
return "http://sytxpublic-msgq-service";
}
},
centerChannelUrl: function() { //---------center-channel
if (this.env == "dev") {
return "http://alitm.qifu-dev.gongsibao.com";
} else {
return "http://center-channel-service.chaolai";
}
},
qifutongUrl: function() { //---------center-channel
if (this.env == "dev") {
return "http://gsbweb.qifu-dev.gongsibao.com";
} else {
return "https://fqgsbweb.gongsibao.com";
}
},
queueUrl: function() {
if (this.env == "dev") {
return "http://192.168.18.101:4018/api/queueAction/producer/springBoard";
} else {
return "http://sytxpublic-msgq-service.chaolai/api/queueAction/producer/springBoard";
}
},
ydzUrl: function() { //TODO: 易代账URL
if (this.env == "dev") {
return "https://sandbox-openapi.chanjet.com";
} else {
return "";
}
},
ydzKey: function() { //TODO: 易代账Key
if (this.env == "dev") {
return { "appKey": "qP2tgcfw", "appSecret": "D25E0435ACFB4844DB75E7E0F87B9F71" };
} else {
return { "appKey": "", "appSecret": "" };
}
},
pmappid: 1,
pmcompanyid: 1,
pmroleid: { "ta": 1, "pr": 2 },
redis: function() {
if (this.env == "dev") {
var localsettings = require("./localsettings");
return localsettings.redis;
} else {
return {
host: ENVINPUT.REDIS_HOST,
port: ENVINPUT.REDIS_PORT,
password: ENVINPUT.REDIS_PWD,
db: ENVINPUT.REDIS_DB,
};
}
},
database: function() {
if (this.env == "dev") {
var localsettings = require("./localsettings");
return localsettings.database;
} else {
return {
dbname: ENVINPUT.DB_NAME,
user: ENVINPUT.DB_USER,
password: ENVINPUT.DB_PWD,
config: {
host: ENVINPUT.DB_HOST,
port: ENVINPUT.DB_PORT,
dialect: 'mysql',
operatorsAliases: false,
pool: {
max: 5,
min: 0,
acquire: 90000000,
idle: 1000000
},
debug: false,
timezone: '+08:00',
dialectOptions: {
requestTimeout: 999999,
// instanceName:'DEV'
} //设置MSSQL超时时间
},
};
}
} }
},
requrl: function () {
if (this.env == "dev") {
return "http://192.168.1.128:4018";
} else {
return "http://sytxpublic-msgq-service";
}
},
centerChannelUrl: function () {//---------center-channel
if (this.env == "dev") {
return "http://alitm.qifu-dev.gongsibao.com";
} else {
return "http://center-channel-service.chaolai";
}
},
qifutongUrl: function () {//---------center-channel
if (this.env == "dev") {
return "http://gsbweb.qifu-dev.gongsibao.com";
} else {
return "https://fqgsbweb.gongsibao.com";
}
},
queueUrl: function () {
if (this.env == "dev") {
return "http://192.168.18.101:4018/api/queueAction/producer/springBoard";
} else {
return "http://sytxpublic-msgq-service.chaolai/api/queueAction/producer/springBoard";
}
},
pmappid: 1,
pmcompanyid: 1,
pmroleid: { "ta": 1, "pr": 2 },
redis: function () {
if (this.env == "dev") {
var localsettings = require("./localsettings");
return localsettings.redis;
} else {
return {
host: ENVINPUT.REDIS_HOST,
port: ENVINPUT.REDIS_PORT,
password: ENVINPUT.REDIS_PWD,
db: ENVINPUT.REDIS_DB,
};
}
},
database: function () {
if (this.env == "dev") {
var localsettings = require("./localsettings");
return localsettings.database;
} else {
return {
dbname: ENVINPUT.DB_NAME,
user: ENVINPUT.DB_USER,
password: ENVINPUT.DB_PWD,
config: {
host: ENVINPUT.DB_HOST,
port: ENVINPUT.DB_PORT,
dialect: 'mysql',
operatorsAliases: false,
pool: {
max: 5,
min: 0,
acquire: 90000000,
idle: 1000000
},
debug: false,
timezone: '+08:00',
dialectOptions: {
requestTimeout: 999999,
// instanceName:'DEV'
} //设置MSSQL超时时间
},
};
}
}
}; };
settings.ENVINPUT = ENVINPUT; settings.ENVINPUT = ENVINPUT;
module.exports = settings; module.exports = settings;
\ 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