data.php 8.9 KB

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