info.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <?php
  2. # 定义几个常用的选项
  3. $type = array
  4. (
  5. 1 => '未领取',
  6. 2 => '已领取',
  7. 3 => '已使用',
  8. 4 => '已作废',
  9. );
  10. $status = array
  11. (
  12. 1 => '不可用',
  13. 2 => '可用',
  14. );
  15. $product = Dever::load('journal/api.data');
  16. $seller = function()
  17. {
  18. return Dever::db('code/seller')->state();
  19. };
  20. # 获取小刊分类权限
  21. $auth = Dever::tops();
  22. $cate = function() use ($auth)
  23. {
  24. $array = array();
  25. if ($auth) {
  26. $info = Dever::db('journal/cate')->getIds(array('ids' => $auth));
  27. } else {
  28. $info = Dever::db('journal/cate')->state();
  29. }
  30. if($info)
  31. {
  32. $array += $info;
  33. }
  34. return $array;
  35. };
  36. return array
  37. (
  38. # 表名
  39. 'name' => 'info',
  40. # 显示给用户看的名称
  41. 'lang' => '兑换码列表',
  42. 'menu' => 'journal',
  43. 'order' => 1,
  44. # 数据结构
  45. 'struct' => array
  46. (
  47. 'id' => array
  48. (
  49. 'type' => 'int-11',
  50. 'name' => 'ID',
  51. 'default' => '',
  52. 'desc' => '',
  53. 'match' => 'is_numeric',
  54. 'search' => 'order',
  55. 'order' => 'desc',
  56. //'list' => true,
  57. ),
  58. 'create_uid' => array
  59. (
  60. 'type' => 'int-11',
  61. 'name' => '创建人',
  62. 'default' => '-1',
  63. 'desc' => '创建人',
  64. 'match' => 'is_numeric',
  65. 'search' => array
  66. (
  67. 'api' => 'passport/user-all',
  68. 'col' => 'username',
  69. 'result' => 'id',
  70. ),
  71. //'list' => 'Dever::load("code/lib/manage.showUserInfo", "{uid}", "{ldate}")',
  72. ),
  73. 'product' => array
  74. (
  75. 'name' => '小刊',
  76. 'default' => '',
  77. 'desc' => '小刊',
  78. 'search' => 'linkage',
  79. 'search_col' => 'cate_id,product_id',
  80. 'option' => Dever::url('lib/manage.search_cate_journal', 'journal'),
  81. ),
  82. 'cate_id' => array
  83. (
  84. 'type' => 'int-11',
  85. 'name' => '小刊分类',
  86. 'default' => '1',
  87. 'desc' => '小刊分类',
  88. 'match' => 'is_numeric',
  89. 'update' => 'select',
  90. 'option' => $cate,
  91. //'search' => 'select',
  92. 'list' => true,
  93. ),
  94. 'product_id' => array
  95. (
  96. 'type' => 'int-11',
  97. 'name' => '小刊',
  98. 'default' => '',
  99. 'desc' => '小刊',
  100. 'match' => 'is_numeric',
  101. 'update' => 'select',
  102. 'option' => $product,
  103. //'search' => 'select',
  104. 'list' => '{product_id} > 0 ? Dever::load("journal/info-one#name", {product_id}) : "通用"',
  105. ),
  106. 'code' => array
  107. (
  108. 'type' => 'varchar-32',
  109. 'name' => '兑换码',
  110. 'default' => '',
  111. 'desc' => '兑换码',
  112. 'match' => 'is_string',
  113. 'update' => 'text',
  114. 'search' => 'fulltext',
  115. 'list' => '{create_uid} > 0 ? "用户创建" : "{code}"',
  116. 'list' => true,
  117. ),
  118. 'score' => array
  119. (
  120. 'type' => 'varchar-80',
  121. 'name' => '增加积分数-直接填写积分数,设置之后,积分规则里的设置及小刊兑换码中的设置将失效,当设置为0时,直接使用积分规则中的设置。当设置为-1时,不增加积分数',
  122. 'default' => '',
  123. 'desc' => '增加积分数',
  124. 'match' => 'is_string',
  125. //'update' => 'text',
  126. ),
  127. 'product_num' => array
  128. (
  129. 'type' => 'int-11',
  130. 'name' => '兑换本数',
  131. 'default' => '0',
  132. 'desc' => '兑换本数',
  133. 'match' => 'option',
  134. 'update' => 'text',
  135. 'search' => 'fulltext',
  136. 'list' => true,
  137. ),
  138. 'type' => array
  139. (
  140. 'type' => 'int-11',
  141. 'name' => '使用状态',
  142. 'default' => '1',
  143. 'desc' => '使用状态',
  144. 'match' => 'is_numeric',
  145. 'option' => $type,
  146. 'search' => 'select',
  147. 'update' => 'select',
  148. 'list' => true,
  149. 'mul' => array(1 => '恢复使用', 4 => '已作废'),
  150. ),
  151. 'seller_id' => array
  152. (
  153. 'type' => 'int-11',
  154. 'name' => '销售商',
  155. 'default' => '1',
  156. 'desc' => '销售商',
  157. 'match' => 'is_numeric',
  158. 'update' => 'select',
  159. 'option' => $seller,
  160. 'search' => 'select',
  161. 'list' => true,
  162. ),
  163. 'uid' => array
  164. (
  165. 'type' => 'int-11',
  166. 'name' => '用户信息',
  167. 'default' => '0',
  168. 'desc' => '用户信息',
  169. 'match' => 'is_numeric',
  170. 'list' => 'Dever::load("code/lib/manage.showUserInfo", "{create_uid}", "{uid}", "{ldate}")',
  171. ),
  172. 'order_id' => array
  173. (
  174. 'type' => 'varchar-100',
  175. 'name' => '付款订单id',
  176. 'default' => '',
  177. 'desc' => '付款订单id',
  178. 'match' => 'is_string',
  179. 'update' => 'text',
  180. //'list' => true,
  181. //'list' => '"{order_id}" ? "{order_id}" : "{code}"',
  182. ),
  183. 'state' => array
  184. (
  185. 'type' => 'tinyint-1',
  186. 'name' => '状态',
  187. 'default' => '1',
  188. 'desc' => '请选择状态',
  189. 'match' => 'is_numeric',
  190. ),
  191. 'ldate' => array
  192. (
  193. 'type' => 'int-11',
  194. 'name' => '领取时间',
  195. 'match' => 'option',
  196. 'default' => '',
  197. 'desc' => '',
  198. //'search' => 'date',
  199. ),
  200. 'cdate' => array
  201. (
  202. 'type' => 'int-11',
  203. 'name' => '生成时间',
  204. 'match' => array('is_numeric', time()),
  205. 'desc' => '',
  206. # 只有insert时才生效
  207. 'insert' => true,
  208. 'search' => 'date',
  209. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  210. ),
  211. ),
  212. //'top' => Dever::config('base')->top,
  213. # 增加这个,为了给当前的list增加一个option
  214. 'top_option' => array
  215. (
  216. 'value' => $auth,
  217. 'col' => 'cate_id',
  218. ),
  219. # 更新表结构
  220. 'alter' => array
  221. (
  222. 2 => array
  223. (
  224. array('update', 'product_num', 'product_num', 'varchar-32 0 兑换本数'),
  225. //array('add', 'config', 'config', 'int-11 1 配置'),
  226. ),
  227. 'version' => 2,
  228. ),
  229. 'manage' => array
  230. (
  231. 'excel' => true,
  232. 'delete' => false,
  233. 'edit' => false,
  234. 'insert' => false,
  235. 'mul' => '{type} == 1 || {type} == 4',
  236. # 自定义快捷新增和编辑
  237. 'button' => array
  238. (
  239. '新增兑换码' => array('fast', 1, 'config&where_id=1'),
  240. '销售商列表' => array('list', 'seller&project=code&oper_parent=info&oper_project=code'),
  241. '新增销售商' => array('fast', 1, 'seller'),
  242. ),
  243. 'list_button' => array
  244. (
  245. 'oper' => array('作废', 'code/lib/manage.drop?id={id}', '{type} == 1'),
  246. 'oper2' => array('恢复使用', 'code/lib/manage.recovery?id={id}', '{type} == 4'),
  247. ),
  248. ),
  249. 'request' => array
  250. (
  251. 'getAll' => array
  252. (
  253. # 匹配的正则或函数 选填项
  254. 'option' => array
  255. (
  256. 'cate_id' => 'yes',
  257. 'create_uid' => 'yes',
  258. 'state' => 1,
  259. ),
  260. 'type' => 'all',
  261. 'order' => array('cdate' => 'desc'),
  262. 'page' => array(30, 'list'),
  263. 'col' => '*',
  264. ),
  265. 'getData' => array
  266. (
  267. # 匹配的正则或函数 选填项
  268. 'option' => array
  269. (
  270. 'order_id' => 'yes',
  271. 'state' => 1,
  272. ),
  273. 'type' => 'all',
  274. 'order' => array('type' => 'desc', 'cdate' => 'desc'),
  275. 'col' => '*',
  276. ),
  277. )
  278. );