product.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <?php
  2. $type = array
  3. (
  4. 1 => '有赞',
  5. 2 => '淘宝',
  6. 3 => '天猫',
  7. );
  8. $set = array
  9. (
  10. 1 => '第三方平台',
  11. 2 => '自有商品',
  12. );
  13. $status = array
  14. (
  15. 1 => '上架',
  16. 2 => '下架',
  17. );
  18. $cate = function()
  19. {
  20. return Dever::db('ku/cate')->state();
  21. };
  22. $brand = function()
  23. {
  24. return Dever::db('ku/brand')->state();
  25. };
  26. return array
  27. (
  28. # 表名
  29. 'name' => 'product',
  30. # 显示给用户看的名称
  31. 'lang' => '商品管理',
  32. 'order' => 10,
  33. 'end' => array
  34. (
  35. 'update' => 'ku/lib/manage.spider',
  36. 'insert' => 'ku/lib/manage.spider',
  37. ),
  38. # 数据结构
  39. 'struct' => array
  40. (
  41. 'id' => array
  42. (
  43. 'type' => 'int-11',
  44. 'name' => 'ID',
  45. 'default' => '',
  46. 'desc' => '',
  47. 'match' => 'is_numeric',
  48. 'search' => 'order',
  49. //'list' => true,
  50. ),
  51. 'set' => array
  52. (
  53. 'type' => 'int-11',
  54. 'name' => '商品类型',
  55. 'default' => '1',
  56. 'desc' => '商品类型',
  57. 'match' => 'is_numeric',
  58. 'option' => $set,
  59. 'search' => 'select',
  60. 'update' => 'radio',
  61. 'control' => 'set',
  62. 'list' => true,
  63. ),
  64. 'type' => array
  65. (
  66. 'type' => 'int-11',
  67. 'name' => '商品来源',
  68. 'default' => '1',
  69. 'desc' => '商品来源',
  70. 'match' => 'is_numeric',
  71. 'option' => $type,
  72. 'search' => 'select',
  73. //'update' => 'radio',
  74. //'control' => 'type',
  75. 'list' => 'Dever::load("ku/lib/manage.showType", "{type}", "{set}")',
  76. ),
  77. 'cate' => array
  78. (
  79. 'type' => 'int-11',
  80. 'name' => '商品分类',
  81. 'default' => '1',
  82. 'desc' => '商品分类',
  83. 'match' => 'is_numeric',
  84. 'option' => $cate,
  85. 'update' => 'select',
  86. 'search' => 'select',
  87. //'control' => 'type',
  88. //'list' => true,
  89. ),
  90. 'brand' => array
  91. (
  92. 'type' => 'int-11',
  93. 'name' => '商品品牌',
  94. 'default' => '0',
  95. 'desc' => '商品品牌',
  96. 'match' => 'is_numeric',
  97. 'option' => $brand,
  98. 'update' => 'select',
  99. 'search' => 'select',
  100. //'control' => 'type',
  101. //'list' => true,
  102. ),
  103. 'link' => array
  104. (
  105. 'type' => 'varchar-300',
  106. 'name' => '商品链接-用于自动抓取商品名称、图片、价格等信息,注意:天猫不能自动抓取,请手动填写商品信息',
  107. 'default' => '',
  108. 'desc' => '商品链接',
  109. 'match' => 'is_string',
  110. 'search' => 'fulltext',
  111. 'update' => 'textarea',
  112. 'show' => 'set=1',
  113. ),
  114. 'code' => array
  115. (
  116. 'type' => 'varchar-500',
  117. 'name' => '淘宝高佣长/短链接或者有赞商城的商品路径-商品路径如:pages/goods/detail/index?alias=3nwqrknhydge',
  118. 'default' => '',
  119. 'desc' => '淘宝高佣长/短链接',
  120. 'match' => 'option',
  121. 'update' => 'textarea',
  122. 'show' => 'set=1',
  123. ),
  124. 'name' => array
  125. (
  126. 'type' => 'varchar-300',
  127. 'name' => '商品名称',
  128. 'default' => '',
  129. 'desc' => '商品名称',
  130. 'search' => 'fulltext',
  131. 'match' => 'option',
  132. 'update' => 'text',
  133. 'list' => '"{link}" ? "<a href=\'{link}\' target=\'_blank\' />{name}</a>" : "{name}"',
  134. ),
  135. 'price' => array
  136. (
  137. 'type' => 'varchar-300',
  138. 'name' => '商品价格-输入整体价格',
  139. 'default' => '',
  140. 'desc' => '商品价格',
  141. 'match' => 'option',
  142. 'update' => 'text',
  143. ),
  144. 'pic' => array
  145. (
  146. 'type' => 'varchar-300',
  147. 'name' => '商品图片',
  148. 'default' => '',
  149. 'desc' => '商品图片',
  150. 'match' => 'option',
  151. 'update' => 'image',
  152. 'key' => '1',
  153. 'list' => '"{pic}" ? "<img src=\'{pic}\' width=\'200\' />" : ""',
  154. ),
  155. 'status' => array
  156. (
  157. 'type' => 'int-11',
  158. 'name' => '是否上架',
  159. 'default' => '1',
  160. 'desc' => '是否上架',
  161. 'match' => 'is_numeric',
  162. 'option' => $status,
  163. 'search' => 'select',
  164. 'update' => 'radio',
  165. //'control' => 'type',
  166. 'list' => true,
  167. 'edit' => true,
  168. ),
  169. 'state' => array
  170. (
  171. 'type' => 'tinyint-1',
  172. 'name' => '状态',
  173. 'default' => '1',
  174. 'desc' => '请选择状态',
  175. 'match' => 'is_numeric',
  176. ),
  177. 'cdate' => array
  178. (
  179. 'type' => 'int-11',
  180. 'name' => '创建时间',
  181. 'match' => array('is_numeric', time()),
  182. 'desc' => '',
  183. # 只有insert时才生效
  184. 'insert' => true,
  185. //'search' => 'date',
  186. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  187. ),
  188. ),
  189. 'manage' => array
  190. (
  191. //'excel' => true,
  192. //'delete' => false,
  193. //'edit' => false,
  194. //'insert' => false,
  195. ),
  196. 'request' => array
  197. (
  198. 'getDataByIds' => array
  199. (
  200. # 匹配的正则或函数 选填项
  201. 'option' => array
  202. (
  203. 'id' => array('yes', 'in'),
  204. 'state' => 1,
  205. ),
  206. 'type' => 'all',
  207. 'order' => array('id' => 'desc'),
  208. 'col' => '*',
  209. ),
  210. 'search' => array
  211. (
  212. # 匹配的正则或函数 选填项
  213. 'option' => array
  214. (
  215. 'name' => array('yes', 'like'),
  216. 'id' => array('yes', 'in'),
  217. 'state' => 1,
  218. ),
  219. 'type' => 'all',
  220. 'order' => array('id', 'desc'),
  221. 'col' => '*,name as value,name as label,cate,pic|id',//这里为了做autocomplete进行测试,必须输出value和label
  222. ),
  223. ),
  224. );