xuchaolang 7 anos atrás
pai
commit
f1dadb55c4
4 arquivos alterados com 489 adições e 11 exclusões
  1. 15 4
      db/product/lj_item_price.md
  2. 6 7
      db/product/lj_item.md
  3. 358 0
      tob/tobApi.md
  4. 110 0
      tob/tobDB.md

+ 15 - 4
db/product/lj_item_price.md

@@ -1,13 +1,16 @@
-### lj_item_price table structure
-> 此表为课程产品的出售价格
+### goods table structure
+> 此表为商品表,标明产品在渠道上的价格
+>
 
 
 | field | type | null | default | desc | extra |
 |:----:|:-----|:-------|:------|:-----|:-----|
 | id | varchar(512) | no | | 主键 | pri |
-| item_id | varchar(512) | no | | 商品id |  |
+| pid | varchar(512) | no | | 产品id |  |
+| product_type | tinyint | no | | 产品类型, 课程/周边/课程包 | |
+| merchant_id | varchar(512) | no | | 渠道id | |
 | duration | int | no | | 售卖时长 | |
-| name | varchar(512) | no | | 价格名字 | |
+| charge_unit | varchar(512) | no | | 计价单位, 如"季度", "件"等 | |
 | cp_price | double(16,2) | no | 0 | 内容提供商成本价 | |
 | merchant_price | double(16,2) | no | 0 | 给渠道价格 | |
 | terminal_price | double(16,2) | no | 0 | 终端显示价格 | |
@@ -17,3 +20,11 @@
 
 ### index
 index on(item_id)
+
+merchant_pid
+
+package?
+id
+name
+
+package_object_relation

+ 6 - 7
db/product/lj_item.md

@@ -1,16 +1,15 @@
-### lj_item table structure
-> 此表为商品的数据结构, 可出售
+### merchant_product table structure
+> 此表为渠道物品的数据结构, 可出售, merchant_product
 
 
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | varchar(512) | no | | 主键 | pri |
-| sub_id | varchar(512) | no | | 来源id | |
-| code | varchar(512) | no | | 课程编码/周边编码 | |
-| name | varchar(512) | no | | 名字 | |
-| type | smallint | no | | 商品类型, 课程/周边 | |
+| pid | varchar(512) | no | | 产品id | |
+| product_type | tinyint | no | | 产品类型, 课程,周边,课程包 | |
 | merchant_id | varchar(512) | no | | 渠道id | |
-| sort | int | no | 0 | 排序字段 | |
+| code | varchar(512) | no | | object_code, 课程编码/周边编码 | |
+| name | varchar(512) | no | | 产品名字 | |
 | status | smallint | no | | 状态 | |
 | gmt_created | timestamp | no | now | 创建时间 | |
 | gmt_modified | timestamp | no | now | 更新时间 | | |

+ 358 - 0
tob/tobApi.md

@@ -0,0 +1,358 @@
+
+### 订单相关
+
+#### 订单查询
+```
+/orders
+GET
+{
+  'orderStatus':0,
+  'timeBegin':2233222,
+  'timeEnd':23232332,
+  'userCode':'xxx',
+  'campusName':'xxx',
+  'campusCode':'xxx',
+  'pageSize':10,
+  'pageNum':0,
+}
+返回
+{
+    'code':200,
+    'success': true,
+    'message': null,
+    'data':{
+        'totalNum':200,
+        'pageNum':0,
+        'pageSize':10,
+        'recs':[
+          {
+              'id':'xxx',
+              'code':'xxxx',
+              'uid':'xxx',
+              'userCode':'xxx',
+              'provinceCode':'xxx',
+              'cityName':'xxx',
+              'zoneName':'xxxx',
+              'classroomName':'xxxx',
+              'finalPrice':2332.12,
+              'merchantPrice':2332.12,
+              'status':0,
+              'gmtCreated':1342342,
+          }
+          ...
+        ]
+    }
+
+}
+
+```
+
+>请求参数
+
+|name |type| null | desc |
+|---- |:---|:---|:----:|
+| orderStatus | string | no | 订单状态,取值{0,1,2}, 分别表示{未支付,已支付,已删除} |
+| timeBegin | unix stamp | yes | 查询开始时间 |
+| timeEnd | unix stamp | yes | 查询结束时间 |
+| campusName | string | yes | 校区名 |
+| campusCode | string | yes | 校区名 |
+| userCode | string | yes | 校区名 |
+| pageSize | int | no | 分布大小 |
+| pageNum | int | no | 页码,从0开始 |
+
+>返回参数
+
+|name |type| null | desc |
+|---- |:---|:---|:----:|
+| totalNum | int | no | 返回总结果数 |
+| id | string | no | 订单id |
+| uid | string | no | 用户id |
+| userCode | string | no | 学号 |
+| code | string | no | recs中的code, 表示订单号 |
+| finalPrice | float | no | 表示最终的成交价 |
+| lingjiaoPrice | float | no | 表示领教给渠道的价格 |
+| gmtCreated | unixStamp | no | 表示订单创建的时间 |
+
+---
+
+#### 创建订单
+```
+/order/
+POST
+{
+  'uid':'xxxx',
+  'priceAdjust':-200.01,
+  'note':'xxx',
+  'recs':[
+    {
+      'goodsId':'xxx',
+      'quantity':2,
+    },
+    ...
+    ]
+}
+返回
+{
+  'code':200,
+  'success': true,
+  'message': null,
+  'data':{
+      'id':'xxxx'
+  }
+}
+```
+
+>请求参数
+
+|name |type| null | desc |
+|---- |:---|:---|:----:|
+| uid | string | no | 终端用户id |
+| priceAdjust | float | no | 订单价格调整,正数表示加,负数表示减 |
+| recs | jsonArray | no | 要购买的商品记录数组 |
+| goodsId | string | no | 商品id |
+| quantity | int | no | 购买的数量 |
+| note | int | no | 订单备注 |
+
+>返回参数
+
+|name |type| null | desc |
+|---- |:---|:---|:----:|
+| id | string | no | 订单id |
+
+---
+
+#### 查询产品列表
+```
+/products
+GET
+{
+  'code':'xxx',
+  'name':'xxxx',
+  'type':0,
+  'merchantId':23,
+  'pageSize':10,
+  'pageNum':0,
+}
+返回
+{
+    "code": 200,
+    "success": true,
+    "message": null,
+    "data": {
+      'totalNum':300,
+      'page':0,
+      'pageSize':10
+      'recs':[
+        {
+          'id':'xxx',
+          'name':'xxx',
+          'code':'xxx',
+          'type':'xxx',
+          'gmt_modified':1321232,
+          'merchantId':'xxxx',
+          'goods':[{
+            'id':'xxx',
+            'duration':2322,
+            'chargeUnit':'xxx',
+            'cpPrice':12.01,
+            'merchantPrice':23.92,
+            'terminalPrice':50.1,
+            },
+            ...
+            ],
+        }
+        ...
+      ],
+    }
+}
+```
+
+>请求参数
+
+|name |type| null | desc |
+|---- |:---|:---|:----:|
+| code | string | yes | product的编号 |
+| name | string | yes | item名称 |
+| type | int | yes | item类型 |
+| merchantId | int | yes | item类型 |
+
+---
+
+#### 获取特定产品详情
+```
+/product
+GET
+{
+  'productId':'xxxx',
+  'product_type':2,
+}
+返回
+{
+    "code": 200,
+    "success": true,
+    "message": null,
+    "data": {
+          'id':'xxx',
+          'name':'xxx',
+          'type':'xxx',
+          'code':'xxx',
+          'gmt_modified':1321232,
+          'goods':[{
+            'id':'xxx',
+            'merchantId':'xxxx',
+            'duration':2322,
+            'chargeUnit':'xxx',
+            'cpPrice':12.01,
+            'merchantPrice':23.92,
+            'terminalPrice':50.1,
+            }],
+    }
+}
+```
+
+---
+
+#### 创建课程包
+```
+/package
+POST
+{
+  'code':'xxx',
+  'name':'xxxx',
+  'recs':[
+    {
+      'pid':'pid1xxx',
+      'product_type':2,
+      'cpPriceInPackage':101.23,
+    },
+    ...
+  ],
+}
+返回
+{
+    "code": 200,
+    "success": true,
+    "message": null,
+    "data": {
+      'id':'xxxx',
+    }
+}
+```
+
+#### 修改课程包
+```
+/package/<packageId>
+PUT
+{
+    /*参考/package/-POST请求参数*/
+}
+返回
+{
+    "code": 200,
+    "success": true,
+}
+```
+---
+
+#### 创建商品
+```
+/goods
+POST
+{
+  'pid':'xxx',
+  'productType':1,
+  'merchantId':'xxxx',
+  'duration':'xxxx',
+  'chargeUnit':'xxxx',
+  'cpPrice':12.01,
+  'merchantPrice':12.11,
+  'terminalPrice':32.11,
+}
+返回
+{
+  "code": 200,
+  "success": true,
+  "message": null,
+  'data':{
+    'id':'xxxx',
+  }
+}
+```
+---
+
+#### 修改商品
+```
+/goods/<goodsId>
+PUT
+{
+  /*参考/goods-POST参数*/
+}
+返回
+{
+  "code": 200,
+  "success": true,
+}
+```
+
+---
+
+#### 查询销售数据
+```
+/soldProduct
+GET
+{
+  'uid':'xxx',
+  'userCode':'xxx',
+  'userName':'xxx',
+  'campusId':'xxx',
+  'campusCode':'xxx',
+  'campusName':'xxx',
+  'pkgId':'xxx',
+  'pid':'xxx',
+  'productCode':'xxx',
+  'cpId':'xxx',
+  'merchantId':'xxx',
+  'pageNum':0,
+  'pageSize':10,
+}
+返回
+{
+  "code": 200,
+  "success": true,
+  "message": null,
+  "data": {
+      'totalNum':300,
+      'page':0,
+      'pageSize':10
+      'recs':[
+        {
+          'uid':'xxx',
+          'userCode':'xxx',
+          'userName':'xxx',
+          'campusId':'xxx',
+          'campusCode':'xxx',
+          'campusName':'xxx',
+          'orderId':'xxx',
+          'goodsId':'xxx',
+          'pkgId':'xxx',
+          'pid':'xxx',
+          'productType':'xxx',
+          'productCode':'xxx',
+          'productName':'xxx',
+          'merchantId':'xxxx',
+          'duration':2322,
+          'cpId':'xxxx',
+          'cpPrice':2,
+          'merchantPrice':2,
+          'terminalPrice':2,
+          'chargeUnit':2,
+          'quantity':2,
+          'gmt_created':213423,
+        }
+        ...
+      ],
+    }
+}
+```
+
+>请求参数(所有请求参数皆非必需)

+ 110 - 0
tob/tobDB.md

@@ -0,0 +1,110 @@
+
+### product table structure
+>此表为产品
+
+| field | type | null | default | desc | extra |
+|----|:-----|:-------|:------|:-----|:-----|
+| id | varchar(512) | no | | 订单id | pri |
+| pid | varchar(512) | no | | product id, 课程/配套/课程包 id, | |
+| product_type | float | no | | product type | |
+| gmt_created | unixStamp | no | | 订单创建时间 | |
+
+
+### order table structure
+>此表为订单表
+
+| field | type | null | default | desc | extra |
+|----|:-----|:-------|:------|:-----|:-----|
+| id | varchar(512) | no | | 订单id | pri |
+| uid | varchar(512) | no | | 下单的终端用户id | |
+| finalPrice | float | no | | 订单成交价格 | |
+| priceAdjust | float | no | | 订单价格调整值 | |
+| note | text | no | '' | 下单备注 | |
+| gmt_created | unixStamp | no | | 订单创建时间 | |
+
+---
+
+### order_product_relation table structure
+
+| field | type | null | default | desc | extra |
+|----|:-----|:-------|:------|:-----|:-----|
+| id | varchar(512) | no | | 主键 | pri |
+| order_id | varchar(512) | no | | 订单id |  |
+| pid | varchar(512) | no | | 商品id |  |
+| product_type | smallint | no | | 商品类型,{课程包,配套, 课程} |  |
+| goods_id | varchar(512) | no | | 订单id |  |
+| quantity | int | no | 0 | 购买的数量 | |
+| gmt_created | timestamp | no | | 快照创建时间 | |
+
+##### index
+> index merchant_id, pkg_id, pid, uid
+
+
+---
+
+### sold_product_snapshoot table structure
+>此表为订单商品快照表, 对于课程包, 将课程包作为商品插入后(此时课程包id作为pid), 再将课程包内商品分解再插入一次(此时pkg_id为课程包id, pid为课程包内的商品id)
+
+| field | type | null | default | desc | extra |
+|----|:-----|:-------|:------|:-----|:-----|
+| id | varchar(512) | no | | 主键 | pri |
+| uid | varchar(512) | no | | 下单终端用户id |  |
+| userCode | varchar(512) | no | | 下单终端用户学号 |  |
+| userName | varchar(512) | no | | 下单终端用户名称 |  |
+| campusId | varchar(512) | no | | 下单终端学校 |  |
+| campusCode | varchar(512) | no | | 下单终端学校编号 |  |
+| campusName | varchar(512) | no | | 下单终端学校名称 |  |
+| order_id | varchar(512) | no | | 订单id |  |
+| goods_id | varchar(512) | no | | 订单id |  |
+| pkg_id | varchar | no | '' | 课程包id, 不为空则表示以package方式购买 |  |
+| pid | varchar(512) | no | | 商品id |  |
+| product_type | smallint | no | | 商品类型,{课程包,配套, 课程} |  |
+| product_code | varchar(512) | no | | 商品code |  |
+| product_name | varchar(512) | no | | 商品名称 |  |
+| merchant_id | varchar(512) | no | | 渠道id |  |
+| duration | int | no | | 时长 |  |
+| cp_id | varchar(512) | yes | | cp id |  |
+| cp_price | double(16,2) | no | 0 | 此订单成交时,内容提供商可获得价格, 当pkg_id不为空时,值为cpPriceInPackage | |
+| merchant_price | double(16,2) | no | 0 | 给渠道价格, 当pkg_id不为空时,值为0 | |
+| terminal_price | double(16,2) | no | 0 | 终端显示价格, 当pkg_id不为空时,值为0 | |
+| charge_unit | varchar(512) | no | 0 | 计价单位 | |
+| quantity | int | no | 0 | 购买的数量 | |
+| gmt_created | timestamp | no | | 快照创建时间 | |
+
+##### index
+> index merchant_id, pkg_id, pid, uid
+
+---
+
+### package
+
+| field | type | null | default | desc | extra |
+|----|:-----|:-------|:------|:-----|:-----|
+| id | varchar(512) | no | | 主键 | pri |
+| code | varchar(1024) | yes | null | 课程包编号 | |
+| name | varchar(1024) | no | '' | 课程包名 | |
+| sort | int | no | 0 | 排序字段 | |
+| status | smallint | no | | 状态 | |
+| gmt_created | timestamp | no | now | 创建时间 | |
+| gmt_modified | timestamp | no | now | 更新时间 | | |
+
+##### index
+> index merchant_id
+
+---
+
+### package_product_relation
+> 此表为课程包与商品的对应关系表
+
+| field | type | null | default | desc | extra |
+|----|:-----|:-------|:------|:-----|:-----|
+| id | varchar(512) | no | | 主键 | pri |
+| package_id | varchar(512) | no | | 课程包id | |
+| product_id | varchar(512) | no | | | |
+| cpPriceInPackage | float | no | | 产品在课程包内的cp价格 | |
+| sort | int | no | | 顺序 | |
+| status | smallint | no | | 状态 | |
+| gmt_created | timestamp | no | now | 创建时间 | | |
+
+##### index
+> unique index (package_id, product_id)