import { Injectable } from '@angular/core';
import {environment} from '../../environments/environment';
import {HttpClient} from '@angular/common/http';
import {CommonsService} from './commons.service';

@Injectable({
  providedIn: 'root'
})
export class MerAccountService {

  constructor(
      private http: HttpClient,
      private common: CommonsService
  ) { }

  /**
   * 充值
   *
   * @param params 上传对象
   * @param  callBack   回调
   * @return data 返回结果
   */
  public recharge(params: object, callBack) {
    this.http.post(environment.baseUrl + 'merAccount/recharge', params).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 充值
   *
   * @param params 上传对象
   * @param  callBack   回调
   * @return data 返回结果
   */
  public getMerAccount(merId: number, callBack) {
    this.http.get(environment.baseUrl + 'merAccount/getMerAccount?merId=' + merId).subscribe(data => {
      callBack(data);
    });
  }

}
