const system = require("../system");
const settings = require("../../config/settings.js");
const reclient = system.getObject("util.redisClient");
const md5 = require("MD5");
//获取平台配置兑换率
//初次登录的赠送数量
//创建一笔交易
//同时增加账户数量,增加系统平台账户
var dbf = system.getObject("db.common.connection");
var db = dbf.getCon();
db.sync({ force: true }).then(async () => {
  // const apps = await system.getObject("service.common.appSve");
  // const usS = await system.getObject("service.auth.userSve");
  // let appnew = await apps.create({
  //   "name": "center-app",
  //   "domainName": "t9.com",
  //   "backend": "192.168.1.148",
  //   "isSystem": true,
  //   "title": "center-app"
  // });
  // let Role = db.models["role"];
  // await Role.create({ code: "ta", name: "租户", isSystem: true, app_id: appnew.id, company_id: settings.pmcompanyid })
  // await Role.create({ code: "pr", name: "个人", isSystem: true, app_id: appnew.id, company_id: settings.pmcompanyid })

  // let usuper = await usS.pmregister({ userName: "sm", password: "951753", isSuper: true, isAdmin: true, isSystem: true, isEnabled: true, nickName: "superman", app_id: appnew.id, company_id: settings.id })
  // appnew.creator_id = usuper.user.id
  // await appnew.save()



  //创建role
  // if(settings.env=="prod"){
  //   reclient.flushall(()=>{
  //     console.log("clear caches ok.....");
  //   });
  // }
  // reclient.flushall(()=>{
  //   console.log("clear caches ok.....");
  // });
});



