CommentLabel.php 791 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace app\api\model\service;
  3. use think\Model;
  4. class CommentLabel extends Model
  5. {
  6. // 表名
  7. protected $name = 'service_comment_label';
  8. // 自动写入时间戳字段
  9. protected $autoWriteTimestamp = 'int';
  10. // 定义时间戳字段名
  11. protected $createTime = 'createtime';
  12. protected $updateTime = 'updatetime';
  13. public static function getLabel($ids)
  14. {
  15. if(!$ids)
  16. {
  17. return '';
  18. }
  19. $idArr = explode(',',$ids);
  20. $list = [];
  21. foreach ($idArr as $val)
  22. {
  23. $name = self::where(['id'=>$val])->value('name');
  24. if($name)
  25. {
  26. $list[] = $name;
  27. }
  28. }
  29. return implode(',',$list);
  30. }
  31. }