Commit bdf68ce3 by 王昆

gsb

parent 7808044c
......@@ -7,6 +7,17 @@ class CtlBase {
this.cacheManager = system.getObject("db.common.cacheManager");
this.md5 = require("MD5");
}
async getDeliver(req) {
let jo = await redisClient.get(req.sid + "_deliver");
if (!jo) {
return null;
}
try {
return JSON.parse(jo);
} catch (e) {
return null;
}
}
encryptPasswd(passwd) {
if (!passwd) {
throw new Error("请输入密码");
......
const system = require("../system");
const settings = require("../../config/settings");
const redisClient = system.getObject("util.redisClient");
class CtlBase {
constructor() {
this.restClient = system.getObject("util.restClient");
......@@ -13,6 +14,17 @@ class CtlBase {
return system.getResultFail(-200, "Ctl出现异常,请联系管理员");
}
}
async getDeliver(req) {
let jo = await redisClient.get(req.sid + "_deliver");
if (!jo) {
return null;
}
try {
return JSON.parse(jo);
} catch (e) {
return null;
}
}
encryptPasswd(passwd) {
if (!passwd) {
throw new Error("请输入密码");
......
......@@ -114,5 +114,49 @@ class DeliverCtl extends CtlBase {
}
}
async provinceList(pobj, pobj2, req) {
try {
return system.getResultSuccess([
{"id": 1100, "name":"北京市"},
{"id": 1200, "name":"天津市"},
{"id": 1300, "name":"河北省"},
{"id": 1400, "name":"山西省"},
{"id": 1500, "name":"内蒙古自治区"},
{"id": 2100, "name":"辽宁省"},
{"id": 2200, "name":"吉林省"},
{"id": 2300, "name":"黑龙江省"},
{"id": 3100, "name":"上海市"},
{"id": 3200, "name":"江苏省"},
{"id": 3300, "name":"浙江省"},
{"id": 3400, "name":"安徽省"},
{"id": 3500, "name":"福建省"},
{"id": 3600, "name":"江西省"},
{"id": 3700, "name":"山东省"},
{"id": 4100, "name":"河南省"},
{"id": 4200, "name":"湖北省"},
{"id": 4300, "name":"湖南省"},
{"id": 4400, "name":"广东省"},
{"id": 4500, "name":"广西壮族自治区"},
{"id": 5000, "name":"重庆市"},
{"id": 5100, "name":"四川省"},
{"id": 5200, "name":"贵州省"},
{"id": 5300, "name":"云南省"},
{"id": 5400, "name":"西藏自治区"},
{"id": 6100, "name":"陕西省"},
{"id": 6200, "name":"甘肃省"},
{"id": 6300, "name":"青海省"},
{"id": 6400, "name":"宁夏回族自治区"},
{"id": 6500, "name":"新疆维吾尔自治区"},
{"id": 7100, "name":"台湾省"},
{"id": 8100, "name":"香港特别行政区"},
{"id": 8200, "name":"澳门特别行政区"},
]);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
}
module.exports = DeliverCtl;
\ No newline at end of file
......@@ -3,8 +3,17 @@ const CtlBase = require("../../ctlms.base");
class InvoiceCtl extends CtlBase {
constructor() {
super();
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
this.deliverSve = system.getObject("service.common.deliverSve");
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
this.pageType = {
"0": ["2020", "2030"], // 我的业务发票
"1": ["2010"], // 发票办理
};
}
getPageStatus(type) {
type = this.trim(type || "0");
return this.pageType[type];
}
/**
......@@ -34,15 +43,34 @@ class InvoiceCtl extends CtlBase {
}
}
setRoleAuth(pobj, loginUser) {
if (loginUser.isManager) {
// 暂时先什么都不做
} else
if (loginUser.isMain) {
if (!loginUser.org_path) {
return system.getResultSuccess({count: 0, rows: []});
}
pobj.operator_path_like = loginUser.org_path + "%";
} else {
pobj.operator_id = loginUser.id || 0;
}
}
/**
* 发票申请列表-业务员
* @param {*} pobj
*/
async myInvoicePage(pobj, pobj2, req) {
try {
pobj.operator_id = req.loginUser.id;
pobj.assigned = true;
// 获取页面类型状态
pobj.statuses = this.getPageStatus(pobj.pageType);
// 设置角色参数
this.setRoleAuth(pobj, req.loginUser);
this.doTimeCondition(pobj, ["createTimeBegin", "createTimeEnd"]);
return await this.invoiceSve.invoicePage(pobj);
return await this.invoiceSve.invoicePage(pobj);
} catch (error) {
console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
......@@ -53,15 +81,8 @@ class InvoiceCtl extends CtlBase {
* 进度处理
* @param {*} pobj
*/
async handleStatus(pobj, pobj2, req) {
async handleStatus(pobj) {
try {
if(pobj.status=="1030" || pobj.operator_id){
let user = await this.deliverSve.deliverUserById({id: pobj.operator_id});
if (!user || user.status != 0 || !user.data) {
return system.getResult(null, `业务员【${pobj.operator_id}】不存在`);
}
pobj.operator_path = user.data.org_path;
}
return await this.invoiceSve.handleStatus(pobj);
} catch (error) {
console.log(error);
......@@ -82,6 +103,102 @@ class InvoiceCtl extends CtlBase {
}
}
/**
* 发票申请
* @param {*} pobj
*/
async invoiceApply(pobj, pobj2, req) {
if(!pobj.deliver_id){
return system.getResult(null,`请重新登录`);
}
try {
pobj.invoice_amount = system.y2f(pobj.invoice_amount);
pobj.additional_tax = system.y2f(pobj.additional_tax);
pobj.value_added_tax = system.y2f(pobj.value_added_tax);
pobj.personal_invoice_tax = system.y2f(pobj.personal_invoice_tax);
// pobj.invoice_content = system.y2f(pobj.invoice_content);
return await this.invoiceSve.invoiceApply(pobj);
} catch (error) {
console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/************************一下是阿里接口*************************************/
/**
*发票开具
* @returns {Promise<void>}
*/
async deliveryAcceptance(pobj, pobj2, req){
try {
let rs = await this.invoiceSve.handleStatus(pobj);
if (rs && rs.status === 0) {
// this.记账
this.jizhang(pobj, pobj2, req);
}
return rs;
} catch (error) {
console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
async jizhang(pobj, pobj2, req) {
return await this.invoiceSve.uploadDetail(pobj.invoice_id);
}
/**
* 客户交付
* @param pobj
* @param pobj2
* @param req
* @returns {Promise<void>}
*/
async deliveryCustomer(pobj, pobj2, req){
if(!pobj.invoice_id){
return system.getResult(null, `参数错误 发票ID 不能为空`);
}
if(!pobj.deliver_mail_no){
return system.getResult(null, `参数错误 快递单不能为空`);
}
try {
return await this.invoiceSve.handleStatus(pobj);
} catch (error) {
console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 分配业务员
* @param pobj
* @param pobj2
* @param req
* @returns {Promise<void>}
*/
async deliverAssignSalesman(pobj, pobj2, req) {
if (!pobj.invoice_id) {
return system.getResult(null, `参数错误 发票ID不能为空`);
}
if (!pobj.status) {
return system.getResult(null, `参数错误 订单状态不能为空`);
}
if (!pobj.operator_id) {
return system.getResult(null, `参数错误 业务员ID不能为空`);
}
let user = await this.deliverSve.deliverUserById({id: pobj.operator_id});
if (!user || user.status != 0 || !user.data) {
return system.getResult(null, `业务员【${pobj.operator_id}】不存在`);
}
pobj.operator_path = user.data.org_path;
try {
return await this.invoiceSve.handleStatus(pobj);
} catch (error) {
console.log(error);
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
}
......
......@@ -48,11 +48,12 @@ class UserCtl extends CtlBase {
let loginBaseUrl = system.base64_encode(loginUrl);
let test = system.base64_decode(loginBaseUrl);
console.log(test);
let subsid = "sub_" + loginKey.xggadminsid.replace("jfs_", "");
let rs = {
key: loginKey.xggadminsid,
taxLoginUrl: ntapi.taxLoginUrl + `?username=${loginUser.ucname}&cookieId=${loginKey.subsid}&target=tax&baseurl=${loginBaseUrl}`,
finLoginUrl: ntapi.taxLoginUrl + `?username=${loginUser.ucname}&cookieId=${loginKey.subsid}&baseurl=${loginBaseUrl}`,
taxLoginUrl: ntapi.taxLoginUrl + `?username=${loginUser.ucname}&cookieId=${subsid}&target=tax&baseurl=${loginBaseUrl}`,
finLoginUrl: ntapi.taxLoginUrl + `?username=${loginUser.ucname}&cookieId=${subsid}&baseurl=${loginBaseUrl}`,
loginname: loginUser.ucname,
auth: loginUser.auth,
isManager: loginUser.isManager,
......@@ -67,19 +68,35 @@ class UserCtl extends CtlBase {
}
}
async ngaLogin(params, pobj2, req, res) {
// 登录用户
let loginUser = req.loginUser;
// 登录地址加密
let ntapi = settings.ntapi();
let loginUrl = settings.protocalPrefix + req.headers['host'] + "/#/logins";
console.log(loginUrl, "---------------loginUrl--------------");
let loginBaseUrl = system.base64_encode(loginUrl);
let url;
// 登录用户key
let subsid = "sub_" + req.sid.replace("jfs_", "");
await this.redisClientTax.setWithEx(subsid, (loginUser.nt_user_id || "").toString(), 60 * 60 * 5);
if (params.type == "tax") {
url = ntapi.taxLoginUrl + `?username=${loginUser.ucname}&cookieId=${subsid}&target=tax&baseurl=${loginBaseUrl}`;
} else {
url = ntapi.finLoginUrl + `?username=${loginUser.ucname}&cookieId=${subsid}&baseurl=${loginBaseUrl}`;
}
return system.getResult(url);
}
async setLogin(user) {
user.loginsid = "jfs_" + uuidv4();
user.subsid = "sub_" + uuidv4();
// if(settings.env == 'dev') {
// user.loginsid = "jfs_" + "3cb49932-fa02-44f0-90db-9f06fe02e5c7";
// user.subsid = "sub_" + "3cb49932-fa02-44f0-90db-9f06fe02e5c7";
// }
// xggadminsid = "jfs_" + "3cb49932-fa02-44f0-90db-9f06fe02e5c7";
await this.redisClient.setWithEx(user.loginsid, JSON.stringify(user), 60 * 60 * 5);
await this.redisClientTax.setWithEx(user.subsid, (user.nt_user_id || "").toString(), 60 * 60 * 5);
await this.redisClient.setWithEx(user.loginsid + "_deliver", JSON.stringify(user.deliver), 60 * 60 * 5);
return {
xggadminsid: user.loginsid,
subsid: user.subsid,
xggadminsid: user.loginsid
};
}
......@@ -115,10 +132,13 @@ class UserCtl extends CtlBase {
"name": "订单中心",
"icon": "iconfont icon-gth-gsdingdanzhongxin",
"team": [
{
"name": "订单管理",
"path": "/trading/ordersAll"
},
{"name": "全部订单", "path": "/trading/ordersAll"},
{"name": "工商注册", "path": "/trading/glyRegister"},
{"name": "刻章办理", "path": "/trading/glyHandle"},
{"name": "银行开户", "path": "/trading/glyBank"},
{"name": "税务报道", "path": "/trading/glyReport"},
{"name": "代理记账", "path": "/trading/glyAccount"},
{"name": "我的业务订单", "path": "/trading/glyorderInformation"},
]
},
{
......@@ -131,16 +151,6 @@ class UserCtl extends CtlBase {
},
]
},
// {
// "name": "用户中心",
// "icon": "iconfont icon-gth-gsgetihuzhongxin",
// "team": [
// {
// "name": "用户管理",
// "path": "/user/userCenter"
// }
// ]
// }
];
} else {
return [
......@@ -158,10 +168,12 @@ class UserCtl extends CtlBase {
"name": "订单中心",
"icon": "iconfont icon-gth-gsdingdanzhongxin",
"team": [
{
"name": "我的业务订单",
"path": "/trading/orderInformation"
}
{"name": "工商注册", "path": "/trading/glyRegister"},
{"name": "刻章办理", "path": "/trading/glyHandle"},
{"name": "银行开户", "path": "/trading/glyBank"},
{"name": "税务报道", "path": "/trading/glyReport"},
{"name": "代理记账", "path": "/trading/glyAccount"},
{"name": "我的业务订单", "path": "/trading/glyorderInformation"},
]
},
{
......@@ -194,7 +206,8 @@ class UserCtl extends CtlBase {
icon: "iconfont icon-gth-gsfapiaozhongxin",
team: [
{name: "发票申请", path: "/trading/invoiceApplyFor"},
{name: "发票管理", path: "/trading/invoiceManagement"},
{name: "发票办理", path: "/trading/invoiceManagement"},
{name: "我的发票业务", path: "/trading/invoiceApplyMy"},
]
}
];
......@@ -209,8 +222,8 @@ class UserCtl extends CtlBase {
name: "发票中心",
icon: "iconfont icon-gth-gsfapiaozhongxin",
team: [
{name: "我的业务发票", path: "/trading/invoiceApplyMy"},
{name: "我的全部发票", path: "/trading/invoicesAllMy"},
{name: "发票办理", path: "/trading/invoiceManagement"},
{name: "我的发票业务", path: "/trading/invoiceApplyMy"},
]
}
];
......
......@@ -7,6 +7,12 @@ class BusinessmenService extends ServiceBase {
super();
}
async byOrderId(params) {
let rs = await this.callms("order", "businessmenByOrderId", params);
this.transField([rs.data]);
return rs;
}
async allPage(params) {
let rs = await this.callms("order", "businessmenPage", params);
if (rs.status != 0 || !rs.data || !rs.data.rows) {
......
......@@ -60,7 +60,12 @@ class DeliverService extends ServiceBase {
this.synSave(rs.data.id, params.password);
}
return rs;
}
}
async deliverUserInfo(params) {
let rs = await this.callms("common", "deliverUserInfo", params);
return rs;
}
async synSave(id, password) {
let rs = await this.callms("common", "deliverUserInfo", {id: id});
......
const system = require("../../../system");
const ServiceBase = require("../../svems.base")
const settings = require("../../../../config/settings")
const moment = require("moment")
class InvoiceService extends ServiceBase {
constructor() {
super();
......@@ -37,5 +38,184 @@ class InvoiceService extends ServiceBase {
return rs;
}
/**
* fn:为了对接财务宝 格式化发票类型
*
* @param {*} invoice_type
*/
formatInvoiceType(invoicesummaryinfo) {
let _billType = null;
if (!invoicesummaryinfo.invoice_type) {
return system.getResult(null, `系统错误 发票类型错误`);
}
if (invoicesummaryinfo['invoice_type'] == '10') {
_billType = `1`;
} else if (invoicesummaryinfo['invoice_type'] == '20') {
_billType = `2`;
} else if (invoicesummaryinfo['invoice_type'] == '30') {
_billType = `0`;
} else {
return system.getResult(null, `系统错误 发票类型错误`);
}
return _billType;
}
/**
* fn:为了对接财务宝 格式化发票联次
*
* @param {*} invoice_type
*/
formatInvoiceJoin(invoicesummaryinfo) {
let invoiceOrder = null;
if (!invoicesummaryinfo.invoice_join) {
return system.getResult(null, `系统错误 发票联次错误`);
}
if (invoicesummaryinfo['invoice_join'] == '10') {
invoiceOrder = `3`;
} else if (invoicesummaryinfo['invoice_join'] == '20') {
invoiceOrder = `0`;
} else if (invoicesummaryinfo['invoice_join'] == '30') {
invoiceOrder = `1`;
} else if (invoicesummaryinfo['invoice_join'] == '40') {
invoiceOrder = `2`;
} else {
return system.getResult(null, `系统错误 发票类型错误`);
}
return invoiceOrder;
}
/**
* fn:为了对接财务宝 格式化发票摘要
* @param {*} invoicesummaryinfo
*/
formatSummary(invoicesummaryinfo) {
if (!invoicesummaryinfo.summary) {
return system.getResult("系统错误 发票摘要信息错误");
}
let _res = [];
for (let item of invoicesummaryinfo.summary) {
// item = JSON.parse(item);
let temp = {
abstractMsg: item.summaryInfo,
attr: {
"standard": item.category,
"unit": item.unit,
"number": item.number,
"unit_price": item.unitPrice
},
amount: item.amount,
tax: item.taxAmount,
totalPrice: Number(item.amount) + Number(item.taxAmount),
taxrate: item.taxRate,
abstractType: item.summaryType
};
_res.push(temp);
}
return _res;
}
/**
* fn:提交发票道财税系统
* @param {*} invoice_id
*/
async uploadDetail(invoice_id) {
let invoice = await this.callms("invoice", "invoice", {
id: invoice_id
});
if (!invoice || !invoice.data) {
return system.getResult(`发票不存在`);
}
//获取个体户信息 拿到customer 在order服务下 参数:通过merchant_credit_code或者是merchant_id (购买方商户)
if (!invoice.data.invoicesummaryinfo || !invoice.data.invoicesummaryinfo.businessmen_credit_code) {
return system.getResult(`发票信息错误`);
}
let businessmen = await this.callms("order", "queryObusinessmenByCreditCode", {
credit_code: invoice.data.invoicesummaryinfo.businessmen_credit_code
});
//获取交付商信息 拿到companyID 在common服务下 参数:通过deliver_id
if (!invoice.data.deliver_id) {
return system.getResult(`交付商不存在`);
}
var deliver = await this.callms("common", "deliverInfo", {
id: invoice.data.deliver_id
});
if (!deliver.data) {
return system.getResult(null, `交付商不存在`);
}
if (!deliver.data.nt_company_id) {
return system.getResult(null, `个体户还未建账,请先建账`);
}
let _params = await this.buildParams(businessmen.data, invoice.data, deliver.data) || {};
try {
if (!_params) {
console.log("推送失败,参数错误");
return system.getResult("推送失败,参数错误");
}
let url = settings.ntapi().uploadDetail;
let res = await this.callApi(url, _params, "提交发票");
console.log(res);
if (!res || res.code != '000000') {
return system.getResult(null, "提交发票失败");
}
//更新发票建账
await this.callms("invoice", "uploadDetail", {
id: invoice_id
});
return system.getResultSuccess();
} catch (error) {
console.log(error);
return system.getResult(null, `系统错误 推送失败`);
}
}
// http://nga-api.gongsibao.com/nga-api/uploadDetail
/**
* 推送票据
*/
async buildParams(businessmen, invoice, deliver) {
try {
let _invoicesummaryinfo = invoice.invoicesummaryinfo || null;
if (!_invoicesummaryinfo) {
return system.getResult(null, `系统错误 发票信息错误`);
}
let params = {
companyId: deliver.nt_company_id, //公司ID
customerId: businessmen.customer_id, //客户ID
uploadPeriod: moment(businessmen.create_account_time).format('YYYYMM'), //上传账期
imageName: invoice['invoice_img'].slice(invoice['invoice_img'].lastIndexOf("/") + 1) || "", //图片名称
imageBasename: invoice['invoice_img'] || "", //图片url
billType: this.formatInvoiceType(_invoicesummaryinfo), //发票类型
isDaikai: `1`, //是否代开 1:yes 0:no
signDate: moment(_invoicesummaryinfo.invoice_time).format("YYYY-MM-DD"), //开票时间
invoiceCode: _invoicesummaryinfo.invoice_no, //发票代码
invoiceNumber: _invoicesummaryinfo.invoice_number, //发票号码
invoiceOrder: this.formatInvoiceJoin(_invoicesummaryinfo), //发票联次
payName: _invoicesummaryinfo.merchant_name,
receiveName: _invoicesummaryinfo.businessmen_name,
payBank: _invoicesummaryinfo.merchant_bank,
payAccount: _invoicesummaryinfo.merchant_account,
payTel: _invoicesummaryinfo.merchant_mobile,
payAddress: _invoicesummaryinfo.merchant_addr,
payAccountAame: "", //xxxx
payerTaxIdentificationNumber: _invoicesummaryinfo.merchant_credit_code,
receiveBank: _invoicesummaryinfo.businessmen_bank,
receiveAccount: _invoicesummaryinfo.businessmen_account,
receiveTel: _invoicesummaryinfo.businessmen_mobile,
receiveAddress: _invoicesummaryinfo.businessmen_addr,
receiveTaxIdentificationNumber: _invoicesummaryinfo.businessmen_credit_code,
// province: PROVINCE_CODE_MAP[_invoicesummaryinfo.province],
province: _invoicesummaryinfo.province,
receiveAccountName: "", //xxxx
sourceClient: "0", //票据来源
createDate: moment(_invoicesummaryinfo.created_at).format("YYYY-MM-DD HH:ss:mm"), //创建时间
// createDate:new Date(_invoicesummaryinfo.created_at), //创建时间
list: this.formatSummary(_invoicesummaryinfo)
}
return params;
} catch (error) {
console.log(error);
return {};
}
}
}
module.exports = InvoiceService;
\ No newline at end of file
......@@ -34,6 +34,11 @@ class OrderService extends ServiceBase {
return rs;
}
async orderAndDeliver(params) {
var rs = await this.callms("order", "orderAndDeliver", params);
return rs;
}
async orderInfoAll(params) {
let rs = await this.callms("order", "orderInfoAll", params);
// await this.setUcUser([rs.data.order]);
......@@ -61,6 +66,24 @@ class OrderService extends ServiceBase {
}
}
}
async setDeliverOperatorUser(rows) {
if (!rows || rows.length == 0) {
return;
}
let ids = [];
for (let row of rows) {
if (row.odeliver && row.odeliver.operator_id) {
ids.push(row.odeliver.operator_id);
}
}
let map = await this.deliverSve.mayByIds(ids);
for (let row of rows) {
let user = map[row.odeliver.operator_id] || {};
row.odeliver.operator_name = user.real_name || "";
}
}
async setUcUser(rows) {
if (!rows || rows.length == 0) {
......@@ -121,5 +144,46 @@ class OrderService extends ServiceBase {
var rs = await this.callms("order", "updateOBusinessmenProinvce", params);
return rs;
}
/*********************************************以下是阿里的接口****************************************************************/
/**
* 添加订单
* @param params
* @returns {Promise<{msg: string, data: (*|null), bizmsg: string, status: number}|{msg: string, data, bizmsg: *|string, status: number}|*|undefined>}
*/
async addSourceOrder(params) {
try {
return await this.callms("order", "addSourceOrder", params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async aliOrderPageAll(params){
try {
let rs = await this.callms("order", "aliOrderPageAll", params);
if (rs.status === 0 && rs.data) {
await this.setDeliverOperatorUser(rs.data.rows);
}
return rs;
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async aliOrderPage(params){
try {
let rs = await this.callms("order", "aliOrderPage", params);
if (rs.status === 0 && rs.data) {
await this.setDeliverOperatorUser(rs.data.rows);
}
return rs;
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
}
module.exports = OrderService;
\ No newline at end of file
......@@ -132,7 +132,7 @@ class UserService extends ServiceBase {
async salesmanList(params) {
try {
let rs = await this.callms("common", "deliverUsers", params);
let rs = await this.callms("common", "deliverUserAll", params);
return rs;
} catch (error) {
console.log(error);
......
......@@ -193,18 +193,17 @@ class System {
// merchant: "http://127.0.0.1:3101" + path,
// 订单服务
order: domain2+ ":3103" + path,
// order: domain + ":3103" + path,
order: domain2 + ":3103"+ path,
// 发票服务
invoice: domain2 + ":3105" + path,
// invoice: "http://127.0.0.1:3105" + path,
// 发票服务
uc: domain2 + ":3106" + path,
// uc: "http://127.0.0.1:3106" + path,
}
} else {
var odomain = "http://123.57.217.203"
return {
common: "xggsvecommon-service" + path,
merchant: "xggsvemerchant-service" + path,
......
......@@ -16,13 +16,13 @@ module.exports = function (app) {
jsonUser = JSON.parse(jsonUser);
}
}
req.sid = xggadminsid || "";
if (req.url.indexOf("auth/userCtl/login") > 0 ||
req.url.indexOf("uc/userCtl/login") > 0 ||
req.url.indexOf("auth/userCtl/smsCode") > 0 ||
req.url.indexOf("common/metaCtl/getApiDoc") > 0 ||
req.url.indexOf("common/captchaCtl/captcha") > 0 ||
req.url.indexOf("invoice/invoiceCtl/jizhang") > 0 ||
req.url.indexOf("getRsConfig") > 0) {
if (jsonUser) {
req.loginUser = jsonUser;
......@@ -104,6 +104,11 @@ module.exports = function (app) {
req.body.saas_id = req.loginUser.saas_id;
req.body.deliverId = req.loginUser.deliver_id || "";
req.body.deliver_id = req.loginUser.deliver_id || "";
req.body.deliverName = req.loginUser.deliver.name ||"";
req.body.deliver_user_id = req.loginUser.id || "";
req.body.deliver_user_path = req.loginUser.org_path || "";
req.body.isManager = req.loginUser.isManager;
req.body.isAdmin = req.loginUser.isAdmin;
}
params.push(methodName);
......
......@@ -26,7 +26,7 @@ var settings = {
salt: "%iatpD1gcxz7iF#B",
defaultpwd: "987456",
basepath: path.normalize(path.join(__dirname, '../..')),
port: process.env.NODE_PORT || 3012,
port: process.env.NODE_PORT || 3112,
reqEsAddr: function () {
if (this.env == "dev") {
var localsettings = require("./localsettings");
......@@ -91,7 +91,7 @@ var settings = {
domain_page = "https://nt.gongsibao.com";
} else {
domain = "https://nga-api.gongsibao.com";
domain_page = "https://nga.gongsibao.com";
domain_page = "https://ali-saas.gongsibao.com";
}
return {
......@@ -127,10 +127,14 @@ var settings = {
redisTax: function () {
if (this.env == "dev") {
return {
host: "47.94.0.45",
// host: "47.94.0.45",
// port: "6379",
// password: "nga2020",
// db: "0",
host: "r-2zejem2xk438n71rny.redis.rds.aliyuncs.com",
port: "6379",
password: "nga2020",
db: "0",
password: "yo#@eXz9EMpa+5O",
db: "10",
};
} else {
return {
......
<a name="menu">目录</a>
1. [登录](#login)
1. [财税登录](#ngaLogin)
1. [当前用户信息查询](#currentUser)
## **<a name="login"> 登录</a>**
......@@ -35,6 +36,33 @@
```
## **<a name="ngaLogin"> 财税登录</a>**
[返回到目录](#menu)
##### URL
[/web/uc/userCtl/ngaLogin]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
| 参数 | 必选 | 类型 | 说明|
| -------- | -------- | ------------|---------|
| **type** | 是 | String | 税务或者财务(tax, fin)|
```javascript
{
"type": "tax" // 登录类型 tax税务 fin财务
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": "https://nt.gongsibao.com/web/auth?..." // 登录地址,判断一下不为空的话,window.open这个
}
```
## **<a name="currentUser"> 当前用户信息查询</a>**
[返回到目录](#menu)
......
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