{"size": 1679, "ext": "js", "max_stars_repo_path": "religion-backend/app/service/record.js", "max_stars_repo_name": "cnroadbridge/jingzhou-religion", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "religion-backend/app/service/record.js", "max_issues_repo_name": "cnroadbridge/jingzhou-religion", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "religion-backend/app/service/record.js", "max_forks_repo_name": "cnroadbridge/jingzhou-religion", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 15.9904761905, "max_line_length": 67, "alphanum_fraction": 0.5580702799}
'use strict';

const { Service } = require('egg');

class RecordService extends Service {
  constructor(ctx) {
    super(ctx);
    this.Record = this.ctx.model.Record;
  }

  async getAllByMobile(mobile, createTime) {
    const { Record } = this;
    const result = await Record.getAllByMobile(mobile, createTime);
    return result;
  }

  async get(id) {
    const { Record } = this;
    const result = await Record.get(id);
    return result;
  }

  async add(
    username,
    gender,
    mobile,
    idcard,
    orgin,
    province,
    city,
    place,
    religiousCountry,
    religiousType,
    matter,
    visiteDate,
    visiteTime,
    leaveTime
  ) {
    const { ctx, Record } = this;
    const result = await Record.add(
      username,
      gender,
      mobile,
      idcard,
      orgin,
      province,
      city,
      place,
      religiousCountry,
      religiousType,
      matter,
      visiteDate,
      visiteTime,
      leaveTime
    );
    if (!result) {
      ctx.fail(result);
    }
    return result;
  }

  async set(
    id,
    username,
    gender,
    mobile,
    idcard,
    orgin,
    province,
    city,
    place,
    religiousCountry,
    religiousType,
    matter,
    visiteDate,
    visiteTime,
    leaveTime
  ) {
    const { ctx, Record } = this;
    const result = await Record.set(
      id,
      username,
      gender,
      mobile,
      idcard,
      orgin,
      province,
      city,
      place,
      religiousCountry,
      religiousType,
      matter,
      visiteDate,
      visiteTime,
      leaveTime
    );
    if (!result) {
      ctx.fail(result);
    }
    return result;
  }
}

module.exports = RecordService;
