123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <?php
- $config = function()
- {
- $array = array();
- $info = Dever::db('score/config')->state();
- if($info)
- {
- $array += $info;
- }
- return $array;
- };
- return array
- (
- # 表名
- 'name' => 'user',
- # 显示给用户看的名称
- 'lang' => '用户积分列表',
- 'order' => 100,
- 'menu' => 'passport',
- 'menu' => false,
- # 数据结构
- 'struct' => array
- (
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => 'ID',
- 'default' => '',
- 'desc' => '',
- 'match' => 'is_numeric',
- //'list' => true,
- ),
- 'uid' => array
- (
- 'type' => 'int-11',
- 'name' => '用户名',
- 'default' => '0',
- 'desc' => '请选择用户',
- 'match' => 'is_numeric',
- //'update' => 'select',
- //'search' => 'select',
- 'search' => array
- (
- 'api' => 'passport/user-all',
- 'col' => 'username',
- 'result' => 'id',
- ),
- 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
- ),
- 'config_id' => array
- (
- 'type' => 'int-11',
- 'name' => '积分名称',
- 'default' => '1',
- 'desc' => '积分名称',
- 'match' => 'is_numeric',
- 'update' => 'select',
- 'option' => $config,
- 'search' => 'select',
- 'list' => true,
- ),
- 'score' => array
- (
- 'type' => 'varchar-80',
- 'name' => '可用数量',
- 'default' => '0',
- 'desc' => '可用数量',
- 'match' => 'option',
- 'update' => 'text',
- 'search' => 'order',
- 'list' => true,
- ),
- 'no_score' => array
- (
- 'type' => 'varchar-80',
- 'name' => '冻结数量',
- 'default' => '0',
- 'desc' => '冻结数量',
- 'match' => 'option',
- 'update' => 'text',
- 'search' => 'order',
- 'list' => true,
- ),
- 'cdate' => array
- (
- 'type' => 'int-11',
- 'name' => '录入时间',
- 'match' => array('is_numeric', time()),
- 'desc' => '',
- # 只有insert时才生效
- 'insert' => true,
- ),
- ),
- # 索引
- 'index' => array
- (
- 1 => array
- (
- 'search' => 'uid,config_id',
- ),
-
- # 版本号 更改版本号会更新当前表的索引
- 'version' => 1,
- ),
- 'manage' => array
- (
- 'delete' => false,
- 'edit' => false,
- 'insert' => false,
- # 列表
- 'list_button' => array
- (
- 'list' => array('积分日志', '"user_log&&project=score&search_option_uid={uid}&oper_parent=user&oper_project=score&top_project=passport&top_parent=user"'),
- ),
- ),
- # request 请求接口定义
- 'request' => array
- (
- 'getScoreByConfig' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'uid' => 'yes',
- ),
- 'type' => 'all',
- 'order' => array('id' => 'desc'),
- 'col' => 'id,uid,config_id,score|config_id',
- ),
- # 更新积分
- 'inc' => array
- (
- 'type' => 'update',
- 'where' => array
- (
- 'id' => 'yes',
- ),
- 'set' => array
- (
- 'score' => array('yes', '+='),
- ),
- ),
- )
- );
|