wechat.php 4.3 KB

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