data.php 7.9 KB

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