wechat.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <?php
  2. $system_source = Dever::config('base')->system_source;
  3. return array
  4. (
  5. # 表名
  6. 'name' => 'wechat',
  7. # 显示给用户看的名称
  8. 'lang' => '微信绑定列表',
  9. 'order' => 10,
  10. 'menu' => false,
  11. # 数据结构
  12. 'struct' => array
  13. (
  14. 'id' => array
  15. (
  16. 'type' => 'int-11',
  17. 'name' => 'ID',
  18. 'default' => '',
  19. 'desc' => '',
  20. 'match' => 'is_numeric',
  21. //'search' => 'order',
  22. 'order' => 'desc',
  23. 'list' => true,
  24. ),
  25. 'project_id' => array
  26. (
  27. 'type' => 'int-11',
  28. 'name' => '所属项目',
  29. 'default' => '1',
  30. 'desc' => '所属项目',
  31. 'match' => 'is_numeric',
  32. //'option' => $level,
  33. //'update' => 'select',
  34. 'search' => 'fulltext',
  35. 'list' => true,
  36. ),
  37. 'uid' => array
  38. (
  39. 'type' => 'int-11',
  40. 'name' => '用户',
  41. 'default' => '',
  42. 'desc' => '',
  43. 'match' => 'is_numeric',
  44. //'update' => 'select',
  45. 'search' => 'fulltext',
  46. 'list' => true,
  47. //'edit' => true,
  48. ),
  49. 'system_source' => array
  50. (
  51. 'type' => 'tinyint-1',
  52. 'name' => '用户来源',
  53. 'default' => '1',
  54. 'desc' => '用户来源',
  55. 'match' => 'is_numeric',
  56. 'option' => $system_source,
  57. 'update' => 'radio',
  58. 'search' => 'select',
  59. 'list' => true,
  60. ),
  61. 'openid' => array
  62. (
  63. 'type' => 'varchar-50',
  64. 'name' => 'openid-微信的唯一用户id',
  65. 'default' => '',
  66. 'desc' => 'openid',
  67. 'match' => 'is_string',
  68. //'update' => 'text',
  69. 'search' => 'fulltext',
  70. 'list' => true,
  71. ),
  72. 'unionid' => array
  73. (
  74. 'type' => 'varchar-50',
  75. 'name' => 'unionid-微信的唯一用户id',
  76. 'default' => '',
  77. 'desc' => 'unionid',
  78. 'match' => 'is_string',
  79. //'update' => 'text',
  80. 'search' => 'fulltext',
  81. 'list' => true,
  82. ),
  83. 'session_key' => array
  84. (
  85. 'type' => 'varchar-50',
  86. 'name' => 'session_key',
  87. 'default' => '',
  88. 'desc' => 'session_key',
  89. 'match' => 'is_string',
  90. //'update' => 'text',
  91. ),
  92. 'access_token' => array
  93. (
  94. 'type' => 'varchar-200',
  95. 'name' => 'access_token',
  96. 'default' => '',
  97. 'desc' => 'access_token',
  98. 'match' => 'is_string',
  99. //'update' => 'text',
  100. ),
  101. 'refresh_token' => array
  102. (
  103. 'type' => 'varchar-200',
  104. 'name' => 'refresh_token',
  105. 'default' => '',
  106. 'desc' => 'refresh_token',
  107. 'match' => 'is_string',
  108. //'update' => 'text',
  109. ),
  110. 'expires_in' => array
  111. (
  112. 'type' => 'varchar-100',
  113. 'name' => 'expires_in',
  114. 'default' => '',
  115. 'desc' => 'expires_in',
  116. 'match' => 'is_string',
  117. //'update' => 'text',
  118. ),
  119. 'state' => array
  120. (
  121. 'type' => 'tinyint-1',
  122. 'name' => '状态',
  123. 'default' => '1',
  124. 'desc' => '请选择状态',
  125. 'match' => 'is_numeric',
  126. ),
  127. 'cdate' => array
  128. (
  129. 'type' => 'int-11',
  130. 'name' => '录入时间',
  131. 'match' => array('is_numeric', time()),
  132. 'desc' => '',
  133. # 只有insert时才生效
  134. 'search' => 'date',
  135. 'insert' => true,
  136. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  137. ),
  138. ),
  139. 'manage' => array
  140. (
  141. 'insert' => false,
  142. 'edit' => false,
  143. 'delete' => false,
  144. ),
  145. # 索引
  146. 'index' => array
  147. (
  148. 11 => array
  149. (
  150. 'openid' => 'uid,openid,unionid',
  151. ),
  152. # 版本号 更改版本号会更新当前表的索引
  153. 'version' => 11,
  154. ),
  155. # request 请求接口定义
  156. 'request' => array
  157. (
  158. 'getByUnionid' => array
  159. (
  160. 'option' => array
  161. (
  162. 'unionid' => 'yes',
  163. ),
  164. 'type' => 'all',
  165. 'order' => array('id' => 'asc'),
  166. 'col' => '*',
  167. ),
  168. 'updates' => array
  169. (
  170. 'set' => array
  171. (
  172. 'uid' => 'yes',
  173. ),
  174. 'where' => array
  175. (
  176. 'uid' => array('yes', 'in'),
  177. ),
  178. 'type' => 'update',
  179. ),
  180. 'updateByOpenid' => array
  181. (
  182. 'set' => array
  183. (
  184. 'session_key' => 'yes',
  185. ),
  186. 'where' => array
  187. (
  188. 'openid' => 'yes',
  189. ),
  190. 'type' => 'update',
  191. ),
  192. ),
  193. );