member.php 18 KB

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