dever преди 3 години
родител
ревизия
a847669959
променени са 36 файла, в които са добавени 4203 реда и са изтрити 404 реда
  1. 2 1
      app/factory/database/goods.php
  2. 1 1
      app/factory/database/info.php
  3. 17 48
      app/factory/database/member.php
  4. 387 1
      app/factory/database/order.php
  5. 71 0
      app/goods/database/add_card.php
  6. 171 0
      app/goods/database/card.php
  7. 162 0
      app/goods/database/card_code.php
  8. 107 93
      app/goods/database/coupon.php
  9. 58 12
      app/goods/database/info.php
  10. 19 8
      app/goods/database/info_sku.php
  11. 7 4
      app/goods/lib/Info.php
  12. 77 2
      app/goods/lib/Manage.php
  13. 0 8
      app/member/index.php
  14. 128 0
      app/shop/database/apply.php
  15. 398 0
      app/shop/database/buy_order.php
  16. 147 0
      app/shop/database/buy_order_goods.php
  17. 135 0
      app/shop/database/cart.php
  18. 113 0
      app/shop/database/coupon.php
  19. 137 0
      app/shop/database/focus.php
  20. 117 0
      app/shop/database/goods.php
  21. 408 0
      app/shop/database/info.php
  22. 106 0
      app/shop/database/member.php
  23. 102 108
      app/shop/database/print.php
  24. 447 0
      app/shop/database/sell_order.php
  25. 147 0
      app/shop/database/sell_order_goods.php
  26. 104 0
      app/shop/database/user_coupon.php
  27. 29 0
      app/shop/lib/Manage.php
  28. 110 0
      app/shop/src/Buy.php
  29. 149 0
      app/shop/src/Main.php
  30. 61 0
      app/shop/src/My.php
  31. 1 1
      app/store/database/info.php
  32. 17 48
      app/store/database/member.php
  33. 134 48
      main/database/config.php
  34. 103 0
      main/database/help.php
  35. 0 17
      main/database/page.php
  36. 31 4
      main/lib/Core.php

+ 2 - 1
app/factory/database/goods.php

@@ -37,7 +37,8 @@ return array
     # 表名
     'name' => 'goods',
     # 显示给用户看的名称
-    'lang' => '商品列表',
+    'lang' => '生产能力',
+    'order' => 10,
     # 数据结构
     'struct' => array
     (

+ 1 - 1
app/factory/database/info.php

@@ -4,7 +4,7 @@ $status = array
 (
     1 => '合作中',
     2 => '已终止合作',
-),
+);
 
 return array
 (

+ 17 - 48
app/factory/database/member.php

@@ -8,24 +8,13 @@ $role = array
     4 => '财务',
 );
 
-$factory = function()
-{
-    $array = array();
-    $info = Dever::db('factory/info')->select();
-    
-    if($info)
-    {
-        $array += $info;
-    }
-    return $array;
-};
-
 return array
 (
     # 表名
     'name' => 'member',
     # 显示给用户看的名称
     'lang' => '账号管理',
+    'menu' => false,
     # 数据结构
     'struct' => array
     (
@@ -42,52 +31,32 @@ return array
             //'list'        => true,
         ),
 
-        'factory_id'      => array
+        'uid'       => array
         (
             'type'      => 'int-11',
-            'name'      => '所属工厂',
-            'default'   => '',
-            'desc'      => '所属工厂',
+            'name'      => '用户名',
+            'default'   => '0',
+            'desc'      => '请选择用户',
             'match'     => 'is_numeric',
-            'update'    => 'select',
-            'option'    => $factory,
-            'list'      => 'Dever::load("factory/info-find#name", {factory_id})';
-        ),
-
-        'name'      => array
-        (
-            'type'      => 'varchar-50',
-            'name'      => '员工姓名',
-            'default'   => '',
-            'desc'      => '请输入员工姓名',
-            'match'     => 'is_string',
             'update'    => 'text',
-            'search'    => 'fulltext',
-            'list'      => true,
+            //'search'  => 'select',
+            'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'list'      => '{uid} > 0 ? Dever::load("passport/user-find#username", {uid}) : "匿名用户"',
         ),
 
-        'mobile'     => array
+        'factory_id'      => array
         (
             'type'      => 'int-11',
-            'name'      => '员工电话',
+            'name'      => '所属工厂',
             'default'   => '',
-            'desc'      => '请输入员工电话',
+            'desc'      => '所属工厂',
             'match'     => 'is_numeric',
-            'update'    => 'text',
-            'search'    => 'fulltext',
-            'list'      => true,
-        ),
-
-        'avatar'        => array
-        (
-            'type'      => 'varchar-150',
-            'name'      => '员工头像',
-            'default'   => '',
-            'desc'      => '请选择员工头像',
-            'match'     => 'option',
-            'update'    => 'image',
-            'key'       => '1',
-            'place'     => '150',
+            'list'      => 'Dever::load("factory/info-find#name", {factory_id})';
         ),
 
         'role_id'      => array

+ 387 - 1
app/factory/database/order.php

@@ -1 +1,387 @@
-order.php
+<?php
+# 系统
+$system_source = Dever::config('base')->system_source;
+
+$status = Dever::config('base', 'pay')->pay['status'];
+
+$source = array
+(
+    1 => '仓库',
+    2 => '门店',
+);
+
+return array
+(
+    # 表名
+    'name' => 'order',
+    # 显示给用户看的名称
+    'lang' => '订货单',
+    'order' => 1,
+
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'      => true,
+        ),
+
+        'order_id'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '支付订单ID',
+            'default'   => '',
+            'desc'      => '付款订单id',
+            'match'     => 'is_string',
+            //'update'    => 'text',
+            //'search'    => 'fulltext',
+            //'list'        => true,
+        ), 
+
+        'factory_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属工厂',
+            'default'   => '',
+            'desc'      => '所属工厂',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $factory,
+            'list'      => 'Dever::load("factory/info-find#name", {factory_id})';
+        ),
+
+        'buy_num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买数量',
+            'default'   => '',
+            'desc'      => '购买数量',
+            'match'     => 'is_numeric',
+            //'search'    => 'select',
+            //'list'        => true,
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '订单名称',
+            'default'   => '',
+            'desc'      => '订单名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list_name' => '订单信息',
+            'list'      => 'Dever::load("user/lib/manage.showOrderUser", "{id}")',
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '支付金额',
+            'default'   => '',
+            'desc'      => '支付金额',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'        => true,
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '订单状态',
+            'default'   => '1',
+            'desc'      => '请选择订单状态',
+            'match'     => 'is_numeric',
+            'option'    => $status,
+            'search'    => 'select',
+            'update'    => 'radio',
+            'list'      => true,
+            'list'      => 'Dever::load("user/lib/manage.showOrderStatus", "{id}", "ticket")',
+            'control'   => 'status',
+        ),
+
+        'tk_pic'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '退款截图',
+            'default'   => '',
+            'desc'      => '退款截图',
+            'match'     => 'is_string',
+            'update'    => 'image',
+            'key'       => 1
+        ),
+
+        'tk_time'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '退款时间',
+            'default'   => '',
+            'desc'      => '退款时间',
+            'match'     => 'option',
+            //'list'        => true,
+            //'update'    => 'date',
+            'callback'  => 'maketime',
+            'show'      => 'status=5',
+        ),
+
+        'tk_admin'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '退款审核人',
+            'default'   => '1',
+            'desc'      => '退款审核人',
+            'match'     => 'option',
+            //'list'        => true,
+            'show'      => 'status=5',
+        ),
+
+        'tk_desc'       => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '退款备注',
+            'default'   => '',
+            'desc'      => '退款备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+            //'show'        => 'status=5',
+        ),
+
+        'info'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '订单备注',
+            'default'   => '',
+            'desc'      => '订单备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+            //'show'        => 'status=5'
+            //'list'      => '"{info}" ? "{info}" : "双击添加备注"',
+            //'edit'      => true,
+        ),
+
+        'mobile'        => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '下单手机号',
+            'default'   => '',
+            'desc'      => '手机号',
+            'match'     => 'option',
+            //'show'        => 'status=5'
+            'search'    => array
+            (
+                'api' => 'passport/user-all',//接口地址,最好是获取多条数据的地址
+                'col' => 'mobile',//要查询的字段
+                'result' => 'id',//返回的字段
+                'search' => 'uid',//本表的字段,默认为当前的字段
+            ),
+        ),
+
+        'note'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否发送状态提醒-1未发送,2已发送',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+
+        'notice'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '模板消息提醒次数',
+            'default'   => '0',
+            'desc'      => '模板消息提醒次数',
+            'match'     => 'is_numeric',
+        ),
+
+        '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,
+            'search'    => 'date',
+            'list'        => 'date("Y-m-d H:i:s", {cdate})',
+            //'list'      => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
+        ),
+    ),
+
+    'top' => Dever::config('base')->top,
+
+    # 增加这个,为了给当前的list增加一个option
+    'top_option' => array
+    (
+        'value' => $auth,
+        'col' => 'cate_id',
+    ),
+
+    'manage' => array
+    (
+        'delete' => false,
+        'edit' => false,
+        'insert' => false,
+
+        'button' => array
+        (
+            //'导出订单' => array('location', 'user/lib/manage.out'),
+        ),
+
+        'list_button' => array(
+            'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2'),
+            //'delete' => array('删除', '', '{status} == 1'),
+        ),
+    ),
+
+    'request' => array
+    (
+        'getList' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'uid' => 'yes',
+                'status' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'page' => array(5, 'list'),
+            'col' => '*',
+        ),
+
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'uid' => 'yes',
+                'status' => array('1', '!='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => '*',
+        ),
+
+        'getYes' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        # 获取提交订单超过12个小时
+        'getDataByTime' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'cdate' => array('yes', '>='),
+                'notice' => 'yes',
+                'note' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        # 获取1,2
+        'getBuy' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'status' => 'yes',
+                'info_id' => 'yes',
+                'order_id' => 'yes',
+                'uid' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*',
+        ),
+
+        'getMyAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'uid' => 'yes',
+                'status' => 'yes',
+                'cate_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => 'id,order_id,name,buy_num,cdate,cash,info_id,buy_id',
+        ),
+
+        # 删除未支付订单
+        'drop' => array
+        (
+            # 匹配的正则或函数 选填项
+            'where' => array
+            (
+                'time' => array('yes-cdate', '<='),
+                'status' => 1,
+                'state' => 1,
+            ),
+            'type' => 'delete',
+            'col' => 'id,order_id',
+        ),
+
+        # 获取数据
+        'getAllByDate' => array
+        (
+            # 匹配的正则或函数 选填项
+            'where' => array
+            (
+                'time' => array('yes-cdate', '<='),
+            ),
+            'type' => 'all',
+            'col' => 'id,order_id',
+        ),
+
+        'getNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'object_id' => 'yes',
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(buy_num) as buy_num',
+        ),
+    ),
+);

+ 71 - 0
app/goods/database/add_card.php

@@ -0,0 +1,71 @@
+<?php
+$seller = function()
+{
+    return Dever::db('code/seller')->state();
+};
+return array
+(
+    # 表名
+    'name' => 'add_card',
+    # 显示给用户看的名称
+    'lang' => '新增兑换码',
+    'order' => 1,
+    'menu' => false,
+    'end' => array
+    (
+        'update' => 'goods/lib/manage.createCard',
+        'insert' => 'goods/lib/manage.createCard',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '系统ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'value'     => Dever::input('where_id'),
+        ),
+
+        'card_id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '礼品卡',
+            'default'   => '',
+            'desc'      => '礼品卡',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_card_id'),
+            'list'      => 'Dever::load("goods/card-find#name", "{card_id}")',
+        ),
+        
+        'num'       => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '兑换码数量',
+            'default'   => '',
+            'desc'      => '请输入兑换码数量',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'value'     => '',
+        ),
+
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '录入时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+        ),
+    ),
+
+    'manage' => array
+    (
+        # 后台管理不要列表页
+        'list' => 'update',
+    ),
+);

+ 171 - 0
app/goods/database/card.php

@@ -0,0 +1,171 @@
+<?php
+$status = Dever::config('base')->status;
+
+$method = array
+(
+    1 => '自提',
+    2 => '配送',
+    3 => '自提+配送',
+);
+
+$type = array
+(
+    1 => '永久有效',
+    2 => '固定天数',
+);
+
+return array
+(
+    # 表名
+    'name' => 'card',
+    # 显示给用户看的名称
+    'lang' => '礼品卡配置',
+    # 后台菜单排序
+    'order' => 99,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+        ),
+        
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '礼品卡名称',
+            'default'   => '',
+            'desc'      => '请输入礼品卡名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'type'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '礼品卡类型',
+            'default'   => '1',
+            'desc'      => '礼品卡类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            'control'   => 'type',
+        ),
+
+        'day'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '有效天数',
+            'default'   => '7',
+            'desc'      => '有效天数',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'show'      => 'type=2',
+        ),
+
+        'method'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '领取方式',
+            'default'   => '3',
+            'desc'      => '领取方式',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $method,
+            'control'   => 'method',
+        ),
+
+        'goods'       => array
+        (
+            'type'      => 'text-1000',
+            'name'      => '商品配置',
+            'default'   => '',
+            'desc'      => '商品配置',
+            'match'     => 'is_string',
+            'update'    => array
+            (
+                array
+                (
+                    'col'       => 'goods_id',
+                    'name'      => '选择商品',
+                    'default'   => '',
+                    'desc'      => '选择商品',
+                    'match'     => 'option',
+                    'update'    => 'select',
+                    'update_search' => 'goods/lib/manage.search',
+                ),
+
+                array
+                (
+                    'col'       => 'num',
+                    'name'      => '数量',
+                    'default'   => '1',
+                    'desc'      => '数量',
+                    'match'     => 'is_string',
+                    'update'    => 'text',
+                ),
+
+                
+            ),
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '状态',
+            'default'   => '1',
+            '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',
+        ),
+        
+        '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
+    (
+
+        'list_button' => array
+        (
+            'fast' => array('生成卡密', 'add_card&where_id=1&search_option_card_id={$id}'),
+
+            'list1' => array('卡密列表', '"card_code&search_option_card_id={id}&oper_table=card"' , '{status} == 1'),
+        ),
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 162 - 0
app/goods/database/card_code.php

@@ -0,0 +1,162 @@
+<?php
+$status = array
+(
+    1 => '未领取',
+    2 => '已使用',
+    3 => '已完成',
+    4 => '已作废',
+);
+
+return array
+(
+    # 表名
+    'name' => 'card_code',
+    # 显示给用户看的名称
+    'lang' => '礼品卡卡密',
+    # 后台菜单排序
+    'order' => 99,
+    'menu'  => false,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+        ),
+        
+        'card_id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '礼品卡',
+            'default'   => '',
+            'desc'      => '礼品卡',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_card_id'),
+            'list'      => 'Dever::load("goods/card-find#name", "{card_id}")',
+        ),
+
+        'card'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '卡号',
+            'default'   => '',
+            'desc'      => '卡号',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'        => true,
+        ),
+
+        'pwd'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '密码',
+            'default'   => '',
+            'desc'      => '密码',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'        => true,
+        ),
+
+        'status'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '使用状态',
+            'default'   => '1',
+            'desc'      => '使用状态',
+            'match'     => 'is_numeric',
+            'option'    => $type,
+            'search'    => 'select',
+            'update'    => 'select',
+            'list'      => true,
+            'mul'       => array(1 => '恢复使用', 4 => '已作废'),
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '用户信息',
+            'default'   => '0',
+            'desc'      => '用户信息',
+            'match'     => 'is_numeric',
+            'list_name' => '兑换信息',
+            'list'      => 'Dever::load("goods/lib/manage.showUserInfo", "{id}")',
+        ),
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '兑换门店',
+            'default'   => '',
+            'desc'      => '兑换门店',
+            'match'     => 'is_numeric',
+        ),
+
+        'ddate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '兑换时间',
+            'match'     => 'option',
+            'default'   => '',
+            'desc'      => '',
+            //'search'  => 'date',
+        ),
+
+        '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})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        'excel' => true,
+        'delete' => false,
+        'edit' => false,
+        'insert' => false,
+        'mul' => '{type} == 1 || {type} == 4',
+
+        'list_button' => array
+        (
+            'oper' => array('作废', 'goods/lib/manage.drop?id={id}', '{type} == 1'),
+
+            'oper2' => array('恢复使用', 'goods/lib/manage.recovery?id={id}', '{type} == 4'),
+        ),
+    ),
+
+    # 索引
+    'index' => array
+    (
+        # 索引名 => 索引id
+        'index' => 'card,pwd',
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 107 - 93
app/goods/database/freight.php → app/goods/database/coupon.php

@@ -1,24 +1,38 @@
 <?php
+$status = Dever::config('base')->status;
+
 $type = array
 (
-    1 => '数值',
-    2 => '百分比',
+    1 => '满减券',
+    2 => '通用券',
 );
 
-$pricing_type = array
+$method = array
 (
-    1 => '按件数',
-    //2 => '按重量',
-    //3 => '按体积',
+    1 => '自提',
+    2 => '配送',
+    3 => '自提+配送',
 );
+
+$time = array
+(
+    1 => '3天',
+    2 => '7天',
+    3 => '15天',
+    4 => '30天',
+    5 => '90天',
+    6 => '182天',
+    7 => '365天',
+);
+
 return array
 (
     # 表名
-    'name' => 'freight',
+    'name' => 'coupon',
     # 显示给用户看的名称
-    'lang' => '运费设置',
-    'order' => 1,
-
+    'lang' => '优惠券配置',
+    # 后台菜单排序
+    'order' => 100,
     # 数据结构
     'struct' => array
     (
@@ -30,7 +44,45 @@ return array
             'desc'      => '',
             'match'     => 'is_numeric',
             'search'    => 'order',
-            //'list'        => true,
+            'list'      => true,
+            'order'     => 'desc',
+        ),
+        
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '优惠券名称',
+            'default'   => '',
+            'desc'      => '请输入优惠券名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'type'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '优惠券类型',
+            'default'   => '1',
+            'desc'      => '优惠券类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            'search'    => 'select',
+            'list'      => true,
+            'control'   => 'type',
+        ),
+
+        'method'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '优惠券范围',
+            'default'   => '3',
+            'desc'      => '优惠券范围',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $method,
         ),
 
         'category'      => array
@@ -46,111 +98,75 @@ return array
             'list'      => 'Dever::load("category/api.string", "{category}")',
         ),
 
-        'goods_area'        => array
+        'total'      => array
         (
-            'type'      => 'int-11',
-            'name'      => '商品所在地区-先按照省份计算',
+            'type'      => 'varchar-100',
+            'name'      => '满减金额-如满100减50,这里填写100',
             'default'   => '',
-            'desc'      => '商品所在地区',
+            'desc'      => '请输入满减金额',
             'match'     => 'is_string',
-            //'search'  => 'linkage',
-            'update'    => 'linkage',
-            'option'    => Dever::url('api.get?level_total=1', 'area'),
-            'list'      => 'Dever::load("area/api.string", "{goods_area}")',
+            'update'    => 'text',
+            //'search'    => 'fulltext',
+            //'list'      => true,
+            'show'      => 'type=1',
         ),
 
-        'area'      => array
+        'cash'      => array
         (
-            'type'      => 'int-11',
-            'name'      => '送达地区',
+            'type'      => 'varchar-100',
+            'name'      => '抵扣金额',
             'default'   => '',
-            'desc'      => '送达地区',
+            'desc'      => '请输入抵扣金额',
             'match'     => 'is_string',
-            'search'    => 'linkage',
-            'update'    => 'linkage',
-            'option'    => Dever::url('api.get?level_total=1', 'area'),
-            'list'      => 'Dever::load("area/api.string", "{area}")',
-        ),
-
-        'type'      => array
-        (
-            'type'      => 'tinyint-1',
-            'name'      => '运费类型',
-            'default'   => '1',
-            'desc'      => '运费类型',
-            'match'     => 'option',
-            'update'    => 'radio',
-            'option'    => $type,
-            //'list'        => true,
-            //'search'  => 'select',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            //'list'      => true,
         ),
 
-        'pricing_type'      => array
+        'day'        => array
         (
-            'type'      => 'tinyint-1',
-            'name'      => '计价类型',
-            'default'   => '1',
-            'desc'      => '计价类型',
-            'match'     => 'option',
-            'update'    => 'radio',
-            'option'    => $pricing_type,
-            'list'      => true,
-            'search'    => 'select',
+            'type'      => 'varchar-100',
+            'name'      => '有效期范围',
+            'default'   => '',
+            'desc'      => '有效期范围',
+            'match'     => 'is_string',
+            //'update'    => 'checkbox',
+            'option'    => $time,
         ),
 
-        'first_num'     => array
+        'num'      => array
         (
             'type'      => 'int-11',
-            'name'      => '首件数量-如果计价类型是按重量,这里就是首件的重量,这里填写了2,就是满2件算首件',
-            'default'   => '',
-            'desc'      => '首件数量',
-            'match'     => 'is_numeric',
-            'update'    => 'text',
-            'list'      => true,
-        ),
-        
-        'first_price'       => array
-        (
-            'type'      => 'varchar-100',
-            'name'      => '首件价格-如果是百分比类型,这里如果填的是10,那就是总价的10%',
-            'default'   => '',
-            'desc'      => '运费价格',
+            'name'      => '默认发放数量',
+            'default'   => '10',
+            'desc'      => '默认发放数量',
             'match'     => 'is_string',
             'update'    => 'text',
-            'list'      => true,
         ),
 
-        'next_num'      => array
+        'status'        => array
         (
             'type'      => 'int-11',
-            'name'      => '续件数量-如果计价类型是按重量,这里就是续件的重量',
-            'default'   => '',
-            'desc'      => '续件数量',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '状态',
             'match'     => 'is_numeric',
-            'update'    => 'text',
-            'list'      => true,
-        ),
-        
-        'next_price'        => array
-        (
-            'type'      => 'varchar-100',
-            'name'      => '续件价格-如果是百分比类型,这里如果填的是10,那就是总价的10%',
-            'default'   => '',
-            'desc'      => '续件价格',
-            'match'     => 'is_string',
-            'update'    => 'text',
+            //'update'  => 'select',
+            'option'    => $status,
+            'search'    => 'select',
             'list'      => true,
+            'edit'      => true,
         ),
 
-        'free'      => array
+        'content'       => array
         (
-            'type'      => 'varchar-100',
-            'name'      => '总价满多少减免运费',
+            'type'      => 'text-800',
+            'name'      => '使用规则',
             'default'   => '',
-            'desc'      => '满多少减免运费',
+            'desc'      => '使用规则',
             'match'     => 'is_string',
-            //'update'  => 'text',
-            //'list'        => true,
+            'update'    => 'editor',
+            'key'       => '1',
         ),
 
         'state'     => array
@@ -166,7 +182,7 @@ return array
         (
             'type'      => 'int-11',
             'name'      => '录入时间',
-            'match'     => array('is_numeric', DEVER_TIME),
+            'match'     => array('is_numeric', time()),
             'desc'      => '',
             # 只有insert时才生效
             'insert'    => true,
@@ -176,13 +192,11 @@ return array
 
     'manage' => array
     (
-        //'delete' => false,
-        //'edit' => false,
-        //'insert' => false,
+        
     ),
 
     'request' => array
     (
         
-    )
+    ),
 );

+ 58 - 12
app/goods/database/info.php

@@ -15,6 +15,12 @@ $mode = array
     3 => '外卖+自提',
 );
 
+$yes = array
+(
+    1 => '是',
+    2 => '否',
+);
+
 $config = array
 (
     # 表名
@@ -169,6 +175,17 @@ $config = array
             'show'      => 'price_type=1',
         ),
 
+        'f_price'       => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '进价',
+            'default'   => '',
+            'desc'      => '进价',
+            'match'     => 'option',
+            'update'    => 'text',
+            'show'      => 'price_type=1',
+        ),
+
         'cover'     => array
         (
             'type'      => 'varchar-150',
@@ -183,6 +200,21 @@ $config = array
             'list'      => 'Dever::load("goods/lib/manage.info", "{id}")',
         ),
 
+        'video'     => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '视频-视频格式mp4,上传大小不能超过4G',
+            'default'   => '',
+            'desc'      => '视频',
+            'match'     => 'option',
+            'update'    => 'video',
+            'key'       => '3',
+            'place'     => '150',
+            'upload'    => 'yun',
+            'large'     => true,
+            //'cover'     => 'pic',//封面图字段名
+        ),
+
         'pic'       => array
         (
             'type'      => 'text-255',
@@ -195,6 +227,32 @@ $config = array
             'place'     => '750*422',
         ),
 
+        'top'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '是否人气推荐',
+            'default'   => '2',
+            'desc'      => '是否人气推荐',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $yes,
+            'list'      => true,
+            'edit'      => true,
+        ),
+
+        'youhui'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '是否每日优惠',
+            'default'   => '2',
+            'desc'      => '是否每日优惠',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $yes,
+            'list'      => true,
+            'edit'      => true,
+        ),
+
         'content'       => array
         (
             'type'      => 'text-800',
@@ -364,7 +422,6 @@ $config = array
                 'shop_id' => 'yes',
                 'brand_id' => 'yes',
                 'name' => array('yes', 'like'),
-                'audit' => 2,
                 'category' => array('yes', 'like'),
                 'top_category_id' => 'yes',
                 'second_category_id' => 'yes',
@@ -391,17 +448,6 @@ $config = array
                 'sell_num' => array('yes', '+='),
             ),
         ),
-
-        'getOne' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'id' => 'yes',
-            ),
-            'type' => 'one',
-            'col' => 'id,name,category,brand_id,shop_id,pic_cover,pic,sell_num+sell_add_num as sell_num,content,platform,price_type,price,s_price,num-sell_num as num,link,code,mode,goods_area,shape,reward_value,reward_type',
-        ),
     ),
 );
 

+ 19 - 8
app/goods/database/info_sku.php

@@ -56,22 +56,33 @@ $config = array
 
         'price'     => array
         (
-            'type'      => 'decimal-10,2',
-            'name'      => '售价',
+            'type'      => 'varchar-100',//decimal-10,2
+            'name'      => '售价',
             'default'   => '',
-            'desc'      => '售价',
-            'match'     => 'is_numeric',
+            'desc'      => '售价',
+            'match'     => 'option',
             'update'    => 'text',
             'list'      => true,
         ),
 
         's_price'       => array
         (
-            'type'      => 'decimal-10,2',
-            'name'      => '价',
+            'type'      => 'varchar-100',
+            'name'      => '市场价',
             'default'   => '',
-            'desc'      => '原价',
-            'match'     => 'is_numeric',
+            'desc'      => '市场价',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'      => true,
+        ),
+
+        'f_price'       => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '进价',
+            'default'   => '',
+            'desc'      => '进价',
+            'match'     => 'option',
             'update'    => 'text',
             'list'      => true,
         ),

+ 7 - 4
app/goods/lib/Info.php

@@ -122,7 +122,7 @@ class Info
         $page['num'] = 10;
         $where_sql = implode(' and ', $where_sql);
 
-        $sql = 'SELECT t_2.* FROM `info_goods_'.$attr->config['name'].'` as t_1 Left Join `info_goods_info` AS t_2 ON t_1.`info_id`=t_2.`id` WHERE '.$where_sql.' order by t_2.`reorder` desc,t_2.`id` desc';
+        $sql = 'SELECT t_2.* FROM `{project}_goods_'.$attr->config['name'].'` as t_1 Left Join `{project}_goods_info` AS t_2 ON t_1.`info_id`=t_2.`id` WHERE '.$where_sql.' order by t_2.`reorder` desc,t_2.`id` desc';
 
         $data = $attr->fetchAll($sql, array(), $page);
 
@@ -245,8 +245,6 @@ class Info
         $info = Dever::db($this->table_info)->getOne($id);
 
         if ($info) {
-            $info['freight_id'] = 0;
-            $info['freight_price'] = 0;
             if ($sku > 0) {
                 $where['info_id'] = $info['id'];
                 $where['id'] = $sku;
@@ -256,14 +254,19 @@ class Info
                     $info['num'] = $sku['num'];
                 }
             }
+
+            /*
+            $info['freight_id'] = 0;
+            $info['freight_price'] = 0;
             $freight = $this->freight($info, $info['price'], $user, $num);
             if ($freight) {
                 $info['freight_id'] = $freight['id'];
                 $info['freight_price'] = $freight['price'];
             }
+            */
 
             # 佣金计算
-            $info['reward'] = $this->reward($info, $info['price']*$num);
+            //$info['reward'] = $this->reward($info, $info['price']*$num);
         }
 
         return $info;

+ 77 - 2
app/goods/lib/Manage.php

@@ -77,12 +77,10 @@ class Manage
                 $top_category_id = $category;
                 $second_category_id = $category;
             }
-            
 
             $update['top_category_id'] = $top_category_id;
             $update['second_category_id'] = $second_category_id;
             $update['category_id'] = $category_id;
-            
         }
 
         $pic = Dever::param('pic', $data);
@@ -297,5 +295,82 @@ class Manage
         return $html;
     }
 
+    /**
+     * 显示用户信息
+     *
+     * @return mixed
+     */
+    public function showUserInfo($id)
+    {
+        $info = Dever::db('goods/card_code')->find($id);
+        $table = array();
+        if ($info && $info['status'] > 1 && $info['uid'] && $info['uid'] > 0) {
+            $user = Dever::load('passport/user-one', $info['uid']);
+            $shop = Dever::load('shop/info-one', $info['shop_id']);
+            if ($user) {
+                $table['领取门店'] = $shop['name'] . '('.$shop['mobile'].')';
+                $table['领取人'] = $user['username'] . '('.$info['uid'].')';
+                $table['手机号'] = $user['mobile'];
+                $table['兑换时间'] = date('Y-m-d H:i:s', $info['ddate']);
+            }
+        }
+
+        return Dever::table($table);
+    }
+
+    /**
+     * 创建兑换码
+     *
+     * @return mixed
+     */
+    public function createCard($id, $name, $param)
+    {
+        $num = Dever::param('num', $param);
+        $card_id = Dever::param('card_id', $param);
 
+        if ($num > 0) {
+            for ($i = 0; $i< $num;$i++) {
+                $this->createCode($card_id);
+            }
+        }
+    }
+
+    private function createCode($card_id)
+    {
+        # 生成卡号和密码
+        $card = Dever::rand(16);
+        $pwd = Dever::rand(8);
+
+        $where['card'] = $card;
+        $where['pwd'] = $pwd;
+        $info = Dever::db('goods/card_code')->find($where);
+
+        if (!$info) {
+            $where['card_id'] = $card_id;
+            Dever::db('goods/card_code')->insert($where);
+        } else {
+            $this->createCode($card_id);
+        }
+    }
+
+    /**
+     * 作废
+     *
+     * @return mixed
+     */
+    public function drop_api($id)
+    {
+        $update['where_id'] = $id;
+        $update['type'] = 4;
+        Dever::db('goods/card_code')->update($update);
+        return 'ok';
+    }
+
+    public function recovery_api($id)
+    {
+        $update['where_id'] = $id;
+        $update['type'] = 1;
+        Dever::db('goods/card_code')->update($update);
+        return 'ok';
+    }
 }

+ 0 - 8
app/member/index.php

@@ -1,8 +0,0 @@
-<?php
-
-define('DEVER_APP_NAME', 'member');
-define('DEVER_APP_LANG', '客户管理');
-define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
-define('DEVER_MANAGE_ORDER', 90);
-define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-username');
-include(DEVER_APP_PATH . '../boot.php');

+ 128 - 0
app/shop/database/apply.php

@@ -0,0 +1,128 @@
+<?php
+# 获取分类权限
+$status = array
+(
+    1 => '申请合作中',
+    2 => '已开通门店',
+);
+
+return array
+(
+    # 表名
+    'name' => 'apply',
+    # 显示给用户看的名称
+    'lang' => '申请合作记录',
+    # 后台菜单排序
+    'order' => 200,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '用户名',
+            'default'   => '0',
+            'desc'      => '请选择用户',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            //'search'  => 'select',
+            'search'    => array
+            (
+                'api' => 'passport/user-select',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'list'      => '{uid} > 0 ? Dever::load("passport/user-find#username", {uid}) : "匿名用户"',
+        ),
+        
+        'name'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '申请人姓名',
+            'default'   => '',
+            'desc'      => '申请人姓名',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'mobile'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '申请人电话',
+            'default'   => '',
+            'desc'      => '申请人电话',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'city'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '城市',
+            'default'   => '',
+            'desc'      => '城市',
+            'match'     => 'option',
+            //'update'  => 'text',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '申请状态',
+            'default'   => '1',
+            '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',
+        ),
+        
+        '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
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 398 - 0
app/shop/database/buy_order.php

@@ -0,0 +1,398 @@
+<?php
+
+$pay_status = Dever::config('base', 'pay')->pay['status'];
+
+$status = array
+(
+    1 => '待支付',
+    2 => '待审核',
+    3 => '待发货',
+    4 => '待收货确认',
+    5 => '已完成',
+    6 => '已完成(有退款)',
+    7 => '已取消',
+);
+
+return array
+(
+    # 表名
+    'name' => 'buy_order',
+    # 显示给用户看的名称
+    'lang' => '采购订单',
+    'order' => 99,
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'      => true,
+        ), 
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+        ),
+
+        'mobile'        => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '下单手机号',
+            'default'   => '',
+            'desc'      => '手机号',
+            'match'     => 'option',
+            'search'    => array
+            (
+                'api' => 'passport/user-select',//接口地址,最好是获取多条数据的地址
+                'col' => 'mobile',//要查询的字段
+                'result' => 'id',//返回的字段
+                'search' => 'uid',//本表的字段,默认为当前的字段
+            ),
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '订单名称',
+            'default'   => '',
+            'desc'      => '订单名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+        'order_num'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '订单编号',
+            'default'   => '',
+            'desc'      => '订单编号',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '购买价格',
+            'default'   => '',
+            'desc'      => '购买价格',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'        => true,
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买数量',
+            'default'   => '',
+            'desc'      => '购买数量',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'list'        => true,
+        ),
+
+        'pay_id'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '支付订单ID',
+            'default'   => '',
+            'desc'      => '付款订单id',
+            'match'     => 'is_string',
+            //'update'    => 'text',
+            //'search'    => 'fulltext',
+            //'list'        => true,
+        ),
+
+        'pay_status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '支付状态',
+            'default'   => '1',
+            'desc'      => '请选择支付状态',
+            'match'     => 'is_numeric',
+            'option'    => $pay_status,
+        ),
+
+        'pay_price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '付款金额',
+            'default'   => '',
+            'desc'      => '付款金额',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'info'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '订单备注',
+            'default'   => '',
+            'desc'      => '订单备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'note'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否发送状态提醒-1未发送,2已发送',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+
+        'notice'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '模板消息提醒次数',
+            'default'   => '0',
+            'desc'      => '模板消息提醒次数',
+            'match'     => 'is_numeric',
+        ),
+
+        'tk_pic'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '退款截图',
+            'default'   => '',
+            'desc'      => '退款截图',
+            'match'     => 'is_string',
+            'update'    => 'image',
+            'key'       => 1
+        ),
+
+        'tk_time'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '退款时间',
+            'default'   => '',
+            'desc'      => '退款时间',
+            'match'     => 'option',
+            //'list'        => true,
+            //'update'    => 'date',
+            'callback'  => 'maketime',
+            'show'      => 'status=5',
+        ),
+
+        'tk_admin'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '退款审核人',
+            'default'   => '1',
+            'desc'      => '退款审核人',
+            'match'     => 'option',
+            //'list'        => true,
+            'show'      => 'status=5',
+        ),
+
+        'tk_desc'       => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '退款备注',
+            'default'   => '',
+            'desc'      => '退款备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+            //'show'        => 'status=5',
+        ),
+
+        '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,
+            'search'    => 'date',
+            'list'        => 'date("Y-m-d H:i:s", {cdate})',
+            //'list'      => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
+        ),
+    ),
+
+    'top' => Dever::config('base')->top,
+
+    # 增加这个,为了给当前的list增加一个option
+    'top_option' => array
+    (
+        'value' => $auth,
+        'col' => 'cate_id',
+    ),
+
+    'manage' => array
+    (
+        'delete' => false,
+        'edit' => false,
+        'insert' => false,
+
+        'button' => array
+        (
+            //'导出订单' => array('location', 'user/lib/manage.out'),
+        ),
+
+        'list_button' => array(
+            'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2'),
+            //'delete' => array('删除', '', '{status} == 1'),
+        ),
+    ),
+
+    'request' => array
+    (
+        'getList' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'uid' => 'yes',
+                'status' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'page' => array(5, 'list'),
+            'col' => '*',
+        ),
+
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'uid' => 'yes',
+                'status' => array('1', '!='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => '*',
+        ),
+
+        'getYes' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        # 获取提交订单超过12个小时
+        'getDataByTime' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'cdate' => array('yes', '>='),
+                'notice' => 'yes',
+                'note' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        # 获取1,2
+        'getBuy' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'status' => 'yes',
+                'info_id' => 'yes',
+                'order_id' => 'yes',
+                'uid' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*',
+        ),
+
+        'getMyAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'uid' => 'yes',
+                'status' => 'yes',
+                'cate_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => 'id,order_id,name,buy_num,cdate,cash,info_id,buy_id',
+        ),
+
+        # 删除未支付订单
+        'drop' => array
+        (
+            # 匹配的正则或函数 选填项
+            'where' => array
+            (
+                'time' => array('yes-cdate', '<='),
+                'status' => 1,
+                'state' => 1,
+            ),
+            'type' => 'delete',
+            'col' => 'id,order_id',
+        ),
+
+        # 获取数据
+        'getAllByDate' => array
+        (
+            # 匹配的正则或函数 选填项
+            'where' => array
+            (
+                'time' => array('yes-cdate', '<='),
+            ),
+            'type' => 'all',
+            'col' => 'id,order_id',
+        ),
+
+        'getNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'object_id' => 'yes',
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(buy_num) as buy_num',
+        ),
+    ),
+);

+ 147 - 0
app/shop/database/buy_order_goods.php

@@ -0,0 +1,147 @@
+<?php
+
+$status = array
+(
+    1 => '正常',
+    2 => '缺货',
+    3 => '退款',
+);
+
+return array
+(
+    # 表名
+    'name' => 'buy_order_goods',
+    # 显示给用户看的名称
+    'lang' => '订单商品表',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '用户名',
+            'default'   => '0',
+            'desc'      => '请选择用户',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            //'search'  => 'select',
+            'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'list'      => '{uid} > 0 ? Dever::load("passport/user-find#username", {uid}) : "匿名用户"',
+        ),
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+        ),
+
+        'order_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '订单表id',
+            'default'   => '',
+            'desc'      => '订单表id',
+            'match'     => 'is_numeric',
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品名称',
+            'default'   => '',
+            'desc'      => '商品名称',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})';
+        ),
+
+        'price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '价格',
+            'default'   => '',
+            'desc'      => '价格',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'        => true,
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买数量',
+            'default'   => '',
+            'desc'      => '购买数量',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'list'        => true,
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '状态',
+            'default'   => '1',
+            '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',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            //'insert'    => true,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 135 - 0
app/shop/database/cart.php

@@ -0,0 +1,135 @@
+<?php
+
+$status = array
+(
+    1 => '默认选中',
+    2 => '未选中',
+);
+
+return array
+(
+    # 表名
+    'name' => 'cart',
+    # 显示给用户看的名称
+    'lang' => '购物车',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '用户名',
+            'default'   => '0',
+            'desc'      => '请选择用户',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            //'search'  => 'select',
+            'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'list'      => '{uid} > 0 ? Dever::load("passport/user-find#username", {uid}) : "匿名用户"',
+        ),
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品名称',
+            'default'   => '',
+            'desc'      => '商品名称',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})';
+        ),
+
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'sku',
+            'default'   => '',
+            'desc'      => 'sku',
+            'match'     => 'is_numeric',
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买数量',
+            'default'   => '',
+            'desc'      => '购买数量',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'list'        => true,
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '状态',
+            'default'   => '1',
+            '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',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            //'insert'    => true,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 113 - 0
app/shop/database/coupon.php

@@ -0,0 +1,113 @@
+<?php
+
+$coupon = function()
+{
+    $array = array();
+    $info = Dever::db('goods/coupon')->select();
+    
+    if($info)
+    {
+        $array += $info;
+    }
+    return $array;
+};
+
+return array
+(
+    # 表名
+    'name' => 'coupon',
+    # 显示给用户看的名称
+    'lang' => '优惠券设置',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_shop_id'),
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+        ),
+
+        'coupon_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '优惠券',
+            'default'   => '',
+            'desc'      => '优惠券',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $coupon,
+            'list'      => 'Dever::load("goods/coupon-find#name", {coupon_id})';
+        ),
+
+        'day'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '有效期-请填写天数',
+            'default'   => '1',
+            'desc'      => '有效期',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'num'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '发放数量',
+            'default'   => '10',
+            'desc'      => '发放数量',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+        '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,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 137 - 0
app/shop/database/focus.php

@@ -0,0 +1,137 @@
+<?php
+
+$location = array
+(
+    1 => '首页',
+    2 => '商品列表',
+);
+
+$type = array
+(
+    1 => '链接',
+    2 => '分享活动',
+    3 => '推广员活动',
+);
+
+return array
+(
+    # 表名
+    'name' => 'focus',
+    # 显示给用户看的名称
+    'lang' => '焦点图管理',
+    # 后台菜单排序
+    'order' => 9,
+    # 数据结构
+    '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,
+        ),
+
+        'type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '类型',
+            'default'   => '1',
+            'desc'      => '请选择类型',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $type,
+            'control'   => 'type',
+        ),
+
+        'link'      => array
+        (
+            'type'      => 'varchar-400',
+            'name'      => '链接',
+            'default'   => '',
+            'desc'      => '请输入链接',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'search'    => 'fulltext',
+            'show'      => 'type=1',
+        ),
+
+        'location'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '显示位置',
+            'default'   => '1',
+            'desc'      => '请选择显示位置',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $location,
+        ),
+
+        'pic'       => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '图片',
+            'default'   => '',
+            'desc'      => '请选择图片',
+            'match'     => 'is_string',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150',
+        ),
+        
+        '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})',
+        ),
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 117 - 0
app/shop/database/goods.php

@@ -0,0 +1,117 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'goods',
+    # 显示给用户看的名称
+    'lang' => '商品列表',
+    'order' => 10,
+    'menu'  => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品名称',
+            'default'   => '',
+            'desc'      => '商品名称',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})';
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '库存数量',
+            'default'   => '',
+            'desc'      => '库存数量',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'list'        => 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,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'top' => array('yes-t_2.top'),
+                'youhui' => array('yes-t_2.youhui'),
+                'category' => array('yes-t_2.category', 'like'),
+                'top_category_id' => array('yes-t_2.top_category_id'),
+                'second_category_id' => array('yes-t_2.second_category_id'),
+                'category_id' => array('yes-t_2.category_id'),
+                'status' => array('yes-t_2.status', 1),
+                'state' => array('yes-t_2.state', 1),
+            ),
+            # 联表
+            'join' => array
+            (
+                array
+                (
+                    'table' => 'goods/info',
+                    'type' => 'left join',
+                    'on' => array('goods_id','id'),
+                    'col' => 'goods_id',
+                ),
+            ),
+            'type' => 'all',
+            'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 408 - 0
app/shop/database/info.php

@@ -0,0 +1,408 @@
+<?php
+# 获取分类权限
+$status = array
+(
+    1 => '合作中',
+    2 => '已终止合作',
+);
+
+$yes = array
+(
+    1 => '是',
+    2 => '否',
+);
+
+$open = array
+(
+    1 => '开启',
+    2 => '关闭',
+);
+
+$method = array
+(
+    1 => '自提',
+    2 => '配送',
+    3 => '自提+配送',
+);
+
+return array
+(
+    # 表名
+    'name' => 'info',
+    # 显示给用户看的名称
+    'lang' => '门店列表',
+    # 后台菜单排序
+    'order' => 99,
+
+    'end' => array
+    (
+        'insert' => 'shop/lib/manage.infoUpdate',
+        'update' => 'shop/lib/manage.infoUpdate',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+        ),
+
+        'hr1'       => array
+        (
+            'name'      => '门店基本信息',
+            'class'     => '',//本项必须填写
+            'attr'      => '',
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '用户名',
+            'default'   => '0',
+            'desc'      => '请选择用户',
+            'match'     => 'is_numeric',
+            //'update'    => 'text',
+            //'search'  => 'select',
+            'searchs'    => array
+            (
+                'api' => 'passport/user-select',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            //'list'      => '{uid} > 0 ? Dever::load("passport/user-find#username", {uid}) : "匿名用户"',
+        ),
+        
+        'name'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '门店名称',
+            'default'   => '',
+            'desc'      => '请输入门店名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'truename'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '联系人姓名',
+            'default'   => '',
+            'desc'      => '请输入联系人姓名',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'mobile'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '联系人电话',
+            'default'   => '',
+            'desc'      => '请输入联系人电话',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'area'       => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '所在城市',
+            'default'   => '',
+            'desc'      => '所在城市',
+            'match'     => 'option',
+            'search'    => 'linkage',
+            'update'    => 'linkage',
+            'option'    => Dever::url('api.get?level_total=2', 'area'),
+            'list'      => 'Dever::load("area/api.string", "{area}")',
+        ),
+
+        'province'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '省份',
+            'default'   => '',
+            'desc'      => '省份',
+            'match'     => 'option',
+            //'update'  => 'text',
+        ),
+
+        'city'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '城市',
+            'default'   => '',
+            'desc'      => '城市',
+            'match'     => 'option',
+            //'update'  => 'text',
+        ),
+
+        'map'       => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '地理位置',
+            'default'   => '',
+            'desc'      => '地理位置',
+            'match'     => 'is_string',
+            # 如果是map,必须在config的base.php中设置map信息
+            'update'  => 'map',
+        ),
+
+        'lng'       => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '经度',
+            'default'   => '',
+            'desc'      => '经度',
+            'match'     => 'option',
+            //'update'    => 'text',
+            //'list'        => true,
+        ),
+
+        'lat'       => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '纬度',
+            'default'   => '',
+            'desc'      => '纬度',
+            'match'     => 'option',
+            //'update'    => 'text',
+            //'list'        => true,
+        ),
+
+        'address'       => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '门店地址',
+            'default'   => '',
+            'desc'      => '门店地址',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'        => true,
+        ),
+
+        'hr2'       => array
+        (
+            'name'      => '门店营业设置',
+            'class'     => '',//本项必须填写
+            'attr'      => '',
+        ),
+
+        'open'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '营业状态',
+            'default'   => '1',
+            'desc'      => '营业状态',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $open,
+            'search'    => 'select',
+            'list'      => true,
+        ),
+
+        'method'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '门店能力',
+            'default'   => '3',
+            'desc'      => '门店能力',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $method,
+            'control'   => 'method',
+        ),
+
+        'worktime'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '营业时间-如10:00~22:00,24小时制',
+            'default'   => '',
+            'desc'      => '营业时间',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'show'      => 'method=1,3',
+        ),
+
+        'gotime'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '外送时间',
+            'default'   => '',
+            'desc'      => '外送时间',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'show'      => 'method=2,3',
+        ),
+
+        'hr3'       => array
+        (
+            'name'      => '门店认证信息',
+            'class'     => '',//本项必须填写
+            'attr'      => '',
+        ),
+
+        'license'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '营业执照',
+            'default'   => '',
+            'desc'      => '营业执照',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '660*660',
+        ),
+
+        'company_name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '公司名称',
+            'default'   => '',
+            'desc'      => '公司名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+        'idcard_front'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '身份证正面',
+            'default'   => '',
+            'desc'      => '身份证正面',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '660*660',
+        ),
+
+        'idcard_back'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '身份证背面',
+            'default'   => '',
+            'desc'      => '身份证背面',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '660*660',
+        ),
+
+        'food_license'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '食品许可证',
+            'default'   => '',
+            'desc'      => '食品许可证',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '660*660',
+        ),
+
+        'hr4'       => array
+        (
+            'name'      => '优惠券设置',
+            'class'     => '',//本项必须填写
+            'attr'      => '',
+        ),
+
+        'coupon_city'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否参数同城活动',
+            'default'   => '1',
+            'desc'      => '是否参数同城活动',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $yes,
+            'search'    => 'select',
+        ),
+
+        'coupon_share'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否参与分享活动',
+            'default'   => '1',
+            'desc'      => '是否参与分享活动',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $yes,
+            'search'    => 'select',
+        ),
+
+        'coupon_tg'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否参与推广员活动',
+            'default'   => '1',
+            'desc'      => '是否参与推广员活动',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $yes,
+            'search'    => 'select',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '合作状态',
+            'default'   => '1',
+            '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',
+        ),
+        
+        '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
+    (
+        'list_button' => array
+        (
+            'list' => array('优惠券管理', '"coupon&search_option_shop_id={id}&oper_table=info"'),
+            'list1' => array('账号管理', '"member&search_option_shop_id={id}&oper_table=info"'),
+            'list2' => array('打印机管理', '"print&search_option_shop_id={id}&oper_table=info"'),
+            'list3' => array('销售订单', '"sell_order&search_option_shop_id={id}&oper_table=info"'),
+            'list4' => array('采购订单', '"buy_order&search_option_shop_id={id}&oper_table=info"'),
+        ),
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 106 - 0
app/shop/database/member.php

@@ -0,0 +1,106 @@
+<?php
+
+$role = array
+(
+    1 => '管理员',
+    2 => '销售收款',
+    3 => '库存盘点',
+    4 => '商品采购',
+    5 => '财务对账',
+);
+
+return array
+(
+    # 表名
+    'name' => 'member',
+    # 显示给用户看的名称
+    'lang' => '账号管理',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '用户名',
+            'default'   => '0',
+            'desc'      => '请选择用户',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            //'search'  => 'select',
+            'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'list'      => '{uid} > 0 ? Dever::load("passport/user-find#username", {uid}) : "匿名用户"',
+        ),
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+        ),
+
+        'role_id'      => array
+        (
+            'type'      => 'varchar-60',
+            'name'      => '角色',
+            'default'   => '1',
+            'desc'      => '角色',
+            'match'     => 'is_numeric',
+            'update'    => 'checkbox',
+            'option'    => $role,
+            'list'      => 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,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 102 - 108
main/database/cate.php → app/shop/database/print.php

@@ -1,108 +1,102 @@
-<?php
-# 获取分类权限
-$status = Dever::config('base')->status;
-
-return array
-(
-    # 表名
-    'name' => 'cate',
-    # 显示给用户看的名称
-    'lang' => '按钮分类',
-    # 后台菜单排序
-    'order' => 99,
-    # 数据结构
-    '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,
-        ),
-
-        'status'        => array
-        (
-            'type'      => 'int-11',
-            'name'      => '上线状态',
-            'default'   => '1',
-            'desc'      => '上线状态',
-            'match'     => 'is_numeric',
-            //'update'  => 'select',
-            'option'    => $status,
-            'search'    => 'select',
-            'list'      => true,
-            'edit'      => 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,state,cdate',
-        'value' => array
-        (
-            '"工具箱",1,1,' . time(),
-        ),
-    ),
-
-    'manage' => array
-    (
-        
-    ),
-
-    'request' => array
-    (
-        
-    ),
-);
+<?php
+# 获取分类权限
+$status = array
+(
+    1 => '使用中',
+    2 => '停止使用',
+    3 => '申请合作',
+);
+
+return array
+(
+    # 表名
+    'name' => 'print',
+    # 显示给用户看的名称
+    'lang' => '打印设备',
+    # 后台菜单排序
+    'order' => 10,
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+        ),
+        
+        'name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '设备名称',
+            'default'   => '',
+            'desc'      => '请输入设备名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'number'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '打印机编号',
+            'default'   => '',
+            'desc'      => '打印机编号',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '打印机状态',
+            'default'   => '1',
+            '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',
+        ),
+        
+        '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
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 447 - 0
app/shop/database/sell_order.php

@@ -0,0 +1,447 @@
+<?php
+
+$pay_status = Dever::config('base', 'pay')->pay['status'];
+
+$method = array
+(
+    1 => '配送',
+    2 => '自提',
+);
+
+$pay_method = array
+(
+    1 => '平台结算',
+    2 => '门店现付',
+    3 => '礼品卡',
+);
+
+$status = array
+(
+    1 => '待支付',
+    2 => '待处理',
+    3 => '配送中',
+    4 => '已完成',
+    5 => '已取消',
+    6 => '退款',
+);
+
+return array
+(
+    # 表名
+    'name' => 'sell_order',
+    # 显示给用户看的名称
+    'lang' => '销售订单',
+    'order' => 100,
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'      => true,
+        ), 
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买人',
+            'default'   => '0',
+            'desc'      => '请选择用户',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            //'search'  => 'select',
+            'search'    => array
+            (
+                'api' => 'passport/user-select',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'list'      => '{uid} > 0 ? Dever::load("passport/user-find#username", {uid}) : "匿名用户"',
+        ),
+
+        'mobile'        => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '下单手机号',
+            'default'   => '',
+            'desc'      => '手机号',
+            'match'     => 'option',
+            'search'    => array
+            (
+                'api' => 'passport/user-select',//接口地址,最好是获取多条数据的地址
+                'col' => 'mobile',//要查询的字段
+                'result' => 'id',//返回的字段
+                'search' => 'uid',//本表的字段,默认为当前的字段
+            ),
+        ),
+
+        'address_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '送货地址',
+            'default'   => '',
+            'desc'      => '送货地址',
+            'match'     => 'is_numeric',
+            //'list'      => 'Dever::load("passport/address-find#address", {address_id})';
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '订单名称',
+            'default'   => '',
+            'desc'      => '订单名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+        'order_num'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '订单编号',
+            'default'   => '',
+            'desc'      => '订单编号',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '购买价格',
+            'default'   => '',
+            'desc'      => '购买价格',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'        => true,
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买数量',
+            'default'   => '',
+            'desc'      => '购买数量',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'list'        => true,
+        ),
+
+        'card_code_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '礼品卡id',
+            'default'   => '',
+            'desc'      => '礼品卡id',
+            'match'     => 'option',
+        ),
+
+        'pay_id'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '支付订单ID',
+            'default'   => '',
+            'desc'      => '付款订单id',
+            'match'     => 'is_string',
+            //'update'    => 'text',
+            //'search'    => 'fulltext',
+            //'list'        => true,
+        ),
+
+        'pay_status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '支付状态',
+            'default'   => '1',
+            'desc'      => '请选择支付状态',
+            'match'     => 'is_numeric',
+            'option'    => $pay_status,
+        ),
+
+        'pay_price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '付款金额',
+            'default'   => '',
+            'desc'      => '付款金额',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'info'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '订单备注',
+            'default'   => '',
+            'desc'      => '订单备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'note'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否发送状态提醒-1未发送,2已发送',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+
+        'notice'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '模板消息提醒次数',
+            'default'   => '0',
+            'desc'      => '模板消息提醒次数',
+            'match'     => 'is_numeric',
+        ),
+
+        'tk_pic'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '退款截图',
+            'default'   => '',
+            'desc'      => '退款截图',
+            'match'     => 'is_string',
+            'update'    => 'image',
+            'key'       => 1
+        ),
+
+        'tk_time'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '退款时间',
+            'default'   => '',
+            'desc'      => '退款时间',
+            'match'     => 'option',
+            //'list'        => true,
+            //'update'    => 'date',
+            'callback'  => 'maketime',
+            'show'      => 'status=5',
+        ),
+
+        'tk_admin'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '退款审核人',
+            'default'   => '1',
+            'desc'      => '退款审核人',
+            'match'     => 'option',
+            //'list'        => true,
+            'show'      => 'status=5',
+        ),
+
+        'tk_desc'       => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '退款备注',
+            'default'   => '',
+            'desc'      => '退款备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+            //'show'        => 'status=5',
+        ),
+
+        '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,
+            'search'    => 'date',
+            'list'        => 'date("Y-m-d H:i:s", {cdate})',
+            //'list'      => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
+        ),
+    ),
+
+    'top' => Dever::config('base')->top,
+
+    # 增加这个,为了给当前的list增加一个option
+    'top_option' => array
+    (
+        'value' => $auth,
+        'col' => 'cate_id',
+    ),
+
+    'manage' => array
+    (
+        'delete' => false,
+        'edit' => false,
+        'insert' => false,
+
+        'button' => array
+        (
+            //'导出订单' => array('location', 'user/lib/manage.out'),
+        ),
+
+        'list_button' => array(
+            'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2'),
+            //'delete' => array('删除', '', '{status} == 1'),
+        ),
+    ),
+
+    'request' => array
+    (
+        'getList' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'uid' => 'yes',
+                'status' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'page' => array(5, 'list'),
+            'col' => '*',
+        ),
+
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'uid' => 'yes',
+                'status' => array('1', '!='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => '*',
+        ),
+
+        'getYes' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        # 获取提交订单超过12个小时
+        'getDataByTime' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'cdate' => array('yes', '>='),
+                'notice' => 'yes',
+                'note' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        # 获取1,2
+        'getBuy' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'status' => 'yes',
+                'info_id' => 'yes',
+                'order_id' => 'yes',
+                'uid' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*',
+        ),
+
+        'getMyAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'uid' => 'yes',
+                'status' => 'yes',
+                'cate_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => 'id,order_id,name,buy_num,cdate,cash,info_id,buy_id',
+        ),
+
+        # 删除未支付订单
+        'drop' => array
+        (
+            # 匹配的正则或函数 选填项
+            'where' => array
+            (
+                'time' => array('yes-cdate', '<='),
+                'status' => 1,
+                'state' => 1,
+            ),
+            'type' => 'delete',
+            'col' => 'id,order_id',
+        ),
+
+        # 获取数据
+        'getAllByDate' => array
+        (
+            # 匹配的正则或函数 选填项
+            'where' => array
+            (
+                'time' => array('yes-cdate', '<='),
+            ),
+            'type' => 'all',
+            'col' => 'id,order_id',
+        ),
+
+        'getNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'object_id' => 'yes',
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(buy_num) as buy_num',
+        ),
+    ),
+);

+ 147 - 0
app/shop/database/sell_order_goods.php

@@ -0,0 +1,147 @@
+<?php
+
+$status = array
+(
+    1 => '正常',
+    2 => '缺货',
+    3 => '退款',
+);
+
+return array
+(
+    # 表名
+    'name' => 'sell_order_goods',
+    # 显示给用户看的名称
+    'lang' => '订单商品表',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '用户名',
+            'default'   => '0',
+            'desc'      => '请选择用户',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            //'search'  => 'select',
+            'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'list'      => '{uid} > 0 ? Dever::load("passport/user-find#username", {uid}) : "匿名用户"',
+        ),
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+        ),
+
+        'order_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '订单表id',
+            'default'   => '',
+            'desc'      => '订单表id',
+            'match'     => 'is_numeric',
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品名称',
+            'default'   => '',
+            'desc'      => '商品名称',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})';
+        ),
+
+        'price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '价格',
+            'default'   => '',
+            'desc'      => '价格',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'        => true,
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买数量',
+            'default'   => '',
+            'desc'      => '购买数量',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'list'        => true,
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '状态',
+            'default'   => '1',
+            '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',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            //'insert'    => true,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 104 - 0
app/shop/database/user_coupon.php

@@ -0,0 +1,104 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'user_coupon',
+    # 显示给用户看的名称
+    'lang' => '用户优惠券',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '用户名',
+            'default'   => '0',
+            'desc'      => '请选择用户',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            //'search'  => 'select',
+            'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'list'      => '{uid} > 0 ? Dever::load("passport/user-find#username", {uid}) : "匿名用户"',
+        ),
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+        ),
+
+        'coupon_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '优惠券id',
+            'default'   => '',
+            'desc'      => '优惠券id',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("goods/coupon-find#name", {coupon_id})';
+        ),
+
+        'shop_coupon_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '优惠券id',
+            'default'   => '',
+            'desc'      => '优惠券id',
+            'match'     => 'is_numeric',
+        ),
+
+        '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,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 29 - 0
app/shop/lib/Manage.php

@@ -0,0 +1,29 @@
+<?php
+
+namespace Shop\Lib;
+
+use Dever;
+
+class Manage
+{
+    /**
+     * 更新信息
+     *
+     * @return mixed
+     */
+    public function infoUpdate($id, $name, $data)
+    {
+        $update = array();
+        $area = Dever::param('area', $data);
+        if ($area) {
+            $temp = explode(',', $area);
+            $update['province'] = $temp[0];
+            $update['city'] = $temp[1];
+        }
+
+        if (isset($update) && $update) {
+            $update['where_id'] = $id;
+            Dever::db('shop/info')->update($update);
+        }
+    }
+}

+ 110 - 0
app/shop/src/Buy.php

@@ -0,0 +1,110 @@
+<?php
+
+namespace Shop\Src;
+
+use Dever;
+use Main\Lib\Core;
+
+class Buy extends Core
+{
+    public function __construct()
+    {
+        parent::__construct();
+        $this->checkLogin();
+        $this->shop_id = Dever::input('shop_id');
+
+        if (!$this->shop_id) {
+            Dever::alert('请选择门店');
+        }
+    }
+
+    # 获取购物车的数据
+    public function getCart()
+    {
+        $where['uid'] = $this->uid;
+        $where['shop_id'] = $this->shop_id;
+
+        $data = Dever::db('shop/cart')->select($where);
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k]['goods'] = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']);
+            }
+        }
+
+        return $data;
+    }
+
+    # 加入到购物车
+    public function addCart()
+    {
+        $where['uid'] = $this->uid;
+        $where['shop_id'] = $this->shop_id;
+        $where['goods_id'] = Dever::input('goods_id');
+        if (!$where['goods_id']) {
+            Dever::alert('错误的商品');
+        }
+
+        $info = Dever::db('shop/cart')->find($where);
+
+        $where['sku_id'] = Dever::input('sku_id');
+        $where['num'] = Dever::input('num');
+        if (!$info) {
+            $state = Dever::db('shop/cart')->insert($where);
+        } else {
+            $where['num'] += $info['num'];
+            $where['where_id'] = $info['id'];
+            $state = Dever::db('shop/cart')->update($where);
+        }
+
+        return $this->alert($state);
+    }
+
+    # 清空购物车
+    public function dropCart()
+    {
+        $where['uid'] = $this->uid;
+        $where['shop_id'] = $this->shop_id;
+
+        $state = Dever::db('shop/cart')->delete($where);
+
+        return $this->alert($state);
+    }
+
+    # 确认订单页面
+    public function confirm()
+    {
+        $goods_id = Dever::input('goods_id');
+        $goods_id = explode(',', $goods_id);
+
+        $sku_id = Dever::input('sku_id');
+        $sku_id = explode(',', $sku_id);
+
+        $num = Dever::input('num');
+        $num = explode(',', $num);
+
+        $this->data['list']['price'] = 0;
+        # 计算总价格
+        foreach ($goods_id as $k => $v) {
+
+            $s = isset($sku_id[$k]) ? $sku_id[$k] : 0;
+            $n = isset($num[$k]) ? $num[$k] : 1;
+            $this->data['list'][$k]['goods'] = Dever::load('goods/lib/info')->getPayInfo($v, $s, $n);
+
+            $this->data['list']['price'] += $this->data['list'][$k]['goods']['price'] * $this->data['list'][$k]['goods']['num'];
+        }
+
+        # 查找符合要求的优惠券
+        $coupon = Dever::db('shop/user_coupon')->select(array('uid' => $this->uid));
+
+        
+
+        return $this->data;
+    }
+
+    # 获取当前可用优惠券
+    public function coupon()
+    {
+
+    }
+}

+ 149 - 0
app/shop/src/Main.php

@@ -0,0 +1,149 @@
+<?php
+
+namespace Shop\Src;
+
+use Dever;
+use Main\Lib\Core;
+
+class Main extends Core
+{
+    public function __construct()
+    {
+        parent::__construct();
+        //$this->checkLogin();
+    }
+    
+    # 获取门店销售小程序首页的数据
+    public function home()
+    {
+        $where['city'] = Dever::input('city');
+
+        $this->data['focus'] = Dever::db('shop/focus')->select(array('location' => 1));
+
+        if ($where['city']) {
+            # 获取当前城市是否开通门店
+            $where['status'] = 1;
+            $this->data['shop'] = Dever::db('shop/info')->find($where);
+            if ($this->data['shop']) {
+                # 有开通的门店
+                $this->data['city'] = 1;
+            } else {
+                # 没有开通的门店
+                $this->data['city'] = 2;
+            }
+        }
+        return $this->data;
+    }
+
+    # 获取当前登录的信息
+    public function user()
+    {
+        $this->data['user'] = $this->user;
+        return $this->data;
+    }
+
+    # 申请合作
+    public function apply()
+    {
+        $data['name'] = Dever::input('name');
+        $data['mobile'] = Dever::input('mobile');
+        $data['city'] = Dever::input('area');
+
+        $data['uid'] = $this->uid;
+
+        $where['city'] = $data['city'];
+        $where['mobile'] = $data['mobile'];
+        $info = Dever::db('shop/apply')->find($where);
+
+        if (!$info) {
+            Dever::db('shop/apply')->insert($data);
+        }
+
+        return '提交成功,我们会在3个工作日内与您联系,感谢您的信任。';
+    }
+
+    # 根据坐标,获取距离用户最近的店
+    public function getShop()
+    {
+        $config = Dever::db('main/config')->find(1);
+        $km = $config['km'];
+
+        $lng = Dever::input('lng');
+        $lat = Dever::input('lat');
+
+        if (!$lng || !$lat) {
+            Dever::alert('请传入用户坐标');
+        }
+        $page['template'] = 'list';
+        $page['num'] = 10;
+        $sql = 'select *, (st_distance(point(lng, lat),point('.$lng.', '.$lat.'))*111195) as distance from {table} where status = 1 and state = 1 order by distance asc';
+        $data = Dever::db('shop/info')->fetchAll($sql, array(), $page);
+
+        $result = array();
+        # 5公里内没有店,状态为2
+        $result['status'] = 2;
+        $result['list'] = $data;
+        if ($data) {
+            foreach ($data as $k => $v) {
+                if ($v['distance'] <= $km) {
+                    $result['status'] = 1;
+                    if ($v['worktime']) {
+                        $time = date('Hi');
+                        $v['worktime'] = str_replace(':', '', $v['worktime']);
+                        $temp = explode('~', $v['worktime']);
+                        if ($time < $temp[0] || $time > $temp[1]) {
+                            $v['open'] = 2;
+                        }
+                    }
+                    $result['shop'] = $v;
+                    break;
+                }
+            }
+        }
+
+        if ($result['status'] == 1) {
+            $result['focus'] = Dever::db('shop/focus')->select(array('location' => 2));
+            $result['goods'] = $this->getGoods($result['shop']['id']);
+        }
+
+        return $result;
+    }
+
+    # 根据店铺获取商品列表
+    public function getGoods($shop_id)
+    {
+        $cate = Dever::load('category/api')->getTop(1);
+
+        $data = array();
+        $data['cate'] = array();
+        $data['cate'] = array
+        (
+            array('id' => -1, 'name' => '人气食材'),
+            array('id' => -2, 'name' => '每日优惠'),
+        );
+
+        $data['cate'][0]['data'] = Dever::db('shop/goods')->getData(array('top' => 1));
+        $data['cate'][1]['data'] = Dever::db('shop/goods')->getData(array('youhui' => 1));
+        if ($cate) {
+            foreach ($cate as $k => $v) {
+                $v['data'] = Dever::db('shop/goods')->getData(array('top_category_id' => $v['id']));
+                $data['cate'][] = $v;
+            }
+        }
+
+        return $data;
+    }
+
+    # 获取商品详细信息
+    public function getGoodsInfo()
+    {
+        $id = Dever::input('goods_id');
+        if (!$id) {
+            Dever::alert('错误的商品');
+        }
+
+        $data = Dever::load('goods/lib/info')->getInfo($id);
+
+        return $data;
+    }
+}

+ 61 - 0
app/shop/src/My.php

@@ -0,0 +1,61 @@
+<?php
+
+namespace Shop\Src;
+
+use Dever;
+use Main\Lib\Core;
+
+class My extends Core
+{
+    public function __construct()
+    {
+        parent::__construct();
+        $this->checkLogin();
+    }
+
+    public function getInfo()
+    {
+        $this->data['user'] = $this->user;
+
+        # 获取拥有的优惠券数量
+        $this->data['coupon_num'] = Dever::db('shop/user_coupon')->total(array('uid' => $this->uid));
+
+        $this->data['card_num'] = Dever::db('goods/card_code')->total(array('uid' => $this->uid));
+
+        $this->data['score'] = Dever::load('score/lib/core')->getUserScore($this->uid);
+
+        $this->data['msg'] = Dever::load('message/lib/data')->num($this->uid);
+
+        return $this->data;
+    }
+
+    # 我的优惠券列表
+    public function coupon()
+    {
+
+    }
+
+    # 我的礼品卡列表
+    public function card()
+    {
+        
+    }
+
+    # 我的消息列表
+    public function msg()
+    {
+
+    }
+
+    # 我的地址列表
+    public function address()
+    {
+        return Dever::load('passport/address')->getAddress($this->uid);
+    }
+
+    # 我的发票列表
+    public function invoice()
+    {
+        return Dever::load('passport/invoice')->get($this->uid);
+    }
+}

+ 1 - 1
app/store/database/info.php

@@ -4,7 +4,7 @@ $status = array
 (
     1 => '合作中',
     2 => '已终止合作',
-),
+);
 
 return array
 (

+ 17 - 48
app/store/database/member.php

@@ -8,24 +8,13 @@ $role = array
     4 => '财务',
 );
 
-$factory = function()
-{
-    $array = array();
-    $info = Dever::db('factory/info')->select();
-    
-    if($info)
-    {
-        $array += $info;
-    }
-    return $array;
-};
-
 return array
 (
     # 表名
     'name' => 'member',
     # 显示给用户看的名称
     'lang' => '账号管理',
+    'menu' => false,
     # 数据结构
     'struct' => array
     (
@@ -42,52 +31,32 @@ return array
             //'list'        => true,
         ),
 
-        'store_id'      => array
+        'uid'       => array
         (
             'type'      => 'int-11',
-            'name'      => '所属仓库',
-            'default'   => '',
-            'desc'      => '所属仓库',
+            'name'      => '用户名',
+            'default'   => '0',
+            'desc'      => '请选择用户',
             'match'     => 'is_numeric',
-            'update'    => 'select',
-            'option'    => $store,
-            'list'      => 'Dever::load("store/info-find#name", {store_id})';
-        ),
-
-        'name'      => array
-        (
-            'type'      => 'varchar-50',
-            'name'      => '员工姓名',
-            'default'   => '',
-            'desc'      => '请输入员工姓名',
-            'match'     => 'is_string',
             'update'    => 'text',
-            'search'    => 'fulltext',
-            'list'      => true,
+            //'search'  => 'select',
+            'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'list'      => '{uid} > 0 ? Dever::load("passport/user-find#username", {uid}) : "匿名用户"',
         ),
 
-        'mobile'     => array
+        'store_id'      => array
         (
             'type'      => 'int-11',
-            'name'      => '员工电话',
+            'name'      => '所属仓库',
             'default'   => '',
-            'desc'      => '请输入员工电话',
+            'desc'      => '所属仓库',
             'match'     => 'is_numeric',
-            'update'    => 'text',
-            'search'    => 'fulltext',
-            'list'      => true,
-        ),
-
-        'avatar'        => array
-        (
-            'type'      => 'varchar-150',
-            'name'      => '员工头像',
-            'default'   => '',
-            'desc'      => '请选择员工头像',
-            'match'     => 'option',
-            'update'    => 'image',
-            'key'       => '1',
-            'place'     => '150',
+            'list'      => 'Dever::load("store/info-find#name", {store_id})';
         ),
 
         'role_id'      => array

+ 134 - 48
main/database/config.php

@@ -19,7 +19,7 @@ return array
 		'id' 		=> array
 		(
 			'type' 		=> 'int-11',
-			'name' 		=> '系统ID',
+			'name' 		=> '平台ID',
 			'default' 	=> '',
 			'desc' 		=> '',
 			'match' 	=> 'is_numeric',
@@ -27,18 +27,17 @@ return array
 		
 		'hr1'		=> array
 		(
-			'name' 		=> '通用设置',
+			'name' 		=> '平台基本信息',
 			'class'		=> '',//本项必须填写
 			'attr'		=> '',
 		),
 		
-		
 		'name'		=> array
 		(
 			'type' 		=> 'varchar-32',
-			'name' 		=> '系统名称',
+			'name' 		=> '平台名称',
 			'default' 	=> '',
-			'desc' 		=> '请输入系统名称',
+			'desc' 		=> '请输入平台名称',
 			'match' 	=> 'is_string',
 			'update'	=> 'text',
 		),
@@ -46,9 +45,9 @@ return array
 		'info'		=> array
 		(
 			'type' 		=> 'varchar-1000',
-			'name' 		=> '系统描述',
+			'name' 		=> '平台业务描述',
 			'default' 	=> '',
-			'desc' 		=> '请输入系统描述',
+			'desc' 		=> '请输入平台描述',
 			'match' 	=> 'option',
 			'update'	=> 'textarea',
 		),
@@ -56,79 +55,166 @@ return array
 		'logo'		=> array
 		(
 			'type' 		=> 'varchar-150',
-			'name' 		=> '系统LOGO',
+			'name' 		=> '平台LOGO',
 			'default' 	=> '',
-			'desc' 		=> '系统LOGO',
+			'desc' 		=> '平台LOGO',
 			'match' 	=> 'option',
 			'update'	=> 'image',
 			'key' 		=> '1',
 			'place'		=> '150',
 		),
 
-		'home_top'		=> array
-		(
-			'type' 		=> 'varchar-150',
-			'name' 		=> '首页顶部图片',
-			'default' 	=> '',
-			'desc' 		=> '首页顶部图片',
-			'match' 	=> 'option',
-			'update'	=> 'image',
-			'key' 		=> '1',
-			'place'		=> '690*228',
-		),
+        'hr2'       => array
+        (
+            'name'      => '门店相关',
+            'class'     => '',//本项必须填写
+            'attr'      => '',
+        ),
+
+        'km'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '推荐门店公里数-单位是公里,如5公里,填写5即可',
+            'default'   => '5',
+            'desc'      => '推荐门店公里数',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+        'video'     => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '视频宣传片-视频格式mp4,上传大小不能超过4G',
+            'default'   => '',
+            'desc'      => '视频宣传片',
+            'match'     => 'is_string',
+            'update'    => 'video',
+            'key'       => '3',
+            'place'     => '150',
+            'upload'    => 'yun',
+            'large'     => true,
+            //'cover'     => 'pic',//封面图字段名
+        ),
 
-		'home_top_type'       => array
+        'file'        => array
         (
-            'type'      => 'int-11',
-            'name'      => '首页顶部图片显示文字',
-            'default'   => '1',
-            'desc'      => '首页顶部图片显示文字',
-            'match'     => 'is_numeric',
-            'update'    => 'radio',
-            'option'    => $home_top_type,
-            'search'    => 'select',
-            //'list'        => true,
+            'type'      => 'varchar-150',
+            'name'      => '宣传文件',
+            'default'   => '',
+            'desc'      => '宣传文件',
+            'match'     => 'option',
+            'update'    => 'upload',
+            'key'       => '3',
         ),
 
-		'hr5'       => array
+        'rule'      => array
         (
-            'name'      => '分享配置',
+            'type'      => 'text-1000',
+            'name'      => '门店合作规则',
+            'default'   => '',
+            'desc'      => '门店合作规则',
+            'match'     => 'option',
+            'update'    => 'editor',
+            'key'       => 1,
+        ),
+
+        'hr3'       => array
+        (
+            'name'      => '官网SEO信息',
             'class'     => '',//本项必须填写
             'attr'      => '',
         ),
 
-        'share_title'       => array
+        'seo_title'      => array
         (
             'type'      => 'varchar-100',
-            'name'      => '分享标题-{name}为当前系统名称,{username}为当前登录的用户名',
+            'name'      => 'SEO标题',
+            'default'   => '',
+            'desc'      => '请输入SEO标题',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+        
+        'seo_keyword'      => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => 'SEO关键词',
+            'default'   => '',
+            'desc'      => 'SEO关键词',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'seo_desc'      => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => 'SEO描述',
             'default'   => '',
-            'desc'      => '分享标题',
+            'desc'      => 'SEO描述',
             'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'hr4'       => array
+        (
+            'name'      => '官网信息',
+            'class'     => '',//本项必须填写
+            'attr'      => '',
+        ),
+
+        'phone'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '客服电话',
+            'default'   => '',
+            'desc'      => '请输入客服电话',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+        'worktime'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '工作时间',
+            'default'   => '',
+            'desc'      => '请输入工作时间',
+            'match'     => 'is_string',
             'update'    => 'text',
         ),
 
-        'share_pic'     => array
+		'wechat'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '公众号',
+			'default' 	=> '',
+			'desc' 		=> '公众号',
+			'match' 	=> 'option',
+			'update'	=> 'image',
+			'key' 		=> '1',
+			'place'		=> '150*150',
+		),
+
+		'sell_applet'       => array
         (
             'type'      => 'varchar-150',
-            'name'      => '分享图片-图片尺寸570*570px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'name'      => '门店销售小程序',
             'default'   => '',
-            'desc'      => '分享图片',
+            'desc'      => '门店销售小程序',
             'match'     => 'option',
             'update'    => 'image',
             'key'       => '1',
-            'place'     => '150',
-            //'upload'  => 'qiniu',
-            //'large'   => true,
+            'place'     => '150*150',
         ),
 
-        'share_content'     => array
+        'foot'      => array
         (
-            'type'      => 'varchar-200',
-            'name'      => '分享内容',
+            'type'      => 'text-255',
+            'name'      => '底部信息',
             'default'   => '',
-            'desc'      => '分享内容',
-            'match'     => 'option',
-            'update'    => 'textarea',
+            'desc'      => '底部信息',
+            'match'     => 'is_string',
+            'update'    => 'editor',
+            'key'       => '1',
         ),
 		
 		'cdate'		=> array
@@ -147,7 +233,7 @@ return array
 		'col' => 'name,info,cdate',
 		'value' => array
 		(
-			'"合小记","合小记",' . time(),
+			'"厨人易料","厨人易料",' . time(),
 		),
 	),
 

+ 103 - 0
main/database/help.php

@@ -0,0 +1,103 @@
+<?php
+
+$type = array
+(
+    1 => '门店销售',
+    2 => '门店管理',
+    3 => '工厂管理',
+    4 => '仓库管理',
+),
+
+$config = array
+(
+    # 表名
+    'name' => 'help',
+    # 显示给用户看的名称
+    '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-80',
+            'name'      => '标题',
+            'default'   => '',
+            'desc'      => '标题',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'type'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '帮助类型',
+            'default'   => '1',
+            'desc'      => '帮助类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            'search'    => 'select',
+            'list'      => true,
+        ),
+
+        'content'      => array
+        (
+            'type'      => 'text-255',
+            'name'      => '内容',
+            'default'   => '',
+            'desc'      => '内容',
+            'match'     => 'is_string',
+            'update'    => 'editor',
+            //'list_name'       => '链接',
+            //'list'      => 'Dever::load("content/lib/page.link", {id})',
+        ),
+
+        '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})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    )
+);
+
+return $config;

+ 0 - 17
main/database/page.php

@@ -92,22 +92,5 @@ $config = array
         
     )
 );
-$auth = Dever::tops();
-
-if ($auth && $auth != 1) {
-    $config['request']['list'] = array
-    (
-        # 匹配的正则或函数 选填项
-        'option' => array
-        (
-            'name' => array('yes', 'like'),
-            'key' => array('_' . $auth, 'like'),
-        ),
-        'type' => 'all',
-        'order' => array('id' => 'desc'),
-        'page' => array(20, 'list'),
-        'col' => '*|id',
-    );
-}
 
 return $config;

+ 31 - 4
main/lib/Core.php

@@ -6,11 +6,38 @@ use Dever;
 
 class Core
 {
-    protected $checkUser = false;
-    protected $data;
+    protected $uid = -1;
+    protected $use = array();
+    protected $data = array();
+
     public function __construct()
     {
-        # 获取用户信息
-        $this->user = Dever::load('passport/user')->init();
+        $this->uid = Dever::load('passport/user')->check(false);
+        if ($this->uid) {
+            $this->user = Dever::load('passport/user')->info($this->uid);
+        } else {
+            $this->user = Dever::load('passport/user')->init();
+            $this->uid = $this->user['id'];
+        }
+
+        if ($this->user) {
+            $this->user['uid'] = $this->user['id'];
+        }
+    }
+
+    public function checkLogin()
+    {
+        if (!$this->uid || $this->uid <= 0) {
+            Dever::alert('请先登录', -2);
+        }
+    }
+
+    public function alert($state)
+    {
+        if ($state) {
+            return 'ok';
+        } else {
+            Dever::alert('操作失败');
+        }
     }
 }