member.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. <?php
  2. $role = function()
  3. {
  4. $array = array();
  5. $data = Dever::load('setting/role-state');
  6. if($data)
  7. {
  8. $array += $data;
  9. }
  10. return $array;
  11. };
  12. $status = array
  13. (
  14. 1 => '未认证',
  15. 2 => '正常',
  16. 3 => '驳回',
  17. 4 => '已删除',
  18. 5 => '已禁用',
  19. );
  20. $type = array
  21. (
  22. 1 => '个人',
  23. 2 => '公司',
  24. );
  25. $source_id = function()
  26. {
  27. $array = array
  28. (
  29. -1 => array
  30. (
  31. 'id' => '-1',
  32. 'name' => '无来源',
  33. ),
  34. );
  35. $data = Dever::load('setting/source-state');
  36. if($data)
  37. {
  38. $array += $data;
  39. }
  40. return $array;
  41. };
  42. $level = function()
  43. {
  44. $array = array
  45. (
  46. -1 => array
  47. (
  48. 'id' => -1,
  49. 'name' => '普通',
  50. ),
  51. );
  52. $data = Dever::load('setting/level-state');
  53. if($data)
  54. {
  55. $array += $data;
  56. }
  57. return $array;
  58. };
  59. $info = '';
  60. $button = array();
  61. $getInfo = Dever::input('getInfo');
  62. $pmid = Dever::input('search_option_pmid');
  63. $parent_mid = Dever::input('search_option_parent_mid');
  64. $search_api_parent_mid = Dever::input('search_api_parent_mid');
  65. if ($search_api_parent_mid && $getInfo != 1) {
  66. Dever::setInput('search_api_parent_mid', 0);
  67. $parent = Dever::db('agent/member')->find(array('mobile' => $search_api_parent_mid));
  68. if ($parent) {
  69. $info = '上级' . Dever::load('agent/lib/member')->getInfoString($parent) . ', 以下为直推列表:';
  70. }
  71. } elseif ($parent_mid && $parent_mid > 0 && $getInfo != 1) {
  72. $info = '上级' . Dever::load('agent/lib/member')->getInfoString($parent_mid) . ', 以下为直推列表:';
  73. $button = array
  74. (
  75. '返回上一页' => array('location', 'l=project/database/list&project=agent&table=member_area&page_type=1&mid=' . $parent_mid),
  76. );
  77. }
  78. return array
  79. (
  80. # 表名
  81. 'name' => 'member',
  82. # 显示给用户看的名称
  83. 'lang' => '代理商管理',
  84. 'order' => 100,
  85. 'auto' => 1000000,
  86. 'config_type' => $type,
  87. 'config_status' => $status,
  88. 'info' => $info,
  89. # 数据结构
  90. 'struct' => array
  91. (
  92. 'id' => array
  93. (
  94. 'type' => 'int-11',
  95. 'name' => 'ID',
  96. 'default' => '',
  97. 'desc' => '',
  98. 'match' => 'is_numeric',
  99. 'search' => 'order',
  100. //'list' => true,
  101. ),
  102. 'name' => array
  103. (
  104. 'type' => 'varchar-100',
  105. 'name' => '姓名',
  106. 'default' => '',
  107. 'desc' => '姓名',
  108. 'match' => 'is_string',
  109. 'update' => 'text',
  110. 'search' => ($parent_mid || $pmid) ? 'hidden' : 'fulltext',
  111. 'list' => 'Dever::load("agent/lib/member.getOne", {id})',
  112. ),
  113. 'rdate' => array
  114. (
  115. 'type' => 'int-11',
  116. 'name' => '认证时间',
  117. 'match' => 'option',
  118. 'default' => '0',
  119. 'desc' => '',
  120. 'update' => 'date',
  121. 'callback' => 'maketime',
  122. 'list' => '{rdate} > 0 ? date("Y-m-d H:i", {rdate}) : "无"',
  123. ),
  124. 'avatar' => array
  125. (
  126. 'type' => 'varchar-150',
  127. 'name' => '头像',
  128. 'default' => '',
  129. 'desc' => '请选择头像',
  130. 'match' => 'option',
  131. 'update' => 'image',
  132. 'key' => '1',
  133. 'place' => '150',
  134. ),
  135. 'mobile' => array
  136. (
  137. 'type' => 'bigint-11',
  138. 'name' => '手机号',
  139. 'default' => '',
  140. 'desc' => '请输入手机号',
  141. 'match' => Dever::rule('mobile'),
  142. 'update' => 'text',
  143. 'search' => ($parent_mid || $pmid) ? 'hidden' : 'fulltext',
  144. //'list' => true,
  145. ),
  146. 'email' => array
  147. (
  148. 'type' => 'varchar-150',
  149. 'name' => '邮箱',
  150. 'default' => '',
  151. 'desc' => '请输入邮箱',
  152. 'match' => 'option',
  153. 'update' => 'text',
  154. ),
  155. 'username' => array
  156. (
  157. 'type' => 'varchar-100',
  158. 'name' => '昵称',
  159. 'default' => '',
  160. 'desc' => '昵称',
  161. 'match' => 'is_string',
  162. 'update' => 'text',
  163. ),
  164. 'birthday' => array
  165. (
  166. 'type' => 'int-11',
  167. 'name' => '生日',
  168. 'default' => '',
  169. 'match' => 'option',
  170. 'desc' => '生日',
  171. 'update' => 'time',
  172. 'callback' => 'maketime',
  173. ),
  174. 'password' => array
  175. (
  176. 'type' => 'varchar-50',
  177. 'name' => '密码',
  178. 'default' => '',
  179. 'desc' => '请输入密码',
  180. 'match' => 'option',
  181. 'update' => 'password',
  182. 'callback' => 'sha1',
  183. ),
  184. 'parent_mid' => array
  185. (
  186. 'type' => 'int-11',
  187. 'name' => '邀请人手机号',
  188. 'default' => '-1',
  189. 'desc' => '邀请人',
  190. 'match' => 'is_string',
  191. 'update' => 'text',
  192. 'search' => $parent_mid ? 'hidden' : array
  193. (
  194. 'api' => 'agent/member-select',
  195. 'col' => 'mobile',
  196. 'result' => 'id',
  197. ),
  198. 'list_name' => '邀请人',
  199. 'list' => ($parent_mid || $pmid) ? false : 'Dever::load("agent/lib/member.getOne", {parent_mid})',
  200. ),
  201. 'source_id' => array
  202. (
  203. 'type' => 'int-11',
  204. 'name' => '注册来源',
  205. 'default' => '-1',
  206. 'desc' => '注册来源',
  207. 'match' => 'is_numeric',
  208. 'search' => 'select',
  209. 'update' => 'checkbox',
  210. 'option' => $source_id,
  211. 'list' => true,
  212. ),
  213. 'pmid' => array
  214. (
  215. 'type' => 'int-11',
  216. 'name' => '邀请人id-废弃无用处',
  217. 'default' => '-1',
  218. 'desc' => '邀请人',
  219. 'match' => 'is_string',
  220. 'update' => 'text',
  221. 'search' => 'hidden',
  222. ),
  223. 'code' => array
  224. (
  225. 'type' => 'varchar-50',
  226. 'name' => '邀请码',
  227. 'default' => '',
  228. 'desc' => '邀请码',
  229. 'match' => 'option',
  230. //'update' => 'text',
  231. 'list' => ($parent_mid || $pmid) ? false : 'Dever::load("invite/api.code", {id})',
  232. ),
  233. 'role' => array
  234. (
  235. 'type' => 'int-11',
  236. 'name' => '代理角色',
  237. 'default' => '',
  238. 'desc' => '代理角色',
  239. 'match' => 'is_numeric',
  240. 'search' => 'select',
  241. 'update' => 'select',
  242. 'option' => $role,
  243. //'list' => true,
  244. ),
  245. 'level_id' => array
  246. (
  247. 'type' => 'int-11',
  248. 'name' => '代理商等级',
  249. 'default' => '-1',
  250. 'desc' => '代理商等级',
  251. 'match' => 'is_numeric',
  252. 'search' => 'select',
  253. 'update' => 'select',
  254. 'option' => $level,
  255. //'list' => true,
  256. ),
  257. 'area' => array
  258. (
  259. 'type' => 'varchar-500',
  260. 'name' => '区域',
  261. 'default' => '',
  262. 'desc' => '区域',
  263. 'match' => 'option',
  264. 'search' => 'linkage',
  265. 'update' => 'linkage',
  266. 'option' => Dever::url('api.get?level_total=4', 'area'),
  267. 'list' => 'Dever::load("area/api.string", "{area}")',
  268. ),
  269. 'shop_id' => array
  270. (
  271. 'type' => 'int-11',
  272. 'name' => '所属门店',
  273. 'default' => '',
  274. 'desc' => '所属门店',
  275. 'match' => 'is_numeric',
  276. 'update' => 'select',
  277. 'update_search' => 'shop/lib/manage.search',
  278. 'list' => ($parent_mid || $pmid) ? false : '{shop_id} > 0 ? Dever::load("shop/info-one#name", {shop_id}) : "无"',
  279. ),
  280. 'type' => array
  281. (
  282. 'type' => 'tinyint-1',
  283. 'name' => '类型',
  284. 'default' => '1',
  285. 'desc' => '类型',
  286. 'match' => 'is_numeric',
  287. 'option' => $type,
  288. 'update' => 'radio',
  289. 'control' => 'type',
  290. ),
  291. 'sign' => array
  292. (
  293. 'type' => 'varchar-150',
  294. 'name' => '手写签名',
  295. 'default' => '',
  296. 'desc' => '手写签名',
  297. 'match' => 'option',
  298. 'update' => 'image',
  299. 'key' => '7',
  300. ),
  301. 'idcard' => array
  302. (
  303. 'type' => 'varchar-32',
  304. 'name' => '身份证号码',
  305. 'default' => '',
  306. 'desc' => '身份证号码',
  307. 'match' => 'is_string',
  308. 'update' => 'text',
  309. ),
  310. 'idcard_front' => array
  311. (
  312. 'type' => 'varchar-150',
  313. 'name' => '身份证正面',
  314. 'default' => '',
  315. 'desc' => '身份证正面',
  316. 'match' => 'option',
  317. 'update' => 'image',
  318. 'key' => '8',
  319. 'place' => '660*660',
  320. ),
  321. 'idcard_back' => array
  322. (
  323. 'type' => 'varchar-150',
  324. 'name' => '身份证背面',
  325. 'default' => '',
  326. 'desc' => '身份证背面',
  327. 'match' => 'option',
  328. 'update' => 'image',
  329. 'key' => '8',
  330. 'place' => '660*660',
  331. ),
  332. 'company_name' => array
  333. (
  334. 'type' => 'varchar-100',
  335. 'name' => '公司名称',
  336. 'default' => '',
  337. 'desc' => '公司名称',
  338. 'match' => 'is_string',
  339. 'update' => 'text',
  340. //'search' => 'fulltext',
  341. //'list' => true,
  342. 'show' => 'type=2',
  343. ),
  344. 'company_pic' => array
  345. (
  346. 'type' => 'varchar-150',
  347. 'name' => '营业执照',
  348. 'default' => '',
  349. 'desc' => '营业执照',
  350. 'match' => 'option',
  351. 'update' => 'image',
  352. 'key' => '8',
  353. 'place' => '660*660',
  354. 'show' => 'type=2',
  355. ),
  356. 'company_number' => array
  357. (
  358. 'type' => 'varchar-80',
  359. 'name' => '营业执照号码',
  360. 'default' => '',
  361. 'desc' => '营业执照号码',
  362. 'match' => 'is_string',
  363. 'update' => 'text',
  364. 'show' => 'type=2',
  365. ),
  366. 'address' => array
  367. (
  368. 'type' => 'varchar-800',
  369. 'name' => '地址',
  370. 'default' => '',
  371. 'desc' => '地址',
  372. 'match' => 'is_string',
  373. 'update' => 'text',
  374. ),
  375. 'cash' => array
  376. (
  377. 'type' => 'float-11,2',
  378. 'name' => '余额',
  379. 'default' => '0',
  380. 'desc' => '余额',
  381. 'match' => 'is_numeric',
  382. 'update' => 'text',
  383. 'list' => true,
  384. ),
  385. 'sell' => array
  386. (
  387. 'type' => 'float-11,2',
  388. 'name' => '直推业绩',
  389. 'default' => '0',
  390. 'desc' => '销售业绩',
  391. 'match' => 'is_numeric',
  392. 'update' => 'text',
  393. 'list' => ($parent_mid || $pmid) ? true : false,
  394. ),
  395. 'group_sell' => array
  396. (
  397. 'type' => 'float-11,2',
  398. 'name' => '团队业绩',
  399. 'default' => '0',
  400. 'desc' => '团队销售业绩',
  401. 'match' => 'is_numeric',
  402. 'update' => 'text',
  403. 'list' => ($parent_mid || $pmid) ? true : false,
  404. ),
  405. 'status' => array
  406. (
  407. 'type' => 'tinyint-1',
  408. 'name' => '状态',
  409. 'default' => '1',
  410. 'desc' => '状态',
  411. 'match' => 'is_numeric',
  412. 'option' => $status,
  413. 'search' => 'select',
  414. 'list' => true,
  415. ),
  416. 'state' => array
  417. (
  418. 'type' => 'tinyint-1',
  419. 'name' => '状态',
  420. 'default' => '1',
  421. 'desc' => '请选择状态',
  422. 'match' => 'is_numeric',
  423. ),
  424. 'cdate' => array
  425. (
  426. 'type' => 'int-11',
  427. 'name' => '加入日期',
  428. 'match' => array('is_numeric', time()),
  429. 'desc' => '',
  430. # 只有insert时才生效
  431. //'insert' => true,
  432. //'search' => 'date',
  433. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  434. ),
  435. ),
  436. 'manage' => array
  437. (
  438. 'insert' => false,
  439. 'delete' => false,
  440. 'edit' => false,
  441. 'button' => $button,
  442. 'list_button' => array
  443. (
  444. 'list' => array('查看详情', '"member_area&mid={id}&page_type=1"'),
  445. //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin,tk_status', '{status} == 6'),
  446. //'delete' => array('删除', '', '{status} == 1'),
  447. ),
  448. ),
  449. 'request' => array
  450. (
  451. 'getInfo' => array
  452. (
  453. # 匹配的正则或函数 选填项
  454. 'option' => array
  455. (
  456. 'status' => 2,
  457. 'state' => 1,
  458. ),
  459. 'order' => array('id' => 'desc'),
  460. 'type' => 'one',
  461. 'col' => '*',
  462. ),
  463. 'getData' => array
  464. (
  465. # 匹配的正则或函数 选填项
  466. 'option' => array
  467. (
  468. 'idcard' => 'yes',
  469. 'id' => array('yes', '!='),
  470. 'status' => 2,
  471. 'state' => 1,
  472. ),
  473. 'order' => array('id' => 'desc'),
  474. 'type' => 'all',
  475. 'page' => array(20, 'list'),
  476. 'col' => '*',
  477. ),
  478. 'upCash' => array
  479. (
  480. 'type' => 'update',
  481. 'where' => array
  482. (
  483. 'id' => 'yes',
  484. ),
  485. 'set' => array
  486. (
  487. 'cash' => array('yes', '+='),
  488. ),
  489. ),
  490. 'upSell' => array
  491. (
  492. 'type' => 'update',
  493. 'where' => array
  494. (
  495. 'id' => 'yes',
  496. ),
  497. 'set' => array
  498. (
  499. 'cash' => array('yes', '+='),
  500. 'upcol' => array('yes-sell', '+='),
  501. 'level_id' => 'yes',
  502. ),
  503. ),
  504. 'upGroupSell' => array
  505. (
  506. 'type' => 'update',
  507. 'where' => array
  508. (
  509. 'id' => 'yes',
  510. ),
  511. 'set' => array
  512. (
  513. 'cash' => array('yes', '+='),
  514. 'upcol' => array('yes-group_sell', '+='),
  515. 'level_id' => 'yes',
  516. ),
  517. ),
  518. 'upGroupSellOne' => array
  519. (
  520. 'type' => 'update',
  521. 'where' => array
  522. (
  523. 'id' => 'yes',
  524. ),
  525. 'set' => array
  526. (
  527. 'group_sell' => array('yes', '+='),
  528. ),
  529. ),
  530. ),
  531. );