Project.php 844 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Account\Lib;
  3. use Dever;
  4. class Project
  5. {
  6. public function getConfig($table)
  7. {
  8. $data = array();
  9. $project = Dever::db('account/config_project')->find(array('source' => $table));
  10. if ($project) {
  11. $data = Dever::db('account/config')->select(array('project_id' => $project['id']));
  12. }
  13. return $data;
  14. }
  15. public function getUsername($uid, $config_id)
  16. {
  17. $name = $uid;
  18. $info = Dever::db('account/config')->find($config_id);
  19. if ($info) {
  20. $project = Dever::db('account/config_project')->find($info['project_id']);
  21. $source = Dever::db($project['source'])->find($uid);
  22. if ($source) {
  23. return $source[$project['source_name']];
  24. }
  25. }
  26. return $name;
  27. }
  28. }