{"size": 694, "ext": "js", "max_stars_repo_path": "src/module/test-dingtalk/backend/src/service/test.js", "max_stars_repo_name": "zhennann/cabloy", "max_stars_repo_stars_event_min_datetime": "2018-07-17T15:52:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T14:00:36.000Z", "max_issues_repo_path": "src/module/test-dingtalk/backend/src/service/test.js", "max_issues_repo_name": "zhennann/cabloy", "max_issues_repo_issues_event_min_datetime": "2018-08-21T05:02:42.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-19T03:44:57.000Z", "max_forks_repo_path": "src/module/test-dingtalk/backend/src/service/test.js", "max_forks_repo_name": "zhennann/cabloy", "max_forks_repo_forks_event_min_datetime": "2018-07-18T08:51:23.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-06T23:09:04.000Z"}
{"max_stars_count": 553, "max_issues_count": 18, "max_forks_count": 89, "avg_line_length": 22.3870967742, "max_line_length": 69, "alphanum_fraction": 0.5158501441}
module.exports = app => {
  class Test extends app.Service {
    async getMemberId({ user }) {
      const modelMember = this.ctx.model.module('a-dingtalk').member;
      const member = await modelMember.get({ userId: user.id });
      return {
        memberId: member.memberId,
      };
    }

    async sendAppMessage({ message, user }) {
      const msg = {
        msgtype: 'text',
        text: {
          content: message.text,
        },
      };
      const content = {
        userIds: [user.id],
        data: { msg },
      };
      await this.ctx.bean.io.pushDirect({
        content,
        channel: { module: 'a-dingtalk', name: 'app' },
      });
    }
  }

  return Test;
};
