'use strict';
const Service = require('egg').Service;

class TypeService extends Service {

  async get_list(condition = {}) {
    const { ctx } = this;
    console.log(condition);
    let job_type = condition.job_type ? condition.job_type : '';

    var where = {};
    const attributes = ['id', 'name', 'icon', 'background'];
    where.job_type = job_type;
    where.status = 1;//在线
    where.is_deleted = 0;//未删除
    var data = {where , attributes};
    console.log(data);
    var jobstyles = await ctx.blockModel.OfficialJobType.all(data); 

    if(!jobstyles) return {};
    var ret = [];
    for(const item of jobstyles) {
      ret.push({
        id: item.id,
        name: item.name,
        icon: item.icon,
        background: item.background,
      });
    }
    return ret;
  }

}
module.exports = TypeService;
