Initial commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace Admin\Model;
|
||||
use Think\Model\RelationModel;
|
||||
class UserModel extends RelationModel{
|
||||
//关联模型
|
||||
Protected $_link=array(
|
||||
"role"=>array(
|
||||
'mapping_type'=>self::MANY_TO_MANY,
|
||||
'foreign_key'=>"user_id",
|
||||
'relation_key'=>"role_id",
|
||||
'relation_table'=>"db_role_user",
|
||||
),
|
||||
);
|
||||
//验证
|
||||
protected $_validate=array(
|
||||
//array("字段","验证规则","错误提示",["验证条件","附加条件","验证时间"]),
|
||||
array("user_name","require","用户名不能为空"),
|
||||
array("user_name","","用户名已存在",0,"unique"),
|
||||
array("user_password","require","密码不能为空"),
|
||||
array("user_password","6,40","密码长度需要6位以上",2,"length"),
|
||||
array('repassword','user_password','确认密码不正确',0,'confirm'), // 验证确认密码是否和密码一致
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user