data.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <?php
  2. $info = function()
  3. {
  4. $array = array();
  5. $info = Dever::db('ad/info')->state();
  6. if($info)
  7. {
  8. $array += $info;
  9. }
  10. return $array;
  11. };
  12. $info_id = Dever::input('search_option_info_id');
  13. $config = array();
  14. $pic = 'image';
  15. $video = 'upload';
  16. $code = 'textarea';
  17. $link = 'textarea';
  18. if ($info_id) {
  19. $config = Dever::load('ad/info-one', $info_id);
  20. if ($config['type'] == 1 || $config['type'] == 4) {
  21. $video = 'hidden';
  22. $code = 'hidden';
  23. }
  24. if ($config['type'] == 2) {
  25. $pic = 'hidden';
  26. $code = 'hidden';
  27. }
  28. if ($config['type'] == 3) {
  29. $video = 'hidden';
  30. $pic = 'hidden';
  31. $link = 'hidden';
  32. }
  33. }
  34. $type = array
  35. (
  36. 1 => '永久',
  37. 2 => '时间段',
  38. );
  39. return array
  40. (
  41. # 表名
  42. 'name' => 'data',
  43. # 显示给用户看的名称
  44. 'lang' => '广告投放',
  45. 'order' => 200,
  46. 'menu' => false,
  47. 'end' => array
  48. (
  49. 'update' => 'ad/lib/manage.upDataCache',
  50. 'insert' => 'ad/lib/manage.upDataCache',
  51. ),
  52. # 数据结构
  53. 'struct' => array
  54. (
  55. 'id' => array
  56. (
  57. 'type' => 'int-11',
  58. 'name' => '投放ID',
  59. 'default' => '',
  60. 'desc' => '',
  61. 'match' => 'is_numeric',
  62. //'search' => 'order',
  63. 'order' => 'desc',
  64. 'list' => true,
  65. ),
  66. 'name' => array
  67. (
  68. 'type' => 'varchar-60',
  69. 'name' => '标题',
  70. 'default' => '',
  71. 'desc' => '请输入标题',
  72. 'match' => 'is_string',
  73. 'update' => 'text',
  74. 'search' => 'fulltext',
  75. 'list' => true,
  76. 'edit' => true,
  77. ),
  78. 'type' => array
  79. (
  80. 'type' => 'tinyint-1',
  81. 'name' => '投放类型',
  82. 'default' => '1',
  83. 'desc' => '投放类型',
  84. 'match' => 'is_numeric',
  85. 'option' => $type,
  86. 'update' => 'radio',
  87. 'search' => 'select',
  88. //'list' => true,
  89. 'control' => 'type',
  90. ),
  91. 'sdate' => array
  92. (
  93. 'type' => 'int-11',
  94. 'name' => '开始投放时间',
  95. 'default' => '',
  96. 'desc' => '开始投放时间',
  97. 'match' => 'is_numeric',
  98. 'update' => 'date',
  99. 'search' => 'date',
  100. 'list_name' => '投放时间',
  101. 'list' => '{type} == 2 ? date("Y-m-d H:i:s", {sdate})." 至 ".date("Y-m-d H:i:s", {edate}) : "永久"',
  102. 'callback' => 'maketime',
  103. 'show' => 'type=2',
  104. ),
  105. 'edate' => array
  106. (
  107. 'type' => 'int-11',
  108. 'name' => '结束投放时间',
  109. 'default' => '',
  110. 'desc' => '结束投放时间',
  111. 'match' => 'is_numeric',
  112. 'update' => 'date',
  113. 'search' => 'date',
  114. //'list' => 'date("Y-m-d H:i:s", {edate})',
  115. 'callback' => 'maketime',
  116. 'show' => 'type=2',
  117. ),
  118. 'info_id' => array
  119. (
  120. 'type' => 'int-11',
  121. 'name' => '选择所属广告位',
  122. 'default' => Dever::input('search_option_info_id', '1'),
  123. 'desc' => '选择所属广告位',
  124. 'match' => 'is_numeric',
  125. 'option' => $info,
  126. 'update' => 'hidden',
  127. 'search' => 'select',
  128. 'list' => true,
  129. 'value' => Dever::input('search_option_info_id', '1'),
  130. ),
  131. 'pic' => array
  132. (
  133. 'type' => 'varchar-150',
  134. 'name' => '广告图',
  135. 'default' => '',
  136. 'desc' => '广告图',
  137. 'match' => 'is_string',
  138. 'update' => $pic,
  139. 'key' => '1',
  140. 'place' => '150',
  141. ),
  142. 'video' => array
  143. (
  144. 'type' => 'varchar-800',
  145. 'name' => '广告视频-视频格式mp4,mov,上传大小不能超过4G',
  146. 'default' => '',
  147. 'desc' => '广告视频',
  148. 'match' => 'is_string',
  149. 'update' => $video,
  150. 'key' => '3',
  151. 'place' => '150',
  152. 'upload' => 'qiniu',
  153. 'large' => true,
  154. //不覆盖原文件,生成新文件
  155. 'cover' => 2,
  156. ),
  157. 'code' => array
  158. (
  159. 'type' => 'text-255',
  160. 'name' => '广告代码',
  161. 'default' => '',
  162. 'desc' => '广告代码',
  163. 'match' => 'option',
  164. 'update' => $code,
  165. ),
  166. 'link' => array
  167. (
  168. 'type' => 'varchar-500',
  169. 'name' => '跳转链接',
  170. 'default' => '',
  171. 'desc' => '请输入跳转链接',
  172. 'match' => 'is_string',
  173. 'update' => $link,
  174. ),
  175. 'reorder' => array
  176. (
  177. 'type' => 'int-11',
  178. 'name' => '排序(数值越大越靠前)',
  179. 'default' => '1',
  180. 'desc' => '请输入排序',
  181. 'match' => 'option',
  182. 'update' => 'text',
  183. 'search' => 'order',
  184. 'list_name' => '排序',
  185. 'list' => true,
  186. 'order' => 'desc',
  187. //'edit' => true,
  188. ),
  189. 'state' => array
  190. (
  191. 'type' => 'tinyint-1',
  192. 'name' => '状态',
  193. 'default' => '1',
  194. 'desc' => '请选择状态',
  195. 'match' => 'is_numeric',
  196. ),
  197. 'cdate' => array
  198. (
  199. 'type' => 'int-11',
  200. 'name' => '录入时间',
  201. 'match' => array('is_numeric', time()),
  202. 'desc' => '',
  203. # 只有insert时才生效
  204. 'insert' => true,
  205. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  206. ),
  207. ),
  208. 'manage' => array
  209. (
  210. ),
  211. # request 请求接口定义
  212. 'request' => array
  213. (
  214. 'getAll' => array
  215. (
  216. # 匹配的正则或函数 选填项
  217. 'option' => array
  218. (
  219. 'info_id' => 'yes',
  220. 'state' => 1,
  221. ),
  222. 'type' => 'all',
  223. 'order' => array('id' => 'desc'),
  224. 'col' => '*',
  225. ),
  226. ),
  227. );