ticket.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <?php
  2. return array
  3. (
  4. # 表名
  5. 'name' => 'ticket',
  6. # 显示给用户看的名称
  7. 'lang' => '用户持有合集门票记录',
  8. 'menu' => false,
  9. # 数据结构
  10. 'struct' => array
  11. (
  12. 'id' => array
  13. (
  14. 'type' => 'int-11',
  15. 'name' => 'ID',
  16. 'default' => '',
  17. 'desc' => '',
  18. 'match' => 'is_numeric',
  19. 'search' => 'order',
  20. 'update' => 'hidden',
  21. //'list' => true,
  22. ),
  23. 'uid' => array
  24. (
  25. 'type' => 'int-11',
  26. 'name' => '用户名',
  27. 'default' => '0',
  28. 'desc' => '请选择用户',
  29. 'match' => 'is_numeric',
  30. 'update' => 'text',
  31. //'search' => 'select',
  32. 'search' => array
  33. (
  34. 'api' => 'passport/user-all',
  35. 'col' => 'username',
  36. 'result' => 'id',
  37. ),
  38. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  39. ),
  40. 'info_id' => array
  41. (
  42. 'type' => 'int-11',
  43. 'name' => '合集',
  44. 'default' => '',
  45. 'desc' => '合集',
  46. 'match' => 'is_numeric',
  47. 'update' => 'text',
  48. ),
  49. 'total' => array
  50. (
  51. 'type' => 'int-11',
  52. 'name' => '总数量',
  53. 'default' => '0',
  54. 'desc' => '总数量',
  55. 'match' => 'is_numeric',
  56. 'update' => 'text',
  57. ),
  58. 'num' => array
  59. (
  60. 'type' => 'int-11',
  61. 'name' => '当前拥有数量',
  62. 'default' => '0',
  63. 'desc' => '当前拥有数量',
  64. 'match' => 'is_numeric',
  65. 'update' => 'text',
  66. ),
  67. 'desc' => array
  68. (
  69. 'type' => 'varchar-500',
  70. 'name' => '一句话介绍',
  71. 'default' => '',
  72. 'desc' => '一句话介绍',
  73. 'match' => 'is_string',
  74. 'update' => 'text',
  75. ),
  76. 'state' => array
  77. (
  78. 'type' => 'tinyint-1',
  79. 'name' => '状态',
  80. 'default' => '1',
  81. 'desc' => '请选择状态',
  82. 'match' => 'is_numeric',
  83. ),
  84. 'cdate' => array
  85. (
  86. 'type' => 'int-11',
  87. 'name' => '操作时间',
  88. 'match' => array('is_numeric', time()),
  89. 'desc' => '',
  90. # 只有insert时才生效
  91. //'insert' => true,
  92. 'search' => 'date',
  93. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  94. ),
  95. ),
  96. 'manage' => array
  97. (
  98. ),
  99. 'request' => array
  100. (
  101. # 更新数量
  102. 'add' => array
  103. (
  104. 'type' => 'update',
  105. 'where' => array
  106. (
  107. 'id' => 'yes',
  108. ),
  109. 'set' => array
  110. (
  111. 'num' => array('yes', '+='),
  112. 'total' => array('yes', '+='),
  113. ),
  114. ),
  115. # 减少数量
  116. 'des' => array
  117. (
  118. 'type' => 'update',
  119. 'where' => array
  120. (
  121. 'id' => 'yes',
  122. ),
  123. 'set' => array
  124. (
  125. 'num' => array('yes', '-='),
  126. ),
  127. ),
  128. # 查看数量
  129. 'total' => array
  130. (
  131. # 匹配的正则或函数 选填项
  132. 'option' => array
  133. (
  134. 'uid' => 'yes',
  135. 'info_id' => 'yes',
  136. //'state' => 1,
  137. ),
  138. 'type' => 'one',
  139. 'col' => 'sum(total) as total',
  140. ),
  141. # 查看数量
  142. 'num' => array
  143. (
  144. # 匹配的正则或函数 选填项
  145. 'option' => array
  146. (
  147. 'uid' => 'yes',
  148. 'info_id' => 'yes',
  149. //'state' => 1,
  150. ),
  151. 'type' => 'one',
  152. 'col' => 'sum(num) as num',
  153. ),
  154. ),
  155. );