member.php 19 KB

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