member.php 18 KB

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