UserinfoModel.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 老猫 <thinkcmf@126.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\portal\model;
  12. use app\admin\model\RouteModel;
  13. use think\Model;
  14. use tree\Tree;
  15. use think\db\Query;
  16. use think\facade\Db;
  17. class UserinfoModel extends Model {
  18. /**
  19. * 模型名称
  20. * @var string
  21. */
  22. protected $name = 't_userinfo';
  23. protected $connection = 'watercat';
  24. protected $type = [
  25. 'more' => 'array',
  26. ];
  27. public function getlist() {
  28. // $where = ['isactive' => 1, 'sfzid' => ['NOT NULL', ''], 'wname' => ['NOTNULL', ''], 'photourl' => ['NOTNULL', '']];
  29. // $where = ['isactive' => 1, 'sfzid' => ['LIKE', '%1%']];
  30. $field = ['id', 'wname', 'photourl'];
  31. $order = "last_unonline_time deac";
  32. $list = $this->field($field)
  33. ->where('isactive', 1)
  34. ->where('sfzid', 'not null')
  35. ->where('wname', 'not null')
  36. ->where('photourl', 'not null')
  37. ->where('photourl', '<>', "")
  38. ->order($order)->page(1, 6)->select();
  39. return $list;
  40. }
  41. /**
  42. * 获取工种
  43. *
  44. * @return void
  45. * @author wj
  46. * @date 2025-09-10
  47. */
  48. public function getworktype($userid) {
  49. $sql = "select workertypedisstr,sum(skillscore) skillscore
  50. from t_workertech where uid='" . $userid . "' and workertype is not null
  51. group by workertypedisstr order by sum(skillscore) desc";
  52. $list = Db::connect($this->connection)->query($sql);
  53. return $list;
  54. }
  55. }