code.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <?php
  2. $status = array
  3. (
  4. 1 => '待核销',
  5. 2 => '已核销',
  6. 3 => '已作废',
  7. );
  8. $type = array
  9. (
  10. 1 => '分享领取',
  11. 2 => '手动添加',
  12. );
  13. $act_status = array
  14. (
  15. 1 => '未开始',
  16. 2 => '报名中',
  17. 3 => '报名结束',
  18. 4 => '活动开始',
  19. 5 => '活动结束',
  20. );
  21. $active = function()
  22. {
  23. $array = array();
  24. $data = Dever::db('active/info')->state();
  25. if($data)
  26. {
  27. $array += $data;
  28. }
  29. return $array;
  30. };
  31. $excel = false;
  32. if (Dever::load('manage/auth')->checkFunc('active.code', 'editExcelCode', '数据导出')) {
  33. $excel[] = array('数据导出','数据导出','active/lib/excel.out_active_code');
  34. }
  35. $button = array();
  36. $button['导入订单'] = array('fast', '', 'import&project=upload&call=active/lib/excel.import');
  37. $list_button = array();
  38. $list_button['fast'] = array('添加座位号', '"code&where_id={id}&col=seat_num&oper_save_jump=code&oper_table=code&oper_parent=code"');
  39. if (Dever::load('manage/auth')->checkFunc('active.code', 'edithexiaocode', '核销')) {
  40. $list_button['oper1'] = array('核销', '"active/lib/manage.upCode?id={id}"', "{status} == 1");
  41. }
  42. return array
  43. (
  44. # 表名
  45. 'name' => 'code',
  46. # 显示给用户看的名称
  47. 'lang' => '活动核销码',
  48. # 后台菜单排序
  49. 'order' => 2,
  50. // 'menu' => false,
  51. # 数据结构
  52. 'struct' => array
  53. (
  54. 'id' => array
  55. (
  56. 'type' => 'int-11',
  57. 'name' => 'ID',
  58. 'default' => '',
  59. 'desc' => '',
  60. 'match' => 'is_numeric',
  61. 'search' => 'order',
  62. 'list' => true,
  63. 'order' => 'desc',
  64. ),
  65. 'active_id' => array
  66. (
  67. 'type' => 'int-11',
  68. 'name' => '活动名称',
  69. 'default' => '-1',
  70. 'desc' => '活动名称',
  71. 'match' => 'is_string',
  72. 'update' => 'hidden',
  73. 'value' => Dever::input('search_option_active_id'),
  74. 'option' => $active,
  75. 'search' => 'select',
  76. // 'search' => array
  77. // (
  78. // 'api' => 'active/info-getSearch',
  79. // 'col' => 'col',
  80. // 'result' => 'id',
  81. // 'search' => 'active_id',
  82. // ),
  83. 'list' => "Dever::load('active/lib/manage.active#active_name',{active_id})",
  84. ),
  85. 'order_id' => array
  86. (
  87. 'type' => 'int-11',
  88. 'name' => '订单名称',
  89. 'default' => '-1',
  90. 'desc' => '订单名称',
  91. 'match' => 'is_string',
  92. 'update' => 'hidden',
  93. // 'search' => 'text',
  94. // 'list' => true,
  95. ),
  96. 'join_uid' => array
  97. (
  98. 'type' => 'int-11',
  99. 'name' => '参加人名称/手机号',
  100. 'default' => '-1',
  101. 'desc' => '用户名称',
  102. 'match' => 'is_string',
  103. // 'option' => $user,
  104. // 'update' => 'text',
  105. 'search' => array
  106. (
  107. 'api' => 'active/user-getSearch',
  108. 'col' => 'col',
  109. 'result' => 'id',
  110. 'search' => 'join_uid',
  111. ),
  112. 'list_name' => '参加人信息',
  113. 'list' => "Dever::load('active/lib/manage.user',{join_uid})",
  114. ),
  115. 'buy_uid' => array
  116. (
  117. 'type' => 'int-11',
  118. 'name' => '购买人姓名/手机号',
  119. 'default' => '-1',
  120. 'desc' => '用户名称',
  121. 'match' => 'is_string',
  122. // 'option' => $user,
  123. // 'update' => 'text',
  124. 'search' => array
  125. (
  126. 'api' => 'active/user-getSearch',
  127. 'col' => 'col',
  128. 'result' => 'id',
  129. 'search' => 'buy_uid',
  130. ),
  131. 'list_name' => '购买人信息',
  132. 'list' => "Dever::load('active/lib/manage.user',{buy_uid})",
  133. ),
  134. 'write_code' => array
  135. (
  136. 'type' => 'varchar-200',
  137. 'name' => '核销码',
  138. 'default' => '',
  139. 'desc' => '核销码',
  140. 'match' => 'is_string',
  141. // 'update' => 'text',
  142. 'search' => 'fulltext',
  143. 'list' => true,
  144. ),
  145. 'seat_num' => array
  146. (
  147. 'type' => 'varchar-200',
  148. 'name' => '座位号',
  149. 'default' => '',
  150. 'desc' => '座位号',
  151. 'match' => 'option',
  152. 'update' => 'text',
  153. 'search' => 'fulltext',
  154. 'list' => true,
  155. ),
  156. 'act_status' => array
  157. (
  158. 'type' => 'tinyint-1',
  159. 'name' => '活动状态',
  160. 'default' => '1',
  161. 'desc' => '活动状态',
  162. 'match' => 'is_numeric',
  163. // 'update' => 'radio',
  164. 'option' => $act_status,
  165. // 'search' => 'select',
  166. // 'list' => true,
  167. ),
  168. 'status' => array
  169. (
  170. 'type' => 'tinyint-1',
  171. 'name' => '核销状态',
  172. 'default' => '1',
  173. 'desc' => '核销状态',
  174. 'match' => 'is_numeric',
  175. 'option' => $status,
  176. 'search' => 'select',
  177. 'list' => true,
  178. ),
  179. 'type' => array
  180. (
  181. 'type' => 'tinyint-1',
  182. 'name' => '核销码来自哪的状态',
  183. 'default' => '1',
  184. 'desc' => '核销码来自哪的状态',
  185. 'match' => 'is_numeric',
  186. 'option' => $type,
  187. // 'search' => 'select',
  188. // 'list' => true,
  189. ),
  190. 'pic' => array
  191. (
  192. 'type' => 'text-255',
  193. 'name' => '二维码',
  194. 'default' => '',
  195. 'desc' => '二维码',
  196. 'match' => 'option',
  197. // 'update' => 'image',
  198. 'key' => '1',
  199. // 'place' => '759*562',
  200. ),
  201. 'offdate' => array
  202. (
  203. 'type' => 'int-11',
  204. 'name' => '核销时间',
  205. 'default' => '',
  206. 'match' => 'is_numeric',
  207. // 'search' => 'date',
  208. // 'desc' => '',
  209. // 'list' => 'date("Y-m-d H:i:s", {zdate})',
  210. ),
  211. 'audit_admin' => array
  212. (
  213. 'type' => 'int-11',
  214. 'name' => '核销操作人',
  215. 'default' => '',
  216. 'match' => 'is_numeric',
  217. 'desc' => '核销操作人',
  218. 'list' => 'Dever::load("active/lib/manage.active#admin_name",{id})',
  219. // '"{audit_admin}" > 0 ? Dever::load("manage/admin-find#username", {audit_admin}) : "-"',
  220. // 'list_order' => 8,
  221. ),
  222. 'top_admin' => array
  223. (
  224. 'type' => 'int-11',
  225. 'name' => '前台核销操作人',
  226. 'default' => '',
  227. 'match' => 'is_numeric',
  228. 'desc' => '核销操作人',
  229. // 'list' => '"{audit_admin}" > 0 ? Dever::load("manage/admin-find#username", {audit_admin}) : "-"',
  230. // 'list_order' => 8,
  231. ),
  232. 'content' => array
  233. (
  234. 'type' => 'text-255',
  235. 'name' => '填写手机号-多个换行隔开,如手机号重复将不会录入到库中',
  236. 'default' => '',
  237. 'desc' => '填写手机号',
  238. 'match' => 'is_string',
  239. 'update' => 'textarea',
  240. 'value' => '',
  241. // 'show' => 'type=2',
  242. ),
  243. 'state' => array
  244. (
  245. 'type' => 'tinyint-1',
  246. 'name' => '状态',
  247. 'default' => '1',
  248. 'desc' => '请选择状态',
  249. 'match' => 'is_numeric',
  250. ),
  251. 'cdate' => array
  252. (
  253. 'type' => 'int-11',
  254. 'name' => '领取日期',
  255. 'match' => array('is_numeric', time()),
  256. 'desc' => '',
  257. # 只有insert时才生效
  258. 'insert' => true,
  259. 'search' => 'day',
  260. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  261. 'list_order' => 5,
  262. ),
  263. ),
  264. 'manage' => array
  265. (
  266. 'insert' => false,
  267. 'delete' => false,
  268. 'edit' => false,
  269. 'excel' => $excel,
  270. 'button' => $button,
  271. 'list_button' => $list_button,
  272. // array
  273. // (
  274. // 'fast' => array('添加座位号', '"code&where_id={id}&col=seat_num&oper_save_jump=code&oper_table=code&oper_parent=code"'),
  275. // 'oper1' => array('手动核销', '"active/lib/manage.upCode?id={id}"', "{status} == 1"),
  276. // ),
  277. ),
  278. 'request' => array
  279. (
  280. 'getAll' => array
  281. (
  282. # 匹配的正则或函数 选填项
  283. 'option' => array
  284. (
  285. 'join_uid' => 'yes',
  286. 'state' => 1,
  287. ),
  288. 'type' => 'all',
  289. 'order' => array('cdate' => 'desc'),
  290. 'col' => '*',
  291. ),
  292. 'getOne' => array
  293. (
  294. # 匹配的正则或函数 选填项
  295. 'option' => array
  296. (
  297. 'join_uid' => 'yes',
  298. 'active_id' =>'yes',
  299. 'status' => array('yes','in'),
  300. 'state' => 1,
  301. ),
  302. 'type' => 'one',
  303. // 'order' => array('cdate' => 'desc'),
  304. 'col' => '*',
  305. ),
  306. 'getCode' => array
  307. (
  308. # 匹配的正则或函数 选填项
  309. 'option' => array
  310. (
  311. 'order_id' => 'yes',
  312. 'status' => array('yes','in'),
  313. 'state' => 1,
  314. ),
  315. 'type' => 'all',
  316. 'order' => array('cdate' => 'desc'),
  317. 'col' => '*',
  318. ),
  319. 'getNum' => array
  320. (
  321. # 匹配的正则或函数 选填项
  322. 'option' => array
  323. (
  324. 'active_id' => 'yes',
  325. 'buy_uid' => 'yes',
  326. 'status' => array('yes','in'),
  327. 'state' => 1,
  328. ),
  329. 'type' => 'count',
  330. // 'order' => array('cdate' => 'desc'),
  331. 'col' => '*',
  332. ),
  333. 'getExcel' => array
  334. (
  335. # 匹配的正则或函数 选填项
  336. 'option' => array
  337. (
  338. 'order_id' => 'yes',
  339. 'status' => 'yes',
  340. 'state' => 1,
  341. ),
  342. 'type' => 'count',
  343. // 'order' => array('cdate' => 'desc'),
  344. 'col' => '*',
  345. ),
  346. ),
  347. );