data.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. $system = array
  40. (
  41. -1 => '全部',
  42. 1 => 'H5',
  43. 2 => '安卓APP',
  44. 3 => '苹果APP',
  45. 4 => '微信小程序',
  46. );
  47. return array
  48. (
  49. # 表名
  50. 'name' => 'data',
  51. # 显示给用户看的名称
  52. 'lang' => '广告投放',
  53. 'order' => 200,
  54. 'menu' => false,
  55. 'end' => array
  56. (
  57. 'update' => 'ad/lib/manage.upDataCache',
  58. 'insert' => 'ad/lib/manage.upDataCache',
  59. ),
  60. # 数据结构
  61. 'struct' => array
  62. (
  63. 'id' => array
  64. (
  65. 'type' => 'int-11',
  66. 'name' => '投放ID',
  67. 'default' => '',
  68. 'desc' => '',
  69. 'match' => 'is_numeric',
  70. //'search' => 'order',
  71. 'order' => 'desc',
  72. //'list' => true,
  73. ),
  74. 'name' => array
  75. (
  76. 'type' => 'varchar-60',
  77. 'name' => '标题',
  78. 'default' => '',
  79. 'desc' => '请输入标题',
  80. 'match' => 'is_string',
  81. 'update' => 'text',
  82. 'search' => 'fulltext',
  83. 'list' => true,
  84. 'edit' => true,
  85. ),
  86. 'system' => array
  87. (
  88. 'type' => 'tinyint-1',
  89. 'name' => '投放系统',
  90. 'default' => '-1',
  91. 'desc' => '投放系统',
  92. 'match' => 'is_numeric',
  93. 'option' => $system,
  94. 'update' => 'radio',
  95. 'search' => 'select',
  96. 'list' => true,
  97. ),
  98. 'type' => array
  99. (
  100. 'type' => 'tinyint-1',
  101. 'name' => '投放类型',
  102. 'default' => '1',
  103. 'desc' => '投放类型',
  104. 'match' => 'is_numeric',
  105. 'option' => $type,
  106. 'update' => 'radio',
  107. 'search' => 'select',
  108. //'list' => true,
  109. 'control' => 'type',
  110. ),
  111. 'sdate' => array
  112. (
  113. 'type' => 'int-11',
  114. 'name' => '开始投放时间',
  115. 'default' => '',
  116. 'desc' => '开始投放时间',
  117. 'match' => 'is_numeric',
  118. 'update' => 'date',
  119. 'search' => 'date',
  120. 'list_name' => '投放数据',
  121. 'list' => 'Dever::load("ad/lib/manage.getTotalNum", {id})',
  122. 'callback' => 'maketime',
  123. 'show' => 'type=2',
  124. ),
  125. 'edate' => array
  126. (
  127. 'type' => 'int-11',
  128. 'name' => '结束投放时间',
  129. 'default' => '',
  130. 'desc' => '结束投放时间',
  131. 'match' => 'is_numeric',
  132. 'update' => 'date',
  133. 'search' => 'date',
  134. //'list' => 'date("Y-m-d H:i:s", {edate})',
  135. 'callback' => 'maketime',
  136. 'show' => 'type=2',
  137. ),
  138. 'info_id' => array
  139. (
  140. 'type' => 'int-11',
  141. 'name' => '广告位',
  142. 'default' => Dever::input('search_option_info_id', '1'),
  143. 'desc' => '选择所属广告位',
  144. 'match' => 'is_numeric',
  145. 'option' => $info,
  146. 'update' => 'hidden',
  147. 'search' => 'select',
  148. //'list' => true,
  149. 'value' => Dever::input('search_option_info_id', '1'),
  150. ),
  151. 'pic' => array
  152. (
  153. 'type' => 'varchar-150',
  154. 'name' => '广告图',
  155. 'default' => '',
  156. 'desc' => '广告图',
  157. 'match' => 'is_string',
  158. 'update' => $pic,
  159. 'key' => '1',
  160. 'place' => '150',
  161. ),
  162. 'video' => array
  163. (
  164. 'type' => 'varchar-800',
  165. 'name' => '广告视频-视频格式mp4,mov,上传大小不能超过4G',
  166. 'default' => '',
  167. 'desc' => '广告视频',
  168. 'match' => 'is_string',
  169. 'update' => $video,
  170. 'key' => '3',
  171. 'place' => '150',
  172. 'upload' => 'qiniu',
  173. 'large' => true,
  174. //不覆盖原文件,生成新文件
  175. 'cover' => 2,
  176. ),
  177. 'code' => array
  178. (
  179. 'type' => 'text-255',
  180. 'name' => '广告代码',
  181. 'default' => '',
  182. 'desc' => '广告代码',
  183. 'match' => 'option',
  184. 'update' => $code,
  185. ),
  186. 'link' => array
  187. (
  188. 'type' => 'varchar-500',
  189. 'name' => '跳转链接',
  190. 'default' => '',
  191. 'desc' => '请输入跳转链接',
  192. 'match' => 'option',
  193. 'update' => $link,
  194. ),
  195. 'reorder' => array
  196. (
  197. 'type' => 'int-11',
  198. 'name' => '排序(数值越大越靠前)',
  199. 'default' => '1',
  200. 'desc' => '请输入排序',
  201. 'match' => 'option',
  202. 'update' => 'text',
  203. 'search' => 'order',
  204. 'list_name' => '排序',
  205. 'list' => true,
  206. 'order' => 'desc',
  207. //'edit' => true,
  208. ),
  209. 'state' => array
  210. (
  211. 'type' => 'tinyint-1',
  212. 'name' => '状态',
  213. 'default' => '1',
  214. 'desc' => '请选择状态',
  215. 'match' => 'is_numeric',
  216. ),
  217. 'cdate' => array
  218. (
  219. 'type' => 'int-11',
  220. 'name' => '录入时间',
  221. 'match' => array('is_numeric', time()),
  222. 'desc' => '',
  223. # 只有insert时才生效
  224. 'insert' => true,
  225. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  226. ),
  227. ),
  228. 'manage' => array
  229. (
  230. 'list_button' => array
  231. (
  232. 'list' => array('统计', '"stat&search_option_data_id={id}&oper_parent=data"'),
  233. ),
  234. ),
  235. # request 请求接口定义
  236. 'request' => array
  237. (
  238. 'getAll' => array
  239. (
  240. # 匹配的正则或函数 选填项
  241. 'option' => array
  242. (
  243. 'info_id' => 'yes',
  244. 'state' => 1,
  245. ),
  246. 'type' => 'all',
  247. 'order' => array('id' => 'desc'),
  248. 'col' => '*',
  249. ),
  250. ),
  251. );