code.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '发送中',
  6. 2 => '已发送',
  7. );
  8. $mobile = Dever::rule('mobile');
  9. return array
  10. (
  11. # 表名
  12. 'name' => 'code',
  13. # 显示给用户看的名称
  14. 'lang' => '短信记录表',
  15. 'menu' => false,
  16. # 数据结构
  17. 'struct' => array
  18. (
  19. 'id' => array
  20. (
  21. 'type' => 'int-11',
  22. 'name' => 'ID',
  23. 'default' => '',
  24. 'desc' => '',
  25. 'match' => 'is_numeric',
  26. 'search' => 'order',
  27. //'list' => true,
  28. ),
  29. 'mobile' => array
  30. (
  31. 'type' => 'varchar-32',
  32. 'name' => '手机号',
  33. 'default' => '',
  34. 'desc' => '请输入用户手机号',
  35. 'match' => $mobile,
  36. 'update' => 'text',
  37. 'search' => 'fulltext',
  38. 'list' => true,
  39. ),
  40. 'code' => array
  41. (
  42. 'type' => 'varchar-32',
  43. 'name' => '验证码',
  44. 'default' => '',
  45. 'desc' => '验证码',
  46. 'match' => 'is_string',
  47. 'update' => 'text',
  48. 'search' => 'fulltext',
  49. 'list' => true,
  50. ),
  51. 'day' => array
  52. (
  53. 'type' => 'int-11',
  54. 'name' => '申请时间',
  55. 'default' => '',
  56. 'desc' => '申请时间',
  57. 'match' => 'is_numeric',
  58. 'update' => 'text',
  59. 'search' => 'fulltext',
  60. 'list' => true,
  61. ),
  62. 'state' => array
  63. (
  64. 'type' => 'tinyint-1',
  65. 'name' => '状态',
  66. 'default' => '1',
  67. 'desc' => '请选择状态',
  68. 'match' => 'is_numeric',
  69. 'option' => $option,
  70. //'update' => 'radio',
  71. 'list' => true,
  72. ),
  73. 'cdate' => array
  74. (
  75. 'type' => 'int-11',
  76. 'name' => '申请时间',
  77. 'match' => array('is_numeric', time()),
  78. 'desc' => '',
  79. # 只有insert时才生效
  80. 'insert' => true,
  81. 'search' => 'date',
  82. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  83. ),
  84. ),
  85. 'request' => array
  86. (
  87. 'getNew' => array
  88. (
  89. # 匹配的正则或函数 选填项
  90. 'option' => array
  91. (
  92. 'day' => 'yes',
  93. 'mobile' => 'yes',
  94. 'state' => 1,
  95. ),
  96. 'type' => 'one',
  97. 'order' => array('id' => 'desc'),
  98. ),
  99. ),
  100. );