<?php
/**
 * 账号列表
 * 
 * @author Daniel Chen
 */

class Service_Account {
  private static $_model = NULL;

  private static function getModelInstance() {
    if (is_null(self::$_model)) {
      self::$_model = new Table_Account();
    }

    return self::$_model;
  }

  /**
   * @see Table_Account::insert()
   */
  public static function insert($data) {
    $model = self::getModelInstance();

    return $model->insert($data);
  }

  /**
   * @see Table_Account::update()
   */
  public static function update($data, $value, $key = 'account_id') {
    $model = self::getModelInstance();

    return $model->update($data, $value, $key);
  }

  /**
   * @see Table_Account::delete()
   */
  public static function delete($value, $key = 'account_id') {
    $model = self::getModelInstance();

    return $model->delete($value, $key);
  }

  /**
   * @see Table_Account::getByCondition()
   */
  public static function getByCondition($condition, $count = FALSE) {
    $model = self::getModelInstance();

    return $model->getByCondition($condition, $count);
  }

  /**
   * @see Table_Account::isUniqueName()
   */
  public static function isUniqueName($name, $customer) {
    $model = self::getModelInstance();

    return $model->isUniqueName($name, $customer);
  }

  /**
   * @see Table_Account::isUniqueEmail()
   */
  public static function isUniqueEmail($email) {
    $model = self::getModelInstance();

    return $model->isUniqueEmail($email);
  }

    public function getByField($value,$field='account_id',$columns="*"){
        $model = self::getModelInstance();
        return $model->getByField($value,$field,$columns);
    }
}
