member.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  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 => array('name' => '未认证', 'style' => 'font-weight:bold;color:#436EEE'),
  15. 2 => array('name' => '正常', 'style' => 'font-weight:bold;color:green'),
  16. //3 => '驳回',
  17. //4 => '已删除',
  18. 5 => array('name' => '已禁用', 'style' => 'font-weight:bold;color:#CD3700'),
  19. );
  20. $type = array
  21. (
  22. 1 => '个人',
  23. 2 => '公司',
  24. );
  25. $prize_type = array
  26. (
  27. 1 => '名额外',
  28. 2 => '名额内',
  29. );
  30. $is_shop = array
  31. (
  32. 1 => '无法修改',
  33. 2 => '可以修改',
  34. );
  35. $import = array
  36. (
  37. 1 => '最新系统',
  38. 2 => 'v2旧系统导入',
  39. 3 => 'v1旧系统导入',
  40. );
  41. $is_area = array
  42. (
  43. 1 => '是',
  44. 2 => '否',
  45. );
  46. $source_id = function()
  47. {
  48. $array = array
  49. (
  50. -1 => array
  51. (
  52. 'id' => '-1',
  53. 'name' => '无来源',
  54. ),
  55. );
  56. $data = Dever::load('setting/source-state');
  57. if($data)
  58. {
  59. $array += $data;
  60. }
  61. return $array;
  62. };
  63. $level = function()
  64. {
  65. $array = array
  66. (
  67. -1 => array
  68. (
  69. 'id' => -1,
  70. 'name' => '普通',
  71. ),
  72. );
  73. $data = Dever::load('setting/level-state');
  74. if($data)
  75. {
  76. $array += $data;
  77. }
  78. return $array;
  79. };
  80. $info = '';
  81. $button = array();
  82. $list_button = array();
  83. $list_button['list'] = array('查看详情', '"member_area&mid={id}&page_type=1&[refer]"');
  84. /*
  85. if (Dever::load('manage/auth')->checkFunc('agent.member', 'edit6', '查看关系图谱')) {
  86. $list_button['list1'] = array('查看关系图谱',Dever::url('lib/manage.relation?mid={id}&[refer].manage', 'agent'));
  87. }
  88. */
  89. # id小于50000为导入的数据
  90. return array
  91. (
  92. # 表名
  93. 'name' => 'member',
  94. # 显示给用户看的名称
  95. 'lang' => '代理商管理',
  96. 'order' => 100,
  97. 'auto' => 50000,
  98. 'config_type' => $type,
  99. 'config_status' => $status,
  100. 'info' => $info,
  101. 'start' => array
  102. (
  103. 'update' => 'agent/lib/manage.updateArea',
  104. ),
  105. # 数据结构
  106. 'struct' => array
  107. (
  108. 'id' => array
  109. (
  110. 'type' => 'int-11',
  111. 'name' => '代理商姓名/手机号',
  112. 'default' => '',
  113. 'desc' => '',
  114. 'match' => 'is_numeric',
  115. 'search' => 'order',
  116. //'list' => true,
  117. 'search' => array
  118. (
  119. 'api' => 'agent/member-getSearch',
  120. 'col' => 'col',
  121. 'result' => 'id',
  122. 'search' => 'id',
  123. ),
  124. 'list_name' => '代理商信息',
  125. 'list' => 'Dever::load("agent/lib/member.getOne", {id}, "agent/member", true)',
  126. ),
  127. 'name' => array
  128. (
  129. 'type' => 'varchar-100',
  130. 'name' => '代理商姓名',
  131. 'default' => '',
  132. 'desc' => '姓名',
  133. 'match' => 'is_string',
  134. 'update' => 'text',
  135. ),
  136. 'rdate' => array
  137. (
  138. 'type' => 'int-11',
  139. 'name' => '认证时间',
  140. 'match' => 'option',
  141. 'default' => '0',
  142. 'desc' => '',
  143. 'update' => 'date',
  144. 'callback' => 'maketime',
  145. // 'list' => '{rdate} > 0 ? date("Y-m-d H:i", {rdate}) : "无"',
  146. 'list' => 'Dever::load("agent/lib/member.set_rdate", {id})',
  147. 'list_order' => 100,
  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' => 'hidden',
  168. //'search' => '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' => array
  218. (
  219. 'api' => 'agent/member-getSearch',
  220. 'col' => 'col',
  221. 'result' => 'id',
  222. 'search' => 'parent_mid',
  223. ),
  224. 'list_name' => '上级信息',
  225. 'list' => '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. ),
  238. 'code' => array
  239. (
  240. 'type' => 'varchar-50',
  241. 'name' => '邀请码',
  242. 'default' => '',
  243. 'desc' => '代理商邀请码',
  244. 'match' => 'option',
  245. //'update' => 'text',
  246. 'list_order'=>1,
  247. ),
  248. 'role' => array
  249. (
  250. 'type' => 'int-11',
  251. 'name' => '代理角色',
  252. 'default' => '',
  253. 'desc' => '代理角色',
  254. 'match' => 'is_numeric',
  255. 'search' => 'select',
  256. 'update' => 'select',
  257. 'option' => $role,
  258. ),
  259. 'level_id' => array
  260. (
  261. 'type' => 'int-11',
  262. 'name' => '代理商等级',
  263. 'default' => '-1',
  264. 'desc' => '代理商等级',
  265. 'match' => 'is_numeric',
  266. 'search' => 'select',
  267. 'update' => 'select',
  268. 'option' => $level,
  269. //'list' => true,
  270. ),
  271. 'is_area' => array
  272. (
  273. 'type' => 'tinyint-1',
  274. 'name' => '是否有代理区域',
  275. 'default' => '1',
  276. 'desc' => '是否有代理区域',
  277. 'match' => 'is_numeric',
  278. 'option' => $is_area,
  279. //'update' => 'radio',
  280. ),
  281. 'area' => array
  282. (
  283. 'type' => 'varchar-500',
  284. 'name' => '代理区域',
  285. 'default' => '',
  286. 'desc' => '代理区域',
  287. 'match' => 'option',
  288. 'search' => 'linkage',
  289. 'update' => 'linkage',
  290. 'option' => Dever::url('api.get?level_total=4', 'area'),
  291. ),
  292. 'is_shop' => array
  293. (
  294. 'type' => 'tinyint-1',
  295. 'name' => '门店是否可以修改',
  296. 'default' => '2',
  297. 'desc' => '门店是否可以修改',
  298. 'match' => 'is_numeric',
  299. 'option' => $is_shop,
  300. 'update' => 'radio',
  301. ),
  302. 'shop_id' => array
  303. (
  304. 'type' => 'int-11',
  305. 'name' => '所属门店',
  306. 'default' => '',
  307. 'desc' => '所属门店',
  308. 'match' => 'is_numeric',
  309. 'update' => 'select',
  310. 'update_search' => 'shop/lib/manage.search',
  311. ),
  312. 'type' => array
  313. (
  314. 'type' => 'tinyint-1',
  315. 'name' => '类型',
  316. 'default' => '1',
  317. 'desc' => '类型',
  318. 'match' => 'is_numeric',
  319. 'option' => $type,
  320. 'update' => 'radio',
  321. 'control' => 'type',
  322. ),
  323. 'sign' => array
  324. (
  325. 'type' => 'varchar-150',
  326. 'name' => '手写签名',
  327. 'default' => '',
  328. 'desc' => '手写签名',
  329. 'match' => 'option',
  330. 'update' => 'image',
  331. 'key' => '7',
  332. ),
  333. 'idcard' => array
  334. (
  335. 'type' => 'varchar-32',
  336. 'name' => '身份证号码',
  337. 'default' => '',
  338. 'desc' => '身份证号码',
  339. 'match' => Dever::rule('idcard'),
  340. 'update' => 'text',
  341. ),
  342. 'idcard_front' => array
  343. (
  344. 'type' => 'varchar-150',
  345. 'name' => '身份证正面',
  346. 'default' => '',
  347. 'desc' => '身份证正面',
  348. 'match' => 'option',
  349. 'update' => 'image',
  350. 'key' => '8',
  351. //'place' => '660*660',
  352. ),
  353. 'idcard_back' => 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. 'company_name' => array
  365. (
  366. 'type' => 'varchar-100',
  367. 'name' => '公司名称',
  368. 'default' => '',
  369. 'desc' => '公司名称',
  370. 'match' => 'is_string',
  371. 'update' => 'text',
  372. //'search' => 'fulltext',
  373. //'list' => true,
  374. 'show' => 'type=2',
  375. ),
  376. 'company_pic' => array
  377. (
  378. 'type' => 'varchar-150',
  379. 'name' => '营业执照',
  380. 'default' => '',
  381. 'desc' => '营业执照',
  382. 'match' => 'option',
  383. 'update' => 'image',
  384. 'key' => '8',
  385. //'place' => '660*660',
  386. 'show' => 'type=2',
  387. ),
  388. 'company_number' => array
  389. (
  390. 'type' => 'varchar-80',
  391. 'name' => '营业执照号码',
  392. 'default' => '',
  393. 'desc' => '营业执照号码',
  394. 'match' => 'is_string',
  395. 'update' => 'text',
  396. 'show' => 'type=2',
  397. ),
  398. 'address' => array
  399. (
  400. 'type' => 'varchar-800',
  401. 'name' => '地址',
  402. 'default' => '',
  403. 'desc' => '地址',
  404. 'match' => 'is_string',
  405. 'update' => 'text',
  406. ),
  407. 'cash' => array
  408. (
  409. 'type' => 'decimal-11,2',
  410. 'name' => '余额',
  411. 'default' => '0',
  412. 'desc' => '余额',
  413. 'match' => 'is_numeric',
  414. 'update' => 'text',
  415. 'list_name' => '余额<br />直推业绩<br />团队业绩',
  416. 'list' => '"{cash}<br />{sell}<br />{group_sell}"',
  417. ),
  418. 'sell' => array
  419. (
  420. 'type' => 'decimal-11,2',
  421. 'name' => '直推业绩',
  422. 'default' => '0',
  423. 'desc' => '销售业绩',
  424. 'match' => 'is_numeric',
  425. 'update' => 'text',
  426. ),
  427. 'group_sell' => array
  428. (
  429. 'type' => 'decimal-11,2',
  430. 'name' => '团队业绩',
  431. 'default' => '0',
  432. 'desc' => '团队销售业绩',
  433. 'match' => 'is_numeric',
  434. 'update' => 'text',
  435. ),
  436. 'old_group_sell' => array
  437. (
  438. 'type' => 'decimal-11,2',
  439. 'name' => '历史团队业绩',
  440. 'default' => '0',
  441. 'desc' => '历史团队业绩',
  442. 'match' => 'is_numeric',
  443. 'update' => 'text',
  444. ),
  445. 'old_agentdownnum' => array
  446. (
  447. 'type' => 'int-11',
  448. 'name' => '历史直推人数',
  449. 'default' => '0',
  450. 'desc' => '历史团队业绩',
  451. 'match' => 'is_numeric',
  452. 'update' => 'text',
  453. ),
  454. 'old_pwd' => array
  455. (
  456. 'type' => 'varchar-32',
  457. 'name' => 'pwd',
  458. 'default' => '',
  459. 'desc' => 'pwd',
  460. 'match' => 'is_string',
  461. 'update' => 'text',
  462. ),
  463. 'old_salt' => array
  464. (
  465. 'type' => 'varchar-32',
  466. 'name' => 'salt',
  467. 'default' => '',
  468. 'desc' => 'salt',
  469. 'match' => 'is_string',
  470. 'update' => 'text',
  471. ),
  472. 'status' => array
  473. (
  474. 'type' => 'tinyint-1',
  475. 'name' => '状态',
  476. 'default' => '1',
  477. 'desc' => '状态',
  478. 'match' => 'is_numeric',
  479. 'option' => $status,
  480. 'search' => 'select',
  481. 'list' => true,
  482. ),
  483. 'import' => array
  484. (
  485. 'type' => 'tinyint-1',
  486. 'name' => '是否导入',
  487. 'default' => '1',
  488. 'desc' => '是否导入',
  489. 'match' => 'is_numeric',
  490. 'option' => $import,
  491. 'update' => 'radio',
  492. ),
  493. 'prize_type' => array
  494. (
  495. 'type' => 'tinyint-1',
  496. 'name' => '是否名额内',
  497. 'default' => '1',
  498. 'desc' => '是否名额内',
  499. 'match' => 'is_numeric',
  500. 'option' => $prize_type,
  501. ),
  502. 'state' => array
  503. (
  504. 'type' => 'tinyint-1',
  505. 'name' => '状态',
  506. 'default' => '1',
  507. 'desc' => '请选择状态',
  508. 'match' => 'is_numeric',
  509. ),
  510. 'cdate' => array
  511. (
  512. 'type' => 'int-11',
  513. 'name' => '加入日期',
  514. 'match' => array('is_numeric', time()),
  515. 'desc' => '',
  516. # 只有insert时才生效
  517. 'insert' => true,
  518. //'search' => 'date',
  519. ),
  520. ),
  521. 'alter' => array
  522. (
  523. 5 => array
  524. (
  525. array('update', 'cash', 'cash', 'decimal-11,2 0 余额'),
  526. array('update', 'sell', 'sell', 'decimal-11,2 0 直推业绩'),
  527. array('update', 'group_sell', 'group_sell', 'decimal-11,2 0 团队业绩'),
  528. array('update', 'old_group_sell', 'old_group_sell', 'decimal-11,2 0 历史团队业绩'),
  529. ),
  530. 'version' => 5,
  531. ),
  532. 'index' => array
  533. (
  534. 1 => array
  535. (
  536. 'parent_mid' => 'parent_mid',
  537. ),
  538. # 版本号 更改版本号会更新当前表的索引
  539. 'version' => 1,
  540. ),
  541. 'manage' => array
  542. (
  543. 'insert' => false,
  544. 'delete' => false,
  545. 'edit' => false,
  546. 'button' => $button,
  547. 'list_button' => $list_button,
  548. ),
  549. 'request' => array
  550. (
  551. 'getInfo' => array
  552. (
  553. # 匹配的正则或函数 选填项
  554. 'option' => array
  555. (
  556. 'status' => 2,
  557. 'state' => 1,
  558. ),
  559. 'order' => array('id' => 'desc'),
  560. 'type' => 'one',
  561. 'col' => '*',
  562. ),
  563. 'getData' => array
  564. (
  565. # 匹配的正则或函数 选填项
  566. 'option' => array
  567. (
  568. 'idcard' => 'yes',
  569. 'id' => array('yes', '!='),
  570. 'status' => array('yes', 'in'),
  571. 'state' => 1,
  572. ),
  573. 'order' => array('id' => 'desc'),
  574. 'type' => 'all',
  575. 'page' => array(20, 'list'),
  576. 'col' => '*',
  577. ),
  578. 'upCash' => array
  579. (
  580. 'type' => 'update',
  581. 'where' => array
  582. (
  583. 'id' => 'yes',
  584. ),
  585. 'set' => array
  586. (
  587. 'cash' => array('yes', '+='),
  588. ),
  589. ),
  590. 'upSell' => array
  591. (
  592. 'type' => 'update',
  593. 'where' => array
  594. (
  595. 'id' => 'yes',
  596. ),
  597. 'set' => array
  598. (
  599. 'cash' => array('yes', '+='),
  600. 'upcol' => array('yes-sell', '+='),
  601. 'level_id' => 'yes',
  602. ),
  603. ),
  604. 'upGroupSell' => array
  605. (
  606. 'type' => 'update',
  607. 'where' => array
  608. (
  609. 'id' => 'yes',
  610. ),
  611. 'set' => array
  612. (
  613. 'cash' => array('yes', '+='),
  614. 'upcol' => array('yes-group_sell', '+='),
  615. 'level_id' => 'yes',
  616. ),
  617. ),
  618. 'upGroupSellOne' => array
  619. (
  620. 'type' => 'update',
  621. 'where' => array
  622. (
  623. 'id' => 'yes',
  624. ),
  625. 'set' => array
  626. (
  627. 'sell' => array('yes', '+='),
  628. 'group_sell' => array('yes', '+='),
  629. ),
  630. ),
  631. # 获取订单数量
  632. 'getNum' => array
  633. (
  634. # 匹配的正则或函数 选填项
  635. 'option' => array
  636. (
  637. 'start' => array('yes-cdate', '>='),
  638. 'end' => array('yes-cdate', '<='),
  639. 'fstart' => array('yes-rdate', '>='),
  640. 'fend' => array('yes-rdate', '<='),
  641. 'status' => 'yes',
  642. 'role' => 'yes',
  643. 'state' => 1,
  644. ),
  645. 'type' => 'count',
  646. 'col' => '*',
  647. ),
  648. 'getSearch' => array
  649. (
  650. # 匹配的正则或函数 选填项
  651. 'option' => array
  652. (
  653. 'col' => array('yes-mobile,name', 'like'),
  654. ),
  655. 'type' => 'all',
  656. 'col' => '*|id',
  657. ),
  658. 'getShopAll' => array
  659. (
  660. # 匹配的正则或函数 选填项
  661. 'option' => array
  662. (
  663. 'shop_id' => array('yes','>='),
  664. 'state' => 1,
  665. ),
  666. 'type' => 'all',
  667. 'col' => '*',
  668. ),
  669. 'getCount' => array
  670. (
  671. # 匹配的正则或函数 选填项
  672. 'option' => array
  673. (
  674. 'id' => 'yes',
  675. 'role' => 'yes',
  676. 'prize_type' => 'yes',
  677. 'state' => 1,
  678. ),
  679. 'type' => 'count',
  680. 'col' => '*',
  681. ),
  682. 'getOutAll' => array
  683. (
  684. # 匹配的正则或函数 选填项
  685. 'option' => array
  686. (
  687. 'id' => 'yes',
  688. 'role' => 'yes',
  689. 'prize_type' => 'yes',
  690. 'state' => 1,
  691. ),
  692. 'type' => 'all',
  693. 'col' => '*',
  694. ),
  695. ),
  696. );