member.php 18 KB

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