wechat.php 5.0 KB

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