Commit f23ca1f6 by 王勇飞

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

parents 196bf0f3 2c932ab7
...@@ -18,7 +18,7 @@ class UserCache extends CacheBase{ ...@@ -18,7 +18,7 @@ class UserCache extends CacheBase{
async buildCacheVal(cachekey,inputkey, val, ex, ...items) { async buildCacheVal(cachekey,inputkey, val, ex, ...items) {
const configValue = await this.userDao.model.findAll({ const configValue = await this.userDao.model.findAll({
where: { userName: inputkey, app_id: settings.pmappid,isEnabled:true}, where: { userName: inputkey, app_id: settings.pmappid,isEnabled:true},
attributes: ['id','userName', 'nickName','headUrl','jwtkey','jwtsecret','created_at','isSuper','isAdmin','isAllocated','mail','opath','ptags'], attributes: ['id','userName', 'nickName','headUrl','jwtkey','jwtsecret','created_at','isSuper','isAdmin','isAllocated','mail','mobile','opath','ptags'],
include: [ include: [
{ model: this.db.models.company,attributes:['id','name','companykey','appids'],raw:true}, { model: this.db.models.company,attributes:['id','name','companykey','appids'],raw:true},
{model:this.db.models.role,as:"Roles",attributes:["id","code"],} {model:this.db.models.role,as:"Roles",attributes:["id","code"],}
......
...@@ -42,18 +42,22 @@ class CompanyService extends ServiceBase { ...@@ -42,18 +42,22 @@ class CompanyService extends ServiceBase {
let curNodeData=p.curdata let curNodeData=p.curdata
if(curNodeData && curNodeData.isPosition){ if(curNodeData && curNodeData.isPosition){
let opathstr=curNodeData.orgpath let opathstr=curNodeData.orgpath
let us=await self.db.models.user.findAll({where:{opath:opathstr},transaction:t}) let us=await self.db.models.user.findAll({where:{opath:{[self.db.Op.like]:`%${opathstr}%`}},transaction:t})
//查询出角色 //查询出角色
let roleids=curNodeData.roles let roleids=curNodeData.roles
let rs=await self.db.models.role.findAll({where:{id:{[self.db.Op.in]:roleids},app_id:p.app_id,company_id:p.company_id},transaction:t}) // let rs=await self.db.models.role.findAll({where:{id:{[self.db.Op.in]:roleids},app_id:p.app_id,company_id:p.company_id},transaction:t})
let rs=await self.db.models.role.findAll({where:{id:{[self.db.Op.in]:roleids},company_id:p.company_id},transaction:t})
for(let u of us){ for(let u of us){
await u.setRoles(rs,{transaction:t}) await u.setRoles(rs,{transaction:t})
//令用户缓存失效
await self.cacheManager["UserCache"].invalidate(u.userName)
} }
// users.forEach((u)=>{ // users.forEach((u)=>{
// await u.setRoles(rs, { transaction: t }); // await u.setRoles(rs, { transaction: t });
// }) // })
} }
//用户缓存也要失效 //用户缓存也要失效
//缓存失效 //缓存失效
await self.cacheManager["CompanyCache"].invalidate(cmk) await self.cacheManager["CompanyCache"].invalidate(cmk)
let companytmp=await self.dao.model.findOne({where:{companykey:cmk},transaction:t}); let companytmp=await self.dao.model.findOne({where:{companykey:cmk},transaction:t});
......
...@@ -29,7 +29,8 @@ class ProductService extends ServiceBase { ...@@ -29,7 +29,8 @@ class ProductService extends ServiceBase {
let tmpdic=await self.findPriceStrategys(stragetyids,t) let tmpdic=await self.findPriceStrategys(stragetyids,t)
stragetyids.forEach(stragetyid => { stragetyids.forEach(stragetyid => {
if(skucodemap){ if(skucodemap){
p.skucode=skucodemap[stragetyid] p.skucode=skucodemap[stragetyid].pricecode
} }
let pps = { let pps = {
product_id: pnew.id, product_id: pnew.id,
...@@ -39,6 +40,7 @@ class ProductService extends ServiceBase { ...@@ -39,6 +40,7 @@ class ProductService extends ServiceBase {
company_id:p.company_id, company_id:p.company_id,
skucode:p.skucode?p.skucode:self.getUUID(), skucode:p.skucode?p.skucode:self.getUUID(),
skuname:p.skuname?p.skuname:p.name, skuname:p.skuname?p.skuname:p.name,
sptags:p.sptags
} }
productprices.push(pps) productprices.push(pps)
}) })
......
...@@ -11,7 +11,7 @@ class XProductService extends ServiceBase { ...@@ -11,7 +11,7 @@ class XProductService extends ServiceBase {
} }
} }
module.exports = XProductService; module.exports = XProductService;
/*
function findTitlePath(items, findstr, results) { function findTitlePath(items, findstr, results) {
items.forEach(item => { items.forEach(item => {
if (item.title.indexOf(findstr) < 0) { if (item.title.indexOf(findstr) < 0) {
...@@ -50,7 +50,7 @@ function findTitlePath(items, findstr, results) { ...@@ -50,7 +50,7 @@ function findTitlePath(items, findstr, results) {
let straid=[] let straid=[]
let skucodemap={} let skucodemap={}
for(let stinfo of stsinfos){ for(let stinfo of stsinfos){
let tg=stinfo.price_name.replace("EDI","").replace("ICP","").replace("(",",").replace(")","").replace("章","").replace("税控","").replace("完成","").replace("\t\r\n","") let tg=stinfo.price_name.replace("EDI","").replace("ICP","").replace("(",",").replace(")","").replace("章","").replace("税控","").replace("完成","").replace("\t\r\n","").replace("天","工作日")
//按照price_name去策略表中查询策略id //按照price_name去策略表中查询策略id
let strategy=await ps.db.models.pricestrategy.findOne({where:{optionunion:tg}}) let strategy=await ps.db.models.pricestrategy.findOne({where:{optionunion:tg}})
if(!strategy){ if(!strategy){
...@@ -139,4 +139,3 @@ function findTitlePath(items, findstr, results) { ...@@ -139,4 +139,3 @@ function findTitlePath(items, findstr, results) {
// }) // })
// console.log(JSON.stringify(root)) // console.log(JSON.stringify(root))
}) () }) ()
*/
\ No newline at end of file
...@@ -28,3 +28,6 @@ for(let i=0;i<rows.length;i++){ ...@@ -28,3 +28,6 @@ for(let i=0;i<rows.length;i++){
} }
} }
console.log(mid) console.log(mid)
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