Commit 458d22a1 by 蒋勇

d

parent f7c39e17

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

...@@ -27,12 +27,15 @@ ...@@ -27,12 +27,15 @@
2、igirl-zcapi release-v2.x.x 2、igirl-zcapi release-v2.x.x
3、igirl-channel-web release-v3.x.x 3、igirl-channel-web release-v3.x.x
4、igirl-channel release-v4.x.x 4、igirl-channel release-v4.x.x
5、igirl-channel release-v5.x.x
后续号端请继续补充 后续号端请继续补充
查看自己项目号段到达的数字,执行git tag | grep v【号段前缀】 查看自己项目号段到达的数字,执行git tag | grep v【号段前缀】
scratch-web
--byc
--boss
--bigdata
......
node-modules/
\ No newline at end of file
const path = require('path');
module.exports = {
'config':path.resolve('dbtool/config', 'database.js'),
'models-path':path.resolve('dbtool', 'models'),
'seeders-path':path.resolve('dbtool', 'seeders'),
'migrations-path':path.resolve('dbtool', 'migrations')
}
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/main.js"
}
]
}
\ No newline at end of file
const system=require("../system");
class ApiBase{
constructor(){
this.cacheManager=system.getObject("db.cacheManager");
}
async checkKey(appKey){
let key = await this.cacheManager["InitAppKeyCache"].getAppKeyVal(appKey);
if(key==null){
return system.getResult2(null,null,"ok","请检查您的授权KEY");
}
}
}
module.exports=ApiBase;
const crypto = require('crypto');
const cryptoJS = require("crypto-js");
var System=require("../../system");
var settings=require("../../../config/settings");
const logCtl=System.getObject("web.oplogCtl");
class BankTradeApi{
constructor(){
this.profitcenterS=System.getObject("service.profitcenterSve");
this.yunzhanghuAppKey=settings.apiconfig.yunzhanghuAppKey();
this.yunzhanghuDESKey=settings.apiconfig.yunzhanghuDESKey();
}
async test(obj){
console.log(obj);
return "xxx";
}
async tradecallback(obj){
var data=obj.data==null?"":obj.data;;
var mess=obj.mess==null?"":obj.mess;
var timestamp=obj.timestamp==null?"":obj.timestamp;
var sign=obj.sign==null?"":obj.sign;
if(data==""||mess==""||timestamp==""||sign==""||data=="undefined"
||mess=="undefined"||timestamp=="undefined"||sign=="undefined"){
return "info Failure"
}
let keyHex = cryptoJS.enc.Utf8.parse(this.yunzhanghuDESKey);
let ivHex = cryptoJS.enc.Utf8.parse(this.yunzhanghuDESKey.substring(0,8));
let appKey=this.yunzhanghuAppKey;
var tmp_sign_type="sha256";
var signContent="data="+data+"&mess="+mess+"&timestamp="+timestamp+"&key="+appKey;
var tmpSign=crypto.createHmac(tmp_sign_type,appKey).update(signContent).digest('hex');
if(tmpSign!=sign){
return "sign Failure"
}
//解密信息
var bytes = cryptoJS.TripleDES.decrypt(data, keyHex, {
iv: ivHex
});
var plaintext = bytes.toString(cryptoJS.enc.Utf8);
var tmpResult=JSON.parse(plaintext);
tmpResult.descStr="云支付返回信息";
//日志记录
logCtl.info({
optitle:"用于云支付回调地址->解密后的数据",
op:"base/api/impl/banktrade/tradecallback",
content:"云支付返回信息::::"+JSON.stringify(tmpResult),
clientIp:""
});
var putItem={
bankTradeNum:tmpResult.data.ref,
opDesc:JSON.stringify(tmpResult)
};
var sqlWheres={where:{tradeOrderNum:tmpResult.data.order_id}};
if(tmpResult.data.status!=1){
//打款失败
putItem.opType="issueError";
}
//更改提现申请状态
await this.profitcenterS.dao.updateByWhere(putItem,sqlWheres);
return tmpResult.data.status!=1?"Failure":"success";
}
}
module.exports=BankTradeApi;
var system=require("../../system")
const http=require("http")
const querystring = require('querystring');
var settings=require("../../../config/settings");
const ApiBase =require("../api.base");
const logCtl=system.getObject("web.oplogCtl");
class beehiveApi extends ApiBase{
constructor(){
super();
this.connectionbh=system.getObject("db.connection").getConhb();
}
async getEntFileList(obj,obj2){
console.log("obj111111111111111111111111111");
console.log(obj);
console.log(obj2);
if(!obj){
obj={
companyName:"",creditCode:"",ps:"",cp:"",type:""
}
}
console.log(obj);
var companyName = obj.companyName || "";
var creditCode = obj.creditCode || "";
var ps = obj.ps || "10";
var cp = obj.cp || "1";
var type = obj.type || "";
ps = Number(ps);
cp = Number(cp);
if(ps>50){
ps=50;
}
if(cp<1){
cp=1;
}
var start = (cp-1)*ps;
var sql="SELECT tmc.credit_code,tmc.applier,att.file_url,att.`name` FROM `ig_trade_mark_case` AS tmc JOIN ig_up_attachment AS att ON att.trade_mark_caseid = tmc.id ";
sql = sql+" where 1=1 AND att.file_url IS NOT NULL and tmc.credit_code IS NOT NULL AND tmc.credit_code != \"\"";
if(companyName){
sql = sql + " and tmc.applier LIKE \"%"+companyName+"%\" ";
}
if(creditCode){
sql = sql + " and tmc.credit_code LIKE \"%"+creditCode+"%\"";
}
if(type=="yyzz"){
sql = sql + " and att.name LIKE \"%营业执照%\"";
}
sql =sql+" group by tmc.credit_code, tmc.applier, att.`name` "
var sql2 = "select count(*) count from ("+sql+") as a";
console.log(sql2);
sql = sql + " limit "+start+","+ps;
console.log(sql);
try {
var filelist = await this.connectionbh.query(sql);
var countList = await this.connectionbh.query(sql2);
if(filelist && filelist.length>0){
var datalist = filelist[0];
var count = 0;
if(countList && countList.length>0){
var counts = countList[0];
if(counts){
count = counts[0].count;
}
}
return {code:1,count:count,data:datalist};
}else{
return {code:-1,msg:"未查到数据"};
}
} catch (e) {
return {code:-2,msg:"操作失败"};;
}
}
}
module.exports=beehiveApi;
// var test = new beehiveApi();
// test.getEntFileList({cp:2,type:"yyzz"}).then(function(d){
// console.log(d);
// })
This source diff could not be displayed because it is too large. You can view the blob instead.
var System=require("../../system");
var settings=require("../../../config/settings");
const querystring = require('querystring');
const ApiBase =require("../api.base");
class ChinaAffairSearchApi extends ApiBase{
constructor(){
super();
this.affairUrl = settings.reqEsAddrIc()+"bigdata_patent_affair_op/_search";
};
buildDate(date){
var date = new Date(date);
var time = Date.parse(date);
time=time / 1000;
return time;
};
async SearchbyFilingno(obj){//根据申请号查询并根据法律状态日期排序
var data=await this.checkKey(obj.appKey);
if(data && data.status && data.status==-1){
return data;
}
var pagesize = obj.pagesize==null?10:obj.pagesize;
if(obj.page==null){
var from = 0;
}else{
var from = Number((obj.page-1)*obj.pagesize);
}
var filingno = obj.filingno==null?"":obj.filingno;
if(filingno==""){
return {status:-1,msg:"传入申请号信息为空",data:null,buckets:null};
}
var params= {
"query": {
"bool": {
"must": [
]
}
},
"sort": [
{
"aff_date": "asc"
}
]
};
var param = {
"term": {
"filing_no": filingno
}
}
params.query.bool.must.push(param);
var rc=System.getObject("util.execClient");
var rtn=null;
var requrl = this.affairUrl;
try{
rtn=await rc.execPost(params,requrl);
var j=JSON.parse(rtn.stdout);
return System.getResult2(j.hits,null);
}catch(e){
return rtn=System.getResult2(null,null);
}
};
}
module.exports = ChinaAffairSearchApi;
\ No newline at end of file
var system = require("../../system")
const md5 = require("MD5");
const logCtl = system.getObject("web.oplogCtl");
class EcontractApi {
constructor() {
this.ecompanySve = system.getObject("service.ecompanySve");
this.econtractSve = system.getObject("service.econtractSve");
this.etemplateSve = system.getObject("service.etemplateSve");
this.restClient = system.getObject("util.restClient");
}
async importECompany(obj) {
console.log(obj, "===================>>>>>>>>>>>>>>>>>>>>>");
var names = obj.companyNames;
var nameA = obj.nameA || '智信云(天津)科技有限公司';
var encryptkey = obj.encryptkey;
var posturl = obj.posturl;
var etemplate = await this.etemplateSve.findById(Number(obj.etemplateId || 0));
if (!etemplate) {
return 0;
}
for (var name of names) {
try {
console.log("========== import ecompany : " + name);
let rs = await this.ecompanySve.importCompany(name, nameA, encryptkey, posturl, etemplate);
} catch (e) {
console.log(e);
}
}
return 1;
}
async validContract(obj, req) {
// 验证合法性
var companyName = obj.companyName;
var idCardList = obj.idCardList;
var sign = md5("companyName=" + companyName + "&nonceStr=" + obj.nonceStr + "&key=wxf616c0a459d66081").toUpperCase();
if (sign != obj.sign) {
return {
code: 1,
msg: "签名失败"
};
}
//日志记录
if (!idCardList || idCardList.length == 0) {
return {
code: 0,
msg: "success",
signedList: [],
unSignList: []
};
}
var ecompany = await this.ecompanySve.findOne({
name: companyName
});
if (!ecompany) {
return {
code: 1,
msg: "公司不存在"
};
}
try {
var signedList = await this.econtractSve.fiterSignedCards(ecompany.id, idCardList);
var unSignList = [];
for (var ic of idCardList) {
if (signedList.indexOf(ic) == -1) {
unSignList.push(ic);
}
}
var result = {
code: 0,
msg: "success",
};
result.signedList = signedList;
result.unSignList = unSignList;
return result;
} catch (e) {
var result = {
code: 500,
msg: "接口异常"
};
console.log(e.stack);
//日志记录
logCtl.error({
optitle: "校验是否签约error",
op: "api/econtractApi/validContract",
content: e.stack,
clientIp: req.clientIp
});
return result;
}
}
async sinedList(obj, req) {
// 验证合法性
var companyName = obj.companyName;
var startId = obj.startId || 0;
var pageSize = obj.pageSize || 20;
var sign = md5("companyName=" + companyName + "&nonceStr=" + obj.nonceStr + "&startId=" + startId + "&key=wxf616c0a459d66081").toUpperCase();
if (sign != obj.sign) {
return {
code: 1,
msg: "签名失败"
};
}
var ecompany = await this.ecompanySve.findOne({
name: companyName
});
if (!ecompany) {
return {
code: 1,
msg: "公司不存在"
};
}
try {
var userList = await this.econtractSve.findSignedUsers(ecompany.id, startId, pageSize);
var result = {
code: 0,
msg: "success",
};
result.data = userList;
return result;
} catch (e) {
var result = {
code: 500,
msg: "接口异常"
};
console.log(e.stack);
//日志记录
logCtl.error({
optitle: "校验是否签约error",
op: "api/econtractApi/validContract",
content: e.stack,
clientIp: req.clientIp
});
return result;
}
}
async dosync(obj, req) {
// TODO 需要验证一下合法
this.econtractSve.syncAllSigners();
return 1;
}
async transfer(obj, req) {
var item = {
"appId": "10000000000",
"currency": "CNY",
"notityUrl": "https://ec.gongsibao.com/api/econtractApi/transferNotify",
"mchtId": "1",
"nonceStr": "nonceStrnonceStr",
"outTradeNo": "2770333475",
"signType": "MD5",
"tradeTime": "20190310152415",
"bizContent": [{
"note": "",
"idType": "00",
"idName": "符伟",
"province": "string",
"seqNo": "1000",
"city": "string",
"openBank": "string",
"accNo": "4309221990050628168",
"mobile": "15618087578",
"amt": 1,
"accType": "00",
"idNo": "430922199005062816"
},
{
"note": "",
"idType": "00",
"idName": "符伟2",
"province": "string",
"seqNo": "1001",
"city": "string",
"openBank": "string",
"accNo": "4309221990050628168",
"mobile": "15618087578",
"amt": 1,
"accType": "01",
"idNo": "430922199005062817"
}
],
};
var signArr = [];
signArr.push("appId=" + (item.appId || ""));
signArr.push("currency=" + (item.currency || ""));
signArr.push("notityUrl=" + (item.notityUrl || ""));
signArr.push("mchtId=" + (item.mchtId || ""));
signArr.push("nonceStr=" + (item.nonceStr || ""));
signArr.push("outTradeNo=" + (item.outTradeNo || ""));
signArr.push("signType=" + (item.signType || ""));
signArr.push("tradeTime=" + (item.tradeTime || ""));
signArr.push("key=secret");
item.sign = md5(signArr.join("&")).toUpperCase();
try {
// let rs = await this.restClient.execPost(item, "http://39.96.42.199/merchant/order/transfer");
let rs = await this.restClient.execPost(item, "http://39.106.185.66:8000/merchant/order/transfer");
console.log(rs, "----------------------------------------- order/transfer -------------------------------------");
} catch (error) {
contract.syncCode = '-10500';
await contract.save();
}
}
async transferNotify(obj) {
console.log(obj.a);
await this.econtractSve.testtransfer("转账回调");
}
async formateTime(inputTime) {
if (!inputTime) {
return '';
}
var date = new Date(inputTime);
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
var h = date.getHours();
h = h < 10 ? ('0' + h) : h;
var minute = date.getMinutes();
var second = date.getSeconds();
minute = minute < 10 ? ('0' + minute) : minute;
second = second < 10 ? ('0' + second) : second;
return y + '' + m + '' + d + '' + h + '' + minute + '' + second;
};
async getUidStr(len, radix) {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
var uuid = [],
i;
radix = radix || chars.length;
if (len) {
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
} else {
var r;
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
uuid[14] = '4';
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | Math.random() * 16;
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
}
}
}
return uuid.join('');
}
}
module.exports = EcontractApi;
\ No newline at end of file
var System = require("../../system");
var settings = require("../../../config/settings");
const ApiBase = require("../api.base");
const logCtl = System.getObject("web.oplogCtl");
// const uuidv4 = require('uuid/v4');
class EntImageApi extends ApiBase {
constructor() {
super();
this.utilsentimageSve = System.getObject("service.utilsentimageSve");
this.utilstmSve = System.getObject("service.utilstmSve");
this.utilscopyrightSve = System.getObject("service.utilscopyrightSve");
this.utilspaSve = System.getObject("service.utilspaSve");
}
async get_customerinfo(obj) {
try {
var data = await this.checkKey(obj.appKey);
if (data && data.status && data.status == -1) {
return { code: -100, message: "appKey参数错误", data: {} };
}
if (!obj.mobile) {
return { code: -100, message: "mobile不能为空", data: {} };
}
var tmpresult = await this.utilsentimageSve.getEntInfo(obj.mobile);
return tmpresult;
} catch (e) {
//日志记录
logCtl.error({
optitle: "获取企业信息异常",
op: "base/api/impl/entimage/get_customerinfo",
content: "参数:" + JSON.stringify(obj) + ",error:" + e.stack,
clientIp: obj.clientIp
});
return { code: 1, message: "error", data: {} };
}
}
async get_customer_total(obj) {
var result = {
code: 1, message: "success", data: {}
}
try {
var data = await this.checkKey(obj.appKey);
if (data && data.status == -1) {
result.code = -1;
result.message = "appKey错误";
return result;
}
var totalInfo = {
zc_total: 63,//无形资产数值
tm_num: 120,//商标数量
pa_num: 20,//专利数量
cp_num: 10,//版权数量
};
result.data.total_info = totalInfo;
result.data.customer_manage = [{ name: "汉唐信通(北京)科技有限公司", op_content: "1000万元" },
{ name: "北京联大共享科技有限公司", op_content: "100万元" }];
return result;
} catch (e) {
//日志记录
logCtl.error({
optitle: "获取企业统计异常",
op: "base/api/impl/entimage/get_customer_total",
content: "参数:" + JSON.stringify(obj) + ",error:" + e.stack,
clientIp: obj.clientIp
});
result.code = -200;
result.message = "error";
return result;
}
}
}
module.exports = EntImageApi;
var System=require("../../system");
var settings=require("../../../config/settings");
const logCtl=System.getObject("web.oplogCtl");
const ApiBase =require("../api.base");
class LbsSearch extends ApiBase{
constructor(){
super();
this.AdressUrl="http://43.247.184.92:8880/lbs/api/addresssearch";
this.LalUrl="http://43.247.184.92:8889/lbs/api/lalsearch";
this.CityUrl="http://43.247.184.92:8886/lbs/api/citysearch";
this.appkey="d41d8cd98f00b204e9800998ecf8427e";
}
async addressSearch(obj){
var data=await this.checkKey(obj.appKey);
if(data && data.status && data.status==-1){
return data;
}
var address=obj.address==null?"":obj.address;
if(address==""){
return System.getResult2(null,null);
}
var distance=obj.distance==null?"":obj.distance;
if(distance==""){
return System.getResult2(null,null);
}
address=await this.getConvertSemiangleStr(address);//全半角转化
var params = {
"appkey":this.appkey,
"address":address,
"distance":distance,
"pagesize":obj.pageSize,
"currentPage":obj.currentPage
}
var reqUrl=this.AdressUrl;
var rtn=null;
var rc=System.getObject("util.execClient");
try{
rtn=await rc.execPost(params,reqUrl);
debugger;
var tmpResult=JSON.parse(rtn.stdout);
if(tmpResult.status!=0){
return System.getResult2(null,null,"other method fail");
}else{
return tmpResult}
}catch(e){
//日志记录
logCtl.error({
optitle:"api->lbssearch->addressSearch方法请求出错,error:",
op:"api/lbssearch/addressSearch",
content:e.stack,
clientIp:""
});
return System.getResult2(null,null,"zntjSearch error;");
}
}
async lalSearch(obj){
var data=await this.checkKey(obj.appKey);
if(data && data.status && data.status==-1){
return data;
}
var lat=obj.lat==null?"":obj.lat;
if(lat==""){
return System.getResult2(null,null);
}
var lng=obj.lng==null?"":obj.lng;
if(lng==""){
return System.getResult2(null,null);
}
var distance=obj.distance==null?"":obj.distance;
if(distance==""){
return System.getResult2(null,null);
}
var params = {
"appkey":this.appkey,
"lat":lat,
"lng":lng,
"distance":distance,
"pagesize":obj.pageSize,
"currentPage":obj.currentPage
}
var reqUrl=this.LalUrl;
var rtn=null;
var rc=System.getObject("util.execClient");
try{
rtn=await rc.execPost(params,reqUrl);
var tmpResult=JSON.parse(rtn.stdout);
if(tmpResult.status!=0){
return System.getResult2(null,null,"other method fail");
}else{
return tmpResult
}
}catch(e){
//日志记录
logCtl.error({
optitle:"api->lbssearch->lalSearch方法请求出错,error:",
op:"api/lbssearch/lalSearch",
content:e.stack,
clientIp:""
});
return System.getResult2(null,null,"zntjSearch error;");
}
}
async citySearch(obj){
var data=await this.checkKey(obj.appKey);
if(data && data.status && data.status==-1){
return data;
}
var cityName=obj.cityName==null?"":obj.cityName;
if(cityName==""){
return System.getResult2(null,null);
}
cityName=await this.getConvertSemiangleStr(cityName);//全半角转化
var params = {
"appkey":this.appkey,
"cityName":cityName,
"pagesize":obj.pageSize,
"currentPage":obj.currentPage
}
var reqUrl=this.CityUrl;
var rtn=null;
var rc=System.getObject("util.execClient");
try{
rtn=await rc.execPost(params,reqUrl);
debugger;
var tmpResult=JSON.parse(rtn.stdout);
if(tmpResult.status!=0){
return System.getResult2(null,null,"other method fail");
}else{
return tmpResult}
}catch(e){
//日志记录
logCtl.error({
optitle:"api->lbssearch->citySearch方法请求出错,error:",
op:"api/lbssearch/citySearch",
content:e.stack,
clientIp:""
});
return System.getResult2(null,null,"zntjSearch error;");
}
}
async getConvertSemiangleStr(str){
var result = "";
var len = str.length;
for(var i=0;i<len;i++)
{
var cCode = str.charCodeAt(i);
//全角与半角相差(除空格外):65248(十进制)
cCode = (cCode>=0xFF01 && cCode<=0xFF5E)?(cCode - 65248) : cCode;
//处理空格
cCode = (cCode==0x03000)?0x0020:cCode;
result += String.fromCharCode(cCode);
}
return result;
}
}
module.exports=LbsSearch;
var System=require("../../system");
var settings=require("../../../config/settings");
const ApiBase =require("../api.base");
const logCtl=System.getObject("web.oplogCtl");
class OpIcbcApi extends ApiBase{
constructor(){
super();
this.icbcinfoSve=System.getObject("service.icbcinfoSve");
this.cacheManager=System.getObject("db.cacheManager");
}
//添加国内工商数据
async add_icbc(obj){
var result={
code: "0000",
message: "success",
app_code:"",
data: null
};
try {
let appCache = await this.cacheManager["AppCache"].cacheApp(obj.appKey);
if(appCache==null||appCache=="undefined"){
result.code="1001";
result.message="appKey错误,请重试";
return result;
}
if(appCache.app_code!=obj.app_code){
result.code="1001";
result.message="appKey错误,请重试!!";
return result;
}
obj.icbcType="gn";
return this.icbcinfoSve.addChannelIcbc(obj,appCache.name);
} catch (e) {
console.log("error........................");
console.log(e.stack);
//日志记录
logCtl.error({
optitle:"渠道添加国内工商数据异常",
op:"base/api/impl/opicbc/add_icbc",
content:"参数:"+JSON.stringify(obj)+",error:"+e.stack,
clientIp:obj.clientIp
});
result.code="2000";
result.message="网络异常,请重试";
return result;
}
}
//添加香港工商数据
async add_hongkong_icbc(obj){
var result={
code: "0000",
message: "success",
app_code:"",
data: null
};
try {
var data= await this.checkKey(obj.appKey);
if(data && data.status==-1){
result.code="1001";
result.message="appKey错误,请重试";
return result;
}
obj.icbcType="hongkong";
return this.icbcinfoSve.addChannelIcbc(obj);
} catch (e) {
//日志记录
logCtl.error({
optitle:"渠道添加香港工商数据异常",
op:"base/api/impl/opicbc/add_hongkong_icbc",
content:"参数:"+JSON.stringify(obj)+",error:"+e.stack,
clientIp:obj.clientIp
});
result.code="2000";
result.message="网络异常,请重试";
return result;
}
}
//添加国内江苏省宿迁市工商数据
async add_gnsqs_icbc(obj){
var result={
code: "0000",
message: "success",
app_code:"",
data: null
};
try {
var data= await this.checkKey(obj.appKey);
if(data && data.status==-1){
result.code="1001";
result.message="appKey错误,请重试";
return result;
}
obj.icbcType="gnjssqs";
return this.icbcinfoSve.addChannelIcbc(obj);
} catch (e) {
//日志记录
logCtl.error({
optitle:"渠道添加国内江苏省宿迁市工商数据异常",
op:"base/api/impl/opicbc/add_gnsqs_icbc",
content:"参数:"+JSON.stringify(obj)+",error:"+e.stack,
clientIp:obj.clientIp
});
result.code="2000";
result.message="网络异常,请重试";
return result;
}
}
//修改工商数据
async put_icbc(obj){
var result={
code: "0000",
message: "success",
app_code:"",
data: null
};
try {
var data= await this.checkKey(obj.appKey);
if(data && data.status==-1){
result.code="1001";
result.message="appKey错误,请重试";
return result;
}
return this.icbcinfoSve.putChannelIcbc(obj);
} catch (e) {
//日志记录
logCtl.error({
optitle:"渠道修改工商数据异常",
op:"base/api/impl/opicbc/put_icbc",
content:"参数:"+JSON.stringify(obj)+",error:"+e.stack,
clientIp:obj.clientIp
});
result.code="2000";
result.message="网络异常,请重试";
return result;
}
}
//获取工商状态
async get_icbcstatus(obj){
var result={
code: "0000",
message: "success",
app_code:"",
data: null
};
try {
var data= await this.checkKey(obj.appKey);
if(data && data.status==-1){
result.code="1001";
result.message="appKey错误,请重试";
return result;
}
return this.icbcinfoSve.getChannelIcbcStatus(obj);
} catch (e) {
//日志记录
logCtl.error({
optitle:"渠道获取工商状态异常",
op:"base/api/impl/opicbc/get_icbcstatus",
content:"参数:"+JSON.stringify(obj)+",error:"+e.stack,
clientIp:obj.clientIp
});
result.code="2000";
result.message="网络异常,请重试";
return result;
}
}
}
module.exports=OpIcbcApi;
var System=require("../../system");
var settings=require("../../../config/settings");
const ApiBase =require("../api.base");
const logCtl=System.getObject("web.oplogCtl");
class NeedApi extends ApiBase{
constructor(){
super();
this.channelSve=System.getObject("service.channelSve");
this.businesschanceSve=System.getObject("service.businesschanceSve");
this.servicesitemSve=System.getObject("service.servicesitemSve");
}
//畅捷通需求接入
async submitneed(obj){
console.log(obj);
var data= await this.checkKey(obj.appKey);
if(data && data.status==-1){
return data;
}
if(obj.serviceItem_code==""||obj.serviceItem_code==null||obj.serviceItem_code=="undefined"){
return {code:-100,msg:"商机类型不能为空"};
}
if(obj.publisherCompany==""||obj.publisherCompany==null||obj.publisherCompany=="undefined"){
return {code:-100,msg:"企业名称不能为空"};
}
if(obj.publisherName==""||obj.publisherName==null||obj.publisherName=="undefined"){
return {code:-100,msg:"企业联系人不能为空"};
}
if(obj.publisherMobile==""||obj.publisherMobile==null||obj.publisherMobile=="undefined"){
return {code:-100,msg:"联系电话不能为空"};
}
if(obj.notes!=""&&obj.notes!=null&&obj.notes!="undefined"&&obj.notes.length>255){
return {code:-100,msg:"沟通内容字数不能超过255"};
}
if(obj.serviceItem_code==""||obj.serviceItem_code==null||obj.serviceItem_code=="undefined"){
return {code:-110,msg:"serviceItem_code参数传递错误"};
}
var tChannelCode=obj.channelCode==""||obj.channelCode==null||obj.channelCode=="undefined"?"":obj.channelCode;
if(tChannelCode==""){
return {code:-111,msg:"channelCode参数传递错误"};
}
var channelItem=await this.channelSve.getChannelItem(tChannelCode);
if(channelItem==""||channelItem==null){
return {code:-111,msg:"channelCode参数传递错误"};
}
var serviceItem=await this.servicesitemSve.findOneByCode(obj.serviceItem_code);
if(serviceItem==""||serviceItem==null){
return {code:-110,msg:"serviceItem_code参数传递错误"};
}
var pobj={
name:obj.publisherCompany,
publisherName:obj.publisherName,
publisherMobile:obj.publisherMobile,
serviceItem_code:obj.serviceItem_code,
channelCode:tChannelCode,
chanceStatus:"1"
};
var result=await this.businesschanceSve.findchance(pobj);
if(result!=""&&result!=null){
return {code:"0",msg:"需求重复发布"};
}
try{
var reqParams={
notes:obj.notes,
name:obj.publisherCompany,
publisherName:obj.publisherName,
publisherMobile:obj.publisherMobile,
channelCode:tChannelCode,
serviceItem_code:obj.serviceItem_code,
serviceItem_name:serviceItem.name,
chanceStatus:"1",
chanceType:serviceItem.itemType,
channelProfitRatio:channelItem.profitType==1?(channelItem.everySingleProfit||0):0,//渠道分成比率(如:总额100,字段值30,则渠道的利润为30/100,剩下的则为平台利润)
channelProfit:channelItem.profitType==2?(channelItem.everySingleProfit||0):0,//渠道利润
profitType:channelItem.profitType//渠道利润类型:1: "比例分成", 2: "每单分成"
};
var chance = await this.businesschanceSve.create(reqParams);
this.smsClient=System.getObject("util.smsClient");
this.smsClient.sendMsg("13381139519","亲爱的知产合伙人,你的客户于"+(new Date()).Format("yyyy-MM-dd")+"发布了新的需求,亲,赶紧去自己店铺去查看“我的商机”吧!");
return {code:"1",msg:"需求发布成功"};
}catch(e){
console.log(e);
//日志记录
logCtl.error({
optitle:"渠道cjtneed提交需求异常",
op:"/api/opneed/submitneed",
content:"请求参数:"+JSON.stringify(obj)+",error:"+e.stack,
clientIp:""
});
return {code:"-1",msg:"操作失败,请稍后重试"};
}
}
//发布工商需求接口
async add_icbc_need(obj){
try {
} catch (e) {
} finally {
}
var result={
code: "0000",
message: "success",
app_code: "31008699",
data: []
};
var data= await this.checkKey(obj.appKey);
if(data && data.status==-1){
return data;
}
var param={
tm_name:obj.tmName,
reg_num:obj.regNum,
applicant_cn:obj.applicantCn,
page_size:obj.pageSize,
current_page:obj.currentPage
}
return this.utilstmSve.tmSearch(param,"FqTmSearchApi");
}
}
module.exports=NeedApi;
var System=require("../../system");
var settings=require("../../../config/settings");
const ApiBase =require("../api.base");
const logCtl=System.getObject("web.oplogCtl");
// const uuidv4 = require('uuid/v4');
class PaSearchApi extends ApiBase{
constructor(){
super();
this.utilspaSve=System.getObject("service.utilspaSve");
}
//----------------------------------------------------专利数据-----------------------
//专利列表=post
async getPaShortList(obj){
var data= await this.checkKey(obj.appKey);
if(data && data.status==-1){
return data;
}
return this.utilspaSve.paShortListByApplicantName(obj,"bossShopApplet");
}
//专利详情=post
async getPaDetails(obj){
console.log(obj,"pa..............................");
var data= await this.checkKey(obj.appKey);
if(data && data.status==-1){
return data;
}
obj.page_size=1;
obj.current_page=1;
return this.utilspaSve.paDetails(obj,"bossShopApplet");
}
}
module.exports=PaSearchApi;
var System = require("../../system");
var settings = require("../../../config/settings");
const ApiBase = require("../api.base");
const logCtl = System.getObject("web.oplogCtl");
class GsbMgSearchApi extends ApiBase {
constructor() {
super();
this.mgdbModel = System.getObject("db.mgconnection").getModel("taierphones");
};
buildDate(date) {
var date = new Date(date);
var time = Date.parse(date);
time = time / 1000;
return time;
};
async phoneNameSearch(obj) {
var data = await this.checkKey(obj.appKey);
if (data && data.status && data.status == -1) {
return data;
}
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
if (obj.currentPage == null) {
var from = 0;
} else {
var from = Number((obj.currentPage - 1) * obj.pageSize);
}
var skipnum = (obj.currentPage - 1) * pageSize;
var params = {
"company_name": companyName
}
var opt = { "_id": 0 };
var rtn = null;
var list = {}
var phone = []
list.company_name = companyName
try {
rtn = await this.mgdbModel.find(params, opt).skip(skipnum).limit(pageSize).exec()
var data = {
"result": 1,
"totalSize": rtn.length,
"pageSize": pageSize,
"currentPage": obj.currentPage - 1, "list": rtn
};
var a = { status: 0, msg: "操作成功", data: data };
return a;
} catch (e) {
//日志记录
logCtl.error({
optitle: "mg操作失败,通过公司名称查电话-error",
op: "base/api/impl/phonesearch/phoneNameSearch",
content: e.stack,
clientIp: ""
});
// console.log(e.stack, "mg操作失败>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
return { status: -1, msg: "操作失败", data: null };
}
}
async phoneAdressSearch(obj) {
var data = await this.checkKey(obj.appKey);
if (data && data.status && data.status == -1) {
return data;
}
var adress = obj.adress == null ? "" : obj.adress;
adress = await this.getConvertSemiangleStr(adress);
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
if (obj.currentPage == null) {
var from = 0;
} else {
var from = Number((obj.currentPage - 1) * obj.pageSize);
}
var skipnum = (obj.currentPage - 1) * pageSize;
var params = {
"postal_address": adress
}
var opt = { "_id": 0 };
var rtn = null;
try {
rtn = await this.mgdbModel.find(params, opt).skip(skipnum).limit(pageSize).exec()
var data = {
"result": 1,
"totalSize": rtn.length,
"pageSize": pageSize,
"currentPage": obj.currentPage, "list": rtn
};
var a = { status: 0, msg: "操作成功", data: data };
return a;
} catch (e) {
//日志记录
logCtl.error({
optitle: "mg操作失败,通过公司地址查电话-error",
op: "base/api/impl/phonesearch/phoneAdressSearch",
content: e.stack,
clientIp: ""
});
return { status: -1, msg: "操作失败", data: null };
}
}
async phoneNumSearch(obj) {
// var data = await this.checkKey(obj.appKey);
// if (data && data.status && data.status == -1) {
// return data;
// }
var phoneNum = obj.phoneNum == null ? "" : obj.phoneNum;
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
// if (obj.currentPage == null) {
// var from = 0;
// } else {
// var from = Number((obj.currentPage - 1) * obj.pageSize);
// }
// var skipnum = (obj.currentPage - 1) * pageSize;
var params = {
"phone_number": phoneNum
}
var opt = { "_id": 0 };
var rtn = null;
var list = {}
list.phoneNum = phoneNum
try {
rtn = await this.mgdbModel.find(params, opt).limit(20).exec()
var sources = []
if (rtn.length > 0) {
for (var i = 0; i < rtn.length; i++) {
if (sources.indexOf(rtn[i]["company_name"])<0) {
sources.push(rtn[i]["company_name"])
}
}
}
var data = {
"result": 1,
"totalSize": sources.length,
"list": sources
};
var a = { status: 0, msg: "操作成功", data: data };
return a;
} catch (e) {
//日志记录
logCtl.error({
optitle: "mg操作失败,通过电话查公司名称-error",
op: "base/api/impl/phonesearch/phoneNumSearch",
content: e.stack,
clientIp: ""
});
// console.log(e.stack, "mg操作失败>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
return { status: -1, msg: "操作失败", data: null };
}
}
async getConvertSemiangleStr(str) {
var result = "";
str = str.replace(/\s+/g, "");
var len = str.length;
for (var i = 0; i < len; i++) {
var cCode = str.charCodeAt(i);
//全角与半角相差(除空格外):65248(十进制)
cCode = (cCode >= 0xFF01 && cCode <= 0xFF5E) ? (cCode - 65248) : cCode;
//处理空格
cCode = (cCode == 0x03000) ? 0x0020 : cCode;
result += String.fromCharCode(cCode);
}
return result;
};
}
module.exports = GsbMgSearchApi;
const system=require("../../system");
const ApiBase =require("../api.base");
class ProductApi extends ApiBase{
constructor(){
super();
this.productS=system.getObject("service.productSve");
}
async list(obj){
console.log(obj);
const aid="wx76a324c5d201d1a4";
return this.productS.list(aid);
}
}
module.exports=ProductApi;
var System=require("../../system");
var settings=require("../../../config/settings");
const ApiBase =require("../api.base");
const logCtl=System.getObject("web.oplogCtl");
// const uuidv4 = require('uuid/v4');
class SoftwareApi extends ApiBase{
constructor(){
super();
this.utilscopyrightSve=System.getObject("service.utilscopyrightSve");
}
//----------------------------------------------------著作权数据-----------------------
//某个公司的软件著作权列表=postordersbysaleman
async getSoftwareListByAuthor(obj){
var data= await this.checkKey(obj.appKey);
if(data && data.status==-1){
return data;
}
return this.utilscopyrightSve.softwareListByAuthor(obj,"bossShopApplet");
}
//软件著作权详情=post
async getSoftwareDetailsByAuthor(obj){
var data= await this.checkKey(obj.appKey);
if(data && data.status==-1){
return data;
}
return this.utilscopyrightSve.softwareDetailsByAuthor(obj,"bossShopApplet");
}
//某个公司的作品著作权列表=post
async getWorksListByAuthor(obj){
var data= await this.checkKey(obj.appKey);
if(data && data.status==-1){
return data;
}
return this.utilscopyrightSve.worksListByAuthor(obj,"bossShopApplet");
}
//作品著作权详情=post
async getWorksDetailsByAuthor(obj){
var data= await this.checkKey(obj.appKey);
if(data && data.status==-1){
return data;
}
return this.utilscopyrightSve.worksDetailsByAuthor(obj,"bossShopApplet");
}
}
module.exports=SoftwareApi;
var System = require("../../system");
var settings = require("../../../config/settings");
const ApiBase = require("../api.base");
const logCtl = System.getObject("web.oplogCtl");
class SubCopyright extends ApiBase {
constructor() {
super();
this.softwarecrsubmitSve = System.getObject("service.softwarecrsubmitSve");
this.workcrsubmitSve = System.getObject("service.workcrsubmitSve");
}
async autosubCr(obj) {//提报软件著作权数据
var data = await this.checkKey(obj.appKey);
if (data && data.code && data.code == -1) {
return { code: -1, message: "appKey错误", data: null };
}
try {
var tmpResult = await this.softwarecrsubmitSve.getAutoSubList();
return tmpResult;
} catch (e) {
//日志记录
logCtl.error({
optitle: "提报软件著作权数据异常",
op: "base/api/impl/subcopyright/autosubCr",
content: e.stack,
clientIp: ""
});
return { code: -1, message: "autosubCr异常", data: [] };
}
}
async autosubWorks(obj) {//提报作品著作权数据
var data = await this.checkKey(obj.appKey);
if (data && data.code && data.code == -1) {
return { code: -1, message: "appKey错误", data: null };
}
try {
var tmpResult = await this.workcrsubmitSve.getAutoSubList();
return tmpResult;
} catch (e) {
//日志记录
logCtl.error({
optitle: "提报作品著作权数据异常",
op: "base/api/impl/subcopyright/autosubWorks",
content: e.stack,
clientIp: ""
});
return { code: -1, message: "autosubWorks异常", data: [] };
}
}
//修改提报的状态
/*
appKey
opType 操作类型,"1"软件著作权、"2"作品著作权
proxyCode 代理号,
statusValue 状态值,
message 操作信息,
*/
async putSubStatus(obj) {//修改提报状态
var data = await this.checkKey(obj.appKey);
if (data && data.code && data.code == -1) {
return { code: -1, message: "appKey错误", data: null };
}
try {
//日志记录
logCtl.info({
optitle: "修改提报著作权状态数据==>>>>>>信息",
op: "base/api/impl/subcopyright/putSubStatus",
content: JSON.stringify(obj),
clientIp: ""
});
const proxyCode = obj.proxyCode || "";
const statusValue = obj.statusValue || "";
const message = obj.message || "";
const opType = Number(obj.opType || "-1")
if (!proxyCode) {
return { code: -1, message: "proxyCode不能为空", data: null };
}
if (!statusValue) {
return { code: -1, message: "statusValue不能为空", data: null };
}
var item = null;
//更改提报状态
if (opType == 1) {
item = await this.softwarecrsubmitSve.dao.findOne({ proxyCode: proxyCode });
}
else if (opType == 2) {
item = await this.workcrsubmitSve.dao.findOne({ proxyCode: proxyCode });
}
if (!item) {
return { code: -1, message: "数据为空,操作失败", data: null };
}
if (item.statusProgress != "COMMITED") {
return { code: -1, message: "要更新的数据status不为COMMITED:人工已提交,操作失败", data: null };
}
var putField = {
statusProgress: statusValue,
subNotes: message
};
var sqlWheres = { where: { proxyCode: proxyCode } };
//更改提报状态
if (opType == 1) {
await this.softwarecrsubmitSve.dao.updateByWhere(putField, sqlWheres);
}
else if (opType == 2) {
await this.workcrsubmitSve.dao.updateByWhere(putField, sqlWheres);
}
return { code: 1, message: "success", data: null };
} catch (e) {
//日志记录
logCtl.error({
optitle: "修改提报著作权状态数据异常",
op: "base/api/impl/subcopyright/putSubStatus",
content: e.stack,
clientIp: ""
});
return { code: -1, message: "putSubStatus异常", data: [] };
}
}
}
module.exports = SubCopyright;
var System = require("../../system");
const http = require("http");
const querystring = require('querystring');
const md5 = require("MD5");
const uuidv4 = require('uuid/v4');
var settings = require("../../../config/settings");
const ApiBase = require("../api.base");
/**
* tmk收藏api
*/
class tmkApi extends ApiBase {
constructor() {
super();
this.cacheManager = System.getObject("db.cacheManager");
this.service = System.getObject("service.tmkSve");
this.calcnameSve = System.getObject("service.calcnameSve");
};
//检查appkey
// async checkKey(obj){
// let key = await this.cacheManager["InitAppKeyCache"].getAppKeyVal(obj.appKey);
// if(key==null){
// return System.getResult2(null,null,"ok","请检查您的授权KEY");
// }
// };
//新增收藏
async addCollect(obj) {
var data = await this.checkKey(obj.appKey);
if (data && data.status && data.status === -1) {
return data;
}
//判断数据是否存在
var select = await this.service.selectCollect(obj);
if (select.length === 0) {
var result = await this.service.insertCollect(obj);
if (result == null) {
return { code: -1, msg: "收藏失败!" }
}
return { code: 1, msg: "OK" }
} else {
return { code: 0, msg: "该数据已存在" }
}
}
//删除收藏
async delCollect(obj) {
//验证appKey
var data = await this.checkKey(obj.appKey);
if (data && data.status && data.status === -1) {
return data;
}
//判断数据是否存在
var select = await this.service.selectCollect(obj);
if (select.length !== 0) {
var result = await this.service.delCollect(obj);
if (result == null) {
return { code: -1, msg: "取消收藏失败!" }
}
// return {code: 1, msg: "取消收藏成功!"}
var collect = await this.service.selectAllCollect(obj);
if (collect.data.length === 0) {
return { code: 0, msg: "没有收藏记录" }
} else {
return collect;
}
} else {
return { code: 0, msg: "该数据未在收藏队列" }
}
}
//查询所有收藏
async seleCollect(obj) {
var data = await this.checkKey(obj.appKey);
if (data && data.status && data.status === -1) {
return data;
}
var select = await this.service.selectAllCollect(obj);
if (select.data.length === 0) {
return { code: 0, msg: "没有收藏记录" }
} else {
return select;
}
}
//获取商标起名信息
async getTmNameList(obj) {
try {
var data = await this.checkKey(obj.appKey);
if (data && data.status && data.status === -1) {
return data;
}
var result = await this.calcnameSve.structurename(obj);
return result;
} catch (e) {
console.log(e.stack, "获取商标起名信息----error");
}
}
}
module.exports = tmkApi;
\ No newline at end of file
var System = require("../../system");
const ApiBase = require("../api.base");
/**
* tmk备注api
*/
class tmkremarkApi extends ApiBase {
constructor() {
super();
this.cacheManager = System.getObject("db.cacheManager");
this.service = System.getObject("service.tmkremarkSve");
};
//新增备注
async addRemark(obj) {
var data = await this.checkKey(obj.appKey);
if (data && data.status && data.status === -1) {
return data;
}
var result = await this.service.insertRemark(obj);
if (result == null) {
return {code: -1, msg: "添加备注失败!"}
}
return {code: 1, msg: "OK"}
}
//删除备注
async delRemark(obj) {
//验证appKey
var data = await this.checkKey(obj.appKey);
if (data && data.status && data.status === -1) {
return data;
}
var result = await this.service.delRemark(obj);
if (result == null) {
return {code: -1, msg: "删除备注失败!"}
}
var remark = await this.service.selectRemark(obj);
if (remark.data.length ===0) {
return {code: 0, msg: "没有备注记录"}
}else {
return {code: 1, msg: "删除备注成功!",data:remark};
}
// return {code: 1, msg: "删除备注成功!"}
}
//显示所有备注
async seleRemark(obj) {
var data = await this.checkKey(obj.appKey);
if (data && data.status && data.status === -1) {
return data;
}
var select = await this.service.selectRemark(obj);
if (select.data.length === 0) {
return {code: 0, msg: "没有备注记录"}
} else {
return select;
}
}
}
module.exports = tmkremarkApi;
\ No newline at end of file
var System=require("../../system");
const logCtl=System.getObject("web.oplogCtl");
class TmSub{
constructor(){
this.cacheManager=System.getObject("db.cacheManager");
this.trademarkS=System.getObject("service.trademarkSve");
}
async checkKey(appKey){
let key = await this.cacheManager["InitAppKeyCache"].getAppKeyVal(appKey);
if(key==null){
return {code:-1,message:"请检查您的授权KEY",data:null};
}
// if(obj.companyName.replace(/(^s*)|(s*$)/g, "").length ==0)
// {
// return System.getResult2(null,null,"ok","请输入要查询的公司名");
// }
}
async autosub(obj){//提报数据
var data=await this.checkKey(obj.appKey);
if(data && data.code && data.code==-1){
return data;
}
//keyCode列表,以,隔开
var keyCodeList=obj.keyCodeList==null?"":obj.keyCodeList;
if(keyCodeList==""){
return {code:-1,message:"keyCodeList不能为空",data:null};
}
//当前key码
var keyCode=obj.keyCode==null?"":obj.keyCode;
if(keyCode==""){
return {code:-1,message:"keyCode不能为空",data:null};
}
try{
var tmpResult= await this.trademarkS.getAutoSubList(keyCodeList,keyCode);
return tmpResult;
}catch(e){
//日志记录
logCtl.error({
optitle:"提报数据异常",
op:"base/api/impl/tmsub/autosub",
content:e.stack,
clientIp:""
});
return {code:-1,message:"TmSub异常",data:[]};
}
}
//机器人提报更新提报错误
async updateErrorCount(obj){
var data=await this.checkKey(obj.appKey);
if(data && data.code && data.code==-1){
return data;
}
//提报号
var proxyCode=obj.proxyCode==null?"":obj.proxyCode;;
if(proxyCode==""){
return {code:-1,message:"proxyCode不能为空",data:null};
}
//错误次数
var errorCount=obj.errorCount==null?1:obj.errorCount;
//key码-redis用
var keyCode=obj.keyCode==null?"":obj.keyCode;
if(keyCode==""){
return {code:-1,message:"keyCode不能为空",data:null};
}
try{
var tmpResult= await this.trademarkS.setUpdateErrorCount(proxyCode,errorCount,keyCode);
return tmpResult;
}catch(e){
//日志记录
logCtl.error({
optitle:"机器人提报更新提报错误异常",
op:"base/api/impl/tmsub/updateErrorCount",
content:e.stack,
clientIp:""
});
return {code:-1,message:"updateErrorCount异常",data:null};
}
}
//机器人提报更新商标状态
async updateState(obj){
var data=await this.checkKey(obj.appKey);
if(data && data.code && data.code==-1){
return data;
}
//提报号
var proxyCode=obj.proxyCode==null?"":obj.proxyCode;
if(proxyCode==""){
return {code:-1,message:"proxyCode不能为空",data:null};
}
var errorCount=obj.errorCount==null?0:obj.errorCount;
//商标状态枚举,传递枚举值
var stateCode=obj.stateCode==null?"":obj.stateCode;
if(stateCode==""){
return {code:-1,message:"stateCode不能为空",data:null};
}
//key码-redis用
var keyCode=obj.keyCode==null?"":obj.keyCode;
if(keyCode==""){
return {code:-1,message:"keyCode不能为空",data:null};
}
try{
var tmpResult= await this.trademarkS.setUpdateState(proxyCode,errorCount,stateCode,keyCode);
return tmpResult;
}catch(e){
//日志记录
logCtl.error({
optitle:"机器人提报更新商标状态异常",
op:"base/api/impl/tmsub/updateState",
content:e.stack,
clientIp:""
});
return {code:-1,message:"updateState异常",data:null};
}
}
//更新商标code和状态
async updateTradeMarkCode(obj){
var data=await this.checkKey(obj.appKey);
if(data && data.code && data.code==-1){
return data;
}
//提报号
var proxyCode=obj.proxyCode==null?"":obj.proxyCode;
if(proxyCode==""){
return {code:-1,message:"proxyCode不能为空",data:null};
}
//商标号
var code=obj.code==null?"":obj.code;
if(code==""){
return {code:-1,message:"code不能为空",data:null};
}
//商标状态枚举,传递枚举值
var stateCode=obj.stateCode==null?"":obj.stateCode;
if(stateCode==""){
return {code:-1,message:"stateCode不能为空",data:null};
}
try{
var tmpResult= await this.trademarkS.setUpdateTradeMarkCode(proxyCode,code,stateCode);
return tmpResult;
}catch(e){
//日志记录
logCtl.error({
optitle:"更新商标code和状态异常",
op:"base/api/impl/tmsub/updateTradeMarkCode",
content:e.stack,
clientIp:""
});
return {code:-1,message:"updateTradeMarkCode异常",data:null};
}
}
}
module.exports=TmSub;
var System=require("../../system")
const http=require("http")
const querystring = require('querystring');
const md5=require("MD5");
const uuidv4 = require('uuid/v4');
//const cyjAppKey="ccb00829347e4048833af213e502c8c5";
var settings=require("../../../config/settings");
class TradeMarkApi{
constructor(){
this.baseUrl=settings.teleDomain();//测试
//this.baseUrl="http://www.telecredit.cn/";//生产
this.cacheManager=System.getObject("db.cacheManager");
};
async checkParams(obj){
let key = await this.cacheManager["InitAppKeyCache"].getAppKeyVal(obj.appKey);
if(key==null){
return System.getResult2(null,null,"ok","请检查您的授权KEY");
}
if(obj.q.replace(/(^s*)|(s*$)/g, "").length ==0)
{
return System.getResult2(null,null,"ok","请输入要查询的公司名");
}
};
buildParams(obj){
var currentT=(new Date()).Format("yyyy-MM-dd hh:mm:ss");
var params = {
q:obj.q,
appKey:"gongsibao",
currentTime:currentT,
page:obj.page?obj.page:0,
pageSize:obj.pagesize?obj.pagesize:5,
};
var originStr=params.currentTime+params.appKey+"d10c5fa8d0d41a56fd1390ad214898ed"
+params.page+""+params.pageSize+params.q;
var token=md5(originStr);
params.token=token;
return params;
};
async tmname(obj){//商标名称查询
var data=await this.checkParams(obj);
if(data && data.status && data.status==-1){
return data;
}
var reqUrl=this.baseUrl+"data/api/trademark/tmname";
//data/api/companyInfo/entregistry
let params = this.buildParams(obj);
var rc=System.getObject("util.restClient");
var data=querystring.stringify(params);
var rtn=null;
try{
rtn=await rc.execPost2(data,reqUrl);
return System.getResult2(JSON.parse(rtn.stdout).data,null);
}catch(e){
return rtn=System.getResult2(null,null);
}
};
async tmid(obj){//商标注册号查询
var data=await this.checkParams(obj);
if(data && data.status && data.status==-1){
return data;
}
var reqUrl=this.baseUrl+"data/api/trademark/tmid";
//data/api/companyInfo/entregistry
let params = this.buildParams(obj);
var rc=System.getObject("util.restClient");
var data=querystring.stringify(params);
var rtn=null;
try{
rtn=await rc.execPost2(data,reqUrl);
return System.getResult2(JSON.parse(rtn.stdout).data,null);
}catch(e){
return rtn=System.getResult2(null,null);
}
};
async tmapplicant(obj){//商标申请人查询
var data=await this.checkParams(obj);
if(data && data.status && data.status==-1){
return data;
}
var reqUrl=this.baseUrl+"data/api/trademark/tmapplicant";
//data/api/companyInfo/entregistry
let params = this.buildParams(obj);
var rc=System.getObject("util.restClient");
var data=querystring.stringify(params);
var rtn=null;
try{
rtn=await rc.execPost2(data,reqUrl);
return System.getResult2(JSON.parse(rtn.stdout).data,null);
}catch(e){
return rtn=System.getResult2(null,null);
}
};
}
module.exports=TradeMarkApi;
// var capi=new CompanyApi();
// capi.entsearch({appKey:cyjAppKey,companyName:"大圣",currentPage:1,pageSize:10}).then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
const ApiBase =require("../api.base");
Class WxApi extends ApiBase{
}
mongoose = require('mongoose');
var Schema = mongoose.Schema({
company_name: { type: String},
})
const ad = mongoose.model('taierphones', Schema);
//导出模型
module.exports =ad;
const system=require("../system");
class CtlBase{
constructor(sname){
this.serviceName=sname;
this.service=system.getObject("service."+sname);
this.cacheManager=system.getObject("db.cacheManager");
}
notify(req,msg){
if(req.session){
req.session.bizmsg=msg;
}
}
async findOne(queryobj,qobj){
var rd=await this.service.findOne(qobj);
return system.getResult2(rd,null);
}
async findAndCountAll(queryobj,obj,req){
obj.codepath=req.codepath;
if(req.session.user){
obj.uid=req.session.user.id;
obj.appid=req.session.user.app_id;
obj.onlyCode=req.session.user.unionId;
obj.account_id=req.session.user.account_id;
obj.ukstr=req.session.user.app_id+"¥"+req.session.user.id+"¥"+req.session.user.nickName+"¥"+req.session.user.headUrl;
}
var apps=await this.service.findAndCountAll(obj);
return system.getResult2(apps,null);
}
async refQuery(queryobj,qobj){
var rd=await this.service.refQuery(qobj);
return system.getResult2(rd,null);
}
async bulkDelete(queryobj,ids){
var rd=await this.service.bulkDelete(ids);
return system.getResult2(rd,null);
}
async delete(queryobj,qobj){
var rd=await this.service.delete(qobj);
return system.getResult2(rd,null);
}
async create(queryobj,qobj,req){
if(req && req.session && req.session.app){
qobj.app_id=req.session.app.id;
qobj.onlyCode=req.session.user.unionId;
if(req.codepath){
qobj.codepath=req.codepath;
}
}
var rd=await this.service.create(qobj);
return system.getResult2(rd,null);
}
async update(queryobj,qobj,req){
if(req && req.session && req.session.user){
qobj.onlyCode=req.session.user.unionId;
}
if(req.codepath){
qobj.codepath=req.codepath;
}
var rd=await this.service.update(qobj);
return system.getResult2(rd,null);
}
static getServiceName(ClassObj){
return ClassObj["name"].substring(0,ClassObj["name"].lastIndexOf("Ctl")).toLowerCase()+"Sve";
}
async initNewInstance(queryobj,req){
return system.getResult2({},null);
}
async findById(oid){
var rd=await this.service.findById(oid);
return system.getResult2(rd,null);
}
async timestampConvertDate(time){
if(time==null){
return "";
}
var date = new Date(Number(time*1000));
var y = 1900+date.getYear();
var m = "0"+(date.getMonth()+1);
var d = "0"+date.getDate();
return y+"-"+m.substring(m.length-2,m.length)+"-"+d.substring(d.length-2,d.length);
}
async universalTimeConvertLongDate(time){
if(time==null){
return "";
}
var d = new Date(time);
return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
}
async universalTimeConvertShortDate(time){
if(time==null){
return "";
}
var d = new Date(time);
return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
}
// async doExecute(methodname,params){
// var result= await this[methodname](params);
// return system.getResult2(result,null);
// }
}
module.exports=CtlBase;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class AccountCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(AccountCtl));
this.accountSve=system.getObject("service.accountSve");
//this.appS=system.getObject("service.appSve");
}
async initNewInstance(queryobj,qobj){
var u=uuidv4();
var aid=u.replace(/\-/g,"");
var rd={name:"",appid:aid}
return system.getResult2(rd,null);
}
async findById(q,obj,req){
var aid=req.session.user.account_id;
var reqParam=obj.param==null?"":obj.param;
var result= await this.accountSve.getFindById(reqParam,aid);
return system.getResult2(result,null);
}
async petradesSum(){
var result=await this.accountSve.getpetradesSum();
return system.getResult2(result,null);
}
async subPublicExpense(obj,pobj,req){
var se= await this.accountSve.subPublicExpense(pobj,req);
return system.getResult2(se,null);
}
}
module.exports=AccountCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class AdvicelettercaseCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(AdvicelettercaseCtl));
this.apifq=system.getObject('api.fqtmsearch');
this.imghandleApi=system.getObject("api.imghandle");
}
async nclonebyscope(pobj,obj,req){
var companyName=pobj.companyName;
var tmName=pobj.tmName;
var s={appKey:'wx76a324c5d201d1a4',companyName:companyName,tmName:tmName};
var ncls=await this.apifq.tjdlSearch(s);
return system.getResult2(ncls,null);
}
async save(pobj,obj,req){
var user=obj.session.user;
var form=JSON.parse(pobj.alc);
form.user_id=user.id;
form.app_id=user.app_id;
form.onlyCode=user.onlyCode;
form.nclOnes= JSON.stringify(form.nclOnes)
var s=await this.service.create(form);
}
async findbyid(pobj,obj,req){
var id=pobj.id;
var s=await this.service.findById(id);
return system.getResult2(s,null);
}
async createalc(o,req){
var app=req.session.app;
var obj={
"appKey":app.appid,
"url":o.url
};
var id=o.id;
var result=await this.imghandleApi.makeDeleForTM(obj);
debugger;
var alcinfo=await this.service.findById(id);
debugger;
alcinfo=alcinfo.dataValues;
if(alcinfo.id!=null){
alcinfo.aclPDF=result.data.url;
var rd=await this.service.update(alcinfo);
}
return result;
}
}
module.exports=AdvicelettercaseCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class AppCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(AppCtl));
//this.appS=system.getObject("service.appSve");
this.newschanneS=system.getObject("service.newschannelSve");
this.servicesitem=system.getObject("service.servicesitemSve");
this.loopplayS=system.getObject("service.loopplaySve");
}
async initNewInstance(queryobj,qobj){
var u=uuidv4();
var aid=u.replace(/\-/g,"");
var rd={name:"",appid:aid}
return system.getResult2(rd,null);
}
async findHomeInitData(queryobj,qobj){
var newschannels=await this.newschanneS.findPrev5();
//var servicesitems=await this.servicesitem.findService5();
var onlines=await this.cacheManager["VisitCountCache"].findOnlines();
qobj.appid=settings.wxconfig.appId;
//var loopplays=await this.loopplayS.findAndCountAll(qobj);
//var app=await this.cacheManager["AppCache"].cacheApp(settings.wxconfig.appId);
var app=await this.service.findOne(settings.wxconfig.appId);
var rtn={};
rtn.logoUrl=app.logoUrl;
rtn.appimgUrl=app.appimgUrl;
rtn.news=newschannels;
//rtn.servicesitem=servicesitems;
rtn.onlines=onlines;
//rtn.loopplays=loopplays;
return system.getResult2(rtn,null);
}
}
module.exports=AppCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class AppdetailCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(AppdetailCtl));
}
async findAndCountAll(queryobj,obj,req){
var result= await this.service.findAndCountAlldetail(obj.exsearch.appkey);
return system.getResult2(result,null);
}
}
module.exports=AppdetailCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class ArticleCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(ArticleCtl));
//this.appS=system.getObject("service.appSve");
}
async findById(q,oid){
return super.findById(Number(oid.id));
}
}
module.exports=ArticleCtl;
var system=require("../../system")
const http=require("http")
const querystring = require('querystring');
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
class AttachmentCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(AttachmentCtl));
this.restS=system.getObject("util.restClient");
this.appDao=system.getObject("db.appDao");
this.userDao=system.getObject("db.userDao");
this.accountDao=system.getObject("db.accountDao");
this.productDao=system.getObject("db.productDao");
this.accountSve=system.getObject("service.accountSve");
}
async create(qobj,pobj,req){
var productId=pobj.productId;
var key=pobj.key;
var originUrl=pobj.originUrl;
var name=pobj.name;
var user=req.session.user;
var accountId=user.account_id;
var product=await this.productDao.model.findOne({where:{id:productId}});
var app=await this.appDao.model.findOne({where:{id:user.app_id}});
var usr =await this.userDao.model.findOne({where:{id:user.id}});
var account=await this.accountDao.model.findOne({where:{id:accountId}});
var attachmentObj={
key:key,
name:name,
originUrl:originUrl,
transformUrl:"",
userId:user.id,
userName:user.nickName,
appid:user.app_id,
appName:app.name,
user:usr,
account:account,
productId:productId
};
//this.model.querry("")
var att =await this.service.create(attachmentObj);
await this.accountSve.delAccountBalance(user.account_id,app.id);
var accountBalance=await this.accountSve.getAccountBalance(user.account_id,user.app_id);
att.dataValues["accountBalance"]=accountBalance;
att.dataValues["price"]=product.price;
return att;
}
}
module.exports=AttachmentCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
class AuthCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(AuthCtl));
}
async saveAuths(query,qobj,req){
var auths=qobj.aus;
var xrtn=await this.service.saveAuths(auths);
return system.getResult2(xrtn,null);
}
async findAuthsByRole(query,qobj,req){
var rolecodestrs=qobj.rolecode;
var xrtn=await this.service.findAuthsByRole(rolecodestrs);
return system.getResult2(xrtn,null);
}
}
module.exports=AuthCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
const logCtl=system.getObject("web.oplogCtl");
class BusinessallotCtl extends CtlBase{
constructor() {
super(CtlBase.getServiceName(BusinessallotCtl));
}
async receipt(queryobj,qobj,req){
let id = qobj.id;
let userId = req.session.user.id;
if(!id) {
return system.getErrResult2("请选择订单");
}
if(!userId) {
return system.getErrResult2("请重新登录");
}
let rs = await this.service.receipt(id, userId);
if(rs == -1) {
return system.getErrResult2("当前任务不属于您");
}
return system.getResult2(rs);
}
// async findAndCountAll(queryobj,qobj,req){
// //日志记录
// logCtl.info({
// optitle:"获取派单列表:findAndCountAll",
// op:"controller/impl/businessallotCtl/findAndCountAll",
// content:"参数:"+JSON.stringify(qobj),
// clientIp:""
// });
// var tlist=await super.findAndCountAll(queryobj,qobj,req);
// //日志记录
// logCtl.info({
// optitle:"获取派单列表:findAndCountAll==结果",
// op:"controller/impl/businessallotCtl/findAndCountAll",
// content:"tlist结果:"+JSON.stringify(tlist),
// clientIp:""
// });
// return tlist;
//
// }
async giveup(queryobj,qobj,req){
let id = qobj.id;
let userId = req.session.user.id;
let reason = qobj.reason;
if(!id) {
return system.getErrResult2("请选择订单");
}
if(!userId) {
return system.getErrResult2("请重新登录");
}
let rs = await this.service.giveup(id, userId, reason);
if(rs == -1) {
return system.getErrResult2("当前任务不属于您");
}
return system.getResult2(rs);
}
async success(queryobj,qobj,req){
let id = qobj.id;
let userId = req.session.user.id;
let reason = qobj.reason;
let money = qobj.money;
if(!id) {
return system.getErrResult2("请选择订单");
}
if(!money) {
return system.getErrResult2("成单金额必须输入");
}
var tMoney=parseFloat(money);
if(isNaN(tMoney) ){
return system.getErrResult2("成单金额必须为数字");
}
if(!userId) {
return system.getErrResult2("请重新登录");
}
let rs = await this.service.success(id, userId, tMoney, reason,"add");
if(rs == -1) {
return system.getErrResult2("当前任务不属于您");
}
return system.getResult2(rs);
}
async putsuccess(queryobj,qobj,req){
let id = qobj.id;
let userId = req.session.user.id;
let reason = qobj.reason;
let money = qobj.money;
if(!id) {
return system.getErrResult2("请选择订单");
}
if(!money) {
return system.getErrResult2("成单金额必须输入");
}
var tMoney=parseFloat(money);
if(isNaN(tMoney) ){
return system.getErrResult2("成单金额必须为数字");
}
if(!userId) {
return system.getErrResult2("请重新登录");
}
let rs = await this.service.success(id, userId, tMoney, reason,"put");
if(rs == -1) {
return system.getErrResult2("当前任务不属于您");
}
return system.getResult2(rs);
}
async failue(queryobj,qobj,req){
let id = qobj.id;
let userId = req.session.user.id;
let reason = qobj.reason;
if(!id) {
return system.getErrResult2("请选择订单");
}
if(!userId) {
return system.getErrResult2("请重新登录");
}
let rs = await this.service.failue(id, userId, reason);
if(rs == -1) {
return system.getErrResult2("当前任务不属于您");
}
return system.getResult2(rs);
}
}
module.exports=BusinessallotCtl;
var System=require("../../system");
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
const logCtl=System.getObject("web.oplogCtl");
class businesschanceCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(businesschanceCtl));
this.shopSve=System.getObject("service.shopSve");
this.channelSve=System.getObject("service.channelSve");
this.servicesitemSve=System.getObject("service.servicesitemSve");
}
//needh5获取相应产品信息列表-----暂时不想要
async getServiceItemList(pobj,obj,req){
if(obj.itemType=="recommand"){
var pobj={
channel:"wssyh5",
recommend:1,
shopOnlyCode:"odnZ4twQmg_AmwrHv6JPIEZqamj8"
}
}else{
var pobj={
channel:"wssyh5",
itemtype:obj.itemType,
shopOnlyCode:"odnZ4twQmg_AmwrHv6JPIEZqamj8"
}
}
var service=await this.shopSve.getServiceItemListForNeedh5(pobj);
return service;
}
//neeh5提交需求
async submitneed(pobj,obj,req){
if(obj.publisherName==""||obj.publisherName==null||obj.publisherName=="undefined"){
return {code:-100,msg:"请填写您的姓名"};
}
if(obj.publisherMobile==""||obj.publisherMobile==null||obj.publisherMobile=="undefined"){
return {code:-100,msg:"请填写您的电话"};
}
if(obj.notes!=""&&obj.notes!=null&&obj.notes!="undefined"&&obj.notes.length>255){
return {code:-100,msg:"备注字数超出限制,请重新填写"};
}
if(obj.serviceItem_code==""||obj.serviceItem_code==null||obj.serviceItem_code=="undefined"){
return {code:-110,msg:"serviceItem_code参数传递错误"};
}
var tChannelCode=obj.channelCode==""||obj.channelCode==null||obj.channelCode=="undefined"?"":obj.channelCode;
if(tChannelCode==""){
return {code:-111,msg:"channelCode参数传递错误"};
}
var channelItem=await this.channelSve.getChannelItem(tChannelCode);
if(channelItem==""||channelItem==null){
return {code:-112,msg:"channelCode参数传递错误"};
}
var serviceItem=await this.servicesitemSve.findOneByCode(obj.serviceItem_code);
if(serviceItem==""||serviceItem==null){
return {code:-113,msg:"serviceItem_code参数传递错误"};
}
var pobj={
publisherName:obj.publisherName,
publisherMobile:obj.publisherMobile,
serviceItem_code:obj.serviceItem_code,
channelCode:tChannelCode,
chanceStatus:"1"
};
//验证小程序求购需求
var tPublisherOnlyCode=obj.publisherOnlyCode==""||obj.publisherOnlyCode==null||obj.publisherOnlyCode=="undefined"?"":obj.publisherOnlyCode;
var tShopOnlyCode=obj.shopOnlyCode==""||obj.shopOnlyCode==null||obj.shopOnlyCode=="undefined"?"":obj.shopOnlyCode;
if(tShopOnlyCode!=""){
pobj.shopOnlyCode=tShopOnlyCode;
}
var result=await this.service.findchance(pobj);
if(result!=""&&result!=null){
return {code:"0",msg:"您已经发布需求,请不要重复提交"};
}
try{
//channelItem===
var reqParams={
notes:obj.notes,
publisherName:obj.publisherName,
publisherMobile:obj.publisherMobile,
channelCode:tChannelCode,
serviceItem_code:obj.serviceItem_code,
serviceItem_name:serviceItem.name,
publisherOnlyCode:tPublisherOnlyCode,
shopOnlyCode:tShopOnlyCode,
chanceStatus:"1",
chanceType:serviceItem.itemType,
channelProfitRatio:channelItem.profitType==1?(channelItem.everySingleProfit||0):0,//渠道分成比率(如:总额100,字段值30,则渠道的利润为30/100,剩下的则为平台利润)
channelProfit:channelItem.profitType==2?(channelItem.everySingleProfit||0):0,//渠道利润
profitType:channelItem.profitType//渠道利润类型:1: "比例分成", 2: "每单分成"
};
//新增的省份和城市
var tCity=obj.city||"";
var tProvince=obj.province||"";
if(tCity && tProvince){
reqParams.city=tCity;
reqParams.province=tProvince;
}
var chance = await this.service.create(reqParams);
this.smsClient=System.getObject("util.smsClient");
this.smsClient.sendMsg("13381139519","亲爱的知产合伙人,你的客户于"+(new Date()).Format("yyyy-MM-dd")+"发布了新的需求,亲,赶紧去自己店铺去查看“我的商机”吧!");
return {code:"1",msg:"发布成功"};
}catch(e){
console.log(e);
//日志记录
logCtl.error({
optitle:"渠道neeh5提交需求异常",
op:"/controller/impl/businesschanceCtl/submitneed",
content:"请求参数:"+JSON.stringify(obj)+",error:"+e.stack,
clientIp:""
});
return {code:"-1",msg:"操作失败,请稍后重试"};
}
}
async publishChance(obj,req){
try{
var user=req.session.user;
var app = req.session.app;
var type=obj.type;
var reqParams={
app_id:app.id,
publisherId:user.id,
chanceStatus:"1",
chanceType:type
};
var ch=await this.service.findOne(reqParams);
if(ch!=null){
return {code:"2",data:reqParams};
}
var chanceObj={
app_id:app.id,
publisherId:user.id,
publisherName:user.nickName,
publisherMobile:obj.mobile,
publisherOnlyCode:user.onlyCode,
chanceType:type,
chanceStatus:"1",
platformChanceType:"common",
};
var chance = this.service.create(chanceObj);
return {code:"1",data:chance};
}catch(e){
return {code:"-1"};
}
}
async findAllChances(obj,req){
var user=req.session.user;
var queryObj={
publisherId:user.id
};
return this.service.findAllChances(queryObj);
}
}
module.exports=businesschanceCtl;
var System=require("../../system")
class xzsearchCtl{
constructor(){
this.tradeSve=System.getObject("service.tradeSve");
this.accountSve=System.getObject("service.accountSve");
this.appSve=System.getObject("service.appSve");
this.productDao=System.getObject("db.productDao");
this.gsbSearchApi=System.getObject("api.gsbtmsearch");
}
convertDate(time){
var date = new Date(Number(time*1000));
var y = 1900+date.getYear();
var m = "0"+(date.getMonth()+1);
var d = "0"+date.getDate();
return y+"-"+m.substring(m.length-2,m.length)+"-"+d.substring(d.length-2,d.length);
}
async findAndCountAll(queryobj,obj,req){
var appkey=req.session.app.appid;
var result={rows:[],count:0};
var sources=[];
var pageSize=obj.pageInfo.pageSize;
var currentPage=obj.pageInfo.pageNo;
var companyName=obj.search.companyName==null?"":obj.search.companyName;
var data={
appKey:appkey,
pageSize:pageSize,
currentPage:currentPage,
companyName:companyName
};
var that=this;
var companys =await this.gsbSearchApi.byslSearch(data);
if(companys.status == 0){
result.count=companys.total;
companys.data.forEach(function(c){
var source={
companyName:c.registrant_name,
regNum:c.tm_regist_num,
noAcceptDay:that.convertDate(c.no_accepted_day),
noAccepyIssue:c.no_accepted_notice_issue,
noAcceptPageNum:c.no_accepted_notice_page_num,
file:c.link_url,
companyAddr:c.registrant_addr,
phone:c.tel_info,
email:c.email_info,
};
sources.push(source);
});
result.rows=sources;
}
return System.getResult2(result,null);
}
async createTrade(qobj,pobj,req){
var productId=pobj.productId;
var product=await this.productDao.model.findOne({where:{id:productId}});
var user=req.session.user;
var tradeObj={username:user.nickName,tradeDate:new Date(),status:"settled",baoAmount:product.price,tradeType:"consume"};
var trade=await this.tradeSve.create(user,tradeObj);
var accountBalance = await this.accountSve.getAccountBalance(user.account_id,user.app_id);
trade.dataValues["accountBalance"]=accountBalance;
return trade;
}
}
module.exports=xzsearchCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class CacheCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(CacheCtl));
//this.appS=system.getObject("service.appSve");
}
async initNewInstance(queryobj,qobj){
return system.getResult2({},null);
}
async delCache(queryobj,qobj){
await this.service.delCache(qobj);
return system.getResult2({},null);
}
async findOnlines(queryobj,qobj,req){
//var ms=await this.cacheManager["VisitCountCache"].findOnlines(req.session.app.appid);
var ms=await this.cacheManager["VisitCountCache"].findOnlines();
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxx");
console.log(ms);
return system.getResult2(ms,null);
}
async clearAllCache(queryobj,qobj){
console.log("clearAllCache===========================");
await this.service.clearAllCache(qobj);
return system.getResult2({},null);
}
}
module.exports=CacheCtl;
var system=require("../../system")
const http=require("http")
const querystring = require('querystring');
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const logCtl=system.getObject("web.oplogCtl");
class ChannelCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(ChannelCtl));
this.wxSve = system.getObject("service.wxSve");
}
async findAllChannel(obj,req){
var self=this;
var result=await this.service.findAllChannel();
result.data.sort(self.keysort('id',true));
return result;
}
async getChannelItem(qobj,obj,req){
var channel=await this.service.getChannelItem(obj.channelcode);
if(channel==""||channel==null||channel=="undefined"){
return {code:-1,msg:"该渠道尚未建立"};
}else{
return {code:1,msg:"success",data:channel.channelName}
}
}
async create(queryobj,qobj,req){
if(req && req.session && req.session.app){
qobj.app_id=req.session.app.id;
qobj.onlyCode=req.session.user.unionId;
if(req.codepath){
qobj.codepath=req.codepath;
}
}
if(!qobj.iconLink) {
qobj.iconLink = "https://boss.gongsibao.com/needhtml5?channelcode=" + qobj.channelCode;
}
if(qobj.iconLink) {
qobj.qrcodeurl = "http://boss.gongsibao.com/api/qc?detailLink=" + qobj.iconLink;
}
var rd=await this.service.create(qobj);
return system.getResult2(rd,null);
}
async update(queryobj,qobj,req){
if(req && req.session && req.session.user){
qobj.onlyCode=req.session.user.unionId;
}
if(req.codepath){
qobj.codepath=req.codepath;
}
if(!qobj.iconLink) {
qobj.iconLink = "https://boss.gongsibao.com/needhtml5?channelcode=" + qobj.channelCode;
}
if(qobj.iconLink) {
qobj.qrcodeurl = "http://boss.gongsibao.com/api/qc?detailLink=" + qobj.iconLink;
}
var rd=await this.service.update(qobj);
return system.getResult2(rd,null);
}
/**
* 排序有倒序 对数组中的对象,按对象的key进行sortType排序
* @param key 数组中的对象为object,按object中的key进行排序
* @param sortType true为降序;false为升序
*/
keysort(key,sortType) {
return function(a,b){
return sortType ? ~~(a[key] < b[key]) : ~~(a[key] > b[key]);
}
}
}
module.exports=ChannelCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class ChannelmanageallotCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(ChannelmanageallotCtl));
this.channelSve=system.getObject("service.channelSve");
this.userSve=system.getObject("service.userSve");
}
async mysave(queryobj,qobj,req){
try {
console.log(qobj, "===========================");
qobj.app_id = 7;
let channel_id = qobj.channel_id;
let mobile = qobj.mobile;
let leaderMobile = qobj.leaderMobile;
let id = qobj.id;
let cma = null;
if(id) {
cma = this.service.findById(id);
}
// 渠道
let channel = await this.channelSve.findById(channel_id);
console.log(channel_id, "===========================");
if(!channel) {
return system.getErrResult2("渠道不存在");
}
// 负责人
let owner = await this.userSve.findOne({app_id:qobj.app_id, mobile:mobile});
if(!owner) {
return system.getErrResult2("负责人未注册,请到公众号注册, 否则无法微信推送");
}
// 负责人领导
let leader = await this.userSve.findOne({app_id:qobj.app_id, mobile:leaderMobile});
if(!leader) {
return system.getErrResult2("负责人领导未注册, 请到公众号注册, 否则无法微信推送");
}
qobj.channelCode = channel.channelCode || "";
qobj.channelName = channel.channelName || "";
qobj.channel_id = channel.id;
qobj.user_id = owner.id;
qobj.businessOwner = owner.userName || "";
qobj.openId = owner.openId || "";
qobj.email = owner.email || "";
qobj.mobile = owner.mobile || "";
qobj.leaderId = leader.id;
qobj.leaderOpenId = leader.openId || "";
if(cma) {
await this.service.update(qobj);
cma = await this.service.findById(id);
} else {
let obj = await this.service.findOne({chanceType:qobj.chanceType, channelCode:qobj.channelCode, user_id:owner.id});
if(obj) {
return system.getErrResult2("该手机号已经添加配置, 请不要重复添加");
}
qobj.weight = 1;
cma = await this.service.create(qobj);
}
await this.cacheManager["ChannelManageAllotCache"].delAllCache();
console.log(cma, "--------------------------queryobj---------------");
return system.getResult2(cma);
} catch (e) {
console.log("-----------------------------e");
console.log(e);
}
return system.getResult2(null);
}
}
module.exports=ChannelmanageallotCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class CodeCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(CodeCtl));
//this.appS=system.getObject("service.appSve");
}
async initNewInstance(queryobj,qobj){
var u=uuidv4();
var aid=u.replace(/\-/g,"");
var rd={name:"",appid:aid}
return system.getResult2(rd,null);
}
}
module.exports=CodeCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class ContainerCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(ContainerCtl));
//this.appS=system.getObject("service.appSve");
}
async initNewInstance(queryobj,qobj){
var u=uuidv4();
var aid=u.replace(/\-/g,"");
var rd={name:"",appid:aid}
return system.getResult2(rd,null);
}
async createData(queryobj,pobj,req){
console.log("createData****************");
//TODO:创建容器脚本==,成功后赋值status
var containerItem={
name:pobj.name+"-容器",
mirrorinfo_id:pobj.id
// machine_id:==机器档案id
// status:==0停用,1启动
};
var result= await this.service.create(containerItem);
return system.getResult2(result,null);
}
async createWork(queryobj,pobj,req){
console.log("createWork****************");
if(pobj.status==1){
pobj.status='0';
}else{
pobj.status='1';
}
pobj.version+=1;
await this.service.update(pobj);
//TODO:创建容器启动或停用脚本==,成功后赋值status,status状态为:0停用,1启动
var result={
}
return system.getResult2(result,null);
}
}
module.exports=ContainerCtl;
var System=require("../../system");
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class CopyrightinfoCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(CopyrightinfoCtl));
}
async initNewInstance(queryobj,req){
return system.getResult2({},null);
}
async createOrEdit(queryobj,qobj,req){
try {
console.log(req.session.user);
var copyRight=null;
if(qobj.id){
copyRight = await this.service.findById(qobj.id);
}
console.log(copyRight);
if(copyRight){//修改
console.log("edit++++++++++++++++++++++++++++++++++++");
delete qobj.applierTypeName;
delete qobj.copyrightTypeName;
delete qobj.compositionTypeName;
delete qobj.statusProgressName;
var result = await this.service.update(qobj);
return {code:1,data:qobj};
}else{//新增
console.log("new++++++++++++++++++++++++++++++++++++");
if(req && req.session && req.session.app){
qobj.app_id=req.session.app.id;
}
var obj={//compositionType itemCode itemName
app_id:qobj.app_id,user_id:req.session.user.id,onlyCode:req.session.onlyCode,userName:req.session.userName,nickName:req.session.nickName,
copyrightType:qobj.copyrightType,status:1,statusProgress:"AWAITCHECK",applierType:qobj.applierType,applyName:qobj.applyName,
mobile:qobj.mobile,identityCardPic:qobj.identityCardPic,businessLicensePic:qobj.businessLicensePic,specimenPic:qobj.specimenPic,
registrationDocument:qobj.registrationDocument,codeDocument:qobj.codeDocument,instructionBookDocument:qobj.instructionBookDocument,
orderNum:"",customerContact:qobj.customerContact,customerMobile:qobj.customerMobile
}
if(qobj.copyrightType=="zpzz"){
obj["compositionType"]=qobj.compositionType;
}
var rd=await this.service.create(obj);
return {code:1,data:rd};
}
} catch (e) {
return {code:-1}
}
}
async hookOrder(qobj,obj){
console.log(obj);
var result=await this.service.hookOrder(obj);
return System.getResult2(result,null);
}
async copy(obj,req){
var user=req.session.user;
var id=obj.id;
var form=await this.service.findById(id);
form=form.dataValues;
form.id="";
form.created_at=null;
form.updated_at=null;
if(req && req.session && req.session.app){
form.app_id=req.session.app.id;
form["user_id"]=req.session.user.id;
}
form.orderNum="";
form.status="1";
form.statusName="未关联订单";
form.statusProgress="AWAITCHECK";
form.statusProgressName="未提交";
form["createAuthorizeStuff"]="";
var rd=await this.service.create(form);
return System.getResult2(rd,null);
}
async changeStatus(qobj,obj){
try {
var r = await this.service.changeStatus(obj);
return r;
} catch (e) {
return {code:-1}
}
}
}
module.exports=CopyrightinfoCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class CustomerRollPicCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(CustomerRollPicCtl));
//this.appS=system.getObject("service.appSve");
}
}
module.exports=CustomerRollPicCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class EcompanyCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(EcompanyCtl));
}
async getByName(queryobj,qobj,req){
}
async mysave(queryobj,qobj,req){
try {
console.log(queryobj, "--------------------------queryobj---------------");
console.log(qobj, "--------------------------qobj---------------");
var old=null;
if(qobj.id){
old = await this.service.findById(qobj.id);
}
console.log(old, "--------------------------old---------------");
var rtn = null;
if(old){//修改
console.log("edit++++++++++++++++++++++++++++++++++++");
rtn = await this.service.update(qobj);
}else{//新增
console.log("new++++++++++++++++++++++++++++++++++++");
rtn=await this.service.create(qobj);
}
// 调用e签宝接口生成accountid
return system.getResult2(rtn, null);
} catch (e) {
console.log("-----------------------------e");
console.log(e);
return {code:-1}
}
}
}
module.exports=EcompanyCtl;
var system = require("../../system")
var settings = require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class EcontractCtl extends CtlBase {
constructor() {
super(CtlBase.getServiceName(EcontractCtl));
this.etemplateSve = system.getObject("service.etemplateSve");
this.userSve = system.getObject("service.userSve");
this.usereaccountSve = system.getObject("service.usereaccountSve");
this.ecompanySve = system.getObject("service.ecompanySve");
this.utilesignbaoSve = system.getObject("service.utilesignbaoSve");
this.esealSve = system.getObject("service.esealSve");
this.Mail = system.getObject("util.mailClient");
this.eSignBaoRedirectBossUrl = settings.apiconfig.eSignBaoRedirectBossUrl();
}
async findCompleteContracts(q, obj, req) {
obj = obj || {};
obj.eflowstatus = "2";
if (req && req.session && req.session.user.id) {
obj.user_id = req.session.user.id;
}
console.log(obj, "=============================================");
var rs = await this.service.findContracts(obj);
return system.getResult2(rs);
}
async genContract(q, obj, req) {
obj = obj || {};
let userid;
if (req && req.session && req.session.user.id) {
userid = req.session.user.id;
}
if (!userid) {
return system.getErrResult2("登录失效,请重新登录");
}
let eaccount_id = obj.eaccount_id;
let etemplateid = obj.etemplateid;
let user = await this.userSve.findById(userid);
let etemplate = await this.etemplateSve.findById(etemplateid);
let company = await this.ecompanySve.findById(etemplate.ecompany_id);
let eaccount = await this.usereaccountSve.findById(eaccount_id);
if (!eaccount.eaccountid) {
return system.getErrResult2("签署失败,请重新进入");
}
if (!etemplate || !etemplate.templateid) {
return system.getErrResult2("协议不存在,请刷新重新选择");
}
let sinedCompanyIds = await this.service.findUserSinedCompanyIds(eaccount_id);
if (sinedCompanyIds.indexOf(Number(etemplate.ecompany_id)) != -1) {
return system.getErrResult2("你已经签署该公司协议,不可以重复签署");
}
var contract = await this.service.findOne({
"etemplate_id": etemplateid,
"usereaccount_id": eaccount_id,
"eflowstatus": "1"
});
if (contract) {
await this.service.delete({
id: contract.id
});
}
contract = {
name: etemplate.name,
etemplate_id: etemplateid,
user_id: userid,
usereaccount_id: eaccount_id,
ecompany_id: etemplate.ecompany_id,
edocid: "",
eflowid: "",
esignUrl: "",
eflowstatus: "1"
}
contract = await this.service.create(contract);
let today = new Date().Format("yyyy-MM-dd");
var nameA = company.nameA || "智信云(天津)科技有限公司";
var eseal = await this.esealSve.findOne({
nameA: nameA
});
var sealId = "";
if (!eseal) {
var rs = await this.utilesignbaoSve.creatEntSignet("f50d8f8cdd8d4bcda6b1aaad1d4b14bf", company.nameA + "alias", nameA, "", "", "econtractCtl");
if (rs && rs.code == 1) {
sealId = rs.data.sealId;
await this.esealSve.create({
nameA : nameA,
sealId : sealId,
});
} else {
return system.getErrResult2("签约失败, 生成印章错误");
}
} else {
sealId = eseal.sealId;
}
var params = {
templateId: etemplate.templateid, //模板id,由创建模板接口调用返回的templateId 必填
name: etemplate.name, //合同模板名称 必填
simpleFormFields: {
nameA: company.nameA || "智信云(天津)科技有限公司", //甲方 必填
nameB: eaccount.userName, //乙方 必填
unit: company.name, //合作单位(国美) 必填---------------------------超出长度风险---目前不知多少长度
signDateA: today, //甲方签约日期 必填
signDateB: today //乙方签约日期 必填
}
};
var ebaoAccountId = eaccount.eaccountid; //签署人账户id-- 必填
var thirdOrderNo = contract.id; //第三方流水号,通知回调使用---选填
var eBaoRedirectBossUrl = this.eSignBaoRedirectBossUrl + "?ecid=" + etemplate.ecompany_id + "&cb=1#/ecompany/signed";
console.log({
params: params,
ebaoAccountId: ebaoAccountId,
thirdOrderNo: thirdOrderNo
}, "-============= params ===========================");
let tt = await this.utilesignbaoSve.userSignContractNoTemplate(params, ebaoAccountId, thirdOrderNo, eBaoRedirectBossUrl, "econtractCtl", sealId);
console.log(tt, "-============= result ===========================");
if (tt && tt.code == 1) {
contract.eflowid = tt.data.flowId;
contract.edocid = tt.data.docId;
contract.esignUrl = tt.data.signUrl;
contract.save();
}
return system.getResult2(contract, null);
}
async findInfo(q, obj, req) {
obj = obj || {};
var rs = await this.service.findInfo(obj);
return system.getResult2(rs);
}
async sendContractEmail(q, obj, req) {
obj = obj || {};
let id = obj.id;
let email = obj.email;
let contract = await this.service.findById(id);
if (!contract) {
return {
code: 0,
msg: "发送失败,合同不存在"
}
}
if (contract.eflowstatus != "2") {
return {
code: 0,
msg: "合同还未签署完成"
}
}
if (!contract.fileurl) {
// 请求文件地址
let fileRs = await this.utilesignbaoSve.downloadUserContractFile(contract.eflowid, "econtractCtl");
console.log(fileRs, "===============================================================");
if (fileRs.code == 1 && fileRs.data.selfossUrl) {
contract.fileurl = fileRs.data.selfossUrl;
contract.save();
} else {
return {
code: 0,
msg: "您的网络繁忙,请稍后重试"
}
}
}
var to = email;
var title = '合同信息';
var text = null;
var html = '请点击下载链接获取合同:';
var cc = null;
var bcc = null;
var atts = [];
var html = '<a href="' + contract.fileurl + '">' + contract.name + '</a>'
try {
console.log(to, title, text, html, cc, bcc, atts);
var result = await this.Mail.sendMsg(to, title, text, html, cc, bcc, atts) //发送成功后result的值:250 Data Ok: queued as freedom
console.log(result);
if (result.indexOf("Ok") >= 0) {
return {
code: 1,
msg: "发送成功"
}
} else {
return {
code: 0,
msg: "发送失败"
}
}
} catch (e) {
console.log(e);
return {
code: 0,
msg: "发送失败"
}
}
}
}
module.exports = EcontractCtl;
\ No newline at end of file
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
const logCtl=system.getObject("web.oplogCtl");
class EtemplateCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(EtemplateCtl));
this.utilesignbaoSve = system.getObject("service.utilesignbaoSve");
this.econtractSve = system.getObject("service.econtractSve");
this.wxSve = system.getObject("service.wxSve");
}
async findReadyContracts(q,obj, req){
obj = obj || {};
obj.userId = req.session.user.id;
// 验证companyId
if(!obj.ecompany_id || !obj.eaccount_id) {
return system.getResult2([]);
}
let sinedCompanyIds = await this.econtractSve.findUserSinedCompanyIds(Number(obj.eaccount_id));
if(sinedCompanyIds.indexOf(Number(obj.ecompany_id)) != -1) {
return system.getResult2([]);
}
var rs=await this.service.findReadyContracts(obj);
return system.getResult2(rs);
}
async mysave(queryobj,qobj,req){
try {
var old=null;
let id = qobj.id;
if(id){
old = await this.service.findById(id);
}
var rtn = null;
if(old){//修改
console.log("edit++++++++++++++++++++++++++++++++++++");
await this.service.update(qobj);
rtn = await this.service.findById(id);
}else{//新增
console.log("new++++++++++++++++++++++++++++++++++++");
rtn = await this.service.create(qobj);
}
// 调用e签宝接口生成template
if(rtn.filepath && rtn.name) {
try {
let templateRs = await this.utilesignbaoSve.createEntTemplate(rtn.filepath, rtn.name, "etemplateCtl");
logCtl.info({
optitle:"e签宝===>保存模板信息template",
op:"app/base/controller/impl/etemplateCtl/mysave",
content:"参数:filepath="+rtn.filepath+";name="+rtn.name + "; result : " + JSON.stringify(templateRs),
clientIp:""
});
if(templateRs && templateRs.code == 1 && templateRs.data) {
rtn.filekey = templateRs.data.fileKey;
rtn.templateid = templateRs.data.templateId;
rtn.save();
} else {
console.log("======================12222222222222222222222222222222222222222222222222222222222222222222222222====================");
}
} catch (e) {
console.error(e);
}
}
rtn.qrcodeurl = await this.wxSve.makeQrWithScene("wxf616c0a459d66081", rtn.ecompany_id);
rtn.save();
return system.getResult2(rtn, null);
} catch (e) {
console.log("-----------------------------e");
console.log(e);
return {code:-1}
}
}
}
module.exports=EtemplateCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class FiledownloadCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(FiledownloadCtl));
this.excelClient = system.getObject("util.excelClient");
}
async download(queryobj,qobj,req){
let id = qobj.code;
var rows = qobj.rows || [];
var userId = req.session.user.id;
var fileName = qobj.fileName || "";
var code = uuidv4();
if(fileName){
fileName = fileName + ".xlsx";
} else {
fileName = "data_" + userId + "_" + new Date().getTime() + ".xlsx";
}
var param = {
title: "商标查询结果列表",
code : code,
fileName : fileName,
user : req.session.user,
rows : rows
}
this.excelClient.download(param);
return system.getResult2(code);
}
}
module.exports=FiledownloadCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class FiletomailCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(FiletomailCtl));
//this.appS=system.getObject("service.appSve");
}
}
module.exports=FiletomailCtl;
var System=require("../../system")
class entrepreneurstasticCtl{
constructor(){
this.tradeSve=System.getObject("service.tradeSve");
this.accountSve=System.getObject("service.accountSve");
this.appSve=System.getObject("service.appSve");
this.productDao=System.getObject("db.productDao");
this.gsbSearchApi=System.getObject("api.gsbtmsearch");
this.cacheManager=System.getObject("db.cacheManager");
}
convertDate(time){
if(time==null){
return "";
}
var date = new Date(Number(time*1000));
var y = 1900+date.getYear();
var m = "0"+(date.getMonth()+1);
var d = "0"+date.getDate();
return y+"-"+m.substring(m.length-2,m.length)+"-"+d.substring(d.length-2,d.length);
}
async findAndCountAll(queryobj,obj,req){
}
async getDetail(queryobj,obj,req){
}
module.exports=entrepreneurstasticCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class InvoiceCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(InvoiceCtl));
//this.appS=system.getObject("service.appSve");
this.orderS=system.getObject("service.orderSve");
this.calculatepriceS=system.getObject("service.calculatepriceSve");
}
async initNewInstance(queryobj,qobj){
return system.getResult2(rd,null);
}
async getInfoByOrderNum(pobj,obj){
var reqParams={
orderNum:obj.orderNum
};
var invoiceinfo=await this.service.findOne(reqParams);
if( invoiceinfo == null )
{
var calculatepriceinfo=await this.calculatepriceS.findOne(reqParams);
var orderinfo= await this.orderS.findOneByOrderNum(obj.orderNum);
invoiceinfo={"mobile":"","email":"","invoiceHeadUp":"","totalSum":""};
invoiceinfo.totalSum=orderinfo.totalSum;
invoiceinfo.mobile=calculatepriceinfo.mobile;
invoiceinfo.email=calculatepriceinfo.email;
invoiceinfo.invoiceHeadUp=orderinfo.applyName;
}
return invoiceinfo;
}
async showInvoiceHeadUp(pobj,obj){
var reqParams={
orderNum:obj.orderNum
};
var orderinfo= await this.orderS.findOneByOrderNum(pobj.orderNum);
return orderinfo;
}
async addInvoiceInfo(gobj,pobj,req){//发票申请
var user=req.session.user;
if(user==null){
return {code:-1,msg:"用户信息为空"}
}
if(pobj==null||pobj.invoiceInfo==null){
return {code:-1,msg:"请求信息为空"}
}
if(pobj.invoiceInfo.invoiceHeadUpType==null||pobj.invoiceInfo.invoiceHeadUpType==""){
return {code:-1,msg:"请求信息类型为空"}
}
var orderinfo= await this.orderS.findOneByOrderNum(pobj.orderNum);
if( orderinfo ==null )
{
return {code:-1,msg:"数据操作失败"}
}
var result= await this.service.createOrUpdateInvoiceInfo(user,orderinfo,pobj);
if(result==null){
return {code:-1,msg:"数据操作失败"}
}
return {code:"1",msg:"ok"};
}
}
module.exports=InvoiceCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class LbsCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(LbsCtl));
//this.appS=system.getObject("service.appSve");
}
async addressSearch(gobj,pobj,req){
console.log("--------------------------------------------------------------");
console.log(pobj);
var address=pobj.address==null?"":pobj.address;
if(address==""){
return system.getResult2(null,null);
}
var distance=pobj.distance==null?"":pobj.distance;
if(distance==""){
return system.getResult2(null,null);
}
address=await this.getConvertSemiangleStr(address);//全半角转化
var params = {
"appkey":"d41d8cd98f00b204e9800998ecf8427e",
"address":address,
"distance":distance,
"pagesize":pobj.pageSize,
"currentPage":pobj.currentPage
}
var reqUrl="http://43.247.184.92:8880/lbs/api/addresssearch";
var rtn=null;
var rc=system.getObject("util.execClient");
try{
rtn=await rc.execPost(params,reqUrl);
debugger;
var tmpResult=JSON.parse(rtn.stdout);
console.log("------------------------------------");
console.log(tmpResult);
if(tmpResult.status!=0){
return system.getResult2(null,null,"other method fail");
}else{
return tmpResult}
}catch(e){
return system.getResult2(null,null,"zntjSearch error;");
}
}
async lalSearch(gobj,pobj,req){
console.log("--------------------------------------------------------------");
console.log(pobj);
var lat=pobj.lat==null?"":pobj.lat;
if(lat==""){
return system.getResult2(null,null);
}
var lng=pobj.lng==null?"":pobj.lng;
if(lng==""){
return system.getResult2(null,null);
}
var distance=pobj.distance==null?"":pobj.distance;
if(distance==""){
return system.getResult2(null,null);
}
var params = {
"appkey": "d41d8cd98f00b204e9800998ecf8427e",
"lat":lat,
"lng":lng,
"distance":distance,
"pagesize":pobj.pageSize,
"currentPage":pobj.currentPage
};
var reqUrl="http://43.247.184.92:8889/lbs/api/lalsearch";
var rtn=null;
var rc=system.getObject("util.execClient");
try{
rtn=await rc.execPost(params,reqUrl);
var tmpResult=JSON.parse(rtn.stdout);
console.log("------------------------------------");
console.log(tmpResult);
if(tmpResult.status!=0){
return system.getResult2(null,null,"other method fail");
}else{
return tmpResult
}
}catch(e){
return system.getResult2(null,null,"zntjSearch error;");
}
}
async citySearch(gobj,pobj,req){
console.log("--------------------------------------------------------------");
console.log(pobj);
var cityName=pobj.cityName==null?"":pobj.cityName;
if(cityName==""){
return system.getResult2(null,null);
}
cityName=await this.getConvertSemiangleStr(cityName);//全半角转化
var params = {
"appkey":"d41d8cd98f00b204e9800998ecf8427e",
"cityName":cityName,
"pagesize":pobj.pageSize,
"currentPage":pobj.currentPage
}
var reqUrl="http://43.247.184.92:8886/lbs/api/citysearch";
var rtn=null;
var rc=system.getObject("util.execClient");
try{
rtn=await rc.execPost(params,reqUrl);
var tmpResult=JSON.parse(rtn.stdout);
console.log("------------------------------------");
console.log(tmpResult);
if(tmpResult.status!=0){
return system.getResult2(null,null,"other method fail");
}else{
return tmpResult}
}catch(e){
return system.getResult2(null,null,"zntjSearch error;");
}
}
async getConvertSemiangleStr(str){
var result = "";
var len = str.length;
for(var i=0;i<len;i++)
{
var cCode = str.charCodeAt(i);
//全角与半角相差(除空格外):65248(十进制)
cCode = (cCode>=0xFF01 && cCode<=0xFF5E)?(cCode - 65248) : cCode;
//处理空格
cCode = (cCode==0x03000)?0x0020:cCode;
result += String.fromCharCode(cCode);
}
return result;
};
}
module.exports=LbsCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class LoopplayCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(LoopplayCtl));
//this.appS=system.getObject("service.appSve");
}
async findById(q,oid){
return super.findById(Number(oid.id));
}
async findByChannelcode(qobj,obj,req){
if(obj.channelcode==null||obj.channelcode==""||obj.channelcode=="undefined"){
return {code:-1,msg:"参数channelcode错误"};
}
var result=await this.service.findByChannelcode(obj);
return {code:1,msg:"success",data:result};
}
async findAndCountAll(queryobj,obj,req){
obj.codepath=req.codepath;
if(req.session.user){
obj.uid=req.session.user.id;
obj.appid=req.session.user.app_id;
obj.onlyCode=req.session.user.unionId;
obj.account_id=req.session.user.account_id;
obj.ukstr=req.session.user.app_id+"¥"+req.session.user.id+"¥"+req.session.user.nickName+"¥"+req.session.user.headUrl;
}
var apps=await this.service.findAndCountAll(obj);
return system.getResult2(apps,null);
}
// async findAll(q,oid){
// var rd=await this.service.findAll();
// return system.getResult2(rd,null);
// return super.findById(Number(oid.id));
// }
}
module.exports=LoopplayCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class MachineCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(MachineCtl));
//this.appS=system.getObject("service.appSve");
}
async initNewInstance(queryobj,qobj){
var u=uuidv4();
var aid=u.replace(/\-/g,"");
var rd={name:"",appid:aid}
return system.getResult2(rd,null);
}
}
module.exports=MachineCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
class MetaCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(MetaCtl));
this.productS=system.getObject("service.productSve");
this.productC=system.getObject("web.productCtl");
this.userS=system.getObject("service.userSve");
this.authS=system.getObject("service.authSve");
}
//权限 角色+资源节点code+权限字符串,codepath--
async getUiConfig(queryObj,req){
var bizCode=queryObj.biz;
var cfg=await this.service.getUiConfig(settings.wxconfig.appId);
console.log(cfg);
var tmpRoleAuthStr="";
if(req && req.session && req.session.user){
var tmpRoles=[];
req.session.user.Roles.forEach(r=>{
tmpRoles.push(r.code);
});
//按照角色获取权限列表
var auths=await this.authS.findAuthsByRole(tmpRoles);
var codeauthattrs=auths.map(r=>{
if(r.authstrs && r.authstrs!=""){
return r.authstrs;
}else{
return "";
}
});
tmpRoleAuthStr=codeauthattrs.join(",");
}
//获取当前登录人的角色,进而获取权限,进而合并工具栏目
var toolbar=[];
const bizConfigData= cfg.config["bizs"][bizCode];
console.log(bizCode);
Object.keys(bizConfigData.config.auth).map(k=>{
//只要有权限就添加
if(req.session.user.account.isSuper || req.session.user.isAdmin){
toolbar=toolbar.concat(bizConfigData.config.auth[k]);
}else{
if(tmpRoleAuthStr.indexOf(k)>=0){
toolbar=toolbar.concat(bizConfigData.config.auth[k]);
}
}
})
bizConfigData.config.toolbar=toolbar;
return system.getResult2(bizConfigData.config,null);
}
// async getCacheQuery(bizCode){
// var bizCode=queryObj.biz;
// var cfg=await this.service.getUiConfig(settings.wxconfig.appId);
// console.log(cfg);
// //获取当前登录人的角色,进而获取权限,进而合并工具栏目
// var toolbar=[];
// const bizConfigData= cfg.config["bizs"][bizCode];
// Object.keys(bizConfigData.config.auth).map(k=>{
// //只要有权限就添加
// toolbar=toolbar.concat(bizConfigData.config.auth[k]);
// })
// bizConfigData.config.toolbar=toolbar;
// return system.getResult2(bizConfigData.config,null);
// }
async getDicConfig(queryObj){
var dicKey=queryObj["dicKey"];
var cfg=await this.service.getUiConfig(settings.wxconfig.appId);
//获取当前登录人的角色,进而获取权限,进而合并工具栏目
return system.getResult2(cfg.config["pdict"][dicKey],null);
}
//每个角色有一个code/codepath的集合
//只要当前code出现在codepath中,就返回
//针对叶子节点授权,那么父节点出现在codepath中,所以可以实现父节点返回
async getRsConfig(q,req){
var rs2=[];
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
var cfg=await this.service.getUiConfig(settings.wxconfig.appId);
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy");
var tmpRoleCodepathStr="";
if(req && req.session && req.session.user){
//按照用户查询角色
// try{
// var user= await this.userS.getAuths(req.session.user.id);
// var roles=await user.getRoles({raw:true});
// console.log(roles);
// }catch(e){
// console.log(e);
// }
var tmpRoles=[];
req.session.user.Roles.forEach(r=>{
tmpRoles.push(r.code);
});
//按照角色获取权限列表
var auths=await this.authS.findAuthsByRole(tmpRoles);
var codepathattrs=auths.map(r=>{
if(r.authstrs && r.authstrs!=""){
return r.codepath;
}else{
return "";
}
});
tmpRoleCodepathStr=codepathattrs.join(",");
}
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>获取当前登录人的角色,进而获取权限,进而合并工具栏目>>>>>>>>>>>>.getRsConfig");
//获取当前登录人的角色,进而获取权限,进而合并工具栏目
console.log(tmpRoleCodepathStr);
console.log(req.session.user);
for(var i =0;i<cfg.config["rstree"].children.length;i++){
var r=cfg.config["rstree"].children[i];
var funcrange=function(n){
if(req && req.session && req.session.user){
if((req.session.user.account && req.session.user.account.isSuper) || (req.session.user.isAdmin )){
n.hidden=false;
}else{
if(tmpRoleCodepathStr.indexOf(n.code)<0){
if(n.isctl && n.isctl=="no"){
n.hidden=false;
}else {
n.hidden=true;
return;
}
}else{
n.hidden=false;
}
}
}
if(n.children){
n.children.forEach((dd)=>{
return funcrange(dd);
});
}else{
if(n.isctl && n.isctl=="no"){
n.hidden=false;
}
return;
}
};
funcrange(r);
}
console.log("===================================");
console.log(cfg.config["rstree"]);
console.log("===================================");
return system.getResult2(cfg.config["rstree"],null);
}
async getRouteConfig(){
var cfg=await this.service.getUiConfig(settings.wxconfig.appId);
//获取当前登录人的角色,进而获取权限,进而合并工具栏目
var tmp={};
tmp.bizs=cfg.config["bizs"];
var products=await this.productS.list(settings.wxconfig.appId);
tmp.ps=await this.productC.addVisitCountData(products);
return system.getResult2(tmp,null);
}
}
module.exports=MetaCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class MirrorinfoCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(MirrorinfoCtl));
//this.appS=system.getObject("service.appSve");
}
async initNewInstance(queryobj,qobj){
var u=uuidv4();
var aid=u.replace(/\-/g,"");
var rd={name:"",appid:aid}
return system.getResult2(rd,null);
}
async createData(queryobj,pobj,req){
console.log("************************************createData");
var refQueryObj={
code_id:pobj.id,
versions_num:pobj.versions_num
}
var refQueryResult= await this.service.refQuery(refQueryObj);
if(refQueryResult.length>0){
var tmpResult={
state:-100
}
return system.getResult2(tmpResult,null);
}
//TODO:创建镜像脚本==
var mirrorinfoItem={
name:pobj.name+"-镜像",
docker_repo_addr:pobj.docker_repo_addr,
code_id:pobj.id,
versions_num:pobj.versions_num
};
var result= await this.service.create(mirrorinfoItem);
return system.getResult2(result,null);
}
}
module.exports=MirrorinfoCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class MsgHistoryCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(MsgHistoryCtl));
}
}
module.exports=MsgHistoryCtl;
var System=require("../../system");
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class ncloneCtl{
constructor(){
this.gsbSearchApi=System.getObject("api.gsbtmsearch");
}
async getNcl(queryobj,req){
var that=this;
var appkey=req.session.app.appid;
var result={rows:[],count:0};
var sources=[];
var nclcode=queryobj.nclcode;
var data={
nclcode:nclcode,
appKey:appkey,
};
var ncls =await this.gsbSearchApi.getNcl(data);
if(ncls.status == 0){
result.count=ncls.total;
var d=ncls.data;
for(var i=0;i<d.length;i++){
var c=d[i];
var source={code:"",name:"",fullname:"",pcode:"",disabled:false};
source.code=c.code;
source.pcode=c.pid;
source.name=c.name;
if(c.code==null){
source.fullname=c.name;
}else{
source.fullname=c.code+" "+c.name;
}
sources.push(source);
}
result.rows=sources;
}
return System.getResult2(result,null);
}
}
module.exports=ncloneCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class NewschannelCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(NewschannelCtl));
//this.appS=system.getObject("service.appSve");
}
async findAgreenment(queryobj,qobj,req){
var rd=await this.service.findAgreenment();
return system.getResult2(rd,null);
}
async initNewInstance(queryobj,qobj){
var u=uuidv4();
var aid=u.replace(/\-/g,"");
var rd={name:"",appid:aid}
return system.getResult2(rd,null);
}
async findPrev5(queryobj,qobj){
var rd=await this.service.findPrev5();
return system.getResult2(rd,null);
}
}
module.exports=NewschannelCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class OplogCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(OplogCtl));
//this.appS=system.getObject("service.appSve");
}
async initNewInstance(qobj){
var u=uuidv4();
var aid=u.replace(/\-/g,"");
var rd={name:"",appid:aid}
return system.getResult2(rd,null);
}
async debug(obj){
obj.logLevel="debug";
return this.create(null,obj);
}
async info(obj){
obj.logLevel="info";
return this.create(null,obj);
}
async warn(obj){
obj.logLevel="warn";
return this.create(null,obj);
}
async error(obj){
obj.logLevel="error";
return this.create(null,obj);
}
async fatal(obj){
obj.logLevel="fatal";
return this.create(null,obj);
}
}
module.exports=OplogCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class PartnerInfoCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(PartnerInfoCtl));
this.roleS=system.getObject("service.roleSve");
this.tradeSve=system.getObject("service.tradeSve");
}
async createWork(queryobj,pobj,req){
console.log("createWork****************");
if(pobj.status==1){
pobj.status='0';
}else{
pobj.status='1';
}
pobj.version+=1;
await this.service.update(pobj);
//TODO:创建容器启动或停用脚本==,成功后赋值status,status状态为:0停用,1启动
var result={
}
return system.getResult2(result,null);
}
async getPartnerInfo(gobj,pobj,req){//合伙人申请
var user=req.session.user;
if(user==null){
return null;
}else {
return user.partnerinfo;
}
}
async addPartnerInfo(gobj,pobj,req){//合伙人申请
var user=req.session.user;
if(user==null){
return {code:-1,msg:"用户信息为空"}
}
if(pobj==null||pobj.partnerInfo==null){
return {code:-1,msg:"请求信息为空"}
}
if(pobj.partnerInfo.apply_type==null||pobj.partnerInfo.apply_type==""){
return {code:-1,msg:"请求信息类型为空"}
}
//银行卡验证
var realName=pobj.partnerInfo.realName;
var identityCard=pobj.partnerInfo.identityCard;
var cardNo=pobj.partnerInfo.cardNo;
if( realName == null || identityCard == null || cardNo == null ){
return {code:-1,msg:"请完善信息"}
}
var result=await this.tradeSve.verifyBankcard(cardNo,identityCard,realName);
if(result.code<0){
return {code:-1,msg:"用于提现三要素,身份证号码、银行卡号、开户人姓名验证未通过"}
}
var role= await this.roleS.findOneByCode(pobj.partnerInfo.apply_type);
if(role==null){
return {code:-1,msg:"角色错误"}
}
var result= await this.service.createOrUpdatePartnerInfo(user,role.id,pobj);
if(result==null){
return {code:-1,msg:"数据操作失败"}
}
req.session.user.partnerinfo=result;
return {code:"1",msg:"ok"};
}
}
module.exports=PartnerInfoCtl;
var System=require("../../system");
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class PatentinfoCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(PatentinfoCtl));
}
async initNewInstance(queryobj,req){
return system.getResult2({},null);
}
async createOrEdit(queryobj,qobj,req){
try {
console.log(qobj);
console.log("---------------------------------");
console.log(req.session.user);
var patent=null;
if(qobj.id){
patent = await this.service.findById(qobj.id);
}
console.log(patent);
if(patent){//修改
console.log("edit++++++++++++++++++++++++++++++++++++");
delete qobj.patentsTypeName;
delete qobj.applierTypeName;
delete qobj.statusProgressName;
qobj.applicantRequireType=qobj.applicantRequireType.join(',');
var result = await this.service.update(qobj);
return {code:1,data:qobj};
}else{//新增
console.log("new++++++++++++++++++++++++++++++++++++");
if(req && req.session && req.session.app){
qobj.app_id=req.session.app.id;
}
var en=qobj.applicantRequireType.join(',');
var obj={
app_id:qobj.app_id,user_id:req.session.user.id,onlyCode:req.session.user.onlyCode,userName:req.session.user.userName,nickName:req.session.user.nickName,
status:1,statusProgress:"AWAITCHECK",orderNum:"",patentsName:qobj.patentsName,patentsType:qobj.patentsType,applicantRequireType:en,
applierType:qobj.applierType,applyName:qobj.applyName,applyAddr:qobj.applyAddr,mobile:qobj.mobile,customerContact:qobj.customerContact,customerMobile:qobj.customerMobile,
wgqPic:qobj.wgqPic,wghPic:qobj.wghPic,wgzPic:qobj.wgzPic,wgyPic:qobj.wgyPic,wgfstPic:qobj.wgfstPic,wgystPic:qobj.wgystPic,wgltPic:qobj.wgltPic,
zipFile:qobj.zipFile,registrationFormUrl:qobj.registrationFormUrl,technicalFileUrl:qobj.technicalFileUrl
}
console.log("--------------------------obj---------------");
console.log(obj);
var rd=await this.service.create(obj);
return {code:1,data:rd};
}
} catch (e) {
console.log("-----------------------------e");
console.log(e);
return {code:-1}
}
}
async hookOrder(qobj,obj){
console.log(obj);
var result=await this.service.hookOrder(obj);
return System.getResult2(result,null);
}
async copy(obj,req){
var user=req.session.user;
var id=obj.id;
var form=await this.service.findById(id);
form=form.dataValues;
form.id="";
form.created_at=null;
form.updated_at=null;
if(req && req.session && req.session.app){
form.app_id=req.session.app.id;
form["user_id"]=req.session.user.id;
}
form.orderNum="";
form.status="1";
form.statusName="未关联订单";
form.statusProgress="AWAITCHECK";
form.statusProgressName="未提交";
form["createAuthorizeStuff"]="";
var rd=await this.service.create(form);
return System.getResult2(rd,null);
}
async changeStatus(qobj,obj){
try {
var r = await this.service.changeStatus(obj);
return r;
} catch (e) {
return {code:-1}
}
}
}
module.exports=PatentinfoCtl;
var System=require("../../system");
var settings=require("../../../config/settings");
class patentqueryCtl{
constructor(){
this.GsbPatentSearchApi=System.getObject("api.gsbpatentsearch");
}
convertDate(time){
if(time==null){
return "";
}
var date = new Date(Number(time*1000));
var y = 1900+date.getYear();
var m = "0"+(date.getMonth()+1);
var d = "0"+date.getDate();
return y+"-"+m.substring(m.length-2,m.length)+"-"+d.substring(d.length-2,d.length);
}
async findsenior(queryobj,obj,req){//高级检索
var appkey=req.session.app.appid;
var result={rows:[],code_counts:[],count:0};
var sources=[];
var codes=[];
var fmtype = obj.fmtype==null?"":obj.fmtype;
var xxtype = obj.xxtype==null?"":obj.xxtype;
var wgtype = obj.wgtype==null?"":obj.wgtype;
var grtype = obj.grtype==null?"":obj.grtype;
var yxstatus = obj.yxstatus==null?"":obj.yxstatus;
var szstatus = obj.szstatus==null?"":obj.szstatus;
var wxstatus = obj.wxstatus==null?"":obj.wxstatus;
var filingname = obj.filingname==null?"":obj.filingname;
var pubno = obj.pubno==null?"":obj.pubno;
var abstract = obj.abstract==null?"":obj.abstract;
var grno = obj.grno==null?"":obj.grno;
var priorno = obj.priorno==null?"":obj.priorno;
var ipcno = obj.ipcno==null?"":obj.ipcno;
var applname = obj.applname==null?"":obj.applname;
var filingdate1 = obj.filingdate1==null?"":obj.filingdate1;
var filingdate2 = obj.filingdate2==null?"":obj.filingdate2;
var invname = obj.invname==null?"":obj.invname;
var pubdate1 = obj.pubdate1==null?"":obj.pubdate1;
var pubdate2 = obj.pubdate2==null?"":obj.pubdate2;
var filingno = obj.filingno==null?"":obj.filingno;
var grdate1 = obj.grdate1==null?"":obj.grdate1;
var grdate2 = obj.grdate2==null?"":obj.grdate2;
var pageSize=obj.pageSize;
var currentPage=obj.currentPage;
var data={
appKey:appkey,
fmtype:fmtype,
xxtype:xxtype,
wgtype:wgtype,
grtype:grtype,
yxstatus:yxstatus,
szstatus:szstatus,
wxstatus:wxstatus,
filingname:filingname,
pubno:pubno,
abstract:abstract,
grno:grno,
priorno:priorno,
ipcno:ipcno,
applname:applname,
filingdate1:filingdate1,
filingdate2:filingdate2,
invname:invname,
pubdate1:pubdate1,
pubdate2:pubdate2,
filingno:filingno,
grdate1:grdate1,
grdate2:grdate2,
pagesize:pageSize,
page:currentPage
};
var tms =await this.GsbPatentSearchApi.seniorSearch(data);//获取查询结果
var that=this;
if(tms.status == 0){
result.count=tms.data.total;
tms.data.hits.forEach(function(pa){
var source={
filingno:pa._source.filing_no,
pubtype:pa._source.pub_type,
filingdate:that.convertDate(pa._source.filing_date),
pubdate:that.convertDate(pa._source.pub_date),
pubno:pa._source.pub_no,
grdate:that.convertDate(pa._source.gr_date),
grno:pa._source.gr_no,
applname:pa._source.applicant_name,
invname:pa._source.inventor_name,
agentname1:pa._source.agent_name1,
agentname2:pa._source.agent_name2,
agencycode:pa._source.agency_code,
agencyname:pa._source.agency_name,
countrycode:pa._source.country_code,
applzip:pa._source.appl_zip,
appladdress:pa._source.appl_address,
filingname:pa._source.filing_name,
pubstatus:pa._source.pub_status,
pubstatusnow:pa._source.pub_status_now,
abstract:pa._source.abstr_text,
mainipc:pa._source.main_ipc,
ipcversion:pa._source.ipc_version,
otheripc:pa._source.other_ipc,
priorinfo:pa._source.prior_info,
pctinfo:pa._source.pct_info
};
sources.push(source);
});
result.rows=sources;
}
return System.getResult2(result,null);
}
async findintellect(queryobj,obj,req){//智能检索
var appkey=req.session.app.appid;
var result={rows:[],code_counts:[],count:0};
var sources=[];
var codes=[];
var selectName=obj.selectName==null?"":obj.selectName;
var pageSize=obj.pageSize;
var currentPage=obj.currentPage;
var data={
appKey:appkey,
selectName:selectName,
pagesize:pageSize,
page:currentPage
};
var tms =await this.GsbPatentSearchApi.intellectSearch(data);//获取查询结果
var that=this;
if(tms.status == 0){
result.count=tms.data.total;
console.log(tms);
tms.data.hits.forEach(function(pa){
console.log(pa);
var source={
filingno:pa._source.filing_no,
pubtype:pa._source.pub_type,
filingdate:that.convertDate(pa._source.filing_date),
pubdate:that.convertDate(pa._source.pub_date),
pubno:pa._source.pub_no,
grdate:that.convertDate(pa._source.gr_date),
grno:pa._source.gr_no,
applname:pa._source.applicant_name,
invname:pa._source.inventor_name,
agentname1:pa._source.agent_name1,
agentname2:pa._source.agent_name2,
agencycode:pa._source.agency_code,
agencyname:pa._source.agency_name,
countrycode:pa._source.country_code,
applzip:pa._source.appl_zip,
appladdress:pa._source.appl_address,
filingname:pa._source.filing_name,
pubstatus:pa._source.pub_status,
pubstatusnow:pa._source.pub_status_now,
abstract:pa._source.abstr_text,
mainipc:pa._source.main_ipc,
ipcversion:pa._source.ipc_version,
otheripc:pa._source.other_ipc,
priorinfo:pa._source.prior_info,
pctinfo:pa._source.pct_info
};
sources.push(source);
});
result.rows=sources;
}
return System.getResult2(result,null);
}
}
module.exports=patentqueryCtl;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class PConfigCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(PConfigCtl));
this.cacheManager=system.getObject("db.cacheManager");
//this.appS=system.getObject("service.appSve");
}
async initNewInstance(queryobj,qobj){
var u=uuidv4();
var aid=u.replace(/\-/g,"");
var rd={name:"",appid:aid}
return system.getResult2(rd,null);
}
async getConfigValue(obj,req){
var configType=obj.configType;
var pconfig=await this.cacheManager["PConfigCache"].cachePConfig();
var result= pconfig.find(item => {
return item.configType === configType;
});
return result;
}
}
module.exports=PConfigCtl;
var System=require("../../system");
var settings=require("../../../config/settings");
class pdf2wordCtl{
constructor(){
this.p2wUrl=settings.apiconfig.pdf2wordUrl();
this.accountSve=System.getObject("service.accountSve");
this.attachmentSve=System.getObject("service.attachmentSve");
this.userDao=System.getObject("db.userDao");
this.accountDao=System.getObject("db.accountDao");
this.productDao=System.getObject("db.productDao");
}
async pdf2word(obj){
var reqUrl=this.p2wUrl;
var filekey=obj.key;
if(filekey==null || filekey==""){
System.getResult2(null,null);
}
var param={"key":filekey};
var rc=System.getObject("util.execClient");
var rtn=null;
try{
rtn=await rc.execPost(param,reqUrl);
var j=JSON.parse(rtn.stdout);
if(j.res.status && j.res.status==200){
return j.url;
}else{
return null;
}
// return "http://gsb-zc.oss-cn-beijing.aliyuncs.com/zc_pdf2word94715337960293212018914279321.doc"
}catch(e){
return null;
}
return null;
}
async createAttachment(queryobj,pobj,req){
var productId=pobj.productId;
var key=pobj.key;
var originUrl=pobj.pdfUrl;
var transformUrl=pobj.docUrl;
var filename=pobj.filename;
var product=await this.productDao.model.findOne({where:{id:productId}});
var user=req.session.user;
var accountId=user.account_id;
var app=req.session.app;
var usr =await this.userDao.model.findOne({where:{id:user.id}});
var account=await this.accountDao.model.findOne({where:{id:accountId}});
var attachmentObj={
key:key,
name:filename,
originUrl:originUrl,
transformUrl:transformUrl,
userId:user.id,
userName:user.nickName,
appid:app.id,
appName:app.name,
user:usr,
account:account,
productId:productId
};
var att =await this.attachmentSve.create(attachmentObj);
await this.accountSve.delAccountBalance(user.account_id,user.app_id);
var accountBalance =await this.accountSve.getAccountBalance(user.account_id,user.app_id);
att.dataValues["price"]=product.price;
att.dataValues["accountBalance"]=accountBalance;
return att;
}
}
module.exports=pdf2wordCtl;
var System=require("../../system")
class PicToTextCtl{
constructor(){
this.businesslicenseKeyCode="95c8b314de2c4e38b8882508cd7e1d0c";
this.businesslicenseUrl="http://dm-58.data.aliyun.com/rest/160601/ocr/ocr_business_license.json";
this.idCardUrl="http://dm-51.data.aliyun.com/rest/160601/ocr/ocr_idcard.json";
this.homecardUrl="https://ocrapi-house-cert.taobao.com/ocrservice/houseCert";
this.idCardKeyCode="aaaaaaaaaaaaaa";
}
async getConfig(qobj,pobj){
var transformType=pobj.transformType;
if(transformType=="1"){
return {keycode:this.businesslicenseKeyCode,
url:this.businesslicenseUrl}
}
if(transformType=="2"){
return {keycode:this.businesslicenseKeyCode,
url:this.idCardUrl}
}
if(transformType=="3"){
return {keycode:this.businesslicenseKeyCode,
url:this.homecardUrl}
}
return null;
};
}
module.exports=PicToTextCtl;
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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