member.php 22 KB

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