member.php 19 KB

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