member.php 18 KB

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