wechat.php 4.6 KB

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