member.php 18 KB

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