Member.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Option\Lib;
  3. use Dever;
  4. class Member
  5. {
  6. public function getInfo($id)
  7. {
  8. if ($id < 0) {
  9. return '无';
  10. }
  11. $account = Dever::db('option/member')->find(array('id' => $id, 'clear_top' => true));
  12. if ($account) {
  13. $string = $account['name'] . '<br />' . $account['mobile'] . '<br />' . $account['idcard'] . '<br />' . $account['key'];
  14. $company = Dever::db('manage/company')->find($account['company_id']);
  15. if ($company) {
  16. $string .= '<br />' . $company['name'];
  17. }
  18. return $string;
  19. } else {
  20. return '';
  21. }
  22. }
  23. public function search_api()
  24. {
  25. $value = Dever::input('value');
  26. if ($value) {
  27. $company = Dever::load('manage/company.get');
  28. $where = array('key' => $value);
  29. if ($company) {
  30. $where['company_id'] = $company;
  31. }
  32. $data = Dever::db('option/member')->getList($where);
  33. $table = array();
  34. if ($data) {
  35. $table = array();
  36. $table['head'] = array('公司', '序列号', '姓名', '手机号', '类型');
  37. $table['body'] = array();
  38. foreach ($data as $k => $v) {
  39. $company = Dever::db('manage/company')->one($v['company_id']);
  40. if ($v['main'] == 1) {
  41. $main = '主账号';
  42. } else {
  43. $main = '子账号';
  44. }
  45. $table['body'][] = array($company['name'], $v['key'], $v['name'], $v['mobile'], $main);
  46. }
  47. $result[] = array
  48. (
  49. 'type' => 'table',
  50. 'content' => $table,
  51. );
  52. $html = Dever::show('', $result, false, false);
  53. return $html;
  54. }
  55. return '暂无账号';
  56. } else {
  57. return '';
  58. }
  59. }
  60. }