member.php 20 KB

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