import type { GroupActorType } from '@src/shared/redux/types/group' ; import _get from 'lodash/get' ; import _isNil from 'lodash/isNil' ; import type { PlayerUser } from '@shared/model/player' ; import type { MsgPayload } from '@redux/types/chat' ; /**
 * 数据相关帮助函数
 */ param groupActor param field export const getGroupActorField = ( groupActor , field ) : string => { return groupActor [ field ] || _get ( groupActor , [ 'actor' , field ] ) ; } ; export const getGroupActorName = ( groupActor ) => getGroupActorField ( groupActor , 'name' ) ; param groupActor export const getGroupActorInfo = ( groupActor ) : { } => { return { ... _get ( groupActor , 'actor.info' , { } ) , ... groupActor . actor_info , } ; } ; param groupActor export const getGroupActorTemplateUUID = ( groupActor ) : string => { return ( groupActor . actor_template_uuid ?? _get ( groupActor , 'actor.template_uuid' ) ) ; } ; param userInfo export function getUserName ( userInfo ) { if ( _isNil ( userInfo ) ) { return '' ; } return userInfo ?. nickname || userInfo ?. username || '' ; } export function buildMsgPayload ( payload ) { return { type : 'normal' , uuid : '' , sender_uuid : '' , message : '' , is_public : false , is_group : false , date : new Date ( ) . toISOString ( ) , revoke : false , ... payload , } ; }