member.php 18 KB

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