'正常', 2 => '冻结', ); $button = array(); $list_button = Dever::config('base', 'project')->passport_list_button; if (!$list_button) { $list_button = array(); } if (Dever::project('account')) { $list_button += array ( 'list99' => array('钱包', '"info&project=account&config_key=qianbao&search_option_uid={id}&oper_parent=user&oper_project=passport"'), ); } if (Dever::project('score')) { $list_button += array ( 'list100' => array('积分', '"user&project=score&search_option_uid={id}&oper_parent=user&oper_project=passport"'), 'list101' => array('等级', '"user_level&project=score&search_option_uid={id}&oper_parent=user&oper_project=passport"'), ); } /* $level = function() { return Dever::db('passport/level')->state(); }; */ $system = function() { $array = array(); $info = Dever::db('passport/system')->state(); if ($info) { $array += $info; } return $array; }; $profession = function() { $array = array(); $info = Dever::db('passport/profession')->state(); if ($info) { $array += $info; } return $array; }; $sex = array ( 1 => '男', 2 => '女', 3 => '未知', ); $weixin = array ( 1 => '已关注', 2 => '未关注', ); $temp = array ( 1 => '临时用户', 2 => '正式用户', ); $bind = array ( 1 => '已绑定', 2 => '未绑定', ); # 即将废弃 暂时做兼容 $source_type = array ( 'ios' => 'ios', 'android' => 'android', 'h5' => 'h5', 'applet' => '小程序', 'pc' => '网站', 'service' => '公众号', ); $system_source = Dever::config('base')->system_source; $email = Dever::rule('email'); $email = 'option'; $mobile = Dever::rule('mobile'); $mobile = 'option'; return array ( 'email' => $email, 'mobile' => $mobile, 'source_type' => $source_type, 'system_source' => $system_source, 'sex' => $sex, # 表名 'name' => 'user', # 显示给用户看的名称 'lang' => '用户管理', 'order' => 10, /* 'end' => array ( 'insert' => '', ), */ # 数据结构 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => '用户ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', 'search' => 'order,fulltext', 'list' => true, ), 'username' => array ( 'type' => 'varchar-50', 'name' => '用户名', 'default' => '', 'desc' => '请输入用户名', 'match' => 'is_string', 'update' => 'text', 'search' => 'fulltext', 'list' => true, ), 'truename' => array ( 'type' => 'varchar-50', 'name' => '姓名', 'default' => '', 'desc' => '请输入姓名', 'match' => 'option', 'update' => 'text', 'search' => 'fulltext', //'list' => '"{truename}" ? "{truename}" : "点此编辑"', //'edit' => true, ), 'title' => array ( 'type' => 'varchar-800', 'name' => '头衔', 'default' => '', 'desc' => '请输入头衔', 'match' => 'option', 'update' => 'text', 'search' => 'fulltext', ), 'mobile' => array ( 'type' => 'varchar-32', 'name' => '手机号', 'default' => '', 'desc' => '请输入用户手机号', 'match' => $mobile, 'update' => 'text', 'search' => 'fulltext,exist', 'exist' => array ( 'yes' => '有值', //'no' => '没有值', ), 'list' => true, ), 'system_id' => array ( 'type' => 'int-11', 'name' => '所属项目', 'default' => '1', 'desc' => '所属项目', 'match' => 'is_numeric', 'option' => $system, //'update' => 'select', //'list' => true, ), 'profession' => array ( 'type' => 'int-11', 'name' => '职业', 'default' => '1', 'desc' => '职业', 'match' => 'is_numeric', 'option' => $profession, //'update' => 'select', //'list' => true, ), 'wechat' => array ( 'type' => 'varchar-100', 'name' => '微信号', 'default' => '', 'desc' => '微信号', 'match' => 'is_string', //'update' => 'select', //'list' => true, ), 'source_type' => array ( 'type' => 'varchar-100', 'name' => '用户来源-废弃,用system_source替代,暂时保留', 'default' => '', 'desc' => '请选择用户来源', 'match' => 'is_string', //'update' => 'select', 'option' => $source_type, //'search' => 'select', //'list' => true, ), 'system_source' => array ( 'type' => 'tinyint-1', 'name' => '所属平台', 'default' => '1', 'desc' => '所属平台', 'match' => 'is_numeric', 'option' => $system_source, 'update' => 'radio', 'search' => 'select', 'list' => true, ), 'email' => array ( 'type' => 'varchar-150', 'name' => '邮箱', 'default' => '', 'desc' => '请输入邮箱', 'match' => $email, 'update' => 'text', //'search' => 'fulltext', //'list' => true, ), 'password' => array ( 'type' => 'varchar-50', 'name' => '密码', 'default' => '', 'desc' => '请输入密码', 'match' => 'option', 'update' => 'password', 'callback' => 'sha1', ), 'avatar_id' => array ( 'type' => 'int-11', 'name' => '默认头像', 'default' => '1', 'desc' => '默认头像', 'match' => 'is_numeric', ), //search_exist_avatar=yes 'avatar' => array ( 'type' => 'varchar-150', 'name' => '头像', 'default' => '', 'desc' => '请选择头像', 'match' => 'option', 'update' => 'image', 'key' => '1', 'place' => '150', 'list_name' => '详细信息', //'list' => '"{avatar}" ? "": ""', 'list' => 'Dever::load("passport/lib/manage.show", {id})', ), 'address_contact' => array ( 'type' => 'varchar-100', 'name' => '联系人', 'default' => '', 'desc' => '联系人', 'match' => 'option', //'update' => 'text', //'list' => true, ), 'address_mobile' => array ( 'type' => 'varchar-100', 'name' => '联系电话', 'default' => '', 'desc' => '联系电话', 'match' => 'option', //'update' => 'text', //'list' => true, ), 'country' => array ( 'type' => 'varchar-100', 'name' => '国家-来自微信', 'default' => '', 'desc' => '国家', 'match' => 'option', //'update' => 'text', ), 'province' => array ( 'type' => 'varchar-100', 'name' => '省份-来自微信', 'default' => '', 'desc' => '省份', 'match' => 'option', //'update' => 'text', ), 'city' => array ( 'type' => 'varchar-100', 'name' => '城市-来自微信', 'default' => '', 'desc' => '城市', 'match' => 'option', //'update' => 'text', ), 'county' => array ( 'type' => 'varchar-100', 'name' => '区县-来自微信', 'default' => '', 'desc' => '区县', 'match' => 'option', //'update' => 'text', ), 'area' => array ( 'type' => 'varchar-800', 'name' => '地区-来自微信', 'default' => '', 'desc' => '地区', 'match' => 'option', //'update' => 'text', //'list' => true, ), 'area_id' => array ( 'type' => 'varchar-500', 'name' => '地区-用户自己选择', 'default' => '', 'desc' => '地区', 'match' => 'option', 'search' => 'linkage', 'update' => 'linkage', 'option' => Dever::url('api.get', 'area'), 'list' => 'Dever::load("area/api.string", "{area_id}")', ), 'address' => array ( 'type' => 'varchar-1000', 'name' => '详细地址-不带省市区的地址', 'default' => '', 'desc' => '详细地址', 'match' => 'option', 'update' => 'text', //'list' => true, ), 'info' => array ( 'type' => 'varchar-255', 'name' => '介绍-选填,如果想清空该介绍,请输入null。', 'default' => '', 'desc' => '请输入介绍', 'match' => 'option', 'update' => 'textarea', ), 'cash' => array ( 'type' => 'decimal-11,2', 'name' => '钱包余额', 'default' => '0', 'desc' => '钱包余额', 'match' => 'is_string', //'update' => 'text', //'list' => true, ), 'score' => array ( 'type' => 'varchar-50', 'name' => '积分', 'default' => '', 'desc' => '请输入积分', 'match' => 'option', //'update' => 'text', //'list' => true, ), 'sex' => array ( 'type' => 'tinyint-1', 'name' => '用户性别', 'default' => '3', 'desc' => '用户性别', 'match' => 'is_numeric', 'option' => $sex, 'update' => 'radio', //'list' => true, ), 'level' => array ( 'type' => 'int-11', 'name' => '用户等级', 'default' => '1', 'desc' => '请选择用户等级', 'match' => 'is_numeric', //'option' => $level, //'update' => 'select', //'list' => true, ), 'temp' => array ( 'type' => 'tinyint-1', 'name' => '是否临时用户', 'default' => '1', 'desc' => '是否临时用户', 'match' => 'is_numeric', //'search' => 'select', 'option' => $temp, //'update' => 'select', //'list' => true, ), 'birthday' => array ( 'type' => 'int-11', 'name' => '生日', 'default' => '', 'match' => 'option', 'desc' => '生日', 'update' => 'time', 'callback' => 'maketime', ), 'login_date' => array ( 'type' => 'int-11', 'name' => '最近登录', //'match' => array('is_numeric', time()), 'match' => 'is_numeric', 'desc' => '', 'default' => '0', //'list' => 'date("Y-m-d H:i:s", {login_date})', ), 'bind' => array ( 'type' => 'tinyint-1', 'name' => '是否绑定手机', 'default' => '2', 'desc' => '请选择是否绑定手机', 'match' => 'is_numeric', //'option' => $bind, //'update' => 'radio', ), 'state' => array ( 'type' => 'tinyint-1', 'name' => '状态', 'default' => '1', 'desc' => '请选择状态', 'match' => 'is_numeric', //'option' => $option, //'update' => 'radio', ), 'cdate' => array ( 'type' => 'int-11', 'name' => '注册时间', 'match' => array('is_numeric', time()), 'desc' => '', # 只有insert时才生效 'insert' => true, 'list' => 'date("Y-m-d H:i:s", {cdate})', ), ), 'manage' => array ( 'excel' => true, 'button' => $button, # 列表 'list_button' => $list_button, ), # 更新表结构 /* 'alter' => array ( 1 => array ( array('add', 'bind', 'bind', 'tinyint-1 2 是否绑定手机'), ), 'version' => 1, ), */ # 索引 'index' => array ( 1 => array ( 'mobile' => 'mobile', ), # 版本号 更改版本号会更新当前表的索引 'version' => 1, ), # request 请求接口定义 'request' => array ( # 此处定义是为跳出auth 'login' => array ( 'option' => array ( 'username' => 'yes', 'mobile' => 'yes', 'email' => 'yes', 'password' => 'yes', ), 'type' => 'one', ), # 验证手机号是否被使用 'checkMobile' => array ( # 匹配的正则或函数 选填项 'where' => array ( 'mobile' => 'yes', 'id' => array('yes', '!='), ), 'type' => 'one', ), # 此处定义是为跳出auth 'updates' => array ( 'set' => array ( 'state' => 'yes', ), 'where' => array ( 'id' => array('yes', 'in'), ), 'type' => 'update', ), # 后台搜索用到 'search' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'ids' => array('yes-id', 'in'), 'username' => array('yes', 'like'), 'id' => 'yes', 'state' => 1, ), 'type' => 'all', 'order' => array('id' => 'desc'), 'limit' => '0,1000', 'col' => 'username as name, id, id as value, "" as selected, "" as disabled|id', ), # 获取基本常用的信息 'getOne' => array ( 'option' => array ( 'id' => 'yes', ), 'type' => 'one', 'col' => 'id,username,avatar,sex,truename,area,mobile,area_id,address,address_contact,address_mobile,info,title,birthday,avatar_id,cash', ), 'getNum' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'start' => array('yes-cdate', '>='), 'end' => array('yes-cdate', '<='), 'state' => 1, ), 'type' => 'count', 'col' => '*', ), 'like' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'search' => array('yes-mobile,username', 'like'), 'mobile' => array('yes', 'like'), 'username' => array('yes', 'like'), 'id' => 'yes', 'state' => 1, ), 'type' => 'all', 'order' => array('id' => 'desc'), 'col' => '*|id', ), 'upCash' => array ( 'type' => 'update', 'where' => array ( 'id' => 'yes', ), 'set' => array ( 'cash' => array('yes', '+='), ), ), ), );