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 WeblinkCtl extends CtlBase {
  constructor() {
    super(CtlBase.getServiceName(WeblinkCtl));
  }
  async initNewInstance(queryobj, req) {
    var rtn = {};
    var vcode = await this.service.getBusUid("wl");
    rtn.code = vcode;
    return system.getResult2(rtn, 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;
      }
    }
    var rd = await this.service.refQuery(qobj);
    return system.getResult2(rd, null);
  }


  //商标报告统计数据
  
}
module.exports = WeblinkCtl;
