sell_goods.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <?php
  2. $status = array
  3. (
  4. 1 => '正常',
  5. 2 => '申请退款中',
  6. 3 => '已退款',
  7. );
  8. return array
  9. (
  10. # 表名
  11. 'name' => 'sell_goods',
  12. # 显示给用户看的名称
  13. 'lang' => '订单商品表',
  14. 'menu' => false,
  15. 'status' => $status,
  16. # 数据结构
  17. 'struct' => array
  18. (
  19. 'id' => array
  20. (
  21. 'type' => 'int-11',
  22. 'name' => 'ID',
  23. 'default' => '',
  24. 'desc' => '',
  25. 'match' => 'is_numeric',
  26. 'search' => 'order',
  27. 'update' => 'hidden',
  28. //'list' => true,
  29. ),
  30. 'order_id' => array
  31. (
  32. 'type' => 'int-11',
  33. 'name' => '订单表id',
  34. 'default' => '',
  35. 'desc' => '订单表id',
  36. 'match' => 'is_numeric',
  37. ),
  38. 'seller_id' => array
  39. (
  40. 'type' => 'int-11',
  41. 'name' => '销售商',
  42. 'default' => '',
  43. 'desc' => '销售商',
  44. 'match' => 'is_numeric',
  45. ),
  46. 'goods_id' => array
  47. (
  48. 'type' => 'int-11',
  49. 'name' => '商品名称',
  50. 'default' => '',
  51. 'desc' => '商品名称',
  52. 'match' => 'is_numeric',
  53. ),
  54. 'sku_id' => array
  55. (
  56. 'type' => 'int-11',
  57. 'name' => 'sku_id',
  58. 'default' => '-1',
  59. 'desc' => 'sku_id',
  60. 'match' => 'is_numeric',
  61. ),
  62. 'cash' => array
  63. (
  64. 'type' => 'decimal-11,2',
  65. 'name' => '单价',
  66. 'default' => '',
  67. 'desc' => '单价',
  68. 'match' => 'option',
  69. 'update' => 'text',
  70. 'list' => true,
  71. ),
  72. 'num' => array
  73. (
  74. 'type' => 'int-11',
  75. 'name' => '购买数量',
  76. 'default' => '',
  77. 'desc' => '购买数量',
  78. 'match' => 'is_numeric',
  79. 'search' => 'select',
  80. 'list' => true,
  81. ),
  82. 'pay_cash' => array
  83. (
  84. 'type' => 'decimal-11,2',
  85. 'name' => '支付金额',
  86. 'default' => '',
  87. 'desc' => '支付金额',
  88. 'match' => 'option',
  89. 'update' => 'text',
  90. 'list' => true,
  91. ),
  92. 'card_cash' => array
  93. (
  94. 'type' => 'decimal-11,2',
  95. 'name' => '礼品卡抵扣金额',
  96. 'default' => '0',
  97. 'desc' => '礼品卡抵扣金额',
  98. 'match' => 'option',
  99. 'update' => 'text',
  100. ),
  101. 'wallet_cash' => array
  102. (
  103. 'type' => 'decimal-11,2',
  104. 'name' => '钱包抵扣金额',
  105. 'default' => '0',
  106. 'desc' => '钱包抵扣金额',
  107. 'match' => 'option',
  108. 'update' => 'text',
  109. ),
  110. 'coupon_cash' => array
  111. (
  112. 'type' => 'varchar-300',
  113. 'name' => '优惠金额',
  114. 'default' => '0',
  115. 'desc' => '优惠金额',
  116. 'match' => 'option',
  117. 'update' => 'text',
  118. ),
  119. 'discount_id' => array
  120. (
  121. 'type' => 'int-11',
  122. 'name' => '使用的折扣id',
  123. 'default' => '',
  124. 'desc' => '使用的折扣id',
  125. 'match' => 'option',
  126. ),
  127. 'discount_cash' => array
  128. (
  129. 'type' => 'varchar-300',
  130. 'name' => '折扣优惠金额',
  131. 'default' => '0',
  132. 'desc' => '折扣优惠金额',
  133. 'match' => 'option',
  134. 'update' => 'text',
  135. ),
  136. 'status' => array
  137. (
  138. 'type' => 'int-11',
  139. 'name' => '状态',
  140. 'default' => '1',
  141. 'desc' => '状态',
  142. 'match' => 'is_numeric',
  143. //'update' => 'select',
  144. 'option' => $status,
  145. 'search' => 'select',
  146. 'list' => true,
  147. 'edit' => true,
  148. ),
  149. 'state' => array
  150. (
  151. 'type' => 'tinyint-1',
  152. 'name' => '状态',
  153. 'default' => '1',
  154. 'desc' => '请选择状态',
  155. 'match' => 'is_numeric',
  156. ),
  157. 'cdate' => array
  158. (
  159. 'type' => 'int-11',
  160. 'name' => '创建时间',
  161. 'match' => array('is_numeric', time()),
  162. 'desc' => '',
  163. # 只有insert时才生效
  164. 'insert' => true,
  165. 'search' => 'date',
  166. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  167. ),
  168. ),
  169. 'manage' => array
  170. (
  171. 'insert' => false,
  172. 'delete' => false,
  173. 'page_list' => 'sell_goods',
  174. ),
  175. 'request' => array
  176. (
  177. # 获取单条数据
  178. 'getIds' => array
  179. (
  180. # 匹配的正则或函数 选填项
  181. 'option' => array
  182. (
  183. 'uid' => 'yes',
  184. 'shop_id' => 'yes',
  185. 'order_id' => 'yes',
  186. 'status' => 1,
  187. 'state' => 1,
  188. ),
  189. 'type' => 'all',
  190. 'col' => '*|id',
  191. ),
  192. # 获取多条数据
  193. 'getDataByIds' => array
  194. (
  195. # 匹配的正则或函数 选填项
  196. 'option' => array
  197. (
  198. 'ids' => array('yes-id', 'in'),
  199. 'uid' => 'yes',
  200. 'shop_id' => 'yes',
  201. 'order_id' => 'yes',
  202. 'status' => 'yes',
  203. 'state' => 1,
  204. ),
  205. 'type' => 'all',
  206. 'col' => '*',
  207. ),
  208. # 获取多条数据
  209. 'getTotal' => array
  210. (
  211. # 匹配的正则或函数 选填项
  212. 'option' => array
  213. (
  214. 'order_id' => 'yes',
  215. 'status' => array('yes', 'in'),
  216. 'state' => 1,
  217. ),
  218. 'type' => 'count',
  219. 'col' => '*',
  220. ),
  221. # 获取订单数量
  222. 'getOrderNum' => array
  223. (
  224. # 匹配的正则或函数 选填项
  225. 'option' => array
  226. (
  227. 'start' => array('yes-cdate', '>='),
  228. 'end' => array('yes-cdate', '<='),
  229. 'shop_id' => 'yes',
  230. 'goods_id' => 'yes',
  231. 'status' => 'yes',
  232. 'state' => 1,
  233. ),
  234. 'type' => 'count',
  235. 'col' => '*',
  236. ),
  237. # 获取总金额
  238. 'getCashNum' => array
  239. (
  240. # 匹配的正则或函数 选填项
  241. 'option' => array
  242. (
  243. 'start' => array('yes-cdate', '>='),
  244. 'end' => array('yes-cdate', '<='),
  245. 'shop_id' => 'yes',
  246. 'goods_id' => 'yes',
  247. 'status' => 'yes',
  248. 'state' => 1,
  249. ),
  250. 'type' => 'one',
  251. 'col' => 'sum(price*num) as total',
  252. ),
  253. 'getGoods' => array
  254. (
  255. # 匹配的正则或函数 选填项
  256. 'option' => array
  257. (
  258. 'order_id' => 'yes',
  259. 'state' => 1,
  260. ),
  261. 'type' => 'all',
  262. 'col' => 'id,goods_id',
  263. ),
  264. # 获取总金额
  265. 'getNum' => array
  266. (
  267. # 匹配的正则或函数 选填项
  268. 'option' => array
  269. (
  270. 'start' => array('yes-t_2.cdate', '>='),
  271. 'end' => array('yes-t_2.cdate', '<='),
  272. 'start_o' => array('yes-t_2.operdate', '>='),
  273. 'end_o' => array('yes-t_2.operdate', '<='),
  274. 'shop_id' => array('yes-t_2.shop_id'),
  275. 'goods_id' => array('yes-t_1.goods_id'),
  276. 'status' => array('yes-t_2.status', 'in'),
  277. 'state_2' => 'yes-t_2.state-1',
  278. 'state_1' => 'yes-t_1.state-1',
  279. 'status_1' => 'yes-t_1.status-1',
  280. ),
  281. # 联表
  282. 'join' => array
  283. (
  284. array
  285. (
  286. 'table' => 'shop/sell_order',
  287. 'type' => 'left join',
  288. 'on' => array('order_id','id'),
  289. ),
  290. ),
  291. 'type' => 'all',
  292. 'group' => 't_2.shop_id, t_1.goods_id',
  293. 'col' => 'id,t_2.shop_id, t_1.goods_id,sum(t_1.price*t_1.num) as cash,sum(t_1.num) as num',
  294. ),
  295. ),
  296. );