<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Admin\Model;
use Think\Model;

/**
 * 代理商模型
 * @author 麦当苗儿 <zuojiazi@vip.qq.com>
 */
class FactoryModel extends Model{

    protected $_validate = array(
        //array('username', '1,16', '用户名长度为1-16个字符', self::EXISTS_VALIDATE, 'length'),
        array('username', '', 'User name occupied', self::EXISTS_VALIDATE, 'unique'), //用户名被占用
        array('password', 'require', 'The password can not be empty', self::MUST_VALIDATE , 'regex', self::MODEL_INSERT),
    );

    protected $_auto = array(
    	array('password','',3,'ignore'),
    	array('password', 'md5', self::MODEL_BOTH, 'function'),
        array('create_time', NOW_TIME, self::MODEL_INSERT),
        array('update_time', NOW_TIME, self::MODEL_BOTH),
    	array('create_ip', 'get_client_ip', self::MODEL_INSERT, 'function', 1),
    	array('status', '1', self::MODEL_BOTH),
    );

}
