商城分销系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
650 B

<?php
namespace app\admin\model\shopro\chat\traits;
trait ChatCommon
{
/**
* 默认房间
*
* @var array
*/
public static function defaultRooms()
{
return [
['name' => '总后台', 'value' => 'admin'],
// ['name' => '官网', 'value' => 'official'],
// ['name' => '商城', 'value' => 'shop']
];
}
public function getRoomNameAttr($value, $data)
{
$value = $value ?: ($data['room_id'] ?? null);
$list = array_column(self::defaultRooms(), null, 'value');
return isset($list[$value]) ? $list[$value]['name'] : $value;
}
}