rabin 6 months ago
parent
commit
7f1c911c86

+ 51 - 0
src/place/api/Address.php

@@ -0,0 +1,51 @@
+<?php namespace Place\Api;
+use Dever;
+use Place;
+use Place\Lib\Main;
+class Address extends Main
+{
+    protected $login = true;
+    protected $entry = true;
+
+    # 获取地址列表
+    public function list()
+    {
+        return Dever::load('address', 'place')->getList();
+    }
+
+
+    # 添加或者更新地址接口
+    public function up()
+    {
+        $id = Dever::input('id');
+        $type = Dever::input('type', 'is_numeric', '类型', 1);
+        $province = Dever::input('province', 'is_numeric', '省份');
+        $city = Dever::input('city', 'is_numeric', '城市');
+        $county = Dever::input('county', 'is_numeric', '区县');
+        $address = Dever::input('address', 'is_string', '地址');
+        $name = Dever::input('name', 'is_string', '联系人');
+        $phone = Dever::input('phone', 'is_string', '联系方式');
+
+        return Dever::load('address', 'place')->update($id, $type, $phone, $name, $province, $city, $county, $address);
+    }
+
+    # 获取默认地址
+    public function getDefault()
+    {
+        return Dever::load('address', 'place')->getDefault();
+    }
+
+    # 获取某个收货地址
+    public function getInfo()
+    {
+        $id = Dever::input('id', 'is_numeric', '收货地址');
+        return Dever::load('address', 'place')->getInfo($id);
+    }
+
+    # 删除地址
+    public function delete()
+    {
+        $id = Dever::input('id', 'is_numeric', '收货地址');
+        return Dever::load('address', 'place')->delete($id);
+    }
+}

+ 15 - 0
src/place/api/Resource.php

@@ -79,4 +79,19 @@ class Resource extends Main
         }
         return $data;
     }
+
+    # 获取订单列表
+    public function getOrderList()
+    {
+        $data['list'] = $this->service->getOrderList();
+        return Place::result($data);
+    }
+
+    # 获取订单详情
+    public function getOrderView()
+    {
+        $data['info'] = $this->service->getOrderView();
+        return Place::result($data);
+    }
+
 }

+ 0 - 43
src/place/lib/Act.php

@@ -133,50 +133,7 @@ class Act
                     $info[$v1] = $v[$v1];
                 }
             }
-            if ($this->db->config['load'] == 'place/order') {
-                if ($v['status'] == 1) {
-                    $m = 3600;
-                    # 支付倒计时
-                    $info['time'] = time() - $v['cdate'];
-                    if ($info['time'] >= $m) {
-                        # 已过期,自动取消
-                        $info['time'] = -1;
-                        $this->cancel($info);
-                        $info['status'] = 10;
-                    } else {
-                        $info['time'] = $m - $info['time'];
-                    }
-                }
-                $info['cash'] = Dever::load('price', 'place')->getText($info['cash'], $info['type']);
-                if ($v['type'] == 3) {
-                    $info['detail'] = Dever::load('order', $this->app)->getDetail($v['id']);
-                    $info['info'] = '共' . intval($info['num']) . '件商品';
-                } else {
-                    $detail['id'] = $info['id'];
-                    $detail['name'] = $info['name'];
-                    $detail['pic'] = $info['pic'];
-                    $detail['sku_name'] = '';
-                    $detail['sku_id'] = 0;
-                    $detail['cash'] = $info['cash'];
-                    $detail['num'] = $info['num'];
-                    $info['detail'][] = $detail;
-                    $info['info'] = '';
-                }
-            }
             return $info;
         }
     }
-
-    # 取消订单
-    public function cancel($order, $status = 9)
-    {
-        if ($order['status'] == 1) {
-            $state = Dever::db('order', 'place')->update($order['data_id'], array('status' => $status, 'fdate' => time()));
-            if ($state) {
-                # 恢复库存
-            }
-
-            return 'ok';
-        }
-    }
 }

+ 127 - 0
src/place/lib/Address.php

@@ -0,0 +1,127 @@
+<?php namespace Place\Lib;
+use Dever;
+use Place;
+class Address
+{
+    # 获取默认地址
+    public function getDefault($type = 1)
+    {
+        $where['uid'] = Place::$uid;
+        $where['type'] = $type;
+        $info = Dever::db('address', 'place')->find($where);
+        if (!$info) {
+            unset($where['type']);
+            $info = Dever::db('address', 'place')->find($where);
+        }
+        if ($info && Dever::project('area')) {
+            $info = $this->handleInfo($info);
+        }
+        return $info;
+    }
+
+    # 获取某个收货地址
+    public function getInfo($id)
+    {
+        $where['id'] = $id;
+        $where['uid'] = Place::$uid;
+        $info = Dever::db('address', 'place')->find($where);
+        if ($info && Dever::project('area')) {
+            $info = $this->handleInfo($info);
+        }
+        return $info;
+    }
+
+    # 获取地址列表
+    public function getList()
+    {
+        $where['uid'] = Place::$uid;
+        $where['type'] = array('<', 3);
+        $data = Dever::db('address', 'place')->select($where);
+        if ($data && Dever::project('area')) {
+            foreach ($data as $k => $v) {
+                $data[$k] = $this->handleInfo($v);
+            }
+        }
+        return $data;
+    }
+
+    public function handleInfo($data)
+    {
+        if (is_array($data['area'])) {
+            $data['area'] = implode(',', $data['area']);
+        }
+        $data['area_string'] = Dever::load('data', 'area')->string($data['area']);
+        $data['province_name'] = $data['city_name'] = $data['county_name'] = '';
+
+        if ($data['county_id']) {
+            $info = Dever::db('county', 'area')->find($data['county_id']);
+            if ($info) {
+                $data['county_name'] = $info['name'];
+            }
+        }
+        if ($data['city_id']) {
+            $info = Dever::db('city', 'area')->find($data['city_id']);
+            if ($info) {
+                $data['city_name'] = $info['name'];
+            }
+        }
+        if ($data['province_id']) {
+            $info = Dever::db('province', 'area')->find($data['province_id']);
+            if ($info) {
+                $data['province_name'] = $info['name'];
+            }
+        }
+        return $data;
+    }
+
+    # 添加或者更新地址
+    public function update($id, $type = 1, $phone, $name, $province = '', $city = '', $county = '', $address = '')
+    {
+        $update['uid'] = Place::$uid;
+        if ($name) {
+            $update['name'] = $name;
+        }
+        if ($phone) {
+            $update['phone'] = $phone;
+        } else {
+            Dever::alert('请输入联系方式');
+        }
+        if ($province) {
+            $update['province_id'] = $province;
+        } else {
+            Dever::alert('请选择省份');
+        }
+        if ($city) {
+            $update['city_id'] = $city;
+        } else {
+            Dever::alert('请选择城市');
+        }
+        if ($county) {
+            $update['county_id'] = $county;
+        } else {
+            Dever::alert('请选择区县');
+        }
+        if ($province && $city && $county) {
+            $update['area'] = $province . ',' . $city . ',' . $county;
+        }
+        $update['type'] = $type;
+        if ($address) {
+            $update['address'] = $address;
+        }
+        if ($type == 1) {
+            Dever::db('address', 'place')->update(array('type' => 1), array('type' => 2));
+        }
+        if ($id) {
+            Dever::db('address', 'place')->update(array('id' => $id, 'uid' => Place::$uid), $update);
+        } else {
+            $id = Dever::db('address', 'place')->insert($update);
+        }
+        return $id;
+    }
+
+    # 删除
+    public function delete($id)
+    {
+        return Dever::db('address', 'place')->delete(array('id' => $id, 'uid' => Place::$uid));
+    }
+}

+ 3 - 12
src/place/lib/Callback.php

@@ -4,21 +4,12 @@ use Place;
 class Callback
 {
     # 资源支付成功
-    public function resource($place, $order_num, $type, $status, $body = array())
+    public function resource($place, $order_num, $app, $status, $body = array())
     {
         Dever::input('authorization', 'is_string', '入口码', $place);
-        $order = Dever::db('order', 'place')->find(array('type' => $type, 'order_num' => $order_num));
+        $order = Dever::db('order', $app)->find(array('order_num' => $order_num));
         if ($order && $order['status'] == 1) {
-            if ($status == 1) {
-                $update['status'] = 5;
-                if ($type == 3) {
-                    $update['status'] = 2;
-                }
-            } else {
-                $update['status'] = 7;
-            }
-            $update['pdate'] = time();
-            $state = Dever::db('order', 'place')->update($order['id'], $update);
+            $state = Dever::load('order', $app)->success($order, $status);
             if (!$state) {
                 return '订单更新失败';
             }

+ 4 - 1
src/place/lib/Price.php

@@ -14,7 +14,10 @@ class Price
         $result['button'] = $button;
         $result['num'] = $num;
         $result['list'] = array();
-        $order = Dever::db('order', 'place')->find(array('type' => $type, 'type_id' => $info['id'], 'uid' => Place::$uid, 'status' => 5));
+        $order = false;
+        if ($type != 3) {
+            $order = Dever::db('order', $app)->find(array('info_id' => $info['id'], 'uid' => Place::$uid, 'status' => 2));
+        }
         if ($order) {
             $result['value'] = $order['cash'];
         } else {

+ 64 - 9
src/place/lib/Resource.php

@@ -79,25 +79,24 @@ class Resource
         $prefix = strtoupper(substr($this->app, 0, 2));
         if ($this->type == 3) {
             $order['cash'] = $info['value'];
+            $order['address_id'] = Dever::input('address_id', 'is_numeric', '收货地址');
         } else {
             $order['cash'] = ($info['value']/Place::$info['score_per']);
         }
-        $order['order_num'] = Dever::load('util', 'api')->createNumber($prefix, 'place/order');
-        $order['notify'] = 'place/callback.resource|' . Dever::input('p') . '|' . $order['order_num'] . '|' . $this->type;
+        $order['order_num'] = Dever::load('util', 'api')->createNumber($prefix, $this->app . '/order');
+        $order['notify'] = 'place/callback.resource|' . Dever::input('p') . '|' . $order['order_num'] . '|' . $this->app;
 
         $data['pay'] = Dever::load('account', 'place')->pay($order);
         if ($data['pay'] && empty($data['pay']['link'])) {
             $order['status'] = 1;
-            $order['type'] = $this->type;
-            $order['type_id'] = $info['id'];
+            $order['info_id'] = $info['id'];
             $order['num'] = $info['num'];
-            $data['order_id'] = Dever::db('order', 'place')->insert($order);
+            $data['order_id'] = Dever::db('order', $this->app)->insert($order);
             $data['order_num'] = $order['order_num'];
             if (isset($info['detail'])) {
                 $detail['order_id'] = $data['order_id'];
                 foreach ($info['detail'] as $k => $v) {
-                    $detail['type'] = $this->type;
-                    $detail['type_id'] = $v['id'];
+                    $detail['info_id'] = $v['id'];
                     if (isset($v['sku_id'])) {
                         $detail['sku_id'] = $v['sku_id'];
                     }
@@ -109,9 +108,9 @@ class Resource
                     $detail['num'] = $v['num'] ?? $order['num'];
                     $detail['name'] = $v['name'];
                     $detail['pic'] = $v['pic'];
-                    Dever::db('order_detail', 'place')->insert($detail);
+                    Dever::db('order_detail', $this->app)->insert($detail);
                     if (isset($v['cart_id']) && $v['cart_id']) {
-                        Dever::db('cart', 'goods')->delete(array('id' => $v['cart_id'], 'uid' => Place::$uid));
+                        Dever::db('cart', $this->app)->delete(array('id' => $v['cart_id'], 'uid' => Place::$uid));
                     }
                 }
             }
@@ -119,6 +118,62 @@ class Resource
         return $data;
     }
 
+    # 获取订单列表
+    public function getOrderList()
+    {
+        $where['uid'] = Place::$uid;
+        $set['num'] = 10;
+        $set['col'] = 'id,info_id,name,cash,num,cdate,status';
+        $data = Dever::db('order', $this->app)->select($where, $set);
+        $result = array();
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $order = $this->getOrderInfo($v);
+                if ($order) {
+                    $result[] = $order;
+                }
+            }
+        }
+        return $result;
+    }
+
+    # 获取订单详情
+    public function getOrderView()
+    {
+        $where['uid'] = Place::$uid;
+        $where['id'] = Dever::input('id', 'is_numeric', '订单');
+        $order = Dever::db('order', $this->app)->find($where);
+        if ($order) {
+            $order = $this->getOrderInfo($order, true);
+        } else {
+            Dever::error('订单不存在');
+        }
+        return $order;
+    }
+
+    private function getOrderInfo($order, $view = false)
+    {
+        $info = Dever::db('info', $this->app)->find($order['info_id'], array('col' => 'id,name,pic,info'));
+        $info['pic'] = explode(',', $info['pic']);
+        $order['pic'] = $info['pic'][0] ?? '';
+
+        $order = Dever::load('order', $this->app)->getInfo($order, $view);
+        if ($order) {
+            $order['status_name'] = Dever::db('order', $this->app)->value('status', $order['status']);
+            $order['cdate_str'] = date('Y-m-d H:i:s', $order['cdate']);
+            if (isset($order['pdate']) && $order['pdate']) {
+                $order['pdate_str'] = date('Y-m-d H:i:s', $order['pdate']);
+            }
+            if (isset($order['ddate']) && $order['ddate']) {
+                $order['ddate_str'] = date('Y-m-d H:i:s', $order['ddate']);
+            }
+            if (isset($order['fdate']) && $order['fdate']) {
+                $order['fdate_str'] = date('Y-m-d H:i:s', $order['fdate']);
+            }
+            return $order;
+        }
+    }
+
     # 同步资源,关联资源
     public function relation($place_id, $data, $relation)
     {

+ 62 - 0
src/place/table/address.php

@@ -0,0 +1,62 @@
+<?php
+return array
+(
+    'name' => '用户地址表',
+    'partition' => 'Dever::call("manage/common.system")',
+    'order' => 'type asc',
+    'struct' => array
+    (
+        'uid'       => array
+        (
+            'type'      => 'int(11)',
+            'name'      => '用户',
+        ),
+        'type' => array
+        (
+            'name'      => '类型',
+            'type'      => 'tinyint(1)',
+            'default'   => 1,
+            'value'     => array
+            (
+                1 => '默认地址',
+                2 => '普通地址',
+                3 => '临时地址',
+            ),
+        ),
+        'name' => array
+        (
+            'name'      => '联系人',
+            'type'      => 'varchar(100)',
+        ),
+        'phone' => array
+        (
+            'name'      => '联系电话',
+            'type'      => 'varchar(200)',
+        ),
+        'area' => array
+        (
+            'name'      => '城市地区',
+            'type'      => 'varchar(800)',
+        ),
+        'province_id' => array
+        (
+            'name'      => '省份',
+            'type'      => 'int(11)',
+        ),
+        'city_id' => array
+        (
+            'name'      => '城市',
+            'type'      => 'int(11)',
+        ),
+        'county_id' => array
+        (
+            'name'      => '区县',
+            'type'      => 'int(11)',
+        ),
+        'address' => array
+        (
+            'name'      => '详细地址',
+            'type'      => 'varchar(1000)',
+        ),
+    ),
+);

+ 35 - 0
src/resource/content/lib/Order.php

@@ -0,0 +1,35 @@
+<?php namespace Content\Lib;
+use Dever;
+use Place;
+# 内容订单只需买一次就可以了,所以只需要保留成功订单
+class Order
+{
+    # 获取订单信息
+    public function getInfo($info)
+    {
+        # 需要定期清理status=1的订单
+        $info['cash'] = Dever::load('price', 'place')->getText($info['cash'], 3);
+        $detail['id'] = $info['id'];
+        $detail['name'] = $info['name'];
+        $detail['pic'] = $info['pic'];
+        $detail['sku_name'] = '';
+        $detail['sku_id'] = 0;
+        $detail['cash'] = $info['cash'];
+        $detail['num'] = $info['num'];
+        $info['detail'][] = $detail;
+        $info['info'] = '';
+        return $info;
+    }
+
+    # 支付成功
+    public function success($order, $status)
+    {
+        if ($status == 1) {
+            $update['pdate'] = time();
+            $state = Dever::db('order', 'content')->update($order['id'], $update);
+        } else {
+            $state = Dever::db('order', 'content')->delete($order['id']);
+        }
+        return $state;
+    }
+}

+ 68 - 0
src/resource/content/table/order.php

@@ -0,0 +1,68 @@
+<?php
+return array
+(
+    'name' => '内容支付订单表',
+    'partition' => 'Dever::call("manage/common.system")',
+    'struct' => array
+    (
+        'info_id' => array
+        (
+            'name'      => '商品ID',
+            'type'      => 'int(11)',
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int(11)',
+            'name'      => '用户',
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar(80)',
+            'name'      => '订单名称',
+        ),
+
+        'order_num'        => array
+        (
+            'type'      => 'varchar(60)',
+            'name'      => '订单号',
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'decimal(11,2)',
+            'name'      => '订单金额',
+        ),
+
+        'num'      => array
+        (
+            'type'      => 'decimal(11,2)',
+            'name'      => '订单数量',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'tinyint(1)',
+            'name'      => '订单状态',
+            'default'   => '1',
+            'value'         => array
+            (
+                1 => '待支付',
+                2 => '已完成',
+                3 => '已取消',
+            ),
+        ),
+
+        'pdate'       => array
+        (
+            'type'      => 'int(11)',
+            'name'      => '付款时间',
+        ),
+    ),
+
+    'index' => array
+    (
+        'search' => 'uid',
+    ),
+);

+ 103 - 32
src/resource/goods/lib/Order.php

@@ -3,10 +3,35 @@ use Dever;
 use Place;
 class Order
 {
-    # 获取某个订单的详情
+    # 获取订单信息
+    public function getInfo($info, $view = false)
+    {
+        if ($info['status'] == 1) {
+            $m = 3600;
+            # 支付倒计时
+            $info['time'] = time() - $info['cdate'];
+            if ($info['time'] >= $m) {
+                # 已过期,自动取消
+                $info['time'] = -1;
+                $this->cancel($info);
+                $info['status'] = 10;
+            } else {
+                $info['time'] = $m - $info['time'];
+            }
+        }
+        $info['cash'] = Dever::load('price', 'place')->getText($info['cash'], 3);
+        $info['detail'] = $this->getDetail($info['id']);
+        $info['info'] = '共' . intval($info['num']) . '件商品';
+        if ($view) {
+            $this->getView($info);
+        }
+        return $info;
+    }
+
+    # 获取订单里每个商品
     public function getDetail($id)
     {
-        $result = Dever::db('order_detail', 'place')->select(array('type' => 3, 'order_id' => $id), array('col' => 'id,name,pic,sku_name,sku_id,cash,num'));
+        $result = Dever::db('order_detail', 'goods')->select(array('type' => 3, 'order_id' => $id), array('col' => 'id,name,pic,sku_name,sku_id,cash,num'));
         if ($result) {
             foreach ($result as &$v) {
                 $v['cash'] = Dever::load('price', 'place')->getText($v['cash'], 3);
@@ -16,39 +41,85 @@ class Order
     }
 
     # 获取订单详情
-    public function getView($info)
+    public function getView(&$info)
     {
-        if ($info) {
-            $info['yun'] = Dever::load('price', 'place')->getText(0, 3);
-            $info['status_list'] = array
+        # 收货地址
+        $info['address'] = Dever::load('address', 'place')->getInfo($info['address_id']);
+        # 运费
+        $info['yun'] = Dever::load('price', 'place')->getText(0, 3);
+        $info['status_list'] = array
+        (
+            1 => array
+            (
+                'selected' => false,
+                'name' => '已拍下',
+            ),
+            2 => array
+            (
+                'selected' => false,
+                'name' => '待付款',
+            ),
+            3 => array
             (
-                1 => array
-                (
-                    'selected' => false,
-                    'name' => '已拍下',
-                ),
-                2 => array
-                (
-                    'selected' => false,
-                    'name' => '待付款',
-                ),
-                3 => array
-                (
-                    'selected' => false,
-                    'name' => '待发货',
-                ),
-                4 => array
-                (
-                    'selected' => false,
-                    'name' => '待收货',
-                ),
-            );
-            foreach ($info['status_list'] as $k => &$v) {
-                if ($info['status'] >= $k) {
-                    $v['selected'] = true;
-                }
+                'selected' => false,
+                'name' => '待发货',
+            ),
+            4 => array
+            (
+                'selected' => false,
+                'name' => '待收货',
+            ),
+            5 => array
+            (
+                'selected' => false,
+                'name' => '已完成',
+            ),
+        );
+        foreach ($info['status_list'] as $k => &$v) {
+            if ($info['status'] >= $k) {
+                $v['selected'] = true;
             }
         }
-        return $info;
+        if ($info['status'] == 1) {
+            $info['status_msg'] = '下单成功,待支付';
+        } elseif ($info['status'] == 2) {
+            $info['status_msg'] = '支付成功,待发货';
+        } elseif ($info['status'] == 3) {
+            $info['status_msg'] = '已发货,等待配送';
+        } elseif ($info['status'] == 4) {
+            $info['status_msg'] = '配送中,等待收货';
+        } elseif ($info['status'] == 5 || $info['status'] == 6) {
+            $info['status_msg'] = '订单已完成';
+        } elseif ($info['status'] > 6) {
+            $info['status_msg'] = '订单已取消';
+        }
+    }
+
+    # 取消订单
+    public function cancel($order, $status = 9)
+    {
+        if ($order['status'] == 1) {
+            $state = Dever::db('order', 'goods')->update($order['data_id'], array('status' => $status, 'fdate' => time()));
+            if ($state) {
+                # 恢复库存
+            }
+            return 'ok';
+        }
+    }
+
+    # 支付成功
+    public function success($order, $status)
+    {
+        if ($status == 1) {
+            $update['status'] = 2;
+        } else {
+            $update['status'] = 7;
+        }
+        $update['pdate'] = time();
+        $state = Dever::db('order', 'goods')->update($order['id'], $update);
+        if ($state && $update['status'] == 7) {
+            # 恢复库存
+        }
+        return $state;
     }
 }

+ 7 - 0
src/resource/goods/lib/Stock.php

@@ -0,0 +1,7 @@
+<?php namespace Goods\Lib;
+use Dever;
+use Place;
+class Stock
+{
+    
+}

+ 2 - 2
src/resource/goods/table/info.php

@@ -59,10 +59,10 @@ return array
         (
             'name'      => '规格类型',
             'type'      => 'tinyint(1)',
-            'default'   => 1,
+            'default'   => 2,
             'value'     => array
             (
-                1 => '免费',
+                //1 => '免费',
                 2 => '单规格',
                 3 => '多规格',
             ),

+ 7 - 7
src/place/table/order.php → src/resource/goods/table/order.php

@@ -1,20 +1,20 @@
 <?php
 return array
 (
-    'name' => '资源支付订单表',
-    'partition' => 'Dever::call("manage/common.system", array(false, true, "place/info.funcType"))',
+    'name' => '商品支付订单表',
+    'partition' => 'Dever::call("manage/common.system")',
     'struct' => array
     (
-        'type'        => array
+        'info_id' => array
         (
-            'type'      => 'tinyint(1)',
-            'name'      => '类型',
+            'name'      => '商品ID',
+            'type'      => 'int(11)',
         ),
 
-        'type_id'        => array
+        'address_id' => array
         (
+            'name'      => '地址ID',
             'type'      => 'int(11)',
-            'name'      => '类型ID',
         ),
 
         'uid'       => array

+ 4 - 10
src/place/table/order_detail.php → src/resource/goods/table/order_detail.php

@@ -1,20 +1,14 @@
 <?php
 return array
 (
-    'name' => '资源支付订单明细表',
-    'partition' => 'Dever::call("manage/common.system", array(false, true, "place/info.funcType"))',
+    'name' => '商品支付订单明细表',
+    'partition' => 'Dever::call("manage/common.system")',
     'struct' => array
     (
-        'type'        => array
-        (
-            'type'      => 'tinyint(1)',
-            'name'      => '类型',
-        ),
-
-        'type_id'        => array
+        'info_id' => array
         (
+            'name'      => '商品ID',
             'type'      => 'int(11)',
-            'name'      => '类型ID',
         ),
 
         'sku_id'        => array

+ 4 - 10
src/place/table/order_refund.php → src/resource/goods/table/order_refund.php

@@ -1,20 +1,14 @@
 <?php
 return array
 (
-    'name' => '资源退款单表',
-    'partition' => 'Dever::call("manage/common.system", array(false, true, "place/info.funcType"))',
+    'name' => '商品退款单表',
+    'partition' => 'Dever::call("manage/common.system")',
     'struct' => array
     (
-        'type'        => array
-        (
-            'type'      => 'tinyint(1)',
-            'name'      => '类型',
-        ),
-
-        'type_id'        => array
+        'info_id' => array
         (
+            'name'      => '商品ID',
             'type'      => 'int(11)',
-            'name'      => '类型ID',
         ),
 
         'order_id'       => array

+ 56 - 0
src/resource/goods/table/stock.php

@@ -0,0 +1,56 @@
+<?php
+return array
+(
+    'name' => '商品库存表',
+    'partition' => 'Dever::call("manage/common.system")',
+    'struct' => array
+    (
+        'info_id' => array
+        (
+            'name'      => '商品ID',
+            'type'      => 'int(11)',
+        ),
+
+        'sku_id'        => array
+        (
+            'type'      => 'int(11)',
+            'name'      => '价格ID',
+        ),
+
+        'order_id'       => array
+        (
+            'type'      => 'int(11)',
+            'name'      => '订单ID',
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar(80)',
+            'name'      => '名称',
+        ),
+
+        'pic' => array
+        (
+            'name'      => '图片',
+            'type'      => 'varchar(150)',
+        ),
+
+        'sku_name'      => array
+        (
+            'type'      => 'varchar(200)',
+            'name'      => '价格的规格名称',
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'decimal(11,2)',
+            'name'      => '明细金额',
+        ),
+
+        'num'      => array
+        (
+            'type'      => 'decimal(11,2)',
+            'name'      => '明细数量',
+        ),
+    ),
+);