data.php 9.1 KB

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