Commit 0f9b8586 by 王悦

fix name zhiquanquan

parent 97c05708
#!/bin/bash #!/bin/bash
FROM registry.cn-beijing.aliyuncs.com/hantang2/node105:v2 FROM registry.cn-beijing.aliyuncs.com/hantang2/node105:v2
MAINTAINER jy "jiangyong@gongsibao.com" MAINTAINER jy "jiangyong@gongsibao.com"
ADD gsb-marketplat /apps/gsb-marketplat/ ADD zhiquanquan /apps/zhiquanquan/
WORKDIR /apps/gsb-marketplat/ WORKDIR /apps/zhiquanquan/
RUN cnpm install -S RUN cnpm install -S
CMD ["node","/apps/gsb-marketplat/main.js"] CMD ["node","/apps/gsb-marketplat/main.js"]
......
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/gsb-marketplat.iml" filepath="$PROJECT_DIR$/.idea/gsb-marketplat.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
const APIBase = require("../../api.base"); const APIBase = require("../../api.base");
const system = require("../../../system"); const system = require("../../../system");
const settings = require("../../../../config/settings"); const settings = require("../../../../config/settings");
/** /**
* 用户端调用订单相关接口 * 用户端调用订单相关接口
*/ */
class Template extends APIBase { class Template extends APIBase {
constructor() { constructor() {
super(); super();
this.templateinfoSve = system.getObject("service.template.templateinfoSve"); this.templateinfoSve = system.getObject("service.template.templateinfoSve");
this.templatelinkSve = system.getObject("service.template.templatelinkSve"); this.templatelinkSve = system.getObject("service.template.templatelinkSve");
this.formsubmitrecordSve= system.getObject("service.configmag.formsubmitrecordSve"); this.formsubmitrecordSve= system.getObject("service.configmag.formsubmitrecordSve");
this.forminfoSve= system.getObject("service.configmag.forminfoSve"); this.forminfoSve= system.getObject("service.configmag.forminfoSve");
this.redisClient = system.getObject("util.redisClient"); this.redisClient = system.getObject("util.redisClient");
this.formCache={}; this.formCache={};
} }
/** /**
* 接口跳转-POST请求 * 接口跳转-POST请求
* action_process 执行的流程 * action_process 执行的流程
* action_type 执行的类型 * action_type 执行的类型
* action_body 执行的参数 * action_body 执行的参数
*/ */
async springBoard(pobj, qobj, req) { async springBoard(pobj, qobj, req) {
if (!pobj.actionType) { if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空"); return system.getResult(null, "actionType参数不能为空");
} }
var result = await this.opActionProcess(pobj, pobj.actionType, req); var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result; return result;
} }
async opActionProcess(pobj, action_type, req) { async opActionProcess(pobj, action_type, req) {
var opResult = null; var opResult = null;
var self = this; var self = this;
pobj.clientIp = req.clientIp; pobj.clientIp = req.clientIp;
pobj.xctx = req.xctx; pobj.xctx = req.xctx;
switch (action_type) { switch (action_type) {
case "editTemplateContent"://修改模板内容 case "editTemplateContent"://修改模板内容
opResult = await this.templateinfoSve.editTemplateContent(pobj); opResult = await this.templateinfoSve.editTemplateContent(pobj);
break; break;
case "findOneByCode"://模板查询 case "findOneByCode"://模板查询
opResult = await this.templateinfoSve.getTemplateInfoByCode(pobj); opResult = await this.templateinfoSve.getTemplateInfoByCode(pobj);
break; break;
case "getTemplateAndLinkInfo"://根据链接参数获取模板链接信息 case "getTemplateAndLinkInfo"://根据链接参数获取模板链接信息
console.log("getTemplateAndLinkInfo+++++++++++++++++++++++++++"); console.log("getTemplateAndLinkInfo+++++++++++++++++++++++++++");
console.log(JSON.stringify(pobj)); console.log(JSON.stringify(pobj));
opResult = await this.templatelinkSve.getTemplateAndLinkInfo2(pobj); opResult = await this.templatelinkSve.getTemplateAndLinkInfo2(pobj);
break; break;
case "submitFormRecord"://提交表单记录 case "submitFormRecord"://提交表单记录
opResult = await this.formsubmitrecordSve.submitFormRecord(pobj); opResult = await this.formsubmitrecordSve.submitFormRecord(pobj);
break; break;
case "pushFormInfo2Fq"://推送需求表单信息至蜂擎 case "pushFormInfo2Fq"://推送需求表单信息至蜂擎
opResult = await this.formsubmitrecordSve.pushFormInfo2Fq(); opResult = await this.formsubmitrecordSve.pushFormInfo2Fq();
break; break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
} }
return opResult; return opResult;
} }
async getFormInfoById(pobj, qobj, req){ async getFormInfoById(pobj, qobj, req){
var shaStr = "forminfo_"+pobj.id; var shaStr = "forminfo_"+pobj.id;
var rtn = null; var rtn = null;
console.log(this.formCache,"+++++++++++++getFormInfoById++++++++++++++++++++++"); console.log(this.formCache,"+++++++++++++getFormInfoById++++++++++++++++++++++");
if(this.formCache[shaStr]){ if(this.formCache[shaStr]){
rtn = this.formCache[shaStr]; rtn = this.formCache[shaStr];
}else{ }else{
rtn = await this.redisClient.get(shaStr); // 先试图从redis读取数据 rtn = await this.redisClient.get(shaStr); // 先试图从redis读取数据
if(rtn){ if(rtn){
this.formCache[shaStr] = rtn; this.formCache[shaStr] = rtn;
} }
} }
//---- 从redis中读取到数据 //---- 从redis中读取到数据
if (rtn) { if (rtn) {
var rtnObj = JSON.parse(rtn); var rtnObj = JSON.parse(rtn);
return system.getResult(rtnObj); return system.getResult(rtnObj);
} else { } else {
let result = await this.forminfoSve.findOne({id:pobj.id},[]); let result = await this.forminfoSve.findOne({id:pobj.id},[]);
// 将数据保存到redis中 // 将数据保存到redis中
await this.redisClient.set(shaStr, JSON.stringify(result)); await this.redisClient.set(shaStr, JSON.stringify(result));
this.formCache[shaStr] = JSON.stringify(result); this.formCache[shaStr] = JSON.stringify(result);
return system.getResult(result); return system.getResult(result);
} }
} }
//删除表单缓存 //删除表单缓存
async delTemplateFormCache(key){ async delTemplateFormCache(key){
if(key && this.formCache[key]){ if(key && this.formCache[key]){
delete this.formCache[key]; delete this.formCache[key];
} }
} }
} }
module.exports = Template; module.exports = Template;
const APIBase = require("../../api.base"); const APIBase = require("../../api.base");
const system = require("../../../system"); const system = require("../../../system");
const settings = require("../../../../config/settings"); const settings = require("../../../../config/settings");
var db = system.getObject("db.common.connection").getCon(); var db = system.getObject("db.common.connection").getCon();
/** /**
* 用户端调用订单相关接口 * 用户端调用订单相关接口
*/ */
class Templateconfig extends APIBase { class Templateconfig extends APIBase {
constructor() { constructor() {
super(); super();
this.imginfoSve = system.getObject("service.configmag.imginfoSve"); this.imginfoSve = system.getObject("service.configmag.imginfoSve");
this.forminfoSve = system.getObject("service.configmag.forminfoSve") this.forminfoSve = system.getObject("service.configmag.forminfoSve")
this.templateinfoSve = system.getObject("service.template.templateinfoSve"); this.templateinfoSve = system.getObject("service.template.templateinfoSve");
this.templatelinkSve = system.getObject("service.template.templatelinkSve"); this.templatelinkSve = system.getObject("service.template.templatelinkSve");
} }
/** /**
* 接口跳转-POST请求 * 接口跳转-POST请求
* action_process 执行的流程 * action_process 执行的流程
* action_type 执行的类型 * action_type 执行的类型
* action_body 执行的参数 * action_body 执行的参数
*/ */
async springBoard(pobj, qobj, req) { async springBoard(pobj, qobj, req) {
if (!pobj.actionType) { if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空"); return system.getResult(null, "actionType参数不能为空");
} }
var result = await this.opActionProcess(pobj, pobj.actionType, req); var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result; return result;
} }
async opActionProcess(pobj, action_type, req) { async opActionProcess(pobj, action_type, req) {
var opResult = null; var opResult = null;
var self = this; var self = this;
pobj.clientIp = req.clientIp; pobj.clientIp = req.clientIp;
pobj.xctx = req.xctx; pobj.xctx = req.xctx;
switch (action_type) { switch (action_type) {
case "test"://测试 case "test"://测试
opResult = system.getResultSuccess("测试接口"); opResult = system.getResultSuccess("测试接口");
break; break;
case "getImgList": // 查询图片 case "getImgList": // 查询图片
pobj.actionBody["company_id"] = pobj.company_id; pobj.actionBody["company_id"] = pobj.company_id;
opResult = await this.imginfoSve.getImgList(pobj.actionBody); opResult = await this.imginfoSve.getImgList(pobj.actionBody);
break; break;
case "createImginfo": // 添加图片 case "createImginfo": // 添加图片
opResult = await this.imginfoSve.createImginfo(pobj.actionBody); opResult = await this.imginfoSve.createImginfo(pobj.actionBody);
break; break;
// case "getTemplateList": // 获取模板列表 // case "getTemplateList": // 获取模板列表
// opResult = await this.templateinfoSve.getTemplateList(pobj.actionBody); // opResult = await this.templateinfoSve.getTemplateList(pobj.actionBody);
// // opResult = await this.templateinfoSve.findByCompanyId(pobj.actionBody); // // opResult = await this.templateinfoSve.findByCompanyId(pobj.actionBody);
// break; // break;
case "editTemplate": // 编辑模板信息 case "editTemplate": // 编辑模板信息
opResult = await this.templateinfoSve.editTemplate(pobj); opResult = await this.templateinfoSve.editTemplate(pobj);
break; break;
case "getFormList": // 获取表单列表 case "getFormList": // 获取表单列表
var actionBody = pobj.actionBody || {}; var actionBody = pobj.actionBody || {};
actionBody["company_id"] = pobj.company_id; actionBody["company_id"] = pobj.company_id;
opResult = await this.forminfoSve.getFormList(pobj.actionBody); opResult = await this.forminfoSve.getFormList(pobj.actionBody);
break; break;
case "getTemplateAndLinkInfo": // 根据链接参数获取模板链接信息 case "getTemplateAndLinkInfo": // 根据链接参数获取模板链接信息
opResult = await this.templatelinkSve.getTemplateAndLinkInfo2(pobj); opResult = await this.templatelinkSve.getTemplateAndLinkInfo2(pobj);
break; break;
case "copyFormInfo": // 复制表单 case "copyFormInfo": // 复制表单
opResult = await this.forminfoSve.copyFormInfo(pobj.actionBody); opResult = await this.forminfoSve.copyFormInfo(pobj.actionBody);
break; break;
case "deleteFormInfo": // 删除表单 case "deleteFormInfo": // 删除表单
opResult = await this.forminfoSve.deleteFormInfo(pobj.actionBody); opResult = await this.forminfoSve.deleteFormInfo(pobj.actionBody);
break; break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
} }
return opResult; return opResult;
} }
} }
module.exports = Templateconfig; module.exports = Templateconfig;
const APIBase = require("../../api.base"); const APIBase = require("../../api.base");
const system = require("../../../system"); const system = require("../../../system");
const settings = require("../../../../config/settings"); const settings = require("../../../../config/settings");
/** /**
* 用户端调用订单相关接口 * 用户端调用订单相关接口
*/ */
class Templatelink extends APIBase { class Templatelink extends APIBase {
constructor() { constructor() {
super(); super();
this.templatelinkSve = system.getObject("service.template.templatelinkSve"); this.templatelinkSve = system.getObject("service.template.templatelinkSve");
} }
/** /**
* 接口跳转-POST请求 * 接口跳转-POST请求
* action_process 执行的流程 * action_process 执行的流程
* action_type 执行的类型 * action_type 执行的类型
* action_body 执行的参数 * action_body 执行的参数
*/ */
async springBoard(pobj, qobj, req) { async springBoard(pobj, qobj, req) {
if (!pobj.actionType) { if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空"); return system.getResult(null, "actionType参数不能为空");
} }
var result = await this.opActionProcess(pobj, pobj.actionType, req); var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result; return result;
} }
async opActionProcess(pobj, action_type, req) { async opActionProcess(pobj, action_type, req) {
var opResult = null; var opResult = null;
var self = this; var self = this;
pobj.xctx = req.xctx; pobj.xctx = req.xctx;
switch (action_type) { switch (action_type) {
case "test"://测试 case "test"://测试
opResult = system.getResultSuccess("测试接口"); opResult = system.getResultSuccess("测试接口");
break; break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
} }
return opResult; return opResult;
} }
} }
module.exports = Templatelink; module.exports = Templatelink;
module.exports = (sequelize, DataType) => { module.exports = (sequelize, DataType) => {
return sequelize.define("marketingsubject", { return sequelize.define("marketingsubject", {
code: DataType.STRING(100), code: DataType.STRING(100),
name: DataType.STRING(100), name: DataType.STRING(100),
notes: DataType.STRING(255), notes: DataType.STRING(255),
user_name: DataType.STRING(100), user_name: DataType.STRING(100),
user_id: DataType.STRING(100), user_id: DataType.STRING(100),
company_id: DataType.INTEGER, company_id: DataType.INTEGER,
}, { }, {
// 不添加时间戳属性 (updatedAt, createdAt) // 不添加时间戳属性 (updatedAt, createdAt)
timestamps: true, timestamps: true,
// 不删除数据库条目,但将新添加的属性deletedAt设置为当前日期(删除完成时)。 // 不删除数据库条目,但将新添加的属性deletedAt设置为当前日期(删除完成时)。
// paranoid 只有在启用时间戳时才能工作 // paranoid 只有在启用时间戳时才能工作
paranoid: true, paranoid: true,
// 将自动设置所有属性的字段选项为下划线命名方式。 // 将自动设置所有属性的字段选项为下划线命名方式。
// 不会覆盖已经定义的字段选项 // 不会覆盖已经定义的字段选项
underscored: true, underscored: true,
// 禁用修改表名; 默认情况下,sequelize将自动将所有传递的模型名称(define的第一个参数)转换为复数。 如果你不想这样,请设置以下内容 // 禁用修改表名; 默认情况下,sequelize将自动将所有传递的模型名称(define的第一个参数)转换为复数。 如果你不想这样,请设置以下内容
freezeTableName: true, freezeTableName: true,
// 定义表的名称 // 定义表的名称
tableName: 'c_marketing_subject', tableName: 'c_marketing_subject',
// 启用乐观锁定。 启用时,sequelize将向模型添加版本计数属性, // 启用乐观锁定。 启用时,sequelize将向模型添加版本计数属性,
// 并在保存过时的实例时引发OptimisticLockingError错误。 // 并在保存过时的实例时引发OptimisticLockingError错误。
// 设置为true或具有要用于启用的属性名称的字符串。 // 设置为true或具有要用于启用的属性名称的字符串。
version: true version: true
}); });
}; };
\ No newline at end of file
...@@ -34,7 +34,7 @@ class LogClient { ...@@ -34,7 +34,7 @@ class LogClient {
try { try {
rtninfo.requestId = this.getUUID(); rtninfo.requestId = this.getUUID();
//第三个字段应该存公司id //第三个字段应该存公司id
system.execLogs(title,params,"gsb-marketplat",rtninfo, errinfo).then(res => { system.execLogs(title,params,"zhiquanquan",rtninfo, errinfo).then(res => {
if (res && res.status == 1) { if (res && res.status == 1) {
console.log("log.....success") console.log("log.....success")
} else { } else {
......
const url = require("url"); const url = require("url");
const system = require("../../base/system"); const system = require("../../base/system");
const fs = require('fs'); const fs = require('fs');
const marked = require("marked"); const marked = require("marked");
module.exports = function (app) { module.exports = function (app) {
app.get('/doc', function (req, res) { app.get('/doc', function (req, res) {
// if (!req.query.key) { // if (!req.query.key) {
// res.send("文件不存在!!!"); // res.send("文件不存在!!!");
// return; // return;
// } // }
// if (req.query.key != "doc12345789") { // if (req.query.key != "doc12345789") {
// res.send("文件不存在!!!!!!"); // res.send("文件不存在!!!!!!");
// return; // return;
// } // }
var path = process.cwd() + "/app/front/entry/public/apidoc/README.md"; var path = process.cwd() + "/app/front/entry/public/apidoc/README.md";
fs.readFile(path, function (err, data) { fs.readFile(path, function (err, data) {
if (err) { if (err) {
console.log(err); console.log(err);
res.send("文件不存在!"); res.send("文件不存在!");
} else { } else {
str = marked(data.toString()); str = marked(data.toString());
res.render('apidoc', { str }); res.render('apidoc', { str });
} }
}); });
}); });
app.get('/doc/:forder', function (req, res) { app.get('/doc/:forder', function (req, res) {
var path = process.cwd() + "/app/front/entry/public/apidoc/README.md"; var path = process.cwd() + "/app/front/entry/public/apidoc/README.md";
fs.readFile(path, function (err, data) { fs.readFile(path, function (err, data) {
if (err) { if (err) {
console.log(err); console.log(err);
res.send("文件不存在!"); res.send("文件不存在!");
} else { } else {
str = marked(data.toString()); str = marked(data.toString());
res.render('apidoc', { str }); res.render('apidoc', { str });
} }
}); });
}); });
app.get('/doc/api/:forder/:fileName', function (req, res) { app.get('/doc/api/:forder/:fileName', function (req, res) {
// if (req.url != "/doc/api/platform/fgbusinesschance.md") { // if (req.url != "/doc/api/platform/fgbusinesschance.md") {
// if (!req.query.key) { // if (!req.query.key) {
// res.send("文件不存在!!!"); // res.send("文件不存在!!!");
// return; // return;
// } // }
// if (req.query.key != "doc12345789") { // if (req.query.key != "doc12345789") {
// res.send("文件不存在!!!!!!"); // res.send("文件不存在!!!!!!");
// return; // return;
// } // }
// } // }
var forder = req.params["forder"]; var forder = req.params["forder"];
var fileName = req.params["fileName"] || "README.md"; var fileName = req.params["fileName"] || "README.md";
var path = process.cwd() + "/app/front/entry/public/apidoc"; var path = process.cwd() + "/app/front/entry/public/apidoc";
if (forder) { if (forder) {
path = path + "/" + forder + "/" + fileName; path = path + "/" + forder + "/" + fileName;
} else { } else {
path = path + "/" + fileName; path = path + "/" + fileName;
} }
fs.readFile(path, function (err, data) { fs.readFile(path, function (err, data) {
if (err) { if (err) {
console.log(err); console.log(err);
res.send("文件不存在!"); res.send("文件不存在!");
} else { } else {
str = marked(data.toString()); str = marked(data.toString());
res.render('apidoc', { str }); res.render('apidoc', { str });
} }
}); });
}); });
}; };
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="keywords" content="api文档"> <meta name="keywords" content="api文档">
<meta name="baidu-site-verification" content="lATAxZAm8y" /> <meta name="baidu-site-verification" content="lATAxZAm8y" />
<meta name="viewport" content="width=device-width, initial-scale=0.8, maximum-scale=0.8, user-scalable=1"> <meta name="viewport" content="width=device-width, initial-scale=0.8, maximum-scale=0.8, user-scalable=1">
<link href="https://cdn.bootcss.com/github-markdown-css/2.8.0/github-markdown.min.css" rel="stylesheet"> <link href="https://cdn.bootcss.com/github-markdown-css/2.8.0/github-markdown.min.css" rel="stylesheet">
</head> </head>
<body> <body>
<div style="width:100%;text-align: center;font-size: 20px;"> <div style="width:100%;text-align: center;font-size: 20px;">
API文档 API文档
</div> </div>
<div class="markdown-body" style="margin-left:40px;" id="doc-page"> <div class="markdown-body" style="margin-left:40px;" id="doc-page">
<%- str%> <%- str%>
</div> </div>
</body> </body>
</html> </html>
\ No newline at end of file
{ {
"name": "gsb-marketplat", "name": "zhiquanquan",
"version": "1.0.0", "version": "1.0.0",
"description": "h5framework", "description": "h5framework",
"main": "main.js", "main": "main.js",
......
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