wechat.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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. 'account_id' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => '所属账户',
  46. 'default' => '1',
  47. 'desc' => '所属账户',
  48. 'match' => 'is_numeric',
  49. //'option' => $level,
  50. //'update' => 'select',
  51. //'list' => true,
  52. ),
  53. 'uid' => array
  54. (
  55. 'type' => 'int-11',
  56. 'name' => '用户',
  57. 'default' => '',
  58. 'desc' => '',
  59. 'match' => 'is_numeric',
  60. //'update' => 'select',
  61. 'search' => 'fulltext',
  62. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "未知用户"',
  63. 'list' => true,
  64. //'edit' => true,
  65. ),
  66. 'type' => array
  67. (
  68. 'type' => 'tinyint-1',
  69. 'name' => '类型',
  70. 'default' => '1',
  71. 'desc' => '类型',
  72. 'match' => 'is_numeric',
  73. 'option' => $type,
  74. 'update' => 'radio',
  75. 'list' => true,
  76. ),
  77. 'openid' => array
  78. (
  79. 'type' => 'varchar-50',
  80. 'name' => 'openid-微信的唯一用户id',
  81. 'default' => '',
  82. 'desc' => 'openid',
  83. 'match' => 'is_string',
  84. //'update' => 'text',
  85. 'search' => 'fulltext',
  86. 'list' => true,
  87. ),
  88. 'unionid' => array
  89. (
  90. 'type' => 'varchar-50',
  91. 'name' => 'unionid-微信的唯一用户id',
  92. 'default' => '',
  93. 'desc' => 'unionid',
  94. 'match' => 'is_string',
  95. //'update' => 'text',
  96. 'search' => 'fulltext',
  97. 'list' => true,
  98. ),
  99. 'session_key' => array
  100. (
  101. 'type' => 'varchar-50',
  102. 'name' => 'session_key',
  103. 'default' => '',
  104. 'desc' => 'session_key',
  105. 'match' => 'is_string',
  106. //'update' => 'text',
  107. ),
  108. 'access_token' => array
  109. (
  110. 'type' => 'varchar-200',
  111. 'name' => 'access_token',
  112. 'default' => '',
  113. 'desc' => 'access_token',
  114. 'match' => 'is_string',
  115. //'update' => 'text',
  116. ),
  117. 'refresh_token' => array
  118. (
  119. 'type' => 'varchar-200',
  120. 'name' => 'refresh_token',
  121. 'default' => '',
  122. 'desc' => 'refresh_token',
  123. 'match' => 'is_string',
  124. //'update' => 'text',
  125. ),
  126. 'expires_in' => array
  127. (
  128. 'type' => 'varchar-100',
  129. 'name' => 'expires_in',
  130. 'default' => '',
  131. 'desc' => 'expires_in',
  132. 'match' => 'is_string',
  133. //'update' => 'text',
  134. ),
  135. 'state' => array
  136. (
  137. 'type' => 'tinyint-1',
  138. 'name' => '状态',
  139. 'default' => '1',
  140. 'desc' => '请选择状态',
  141. 'match' => 'is_numeric',
  142. ),
  143. 'cdate' => array
  144. (
  145. 'type' => 'int-11',
  146. 'name' => '录入时间',
  147. 'match' => array('is_numeric', time()),
  148. 'desc' => '',
  149. # 只有insert时才生效
  150. 'search' => 'date',
  151. 'insert' => true,
  152. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  153. ),
  154. ),
  155. 'manage' => array
  156. (
  157. 'insert' => false,
  158. 'edit' => false,
  159. 'delete' => false,
  160. ),
  161. # 索引
  162. 'index' => array
  163. (
  164. 11 => array
  165. (
  166. 'openid' => 'uid,openid,unionid',
  167. ),
  168. # 版本号 更改版本号会更新当前表的索引
  169. 'version' => 11,
  170. ),
  171. # request 请求接口定义
  172. 'request' => array
  173. (
  174. 'getByUnionid' => array
  175. (
  176. 'option' => array
  177. (
  178. 'unionid' => 'yes',
  179. ),
  180. 'type' => 'all',
  181. 'order' => array('id' => 'asc'),
  182. 'col' => '*',
  183. ),
  184. 'updates' => array
  185. (
  186. 'set' => array
  187. (
  188. 'uid' => 'yes',
  189. ),
  190. 'where' => array
  191. (
  192. 'uid' => array('yes', 'in'),
  193. ),
  194. 'type' => 'update',
  195. ),
  196. 'updateByOpenid' => array
  197. (
  198. 'set' => array
  199. (
  200. 'session_key' => 'yes',
  201. ),
  202. 'where' => array
  203. (
  204. 'openid' => 'yes',
  205. ),
  206. 'type' => 'update',
  207. ),
  208. ),
  209. );