member.php 19 KB

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