Commit 5706edb2 by 蒋勇

d

parent e9b42913
......@@ -27,6 +27,10 @@ class UserCtl extends CtlBase {
await this.service.updateByWhere({isEnabled:!pobj.isEnabled},{company_id:pobj.company_id})
return system.getResult({});
}
async allowOrNotToOne(pobj, qobj, req){
await this.service.updateByWhere({isEnabled:!pobj.isEnabled},{id:pobj.curid})
return system.getResult({});
}
async initNewInstance(queryobj, req) {
var rtn = {};
rtn.roles = [];
......
......@@ -17,7 +17,7 @@ class UserCache extends CacheBase{
}
async buildCacheVal(cachekey,inputkey, val, ex, ...items) {
const configValue = await this.userDao.model.findAll({
where: { userName: inputkey, app_id: settings.pmappid },
where: { userName: inputkey, app_id: settings.pmappid,isEnabled:true},
attributes: ['id','userName', 'nickName','headUrl','jwtkey','jwtsecret','created_at','isSuper','isAdmin','mail','opath','ptags'],
include: [
{ model: this.db.models.company,attributes:['id','name','companykey','appids'],raw:true},
......
......@@ -70,9 +70,11 @@ class DbFactory{
//产品相关
this.db.models.productprice.belongsTo(this.db.models.product,{constraints: false,});
this.db.models.product.hasMany(this.db.models.productprice,{as:"skus",constraints: false,});
this.db.models.product.belongsTo(this.db.models.company,{constraints: false,});
//产品价格引用定价策略
this.db.models.productprice.belongsTo(this.db.models.pricestrategy,{constraints: false,});
this.db.models.productprice.belongsTo(this.db.models.company,{constraints: false,});
//成本项目属于productprice
this.db.models.productcost.belongsTo(this.db.models.productprice,{constraints: false,});
......
......@@ -4,6 +4,20 @@ class ProductDao extends Dao {
constructor() {
super(Dao.getModelName(ProductDao));
}
extraWhere(obj,w,qc,linkAttrs){
if(obj.bizpath && obj.bizpath!=""){
if(obj.bizpath.indexOf("productdef")>0){//说明是租户查询自己创建的应用
w["company_id"]= obj.company_id;
}
}
if(linkAttrs.length>0){
var search=obj.search;
var lnkKey=linkAttrs[0];
var strq="$"+lnkKey.replace("~",".")+"$";
w[strq]= {[this.db.Op.like]:"%"+search[lnkKey]+"%"};
}
return w;
}
extraModelFilter() {
//return {"key":"include","value":[{model:this.db.models.app,},{model:this.db.models.role,as:"Roles",attributes:["id","name"],joinTableAttributes:['created_at']}]};
return {
......
......@@ -4,6 +4,20 @@ class ProductpriceDao extends Dao{
constructor(){
super(Dao.getModelName(ProductpriceDao));
}
extraWhere(obj,w,qc,linkAttrs){
if(obj.bizpath && obj.bizpath!=""){
if(obj.bizpath.indexOf("platformprice")>0){//说明是租户查询自己创建的应用
w["company_id"]= obj.company_id;
}
}
if(linkAttrs.length>0){
var search=obj.search;
var lnkKey=linkAttrs[0];
var strq="$"+lnkKey.replace("~",".")+"$";
w[strq]= {[this.db.Op.like]:"%"+search[lnkKey]+"%"};
}
return w;
}
extraModelFilter(){
//return {"key":"include","value":[{model:this.db.models.app,},{model:this.db.models.role,as:"Roles",attributes:["id","name"],joinTableAttributes:['created_at']}]};
return {"key":"include","value":[
......
......@@ -21,7 +21,7 @@ module.exports = (db, DataTypes) => {
allowNull: false,
}//和user的from相同,在注册user时,去创建
}, {
paranoid: false,//假的删除
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
......
......@@ -17,7 +17,7 @@ module.exports = (db, DataTypes) => {
allowNull: false,
}//和user的from相同,在注册user时,去创建
}, {
paranoid: false,//假的删除
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
......
......@@ -25,7 +25,7 @@ module.exports = (db, DataTypes) => {
allowNull: false,
},//和user的from
}, {
paranoid: false,//假的删除
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
......
......@@ -21,7 +21,7 @@ module.exports = (db, DataTypes) => {
allowNull: true
},
}, {
paranoid: false,//假的删除
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
......
......@@ -42,7 +42,7 @@ module.exports = (db, DataTypes) => {
defaultValue: false
}
}, {
paranoid: false,//假的删除
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
......
......@@ -31,7 +31,8 @@ class ProductService extends ServiceBase {
product_id: pnew.id,
pricestrategy_id: stragetyid,
pname:p.name,
strategyitems:tmpdic[stragetyid+'']
strategyitems:tmpdic[stragetyid+''],
company_id:p.company_id
}
productprices.push(pps)
})
......@@ -83,7 +84,8 @@ class ProductService extends ServiceBase {
product_id: p.id,
pricestrategy_id: stragetyid,
pname:p.name,
strategyitems:tmpdic[stragetyid+'']
strategyitems:tmpdic[stragetyid+''],
company_id:p.company_id
}
productprices.push(pps)
})
......
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