| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace app\api\model\service;
- use think\Model;
- class CommentLabel extends Model
- {
- // 表名
- protected $name = 'service_comment_label';
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- public static function getLabel($ids)
- {
- if(!$ids)
- {
- return '';
- }
- $idArr = explode(',',$ids);
- $list = [];
- foreach ($idArr as $val)
- {
- $name = self::where(['id'=>$val])->value('name');
- if($name)
- {
- $list[] = $name;
- }
- }
- return implode(',',$list);
- }
- }
|