Commit 26d7e704 by 王勇飞

Merge branch 'center-manage' of gitlab.gongsibao.com:jiangyong/zhichan into center-manage

parents f5737e5e 67a97272
node_modules/
\ No newline at end of file
node_modules/
*_build.sh
\ No newline at end of file
#!/bin/bash
FROM registry.cn-beijing.aliyuncs.com/hantang2/node105:v2
MAINTAINER jy "jiangyong@gongsibao.com"
ARG webenv
ADD center-manage /apps/center-manage/
ADD web/$webenv /apps/center-manage/app/front/entry/public/
WORKDIR /apps/center-manage/
RUN cnpm install -S
CMD ["node","/apps/center-manage/main.js"]
......
node_modules/
app/config/localsettings.js
*.sh
\ No newline at end of file
app/front/entry/public/
\ No newline at end of file
......@@ -7,60 +7,69 @@ const CtlBase = require("../../ctl.base");
class CompanyCtl extends CtlBase {
constructor() {
super("common", CtlBase.getServiceName(CompanyCtl));
this.userSve = system.getObject("service.auth.userSve");
}
async update(p,q,req){
let u= await super.update(p,q,req)
//缓存失效
await this.cacheManager["CompanyCache"].invalidate(p.companykey)
let company=await this.cacheManager["CompanyCache"].cache(p.companykey)
return system.getResult(company)
async update(p, q, req) {
let u = await super.update(p, q, req)
//缓存失效
await this.cacheManager["CompanyCache"].invalidate(p.companykey)
let company = await this.cacheManager["CompanyCache"].cache(p.companykey)
return system.getResult(company)
}
async getMyApps(p,q,req){
async getMyApps(p, q, req) {
let userfind = await this.cacheManager["UserCache"].cache(p.username)
let isSuper=userfind.isSuper
if(userfind.company.appids && userfind.company.appids!=""){
let appsarray=userfind.company.appids.split(",")
let appidsquery=appsarray.map(astr=>{
return astr.split("|")[0]
let isSuper = userfind.isSuper
if (userfind.company.appids && userfind.company.appids != "") {
let appsarray = userfind.company.appids.split(",")
let appidsquery = appsarray.map(astr => {
return astr.split("|")[0]
})
let apps=await this.service.getMyApps(appidsquery,isSuper)
let apps = await this.service.getMyApps(appidsquery, isSuper)
return system.getResult(apps)
}else{
} else {
return []
}
}
async bindApps(p,q,req){
let appids=p.appids
let cmpid=p.postcmpid
let appids2=appids.map(item=>{
return item.appid+"|"+item.title
})
let appidstrs=appids2.join(",")
await this.service.bindApps(appidstrs,cmpid)
async bindApps(p, q, req) {
let appids = p.appids
let cmpid = p.postcmpid
let appids2 = appids.map(item => {
return item.appid + "|" + item.title
})
let appidstrs = appids2.join(",")
await this.service.bindApps(appidstrs, cmpid)
return system.getResult(appids)
}
async setOrgs(p,q,req){
async setOrgs(p, q, req) {
//let companynew=await this.service.findById(p.company_id)
let orgs=await this.service.setOrgs(p)
let orgs = await this.service.setOrgs(p)
return system.getResult(orgs)
}
async getOrgs(p,q,req){
}
async getOrgs(p, q, req) {
//let companynew=await this.cacheManager["CompanyCache"].cache(req.xctx.fromcompanykey)
let companynew=await this.service.findById(p.company_id)
let orgjsonstr=companynew.orgJson
let rtnjson=null
if(orgjsonstr && orgjsonstr!=""){
rtnjson=JSON.parse(companynew.orgJson)
}else{
rtnjson=[]
let companynew = await this.service.findById(p.company_id);
const userData = await this.userSve.findById(p.userid);
let orgjsonstr = companynew.orgJson;
let rtnjson = null;
if (orgjsonstr && orgjsonstr != "") {
rtnjson = JSON.parse(companynew.orgJson);
} else {
rtnjson = [];
}
if (userData) {
if (userData.isAdmin || userData.isSuper) {
return system.getResult({ orgJson: rtnjson });
} else {
return system.getResult({ orgJson: this.service.buildOrgs(rtnjson, userData.ptags) });
}
} else {
return system.getResult({ orgJson: [] });
}
return system.getResult({orgJson:rtnjson})
}
}
async refQuery(pobj, qobj, req) {
let rtn=await this.service.refQuery(pobj);
async refQuery(pobj, qobj, req) {
let rtn = await this.service.refQuery(pobj);
return rtn
}
}
module.exports = CompanyCtl;
......@@ -10,19 +10,20 @@ class VCodeCache extends CacheBase {
// isdebug() {
// return settings.env == "dev";
// }
desc() {
desc () {
return "缓存给手机发送的验证码60妙";
}
prefix() {
prefix () {
return "g_vcode_cm:"
}
async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
async buildCacheVal (cachekey, inputkey, val, ex, ...items) {
//inputkey采用appkey_mobile的形式
var mobile = inputkey;
var tmplCode = val;
var signName = items ? items[0] : "";
var vcode = await this.smsUtil.getUidStr(6, 10);
if (!tmplCode && !signName) {
console.log("=============================")
this.smsUtil.sendMsg(mobile, vcode);
} //tmplCode为发送短信编码,需在阿里开通,signName为短信头描述信息,二者没有传递则用默认的发送验证码
else {
......
......@@ -106,8 +106,10 @@ class Dao {
const search = qobj.search;
var qc = {};
//设置分页查询条件
qc.limit = pageSize;
qc.offset = (pageNo - 1) * pageSize;
if (pageNo != -1) {
qc.limit = pageSize;
qc.offset = (pageNo - 1) * pageSize;
}
//默认的查询排序
qc.order = this.orderBy(qobj);
//构造where条件
......
......@@ -101,6 +101,9 @@ class UserDao extends Dao {
w[strq] = { [this.db.Op.like]: "%" + search[lnkKey] + "%" };
}
qc.attributes = {
exclude: ["password", "jwtkey", "jwtsecret"]
}
return w;
}
async preUpdate(u) {
......
......@@ -5,7 +5,7 @@ class CompanyService extends ServiceBase {
constructor() {
super("common", ServiceBase.getDaoName(CompanyService));
}
async getMyApps (appids, isSuper) {
async getMyApps(appids, isSuper) {
let appsrtn = null
if (isSuper) {
appsrtn = this.db.models.app.findAll({
......@@ -24,14 +24,14 @@ class CompanyService extends ServiceBase {
}
return appsrtn
}
async bindApps (appids, companyid) {
async bindApps(appids, companyid) {
var self = this
return this.db.transaction(async function (t) {
let u = await self.dao.update({ appids: appids, id: companyid }, t)
return appids
})
}
async setOrgs (p, cmk) {
async setOrgs(p, cmk) {
var self = this
let curNodeData = p.curdata
let opathstr = curNodeData.orgpath
......@@ -106,5 +106,18 @@ class CompanyService extends ServiceBase {
return { orgJson: JSON.parse(companytmp.orgJson) }
})
}
buildOrgs(rtnjson, code) {
if (rtnjson.length > 0) {
for (let val of rtnjson) {
if (val.code === code) {
return [val]
} else {
return this.buildOrgs(val.children || [], code)
}
}
} else {
return rtnjson
}
}
}
module.exports = CompanyService;
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
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 diff is collapsed. Click to expand it.
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 diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
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 diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
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 diff is collapsed. Click to expand it.
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