Manage.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace Passport\Lib;
  3. use Dever;
  4. class Manage
  5. {
  6. # 同步将其他地方的分类更新为system
  7. public function updateSystem($id, $name, $param)
  8. {
  9. $name = Dever::param('name', $param);
  10. $data['name'] = $name;
  11. $info = Dever::db('passport/system')->one($id);
  12. if (!$info) {
  13. Dever::db('passport/system')->insert($data);
  14. } else {
  15. $data['where_id'] = $info['id'];
  16. $data['state'] = Dever::param('state', $param);
  17. if (!$name) {
  18. unset($data['name']);
  19. };
  20. Dever::db('passport/system')->update($data);
  21. }
  22. return $info;
  23. }
  24. public function show($id)
  25. {
  26. $db = Dever::db('passport/user');
  27. $user = $db->one($id);
  28. $config = $db->config;
  29. if ($user['avatar']) {
  30. $table['头像'] = '<img src="'.$user['avatar'].'" width="150" />';
  31. }
  32. if ($user['area']) {
  33. $table['地区'] = $user['area'];
  34. }
  35. if ($user['address']) {
  36. $table['详细地址'] = $user['address'];
  37. }
  38. if ($user['source_type']) {
  39. $table['来源'] = $config['source_type'][$user['source_type']];
  40. }
  41. if ($user['profession']) {
  42. $profession = Dever::db('passport/profession')->one($user['profession']);
  43. $table['职业'] = $profession['name'];
  44. }
  45. if ($user['sex']) {
  46. $table['性别'] = $config['sex'][$user['sex']];
  47. }
  48. if ($user['wechat']) {
  49. $table['微信号'] = $user['wechat'];
  50. }
  51. if ($user['email']) {
  52. $table['邮箱'] = $user['email'];
  53. }
  54. if (Dever::project('invite')) {
  55. $invite = Dever::db('invite/code')->one(array('uid' => $user['id']));
  56. if ($invite) {
  57. $table['邀请码'] = $invite['value'];
  58. }
  59. }
  60. return Dever::table($table);
  61. }
  62. }