dever 4 years ago
commit
d290660730
3 changed files with 383 additions and 0 deletions
  1. 92 0
      database/cate.php
  2. 283 0
      database/info.php
  3. 8 0
      index.php

+ 92 - 0
database/cate.php

@@ -0,0 +1,92 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'cate',
+    # 显示给用户看的名称
+    'lang' => '分类设置',
+    # 后台菜单排序
+    'order' => 1,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+        ),
+        
+        'name'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '分类名称',
+            'default'   => '',
+            'desc'      => '请输入名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序(数值越大越靠前)',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+            'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '录入时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    # 默认值
+    'default' => array
+    (
+        'col' => 'name,reorder,cdate',
+        'value' => array
+        (
+            '"默认分类",10,' . time(),
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 283 - 0
database/info.php

@@ -0,0 +1,283 @@
+<?php
+
+$status = array
+(
+    1 => '可用',
+    2 => '禁用',
+);
+
+$cate = function()
+{
+    $array = array();
+    $info = Dever::db('quan/cate')->state();
+    if($info)
+    {
+        $array += $info;
+    }
+    return $array;
+};
+
+$score = function()
+{
+    $array = array();
+    $info = Dever::load('score/lib/core')->getScore();
+    if($info)
+    {
+        $array += $info;
+    }
+    return $array;
+};
+
+$function = array
+(
+    1 => '消耗积分',
+    2 => '赠送积分',
+    3 => '满减积分',
+    4 => '推荐',
+    5 => '等级',
+    6 => '提现',
+    11 => '赠送券',
+);
+
+return array
+(
+    # 表名
+    'name' => 'info',
+    # 显示给用户看的名称
+    'lang' => '券管理',
+    'order' => 100,
+
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'list'      => true,
+        ),
+        
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '券名称',
+            'default'   => '',
+            'desc'      => '券名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'list'      => true,
+            'search'    => 'fulltext',
+        ),
+
+        'cate_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属分类',
+            'default'   => '1',
+            'desc'      => '所属分类',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $cate,
+            'search'    => 'select',
+            'list'      => 'Dever::load("quan/cate-one#name", {cate_id})',
+        ),
+
+        'desc'      => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '券描述',
+            'default'   => '',
+            'desc'      => '券描述',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'value'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '券面值',
+            'default'   => '',
+            'desc'      => '券面值',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'list'      => true,
+        ),
+
+        'qtime'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '有效期-直接填写天数即可,如有效期为10天,直接填写10',
+            'default'   => '',
+            'desc'      => '有效期',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'qdate'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '截止时间-选择时间',
+            'default'   => '',
+            'desc'      => '截止时间',
+            'match'     => 'option',
+            'update'    => 'date',
+            'callback'  => 'maketime',
+        ),
+
+        'icon'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '1:1图标-图片尺寸150*150px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'default'   => '',
+            'desc'      => '1图标',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150',
+            //直接上传到云端
+            //'upload'  => 'qiniu',
+            //上传大数据
+            //'large'   => true,
+        ),
+
+        'function'      => array
+        (
+            'type'      => 'varchar-30',
+            'name'      => '功能选择',
+            'default'   => '1',
+            'desc'      => '功能选择',
+            'match'     => 'is_string',
+            'update'    => 'checkbox',
+            'option'    => $function,
+            'control'   => 'function',
+        ),
+
+        'xh_score'      => array
+        (
+            'type'      => 'varchar-30',
+            'name'      => '消耗积分',
+            'default'   => '',
+            'desc'      => '消耗积分',
+            'match'     => 'is_string',
+            'update'    => 'checkbox',
+            'option'    => $score,
+            'show'   => 'function=1',
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序(数值越大越靠前)',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+            'edit'      => true,
+        ),
+
+        'content'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '内容介绍',
+            'default'   => '',
+            'desc'      => '请输入内容',
+            'match'     => 'is_string',
+            'update'    => 'editor',
+            'key'       => '1',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '发布状态',
+            'default'   => '2',
+            'desc'      => '发布状态',
+            'match'     => 'is_numeric',
+            //'update'  => 'select',
+            'option'    => $status,
+            'search'    => 'select',
+            'list'      => true,
+            'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+
+        'admin'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '操作人',
+            'default'   => '1',
+            'desc'      => '操作人',
+            'match'     => 'is_numeric',
+        ),
+
+        'udate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '更新时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+        ),
+
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '录入时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+        ),
+    ),
+
+    # 索引
+    'index' => array
+    (
+        'version' => 1,
+        
+        1 => array
+        (
+            'i1' => 'cate_id,reorder',
+        )
+    ),
+    
+    # 管理功能
+    'manage' => array
+    (
+        
+    ),
+
+    # request 请求接口定义
+    'request' => array
+    (
+        'search' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'ids' => array('yes-id', 'in'),
+                'cate_id' => 'yes',
+                'name' => array('yes', 'like'),
+                'id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'pdate' => 'desc'),
+            'limit' => '0,1000',
+            'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
+        ),
+    ),
+);

+ 8 - 0
index.php

@@ -0,0 +1,8 @@
+<?php
+
+define('DEVER_APP_NAME', 'quan');
+define('DEVER_APP_LANG', '优惠券');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', 80);
+define('DEVER_MANAGE_ICON', 'glyphicon-shopping-cart layui-icon-dollar');
+include(DEVER_APP_PATH . '../boot.php');