Commit aaa35c5e by 宋毅

tj

parent 035fe6c3

Too many changes to show.

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

module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
},
parserOptions: {
parser: 'babel-eslint'
}
}
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
#!/bin/bash
FROM registry.cn-beijing.aliyuncs.com/hantang2/node105:v3
MAINTAINER jy "jiangyong@gongsibcd ao.com"
ADD igirl-web /apps/igirl-web/
WORKDIR /apps/igirl-web/
# RUN yum install gcc gcc-c++ -y
RUN cnpm install -S
CMD ["node","/apps/igirl-web/main.js"]
FROM registry.cn-beijing.aliyuncs.com/hantang/node105:v2
MAINTAINER jy "jiangyong@gongsibao.com"
ADD channel-access /apps/channel-access/
WORKDIR /apps/channel-access/
RUN cnpm install -S
CMD ["node","/apps/channel-access/main.js"]
......
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
},
parserOptions: {
parser: 'babel-eslint'
}
}
# channel-access
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "channel-access",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.19.0",
"core-js": "^3.4.4",
"element-ui": "^2.13.0",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-plugin-router": "^4.1.0",
"@vue/cli-plugin-vuex": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"babel-eslint": "^10.0.3",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.0",
"vue-template-compiler": "^2.6.10"
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>channel-access</title>
</head>
<body>
<noscript>
<strong>We're sorry but channel-access doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<!-- 根组件 -->
<div id="app">
<router-view/>
</div>
</template>
<style lang="scss">
</style>
// 用ip
// var host = "https://movie.douban.com/";
var dev = "192.168.18.237";
export default {
testData: `${dev ? dev : host}/xxx`
}
\ No newline at end of file
/* 改变主题色变量 */
$--color-primary: red;
/* 改变 icon 字体路径变量,必需 */
$--font-path: '~element-ui/lib/theme-chalk/fonts';
// 自定义主题色变量
$themecolor:red;
@import "~element-ui/packages/theme-chalk/src/index";
\ No newline at end of file
<template>
<div class="hello">
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
import axios from 'axios'
import { Message, MessageBox } from 'element-ui'
import store from '../store'
import router from '../router/index'
// 创建axios实例
const service = axios.create({
// baseURL: process.env.BASE_API, // api 的 base_url
timeout: 5000 // 请求超时时间
})
// request拦截器
service.interceptors.request.use(
config => {
if (store.getters.token) {
config.headers['X-Token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
return config
},
error => {
// Do something with request error
console.log(error) // for debug
Promise.reject(error)
}
)
// response 拦截器
service.interceptors.response.use(
response => {
/**
* code为非20000是抛错 可结合自己业务进行修改
*/
const res = response.data
const codeReg = /^20\d+/
if (!codeReg.test(response.status)) {
Message({
message: res.message,
type: 'error',
duration: 5 * 1000
})
// 50008:非法的token; 50012:其他客户端登录了; 50014:Token 过期了;
if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
MessageBox.confirm(
'你已被登出,可以取消继续留在该页面,或者重新登录',
'确定登出',
{
confirmButtonText: '重新登录',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
store.dispatch('FedLogOut').then(() => {
location.reload() // 为了重新实例化vue-router对象 避免bug
})
})
}
return Promise.reject('error')
} else {
return response.data
}
},
error => {
console.log('err' + error) // for debug
Message({
message: error.message,
type: 'error',
duration: 5 * 1000
})
return Promise.reject(error)
}
)
export default service
\ No newline at end of file
import http from './http.js'
export default {
post(url, data, config) {
return http.post(url, data, config)
},
get(url, params, config) {
const getConfig = {}
if (params) {
Object.assign(getConfig, {
params
})
}
if (config) Object.assign(getConfig, config)
return http.get(url, getConfig)
},
put(url, data, config) {
return http.put(url, data, config)
},
delete(url, params, config) {
const delConfig = {}
if (params) {
Object.assign(delConfig, {
params
})
}
if (config) Object.assign(delConfig, config)
return http.delete(url, delConfig)
}
}
\ No newline at end of file
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// ui以及主题样式
import Element from 'element-ui'
import './assets/css/globelcolor.scss'
// 请求方法
import http from './http/request'
Vue.prototype.$axios = http;
Vue.use(Element)
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/pages/Home'
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'home',
component: Home
},
]
const router = new VueRouter({
routes
})
export default router
import Vue from 'vue'
import Vuex from 'vuex'
import state from './root/state'
import mutations from './root/mutations'
import getters from './root/getters'
import actions from './root/actions'
import userInfo from './modules/userinfo'
import brandreg from './modules/brandreg'
Vue.use(Vuex)
export default new Vuex.Store({
state: state,
mutations: mutations,
actions: actions,
getters: getters,
modules:{
brandreg,
userInfo
}
})
const actions = {
ASYNC_SET_NAME({ state, commit, rootState }, payload) {
setTimeout(() => {
state.bName = 'asyncName'
}, 4000)
}
}
export default actions
\ No newline at end of file
export default {
}
\ No newline at end of file
import state from './state'
import mutations from './mutations'
import getters from './getters'
import actions from './actions'
export default {
namespaced: true,
state,
mutations,
actions,
getters,
}
let state = {
userName: ""
}
export default state
\ No newline at end of file
const actions = {
ASYNC_SET_NAME({ state, commit, rootState }, payload) {
setTimeout(() => {
state.bName = 'asyncName'
}, 4000)
}
}
export default {
}
\ No newline at end of file
export default {
}
\ No newline at end of file
import state from './state'
import mutations from './mutations'
import getters from './getters'
import actions from './actions'
export default {
namespaced: true,
state,
mutations,
actions,
getters,
}
let state = {
userName: ""
}
export default state
\ No newline at end of file
const actions = {
ASYNC_SET_NAME({ state, commit, rootState }, payload) {
setTimeout(() => {
state.bName = 'asyncName'
}, 4000)
}
}
export default {
}
\ No newline at end of file
export default {
}
\ No newline at end of file
let state = {
userName: ""
}
export default state
\ No newline at end of file
<template>
<div class="home">
<i class="el-icon-edit"></i>
<i class="el-icon-share"></i>
<el-input v-model="input" placeholder="请输入内容"></el-input>
<el-button type="primary">主要按钮</el-button>
<el-button type="success">成功按钮</el-button>
<el-button type="info">信息按钮</el-button>
<Abc />
</div>
</template>
<script>
// @ is an alias to /src
import HelloWorld from "@/components/HelloWorld.vue";
import Abc from "@/views/pages/abc.vue";
import api from '@/api/api.js'
export default {
name: "home",
components: {
HelloWorld,
Abc
},
data() {
return {
input: "123"
};
},
created() {
this.$axios
.get("/api/j/search_tags", { type: "movie", source: "1" })
.then(d => {
console.log(d);
});
}
};
</script>
<template>
<div>
<header>111111111111111</header>
</div>
</template>
<script>
export default {};
</script>
<style lang="scss" scoped>
@import "../../assets/css/globelcolor";
header {
background: $--color-primary;
}
</style>
\ No newline at end of file
module.exports = {
outputDir: 'dist', //build输出目录
assetsDir: 'assets', //静态资源目录(js, css, img)
lintOnSave: false, //是否开启eslint
devServer: {
open: true, //是否自动弹出浏览器页面
host: "localhost",
port: '8080',
https: false,
hotOnly: false,
proxy: {
'/api': {
target: 'https://movie.douban.com', //API服务器的地址
ws: true, //代理websockets
changeOrigin: true, // 虚拟的站点需要更管origin
pathRewrite: { //重写路径 比如'/api/aaa/ccc'重写为'/aaa/ccc'
'^/api': ''
}
}
},
}
}
\ No newline at end of file
{
// 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
{
"editor.fontSize": 16,
"editor.tabSize": 2
}
\ 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");
// }else{
// return {status:200};
// }
return {status:200};
}
}
module.exports=ApiBase;
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");
var settings = require("../../../config/settings");
const ApiBase = require("../api.base");
var ad = require('../mongo');
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;
var System = require("../../system")
const uuidv4 = require('uuid/v4');
const crypto = require('crypto');
const cryptoJS = require("crypto-js");
const querystring = require('querystring');
const logCtl = System.getObject("web.oplogCtl");
var settings = require("../../../config/settings");
var moment = require('moment');
const md5 = require("MD5");
class TlApi {
constructor() {
this.tlorderSve = System.getObject("service.tlorderSve");
this.utilstlbankSve = System.getObject("service.utilstlbankSve");
}
async getH5PayUrl(pobj) {
try {
var result = await this.utilstlbankSve.getH5Url(pobj.company_id,pobj.pay_title,pobj.total_sum,pobj.order_no,pobj.returl);
console.log(result, "result..................");
return result;
} catch (e) {
console.log(e.stack, "e.......................");
}
}
async getQrCodeInfo(obj) {
try {
// {
// "orderNo":"",-----//订单号
// "company_id":1,-----//公司id
// "other_company_id":,-----//其他公司id
// "op_type":"wx",-----//支付方式
// "totalSum":,-----//订单金额
// "sveItemCode":,-----//服务编码
// "sveItemName":"测试支付",
// "create_ip":""-----//请求ip地址
// }
var result = await this.tlorderSve.getQrCodeInfoTl(obj);
console.log(result, "result..................");
return result;
} catch (e) {
console.log(e.stack, "e.......................");
}
}
async getPayStatus(obj) {
// "aliPayOrderCode": "121905790000021861",
// "company_id": 1,
// "other_company_id":40,
// "op_type": "alipay",
// "orderNo": "TMO201910151718RCSW1",
// "wxPayOrderCode": "121905790000021859"
try {
var result = await this.tlorderSve.checkPayStatusTl(obj);
console.log(result, "result..................");
return result;
} catch (e) {
console.log(e.stack, "e.......................");
}
}
async notifyUrl(obj) {
try {
logCtl.info({
optitle: "test支付页面回调支付状态---info",
op: "/base/service/impl/orderSve.js/notifyUrl",
content: "参数=" + JSON.stringify(obj),
clientIp: obj.client_ip || ""
});
} catch (e) {
logCtl.error({
optitle: "支付页面回调支付状态---error异常",
op: "/base/service/impl/orderSve.js/checkPayStatus",
content: "error:" + e.stack + ",参数=" + JSON.stringify(obj),
clientIp: obj.client_ip || ""
});
}
}
}
module.exports = TlApi;
var System = require("../../system");
const logCtl = System.getObject("web.oplogCtl");
class TmSub {
constructor() {
this.cacheManager = System.getObject("db.cacheManager");
this.trademarkSve = System.getObject("service.trademarkSve");
this.companySve = System.getObject("service.companySve");
this.companyauthcodeSve = System.getObject("service.companyauthcodeSve");
}
async verifyData(obj) {
if (obj.appKey != "95f167212a8146daac99feddffa6a9sy") {
return { code: -100, message: "appKey参数有误", data: [] };
}
var code = obj.code || "";
if (!code) {
return { code: -101, message: "站点授权码信息不能为空", data: [] };
}
var mac_addr = obj.mac_addr || "";
if (!mac_addr) {
return { code: -102, message: "mac_addr信息不能为空", data: [] };
}
let codeListCache = await this.cacheManager["AuthCodeListCache"].getListByCache();
if (!codeListCache || codeListCache == "undefined") {
return { code: -103, message: "获取授权码缓存数据为空" };
}
let codeList = JSON.parse(codeListCache);
if (!codeList || codeList.length == 0) {
return { code: -104, message: "转换授权码缓存数据查询有误" };
}
var newList = codeList.filter(item => item.code == obj.code);
if (newList == null || newList.length == 0 || !newList[0].company) {
return { code: -105, message: "未找到站点授权码信息" };
}
if (newList[0].macAddr && newList[0].macAddr != mac_addr) {
return { code: -106, message: "站点授权码只能授权在一台电脑上进行提报,要想换电脑请联系平台人员" };
}
if (!newList[0].macAddr) {
//进行macaddr更新
this.companyauthcodeSve.putMacAddrByCode(code, mac_addr);
}
return { code: 1, message: "success", code_item: newList[0], code_list: codeList };
}
async autosub(obj) {//提报数据
try {
var verifyResult = await this.verifyData(obj);
if (verifyResult.code != 1) {
return verifyResult;
}
var tmpResult = await this.trademarkSve.getAutoSubList(verifyResult.code_list, verifyResult.code_item);
return tmpResult;
} catch (e) {
// console.log(e.stack, "error------------");
//日志记录
logCtl.error({
optitle: "提报数据异常",
op: "base/api/impl/tmsub/autosub",
content: e.stack,
clientIp: ""
});
return { code: -1, message: "autosub异常", data: [] };
}
}
//机器人提报更新提报错误--移出更新缓存中的数据--暂时不用此方法
async updateErrorCount(obj) {
try {
var verifyResult = await this.verifyData(obj);
if (verifyResult.code != 1) {
return verifyResult;
}
//提报号
var proxyCode = obj.proxyCode || "";
if (proxyCode == "") {
return { code: -1, message: "proxyCode不能为空", data: null };
}
//错误次数
var errorCount = obj.errorCount || 1;
var tmpResult = await this.trademarkSve.setUpdateErrorCount(proxyCode, errorCount, obj.code);
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 putCacheData(obj) {
try {
var verifyResult = await this.verifyData(obj);
if (verifyResult.code != 1) {
return verifyResult;
}
//提报号
var proxyCode = obj.proxyCode || "";
if (proxyCode == "") {
return { code: -1, message: "proxyCode不能为空", data: null };
}
var tmpResult = await this.trademarkSve.updateTmCache(proxyCode, obj.code);
return tmpResult;
} catch (e) {
//日志记录
logCtl.error({
optitle: "机器人提报更新商标缓存异常",
op: "base/api/impl/tmsub/putCacheData",
content: e.stack,
clientIp: ""
});
return { code: -1, message: "putCacheData异常", data: null };
}
}
//机器人提报更新商标状态
async updateState(obj) {
try {
var verifyResult = await this.verifyData(obj);
if (verifyResult.code != 1) {
return verifyResult;
}
//提报号
var proxyCode = obj.proxyCode || "";
if (proxyCode == "") {
return { code: -1, message: "proxyCode不能为空", data: null };
}
var errorCount = obj.errorCount == null ? 0 : obj.errorCount;
//商标状态枚举,传递枚举值
var stateCode = obj.stateCode || "";
if (stateCode == "") {
return { code: -1, message: "stateCode不能为空", data: null };
}
var tmpResult = await this.trademarkSve.setUpdateState(proxyCode, errorCount, stateCode, obj.code, obj.errorMsg);
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) {
try {
var verifyResult = await this.verifyData(obj);
if (verifyResult.code != 1) {
return verifyResult;
}
//提报号
var proxyCode = obj.proxyCode || "";
if (!proxyCode) {
return { code: -1, message: "proxyCode不能为空", data: null };
}
//商标号
var regCode = obj.regCode || "";
if (!regCode) {
return { code: -1, message: "code不能为空", data: null };
}
//商标状态枚举,传递枚举值
var stateCode = obj.stateCode || "";
if (!stateCode) {
return { code: -1, message: "stateCode不能为空", data: null };
}
var tmpResult = await this.trademarkSve.setUpdateTradeMarkCode(proxyCode, regCode, 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");
var settings = require("../../../config/settings");
const ApiBase = require("../api.base");
const logCtl = System.getObject("web.oplogCtl");
class TmtransactionApi extends ApiBase {
constructor() {
super();
this.trademarktransactionSve = System.getObject("service.trademarktransactionSve");
this.companyS = System.getObject("service.companySve");
};
//获取某类型的交易商标 post
async findByTmType(obj){
if(!obj.company_id){
//获取当前域名
var hostname = "jiaoyi.gongsibao.com";
// console.log("xccccccccccccccccccccccccccccccccccccccc", hostname);
//按照hostname去查找公司站点信息
var companytmp = await this.companyS.findOne({ domainname: hostname, isEnabled: true });
if(companytmp){
obj.company_id=companytmp.id;
}
}
try {
return this.trademarktransactionSve.findByTmType(obj);
} catch (error) {
return {code:-200,msg:"操作失败"};
}
}
}
module.exports = TmtransactionApi;
const ApiBase =require("../api.base");
Class WxApi extends ApiBase{
}
var System = require("../../system")
var settings = require("../../../config/settings");
const logCtl = System.getObject("web.oplogCtl");
const md5 = require("MD5");
class Xbg {
constructor() {
this.zxyAppSecretKey = settings.apiconfig.zxyAppSecretKey();
this.oplogSve = System.getObject("service.oplogSve");
this.oplogSve = System.getObject("service.oplogSve");
}
async transferNotify(obj) {
//返回值
// var tmpSignObj = {
// "accNo": "6214850112377038", "accType": "00", "amt": 100,
// "appId": "1103817785", "busiId": "1103817785420820481",
// "currency": "CNY", "idName": "宋毅", "idNo": "341221198504218256",
// "idType": "00", "mobile": "15010929366", "note": "知产平台转账操作",
// "notityUrl": "http://igirl.gongsibao.com/api/xbg/transferNotify",
// "outTradeNo": "fxfx_XxHqg5hLlP", "platformSeqNo": "1120991431960649729",
// "respCode": "00", "respDesc": "成功", "seqNo": "1001",
// "sign": "6E1F113FDBA02F37DB53C5273EF847AF", "signType": "MD5", "tradeStatus": "00",
// "tradeTime": "20190424180307", "tradeType": "00"
// };
//日志记录
logCtl.info({
optitle: "请求薪必果接口回调结果信息===info",
op: "/app/base/api/impl/xbg.js/transferNotify",
content: "param=" + JSON.stringify(obj),
clientIp: ""
});
var respCode = obj.respCode || "";
var outTradeNo = obj.outTradeNo || "";
var sign = obj.sign || "";
if (respCode && outTradeNo && sign) {
var signArr = [];
signArr.push("accNo=" + obj.accNo);
signArr.push("accType=" + obj.accType);
signArr.push("amt=" + obj.amt);
signArr.push("appId=" + obj.appId);
signArr.push("busiId=" + obj.busiId);
signArr.push("currency=" + obj.currency);
signArr.push("idName=" + obj.idName);
signArr.push("idNo=" + obj.idNo);
signArr.push("idType=" + obj.idType);
signArr.push("mobile=" + obj.mobile);
signArr.push("note=" + obj.note);
signArr.push("notityUrl=" + obj.notityUrl);
signArr.push("outTradeNo=" + obj.outTradeNo);
signArr.push("platformSeqNo=" + obj.platformSeqNo);
signArr.push("respCode=" + obj.respCode);
signArr.push("respDesc=" + obj.respDesc);
signArr.push("seqNo=" + obj.seqNo);
signArr.push("signType=" + obj.signType);
signArr.push("tradeStatus=" + obj.tradeStatus);
signArr.push("tradeTime=" + obj.tradeTime);
signArr.push("tradeType=" + obj.tradeType);
signArr.push("key=" + this.zxyAppSecretKey);
// accNo=6214850112377038&accType=00&amt=100&appId=1103817785&busiId=1103817785420820481&
// currency=CNY&idName=宋毅&idNo=341221198504218256&idType=00&mobile=15010929366&note=测试-知圈圈&
// notityUrl=http://bpohhr.gongsibao.com/api/econtractApi/transferNotify&outTradeNo=PRO201903251623VGjsy01&platformSeqNo=1116256506449272833&respCode=00&respDesc=成功&seqNo=1001&signType=MD5&tradeStatus=00&tradeTime=20190411162729&tradeType=00&key=ca47edd3ae8bac3f7a68d8126d891f52
var tmpSign = md5(signArr.join("&")).toUpperCase();
if (tmpSign == sign) {
var tmpCount = await this.oplogSve.getCountBySourceOrderNo(outTradeNo);
if (tmpCount > 0) {
await this.oplogSve.updateByCallback(obj);
return { code: "0000" };
}
}
}
}
}
module.exports = Xbg;
mongoose = require('mongoose');
var Schema = mongoose.Schema({
company_name: { type: String},
})
const ad = mongoose.model('taierphones', Schema);
//导出模型
module.exports =ad;
const system = require("../system");
const settings = require("../../config/settings");
class CtlBase {
constructor(sname) {
this.serviceName = sname;
this.service = system.getObject("service." + sname);
this.cacheManager = system.getObject("db.cacheManager");
this.md5 = require("MD5");
this.dataprivS = system.getObject("service.dataauthSve");
}
notify(req, msg) {
if (req.session) {
req.session.bizmsg = msg;
}
}
//按照单据号查询出单据
async findByCode(queryobj, qobj, req) {
var rd = await this.service.findOne({ code: qobj.code, company_id: req.companyid });
if (!rd) {
var rd = await this.service.findOne({ id: qobj.code, company_id: req.companyid });
}
return system.getResult2(rd, null);
}
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;
}
if (req.codepath.indexOf("pmg") < 0 && req.companyid && req.companyid != "" && obj.search) {
obj.search.company_id = req.companyid;
}
var apps = await this.service.findAndCountAll(obj);
return system.getResult2(apps, null);
}
async refQuery(queryobj, qobj, req) {
//不是超级管理员,参照需要添加公司查询条件
// if(req.session && req.session.user && !req.session.user.isSuper){
//判断是否考虑数据权限
if (qobj.datapriv && req.session && req.session.user) {
var uid = req.session.user.id;
var authtmp = await this.dataprivS.findOne({ user_id: uid, modelname: this.service.dao.modelName });
if (authtmp) {
var auths = authtmp.auths;
var arys = auths.split(",");
qobj.datapriv = arys;
}
}
if (this.serviceName.indexOf("company") < 0 && this.serviceName.indexOf("sitetheme") < 0) {
qobj.refwhere["company_id"] = req.companyid;
}
//}
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 bulkCreate(queryobj, ids) {
var rd = await this.service.bulkCreate(ids);
return system.getResult2(rd, null);
}
async delete(queryobj, qobj, req) {
this.clearProductCache(req.company_id, req.codepath, null);
var rd = await this.service.delete(qobj);
return system.getResult2(rd, null);
}
async audit(queryobj, qobj, req) {
var audlist = qobj.audlist;
var notes = qobj.notes;
var status = qobj.status;
var userinfo = req.session.user;
var rd = await this.service.audit(userinfo, audlist, notes, status);
return system.getResult2({}, null);
}
async create(queryobj, qobj, req) {
if (req && req.codepath) {
qobj.codepath = req.codepath;
}
if (req && req.companyid && req.companyid != "") {
qobj.company_id = req.companyid;
}
if (req && req.session && req.session.user) {
var userinfo = req.session.user;
qobj.creator = userinfo.nickName;
qobj.createuser_id = userinfo.id;
}
await this.clearProductCache(qobj.company_id, qobj.codepath, qobj);
var rd = await this.service.create(qobj);
return system.getResult2(rd, null);
}
async update(queryobj, qobj, req) {
if (req.codepath) {
qobj.codepath = req.codepath;
}
if (req && req.companyid && req.companyid != "") {
qobj.company_id = req.companyid;
}
await this.clearProductCache(qobj.company_id, qobj.codepath, qobj);
qobj.updator = qobj.nickName;
qobj.updateuser_id = qobj.id;
var rd = await this.service.update(qobj);
return system.getResult2(rd, null);
}
async clearProductCache(company_id, code_path, qobj) {//清理首页展示的产品缓存
if (!code_path || !company_id) {
return;
}
if (code_path.indexOf("productmag/producttype") >= 0 || code_path.indexOf("productmag/productcrud") >= 0) {
await this.cacheManager["ProductListCache"].delCache(company_id);
if (qobj && code_path.indexOf("productmag/producttype") >= 0) {
var count = await this.service.findCount({ where: { company_id: company_id, pid: 0, isPubed: 1 } });
if (count > 6) {
throw new Error("目前只支持6个启用的大类");
}
if (!qobj.pid) {
if (!qobj.oneIconUrl) {
throw new Error("添加的是产品大类,必须选择产品大类图标");
}
}
}
}
}
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);
}
encryptPasswd(passwd) {
if (!passwd) {
throw new Error("请输入密码");
}
var md5 = this.md5(passwd + "_" + settings.salt);
return md5.toString().toLowerCase();
}
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 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")
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,req.companyid);
return system.getResult2(xrtn,null);
}
async findAuthsByRole(query,qobj,req){
var rolecodestrs=qobj.rolecode;
var xrtn=await this.service.findAuthsByRole(rolecodestrs,req.companyid);
return system.getResult2(xrtn,null);
}
}
module.exports=AuthCtl;
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 BusCompanyNotesCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(BusCompanyNotesCtl));
}
}
module.exports=BusCompanyNotesCtl ;
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 BusinessCompanyCtl extends CtlBase {
constructor() {
super(CtlBase.getServiceName(BusinessCompanyCtl));
}
async getBusinessDetail(qobj,obj,req){
var user = req.session.user;
if(user){
obj["user"]=user;
try {
return this.service.getBusinessDetail(obj);
} catch (e) {
console.log(e);
//日志记录
logCtl.error({
optitle: "获取商机详情getBusinessDetail异常error",
op: "base/controller/impl/businesscompanyCtl.js",
content: e.stack,
clientIp: ""
});
return {code:-200,msg:"操作失败"};
}
}else{
return {code:-201,msg:"用户数据为空"};
}
}
async updateBusinessStatus(qobj,obj,req){
var user = req.session.user;
if(user){
// user:用好
// code:商机公司code
// opType:操作类型(1无效电话,2商机无效)
if(!obj.code){
return {code:-202,msg:"code参数错误"};
}
if(!obj.opType){
return {code:-203,msg:"opType参数错误"};
}
try {
return this.service.updateBusinessStatus(user,obj.code,obj.opType);
} catch (e) {
console.log(e);
//日志记录
logCtl.error({
optitle: "修改商机状态updateBusinessStatus异常error",
op: "base/controller/impl/businesscompanyCtl.js",
content: e.stack,
clientIp: ""
});
return {code:-200,msg:"操作失败"};
}
}else{
return {code:-201,msg:"用户数据为空"};
}
}
//免费认领商机
async freeClaimOperation(pobj,obj,req){
var user = req.session.user;
if(user){
try {
var bus_type = obj.bus_type;
var ids = obj.ids;
if(!bus_type){
return {code:-1,msg:"bus_type参数错误"};
}
if(!ids || ids.length<1){
return {code:-2,msg:"ids参数错误"};
}
var result = await this.service.freeClaimOperation(user,bus_type,ids);
return result;
} catch (e) {
console.log(e);
//日志记录
logCtl.error({
optitle: "免费认领商机freeClaimOperation异常error",
op: "base/controller/impl/businesscompanyCtl.js",
content: e.stack,
clientIp: ""
});
return {code:-100,msg:"操作失败"};
}
}else{
return {code:-200,msg:"用户数据为空"};
}
}
//保护商机操作
async protectBus(pobj,obj,req){
var user = req.session.user;
if(user){
try {
var bus_type = obj.bus_type;
var code_list = obj.code_list;
if(!bus_type){
return {code:-1,msg:"bus_type参数错误"};
}
if(!code_list || code_list.length<1){
return {code:-2,msg:"code_list参数错误"};
}
var result = await this.service.protectBus(user,bus_type,code_list);
return result;
} catch (e) {
console.log(e);
//日志记录
logCtl.error({
optitle: "保护商机操作protectBus异常error",
op: "base/controller/impl/businesscompanyCtl.js",
content: e.stack,
clientIp: ""
});
return {code:-100,msg:"操作失败"};
}
}else{
return {code:-200,msg:"用户数据为空"};
}
}
//修改客户意向
async updateCustomerIntention(pobj,obj,req){
var user = req.session.user;
if(user){
if(!obj.customer_intention){
return {code:-201,msg:"customer_intention参数错误"};
}
if(!obj.code){
return {code:-202,msg:"code参数错误"};
}
try {
return this.service.updateCustomerIntention(obj);
} catch (e) {
console.log(e);
//日志记录
logCtl.error({
optitle: "修改客户意向updateCustomerIntention异常error",
op: "base/controller/impl/businesscompanyCtl.js",
content: e.stack,
clientIp: ""
});
return {code:-203,msg:"操作失败"};
}
}else{
return {code:-200,msg:"用户数据为空"};
}
}
//提交客户意向
async submitCustomerIntention(pobj,obj,req){
var user = req.session.user;
if(user){
obj["user"]=user;
if(!obj.customer_intention){
return {code:-201,msg:"customer_intention参数错误"};
}
if(!obj.code){
return {code:-202,msg:"code参数错误"};
}
try {
return this.service.submitCustomerIntention(obj);
} catch (e) {
console.log(e);
//日志记录
logCtl.error({
optitle: "修改客户意向updateCustomerIntention异常error",
op: "base/controller/impl/businesscompanyCtl.js",
content: e.stack,
clientIp: ""
});
return {code:-203,msg:"操作失败"};
}
}else{
return {code:-200,msg:"用户数据为空"};
}
}
//获取该业务员累计商机数量 商标数量 下单数量
async getBusinessStatisticForSalesman(obj,req) {//obj.statisticType: 1累计统计,2当月统计
var user = req.session.user;
if(user){
try {
return this.service.getBusinessStatisticForSalesman(user.company_id,user.id,obj.statisticType || null);
} catch (e) {
console.log(e);
//日志记录
logCtl.error({
optitle: "获取该业务员累计商机数量 商标数量 下单数量getBusinessStatisticForSalesman异常error",
op: "base/controller/impl/businesscompanyCtl.js",
content: e.stack,
clientIp: ""
});
return {code:-203,msg:"操作失败"};
}
}else{
return {code:-200,msg:"用户数据为空"};
}
}
//获取该公司所有员工累计商机数量 商标数量 下单数量============XXXX
async getBusinessStatisticForBoss(obj,req) {//obj.statisticType: 1累计统计,2当月统计
var user = req.session.user;
if(user){
try {
return this.service.getBusinessStatisticForBoss(user.company_id,obj.statisticType || null);
} catch (e) {
console.log(e);
//日志记录
logCtl.error({
optitle: "获取该公司所有员工累计商机数量 商标数量 下单数量getBusinessStatisticForBoss异常error",
op: "base/controller/impl/businesscompanyCtl.js",
content: e.stack,
clientIp: ""
});
return {code:-203,msg:"操作失败"};
}
}else{
return {code:-200,msg:"用户数据为空"};
}
}
}
module.exports = BusinessCompanyCtl;
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 BusinessInfoCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(BusinessInfoCtl));
}
async findOneById(pobj,obj,req){
var user = req.session.user;
if(user){
var id = obj.id;
if(!id){
return {code:-1,msg:"参数错误"};
}
try {
var data = await this.service.dao.model.findOne({where:{id:id},raw:true});
return {code:1,data:data};
} catch (e) {
console.log(e);
//日志记录
logCtl.error({
optitle: "查询商机信息findOneById异常error",
op: "base/controller/impl/businessinfoCtl.js",
content: e.stack,
clientIp: ""
});
return {code:-100,msg:"操作失败"};
}
}else{
return {code:-200,msg:"用户数据为空"}
}
}
}
module.exports=BusinessInfoCtl ;
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 companyCtl extends CtlBase {
constructor() {
super(CtlBase.getServiceName(companyCtl));
this.userSve = system.getObject("service.userSve");
this.footerinfoSve = system.getObject("service.footerinfoSve");
this.moneyaccountS = system.getObject("service.moneyaccountSve");
}
//初始化产品类型和产品 角色 默认授权
async initdata(pobj, obj, req) {
if (obj.isEnabled) {
await this.service.companyInitdata(obj);
}
//更新公司启用
var rd = await this.service.update(obj);
return system.getResult2(rd, null);
};
async siteupdate(qobj, pobj, req) {
//创建管理员用户
var userReg = {
id: req.session.user.id,
userName: pobj.u.userName,
password: super.encryptPasswd(pobj.u.password),
nickName: pobj.u.nickName,
mobile: pobj.u.mobile,
isAdmin: true,
companyName: pobj.u.companyName,
};
var user = await this.userSve.update(userReg);
var companyInfo = {
id: pobj.u.id,
name: pobj.u.companyName,
sitename: pobj.u.sitename,
domainname: pobj.u.domainname,
subdomainname: pobj.u.domainname,
contact: pobj.u.nickName,
contactmobile: pobj.u.mobile,
logo: pobj.u.logo,
serviceqq: pobj.u.serviceqq,
zipCode: pobj.u.zipCode,
isEnabled: false,
};
var bankaccountinfo = {
code: pobj.u.moneyaccountcode,
name: pobj.u.moneyaccountname,
payeeName: pobj.u.payeeName,
id: pobj.u.moneyaccountid,
};
var user = await this.service.siteupdate(companyInfo, bankaccountinfo);
return system.getResult2(pobj.u, null);
}
async siteapply(qobj, pobj, req) {
// console.log(pobj.u);
//创建管理员用户
var userReg = {
userName: pobj.u.userName,
password: super.encryptPasswd(pobj.u.password),
nickName: pobj.u.nickName,
mobile: pobj.u.mobile,
isAdmin: true,
companyName: pobj.u.companyName,
};
var user = await this.userSve.findOne({ userName: pobj.u.userName });
if (user) {
return system.getErrResult2("帐号已存在, 请修改并重试");
}
//检查域名唯一性,子域名唯一性
var comtmp = await this.service.findOne({ domainname: pobj.u.domainname });
if (comtmp) {
return system.getErrResult2("域名已存在, 请修改并重试");
}
var comtmp2 = await this.service.findOne({ subdomainname: pobj.u.subdomainname });
if (comtmp2) {
return system.getErrResult2("子域名已存在, 请修改并重试");
}
var companyInfo = {
name: pobj.u.companyName,
sitename: pobj.u.sitename,
domainname: pobj.u.domainname,
subdomainname: pobj.u.domainname,
contact: pobj.u.nickName,
contactmobile: pobj.u.mobile,
logo: pobj.u.logo,
serviceqq: pobj.u.serviceqq,
zipCode: pobj.u.zipCode,
// wxappid:pobj.u.wxappid,
// wxsecstr:pobj.u.wxsecstr,
// wxsectoken:pobj.u.wxsectoken,
// wxseccert:pobj.u.wxseccert,
// mechantid:pobj.u.mechantid,
// mechantkey:pobj.u.mechantkey,
// mechantcerturl:pobj.u.mechantcerturl,
isEnabled: false,
};
var bankaccountinfo = {
code: pobj.u.moneyaccountcode,
name: pobj.u.moneyaccountname,
payeeName: pobj.u.payeeName,
};
var companyInfo = await this.service.siteapply(userReg, companyInfo, bankaccountinfo);
return system.getResult2(companyInfo, null);
}
async getInitCompanyInfo(qobj, pobj, req) {
var rtn = {};
var footerinfo = await this.footerinfoSve.findOne({ company_id: pobj.id });
var c = await this.service.findById(pobj.id);
rtn.footerinfo = footerinfo;
rtn.company = c;
return system.getResult2(rtn, null);
}
async findById(obj, req) {
var cid = obj.cid
var rd = await this.service.findById(cid);
return system.getResult2(rd, null);
}
async findById2(obj, req) {
var user = req.session.user;
if (!user) {
return { code: -1, mag: "用户信息为空" }
}
var oid = user.company_id
var rd = await this.service.findById(oid);
return system.getResult2(rd, null);
}
//站点统计站点订单合计
async findAndCountAll2(queryobj, obj, req) {
obj.codepath = req.codepath;
if (req.session.user) {
obj.uid = req.session.user.id;
}
if (req.codepath.indexOf("pmg") < 0 && req.companyid && req.companyid != "" && obj.search) {
obj.search.company_id = req.companyid;
}
var apps = await this.service.siteOrderStatistic(obj);
// apps = apps.get({raw:true});
console.log(system.getResult2(apps, null));
return system.getResult2(apps, null);
}
//站点线索统计
async siteBusinessStatistic(queryobj, obj, req) {
try {
var apps = await this.service.siteBusinessStatistic(obj);
return system.getResult2(apps, null);
} catch (error) {
return system.getResult2(null, null);
}
}
async getCompanyTheme(qobj, pobj, req) {
try {
if (!req.session.user) {
return { code: -100, msg: "用户未登录" }
}
return await this.service.getCompanyThemeById(req.session.user.company_id);
} catch (e) {
//日志记录
logCtl.error({
optitle: "查询公司主题异常error",
op: "/base/controller/impl/companyCtl.js/getCompanyTheme",
content: e.stack,
clientIp: ""
});
return { code: -200, msg: "操作异常" }
}
}
async putCompanyTheme(qobj, pobj, req) {
try {
var sitetheme = pobj.siteTheme || "";
if (!req.session.user) {
return { code: -100, msg: "用户未登录" }
}
if (!sitetheme) {
return { code: -101, msg: "主题参数有误" }
}
return await this.service.putCompanyThemeById(req.session.user.company_id, req.session.user.id, sitetheme);
} catch (e) {
//日志记录
logCtl.error({
optitle: "修改公司主题异常error",
op: "/base/controller/impl/companyCtl.js/putCompanyTheme",
content: e.stack,
clientIp: ""
});
return { code: -200, msg: "操作异常" }
}
}
}
module.exports = companyCtl;
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");
const uuidv4 = require('uuid/v4');
class CompanyauthcodeCtl extends CtlBase {
constructor() {
super(CtlBase.getServiceName(CompanyauthcodeCtl));
}
async initNewInstance(queryobj,req){
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return system.getResult2({code:u},null);
}
}
module.exports = CompanyauthcodeCtl;
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 CompanyPayParamCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(CompanyPayParamCtl));
}
}
module.exports=CompanyPayParamCtl ;
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 CustomerInfoCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(CustomerInfoCtl));
}
async findOneByCustomerName(obj,req){
if(!obj.name){
return {code:-1,msg:"name参数错误"};
}
try {
var data = await this.service.dao.model.findOne({where:{name:obj.name}});
return {code:1,data:data};
} catch (error) {
return {code:-100,msg:"操作失败"};
}
}
async getMyCustomerEntInfo(obj,req){
var user = req.session.user;
if(user){
try {
var result=[];
var dataList = await this.service.dao.model.findAll({where:{owner_id:user.id,customerType:"ent"},limit:50,offset:0,attributes: ["applyAddr", "code", "name", "businessLicensePic", "customerType","identityCardNo","identityCardPic"],raw:true});
if(dataList && dataList.length>0){
for(var i=0;i<dataList.length;i++){
var data = dataList[i];
var obj={regLocation:data.applyAddr,entName:data.name,domainEntName:data.name,creditCode:data.code,
businessLicensePic:data.businessLicensePic,customerType:data.customerType,identityCardNo:data.identityCardNo,
identityCardPic:data.identityCardPic
};
result.push(obj);
}
}
return {code:1,data:result};
} catch (error) {
return {code:-100,msg:"操作失败"};
}
}else{
return {code:-200,msg:"用户数据为空"};
}
}
async getMyCustomerPersonInfo(obj,req){
var user = req.session.user;
var likename = obj.likeName;
if(user){
try {
var result=[];
var whereObj={owner_id:user.id,customerType:"person"};
//,name: { [this.dao.db.Op.like]: '%' +mobile_no + '%' }
if(likename){
whereObj["name"] = { [this.service.dao.db.Op.like]: '%' +likename + '%' };
}
var dataList = await this.service.dao.model.findAll({where:whereObj,limit:50,offset:0,attributes: ["applyAddr", "code", "name", "businessLicensePic", "customerType","identityCardNo","identityCardPic"],raw:true});
if(dataList && dataList.length>0){
for(var i=0;i<dataList.length;i++){
var data = dataList[i];
var obj={regLocation:data.applyAddr,entName:data.name,domainEntName:data.name,creditCode:data.code,
businessLicensePic:data.businessLicensePic,customerType:data.customerType,identityCardNo:data.identityCardNo,
identityCardPic:data.identityCardPic
};
result.push(obj);
}
}
return {code:1,data:result};
} catch (error) {
return {code:-100,msg:"操作失败"};
}
}else{
return {code:-200,msg:"用户数据为空"};
}
}
}
module.exports=CustomerInfoCtl ;
var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
class DataauthCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(DataauthCtl));
}
async saveauth(querybij,qobj,req){
var arys=qobj.arys;
var uid=qobj.uid;
var refmodel=qobj.modelname;
var u=await this.service.saveauth({
user_id:uid,
modelname:refmodel,
auths:arys.join(","),
company_id:req.companyid,
});
return system.getResult2(u,null);
}
async fetchInitAuth(querybij,qobj,req){
var uid=qobj.uid;
var refmodel=qobj.modelname;
var authtmp=await this.service.findOne({user_id:uid,modelname:refmodel});
if(authtmp){
var auths= authtmp.auths;
var arys=auths.split(",");
return system.getResult2(arys,null);
}else{
return system.getResult2([],null);
}
}
}
module.exports=DataauthCtl;
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 ExpenseVoucherCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(ExpenseVoucherCtl));
}
async initNewInstance(queryobj,req){
var rtn={};
var vcode=await this.service.getBusUid("FYD");
rtn.code=vcode;
rtn.sourceType="expensevoucher";
return system.getResult2(rtn,null);
}
async fetchForFinance(pobj,obj,req){
var result= await this.service.fetchForFinance(req.companyid);
return system.getResult2(result);
}
}
module.exports=ExpenseVoucherCtl ;
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");
this.utilstmSve=system.getObject("service.utilstmSve");
}
async download(queryobj,qobj,req){
let id = qobj.code;
var rows = qobj.rows || [];
var code = uuidv4();
var fileName = "data_" + code + ".xlsx";
console.log("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
// console.log(rows);
var biaoti = rows[0];
var index = biaoti.length-1;
if(biaoti.indexOf("商品/服务项")>0){
for (var i = 1; i < rows.length; i++) {
console.log(rows[i]);
var tm= rows[i];
var regist_num=tm[1];
var ncl_one_codesstr=tm[2];
var ncl_one_codes=ncl_one_codesstr.split("类 ")[0];
var sbdata={
reg_num:regist_num,
nclone_code:ncl_one_codes
};
console.log(sbdata);
var qunzutms=await this.utilstmSve.getGroupNclInfo(sbdata);
var spfwxmlist=[];
if(qunzutms.status==0){
qunzutms.data.exist.forEach(function(c){
if(spfwxmlist.findIndex(f => f == c.small_name) < 0){
spfwxmlist.push(c.small_name)
}
});
}
var spfwxm=spfwxmlist.join(",");
if(spfwxm!=""){
rows[i][index]=spfwxm;
console.log(rows[i][index]);
}
console.log(spfwxm);
}
}
console.log("rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr");
console.log(rows);
var param = {
title: "商标查询结果列表",
code : code,
fileName : fileName,
user : {},
rows : rows
}
console.log("pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp");
console.log(param);
this.excelClient.download(param);
return system.getResult2(code);
}
async bycode(queryobj,qobj,req) {
var f = await this.service.findOne({code:(qobj.code || "")});
return system.getResult2(f);
}
}
module.exports=FiledownloadCtl;
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 FooterinfoCtl extends CtlBase {
constructor() {
super(CtlBase.getServiceName(FooterinfoCtl));
}
async fetchCompanyInfo(pobj, obj, req) {
var companyinfo = await this.service.findAll({ company_id: req.companyid });
if (companyinfo && companyinfo.length > 0) {
return system.getResult2(companyinfo[0]);
}
return { status: -100, msg: "暂无信息,请进行填写", bizmsg: "empty" };
}
async createOrUpdate(pobj, obj, req) {
var companyinfo = await this.service.findAll({ company_id: req.companyid });
console.log(companyinfo);
if (companyinfo.length == 0) {
var params = {
companyName: obj.companyname,
serviceTel: obj.servicetel,
cooperationTel: obj.cooperationtel,
address: obj.address,
picUrl: obj.picUrl,
loginUrl: obj.loginUrl,
aboutUs: obj.aboutus,
wxQrCodeUrl: obj.wxQrCodeUrl,
company_id: req.companyid,
icpNum: obj.icpNum,
icpCard:obj.icpCard,
establishmentYear:obj.establishmentYear,
};
var result = await this.service.create(params);
} else {
console.log("---------update---------------");
var params = {
id: companyinfo[0].id,
companyName: obj.companyname,
serviceTel: obj.servicetel,
cooperationTel: obj.cooperationtel,
address: obj.address,
picUrl: obj.picUrl,
loginUrl: obj.loginUrl,
aboutUs: obj.aboutus,
company_id: req.companyid,
wxQrCodeUrl: obj.wxQrCodeUrl,
icpNum: obj.icpNum,
icpCard:obj.icpCard,
establishmentYear:obj.establishmentYear
};
var result = await this.service.update(params);
}
return system.getResult2(result);
}
}
module.exports = FooterinfoCtl;
var System=require("../../system");
var settings=require("../../../config/settings");
var pinyin = require("pinyin");
class ichemingCtl{
constructor(){
this.ichemingUrl=settings.apiconfig.ichemingUrl();
}
async ichemingApi(query,obj){
var result={};
var cityname=obj.cityname;
var keyword=obj.keyword;
var btname=obj.btname;
var orgname=obj.orgname;
var sitcity=obj.sitcity;
var heming ={
"cityname":cityname,
"keyword":keyword,
"btname":btname,
"orgname":orgname,
"sitcity":sitcity
}
var url=this.ichemingUrl;
var rc=System.getObject("util.execClient");
var rtn=null;
try{
rtn=await rc.execPost(heming,url);
var data=JSON.parse(rtn.stdout);
console.log("heming++++++++++++++++++++++++++++++++++++++++++++++++++++++");
console.log(data);
return System.getResult2(data,null);
}catch(e){
console.log(e);
return System.getResult2(result,null);
}
return System.getResult2(result,null);
}
}
module.exports=ichemingCtl;
// var task = new ichemingCtl();
// task.ichemingApi({
// "cityname":"北京",
// "keyword":"白杨",
// "btname":"管理",
// "orgname":"有限公司",
// "sitcity":2
// }).then(d=>{
// console.log("ddddddddddddddddddddddddddddddddddddd");
// console.log(d);
// })
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 IcpCustomerInfoCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(IcpCustomerInfoCtl));
}
}
module.exports=IcpCustomerInfoCtl ;
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 InvoiceApplyCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(InvoiceApplyCtl));
this.pushmsgWxop = system.getObject("wxop.pushmsgWxop");
this.mailClient = system.getObject("util.mailClient");
this.orderSve = system.getObject("service.orderSve");
}
async submitInvoice(pobj,obj,req){
try {
obj.createuser_id=req.session.user.id;
obj.invoiceContent="知识产权服务费";
obj.invoiceHeadUpType="ent";
obj.company_id=req.companyid;
// var invoiceInfo=await this.service.create(obj);
var result=await this.service.submitInvoice(obj);
if(result && result.code==1 && result.data){
return system.getResult2(result.data);
}else{
return system.getResult2(null,null);
}
// return system.getResult2(invoiceInfo);
} catch (e) {
return system.getResult2(null,null);
}
}
//公众号、邮箱消息推送
async msgSend(invoiceapply_id,user){
var self = this;
this.service.dao.model.findOne({
where:{id:invoiceapply_id},
include:[
{ model: this.service.db.models.company, as: "company", attributes: ["name","domainname"]}
],
raw:true
}).then(invoice=>{
if(invoice && invoice.id && invoice["company.domainname"]){
self.orderSve.dao.model.findOne({
where:{invoiceapply_id:invoice.id},
raw:true
}).then(order=>{
if(order && order.id){
if(invoice.email){
var text="【知圈圈】尊敬的用户,您的商标【"+order.name+"】,订单号【"+order.code+"】的发票已经开出,请您登录『"+invoice['company.domainname']+"』平台,在发票管理处提交邮寄信息。";
self.mailClient.sendMsg(invoice.email, "发票通知", null, text, null, null, []); //发送成功后result的值:250 Data Ok: queued as freedom
}
if(invoice.mobile){
var text="尊敬的用户,您的商标【"+order.name+"】,订单号【"+order.code+"】的发票已经开出,请您登录『"+invoice['company.domainname']+"』平台,在发票管理处提交邮寄信息。";
self.pushmsgWxop.pushMsg({
company_id:user.company_id,mobile:invoice.mobile,title:text,itemName:"申请发票",progress:"已完成"
});
}
}
})
}
}).catch(e=>{
console.log(e);
})
}
async auditExpress(pobj,obj,req){
var user = req.session.user;
var params={
id:obj.id,
invoiceStatus:"finished",
opNotes:obj.opNotes,
auditStatus:"tg",
updator:req.session.user.nickName,
updateuser_id:req.session.user.id,
auditor:req.session.user.nickName,
audituser_id:req.session.user.id
}
var result=await this.service.update(params);
this.msgSend(obj.id,user);//消息推送
return system.getResult2(result,null);
}
//查询订单发票
async findAllOrderInvoice(obj,req){
var user = req.session.user;
if(user){
obj["user"]=user;
try {
return this.service.findAllOrderInvoice(obj);
} catch (e) {
//日志记录
logCtl.error({
optitle: "查询订单发票操作异常error",
op: "/igirl-web/app/base/controller/impl/invoiceApplyCtl.js/findAllOrderInvoice",
content: e.stack,
clientIp: ""
});
return { code: -200, msg: "操作失败" };
}
}else{
return {code:-100,msg:"未知用户"};
}
}
//订单发票提交申请
async orderInvoiceSubmit(pobj,obj,req){
var user = req.session.user;
if(user){
obj["user"]=user;
try {
return this.service.orderInvoiceSubmit(obj);
} catch (e) {
//日志记录
logCtl.error({
optitle: "订单发票提交申请操作异常error",
op: "/igirl-web/app/base/controller/impl/invoiceApplyCtl.js/orderInvoiceSubmit",
content: e.stack,
clientIp: ""
});
return { code: -200, msg: "操作失败" };
}
}else{
return {code:-100,msg:"未知用户"};
}
}
}
module.exports=InvoiceApplyCtl ;
// var task = new InvoiceApplyCtl();
// task.findAllOrderInvoice({},null).then(d=>{
// console.log(d);
// console.log(d.data.length);
// })
\ 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');
class LoopplayCtl extends CtlBase {
constructor() {
super(CtlBase.getServiceName(LoopplayCtl));
//this.appS=system.getObject("service.appSve");
}
async initNewInstance(queryobj, req) {
var rtn = {};
var vcode = await this.service.getBusUid("lx");
rtn.code = vcode;
return system.getResult2(rtn, null);
}
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错误" };
}
obj.company_id = req.companyid;
var result = await this.service.findByChannelcode(obj);
return { code: 1, msg: "success", data: result };
}
async findAll2(hostname, themename) {
var lbs = await this.cacheManager["LoopbackCache"].cacheLoopback(hostname, themename);
return lbs;
}
async findAll(queryobj, obj, req) {
var lbs = await this.cacheManager["LoopbackCache"].cacheLoopback(req.hostname, req.theme);
return system.getResult2(lbs, null);
}
async findAndCountAll(queryobj, obj, req) {
obj.codepath = req.codepath;
if (req.companyid && req.companyid != "" && obj.search) {
obj.search.company_id = req.companyid;
}
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 getLooppayList(gobj, pobj, req) {
try {
var hostname = req.hostname;
var themename = pobj.theme_name || "";
var loopType = pobj.loop_type || ["PC"];
var returnList = [];
if (loopType.length) {
for (let index = 0; index < loopType.length; index++) {
const element = loopType[index];
if (element) {
var list = await this.cacheManager["LoopbackCache"].cacheLoopback(hostname, themename, loopType);
if (list.length > 0) {
returnList.push.apply(returnList, list);
}
}
}
}
return { code: 1, msg: "ok", data: returnList };
} catch (e) {
return { code: -200, msg: "error", data: [] };
}
}
}
module.exports = LoopplayCtl;
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 MoneyAccountCtl extends CtlBase {
constructor() {
super(CtlBase.getServiceName(MoneyAccountCtl));
this.companySve = system.getObject("service.companySve");
}
async fetchAccountForBoss(qobj, obj, req) {//公司账户列表余额展示-------============XXXX
var result = await this.service.fetchAccountForBoss(req.companyid);
return system.getResult2(result);
}
async findAllByCompanyId(qobj, obj, req) {
var user = req.session.user;
if (!user) {
return { code: -1, msg: "操作失败,用户信息为空" };
}
if (!obj.company_id) {
return { code: -2, msg: "参数错误" };
}
try {
var data = await this.service.findAllByCompanyId(obj.company_id);
return { code: 1, data: data };
} catch (error) {
return { code: -1, msg: "操作失败" };
}
}
async findAll(qobj, obj, req) {
var user = req.session.user;
if (user) {
try {
var data = await this.service.dao.model.findAll({ where: { company_id: user.company_id }, raw: true });
return { code: 1, data: data };
} catch (error) {
return { code: -1, msg: "操作失败" };
}
} else {
return { code: -1, msg: "操作失败,用户信息为空" };
}
}
async findAllOfflineAccount(qobj, obj, req) {
var user = req.session.user;
if (user) {
try {
if (!user.company_id) {
return { code: -3, msg: "company_id参数错误" };
}
var company = await this.companySve.dao.model.findOne({ where: { id: user.company_id, isEnabled: 1 }, raw: true });
if (!company) {
return { code: -2, msg: "操作失败,公司信息为空" };
}
var data = null;
if (company.companyType == "self") {
data = await this.service.dao.model.findAll({ where: { company_id: user.company_id, isOfflinePay: 1 }, 'order': [['created_at', 'ASC']], raw: true });
} else {
data = await this.service.dao.model.findAll({ where: { company_id: 1, isOfflinePay: 1 }, 'order': [['created_at', 'ASC']], raw: true });
}
if (!data) {
return { code: -4, msg: "账户信息不存在" };
}
return { code: 1, data: data };
} catch (error) {
return { code: -1, msg: "操作失败" };
}
} else {
return { code: -1, msg: "操作失败,用户信息为空" };
}
}
}
module.exports = MoneyAccountCtl;
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 MoneyJourneyCtl extends CtlBase {
constructor() {
super(CtlBase.getServiceName(MoneyJourneyCtl));
}
async fetchRecvExpense(qobj, obj, req) {//进十二个月的回款费用变动图---在使用
var result = await this.service.fetchRecvExpense(req.companyid, req.session.user);
return system.getResult2(result);
}
}
module.exports = MoneyJourneyCtl;
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 NeedCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(NeedCtl));
this.serviceitemSve=system.getObject("service.serviceitemSve");
}
async submitneed(pobj,obj,req){
var cid = req.companyid;
// 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.province==""||obj.province==null||obj.province=="undefined"){
// return {code:-100,msg:"请选择你所在的省市"};
// }
// if(obj.city==""||obj.city==null||obj.city=="undefined"){
// return {code:-100,msg:"请选择你所在的省市"};
// }
if(obj.notes!=""&&obj.notes!=null&&obj.notes!="undefined"&&obj.notes.length>255){
return {code:-100,msg:"备注字数超出限制,请重新填写"};
}
if(obj.servicecode==""||obj.servicecode==null||obj.servicecode=="undefined"){
return {code:-110,msg:"serviceItem_code参数传递错误"};
}
if(obj.company_id=="" || obj.company_id==null || obj.company_id=="undefined"){
return {code:-111,msg:"company_id参数传递错误"};
}
var serviceInfo=await this.serviceitemSve.findOneByCode(obj.servicecode,cid);
console.log("---------submitneed-----------------serviceInfo-----------");
console.log(serviceInfo);
if(serviceInfo==""||serviceInfo==null){
return {code:-110,msg:"servicecode参数传递错误"};
}
var pobj={
publisherName:obj.publisherName,
publisherMobile:obj.publisherMobile,
servicecode:obj.servicecode,
company_id:obj.company_id,
publisherEnt:obj.entname,
status:"1"
};
var result=await this.service.findchance(pobj);
if(result!=""&&result!=null){
return {code:"0",msg:"您已经发布需求,请不要重复提交"};
}
try{
var reqParams={
publisherName:obj.publisherName,
publisherMobile:obj.publisherMobile,
province:obj.provimce,
city:obj.city,
notes:obj.notes,
servicecode:obj.servicecode,
servicename:serviceInfo.name,
itemType:serviceInfo.itemType,
itemTypeName:serviceInfo.itemTypeName,
status:"1",
company_id:obj.company_id,
};
var need = await this.service.create(reqParams);
return {code:"1",msg:"发布成功"};
}catch(e){
console.log(e);
return {code:"-1",msg:"操作失败,请稍后重试"};
}
}
//提交备注
async submitRemarks(qobj,obj,req){
var user = req.session.user;
if(user){
obj["user"]=user;
try {
return this.service.submitRemarks(obj);
} catch (error) {
return {code:-200,msg:"操作失败"};
}
}else{
return {code:-100,msg:"用户数据为空"};
}
}
}
module.exports=NeedCtl ;
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")
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 OkCtl extends CtlBase{
constructor(){
super(CtlBase.getServiceName(OkCtl));
}
}
module.exports=OkCtl ;
var system = require("../../system")
var settings = require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
var moment = require("moment");
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);
}
/*
返回20位业务订单号
prefix:业务前缀
*/
async getBusUid_Ctl(prefix) {
prefix = (prefix || "");
if (prefix) {
prefix = prefix.toUpperCase();
}
var prefixlength = prefix.length;
var subLen = 8 - prefixlength;
var uidStr = "";
if (subLen > 0) {
uidStr = await this.getUidInfo_Ctl(subLen, 60);
}
var timStr = moment().format("YYYYMMDDHHmm");
return prefix + timStr + uidStr;
}
/*
len:返回长度
radix:参与计算的长度,最大为62
*/
async getUidInfo_Ctl(len, radix) {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');//长度62,到yz长度为长36
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 = OplogCtl;
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