data.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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. 'location' => array
  108. (
  109. 'type' => 'int-11',
  110. 'name' => '投放位置-选填项,请输入投放位置,直接输入位置的数字即可,默认为0则无需位置',
  111. 'default' => '0',
  112. 'desc' => '投放位置',
  113. 'match' => 'option',
  114. 'update' => 'text',
  115. ),
  116. 'ad_type' => array
  117. (
  118. 'type' => 'int-11',
  119. 'name' => '广告类型',
  120. 'default' => '1',
  121. 'desc' => '请选择广告类型',
  122. 'match' => 'is_numeric',
  123. 'option' => $ad_type,
  124. 'update' => 'radio',
  125. 'control' => 'ad_type',
  126. ),
  127. 'type' => array
  128. (
  129. 'type' => 'tinyint-1',
  130. 'name' => '投放类型',
  131. 'default' => '1',
  132. 'desc' => '投放类型',
  133. 'match' => 'is_numeric',
  134. 'option' => $type,
  135. 'update' => 'radio',
  136. 'search' => 'select',
  137. 'list' => true,
  138. 'control' => 'type',
  139. ),
  140. 'sdate' => array
  141. (
  142. 'type' => 'int-11',
  143. 'name' => '开始投放时间',
  144. 'default' => '',
  145. 'desc' => '开始投放时间',
  146. 'match' => 'is_numeric',
  147. 'update' => 'date',
  148. 'search' => 'date',
  149. 'list_name' => '投放数据',
  150. 'list' => 'Dever::load("ad/lib/manage.getTotalNum", {id})',
  151. 'callback' => 'maketime',
  152. 'show' => 'type=2',
  153. ),
  154. 'edate' => array
  155. (
  156. 'type' => 'int-11',
  157. 'name' => '结束投放时间',
  158. 'default' => '',
  159. 'desc' => '结束投放时间',
  160. 'match' => 'is_numeric',
  161. 'update' => 'date',
  162. 'search' => 'date',
  163. //'list' => 'date("Y-m-d H:i:s", {edate})',
  164. 'callback' => 'maketime',
  165. 'show' => 'type=2',
  166. ),
  167. 'info_id' => array
  168. (
  169. 'type' => 'int-11',
  170. 'name' => '广告位',
  171. 'default' => Dever::input('search_option_info_id', '1'),
  172. 'desc' => '选择所属广告位',
  173. 'match' => 'is_numeric',
  174. 'option' => $info,
  175. 'update' => 'hidden',
  176. 'search' => 'select',
  177. //'list' => true,
  178. 'value' => Dever::input('search_option_info_id', '1'),
  179. ),
  180. 'pic' => array
  181. (
  182. 'type' => 'varchar-150',
  183. 'name' => '广告图',
  184. 'default' => '',
  185. 'desc' => '广告图',
  186. 'match' => 'is_string',
  187. 'update' => $pic,
  188. 'key' => '1',
  189. 'place' => '150',
  190. 'show' => 'ad_type=1,4',
  191. ),
  192. 'video' => array
  193. (
  194. 'type' => 'varchar-800',
  195. 'name' => '广告视频-视频格式mp4,mov,上传大小不能超过4G',
  196. 'default' => '',
  197. 'desc' => '广告视频',
  198. 'match' => 'is_string',
  199. 'update' => $video,
  200. 'key' => '3',
  201. 'place' => '150',
  202. 'upload' => 'qiniu',
  203. 'large' => true,
  204. //不覆盖原文件,生成新文件
  205. 'cover' => 2,
  206. 'show' => 'ad_type=2',
  207. ),
  208. 'code' => array
  209. (
  210. 'type' => 'text-255',
  211. 'name' => '广告代码',
  212. 'default' => '',
  213. 'desc' => '广告代码',
  214. 'match' => 'option',
  215. 'update' => $code,
  216. 'show' => 'ad_type=3',
  217. ),
  218. 'link' => array
  219. (
  220. 'type' => 'varchar-500',
  221. 'name' => '跳转链接',
  222. 'default' => '',
  223. 'desc' => '请输入跳转链接',
  224. 'match' => 'option',
  225. 'update' => $link,
  226. 'show' => 'ad_type=1,2,4',
  227. ),
  228. 'reorder' => array
  229. (
  230. 'type' => 'int-11',
  231. 'name' => '排序(数值越大越靠前)',
  232. 'default' => '1',
  233. 'desc' => '请输入排序',
  234. 'match' => 'option',
  235. 'update' => 'text',
  236. 'search' => 'order',
  237. 'list_name' => '排序',
  238. 'list' => true,
  239. 'order' => 'desc',
  240. //'edit' => true,
  241. ),
  242. 'state' => array
  243. (
  244. 'type' => 'tinyint-1',
  245. 'name' => '状态',
  246. 'default' => '1',
  247. 'desc' => '请选择状态',
  248. 'match' => 'is_numeric',
  249. ),
  250. 'cdate' => array
  251. (
  252. 'type' => 'int-11',
  253. 'name' => '录入时间',
  254. 'match' => array('is_numeric', time()),
  255. 'desc' => '',
  256. # 只有insert时才生效
  257. 'insert' => true,
  258. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  259. ),
  260. ),
  261. 'manage' => array
  262. (
  263. 'list_button' => array
  264. (
  265. 'list' => array('统计', '"stat&search_option_data_id={id}&oper_parent=data"'),
  266. ),
  267. ),
  268. # request 请求接口定义
  269. 'request' => array
  270. (
  271. 'getAll' => array
  272. (
  273. # 匹配的正则或函数 选填项
  274. 'option' => array
  275. (
  276. 'info_id' => 'yes',
  277. 'state' => 1,
  278. ),
  279. 'type' => 'all',
  280. 'order' => array('id' => 'desc'),
  281. 'col' => '*',
  282. ),
  283. ),
  284. );