role.ts 963 Bytes
import { RpcApiClient } from '../core/rpc-client';
import type { RoleRow, RpcListResult } from '../core/types';

/** 角色管理接口。method 与参数名逐字保留老 H5(html/role/*.html)。 */
class RoleApi extends RpcApiClient {
  page(params: Record<string, unknown> = {}) {
    return this.rpc<RpcListResult<RoleRow>>('entmicro-account', 'merchants.api.role.page', params);
  }

  insert(params: Record<string, unknown>) {
    return this.rpc<unknown>('entmicro-account', 'merchants.api.role.insert', params);
  }

  update(params: Record<string, unknown>) {
    return this.rpc<unknown>('entmicro-account', 'merchants.api.role.update', params);
  }

  deleteById(id: string | number) {
    return this.rpc<unknown>('entmicro-account', 'merchants.api.role.deleteById', { id });
  }

  getById(id: string | number) {
    return this.rpc<RoleRow>('entmicro-account', 'merchants.api.role.getById', { id });
  }
}

export const roleApi = new RoleApi();