hujiabin 58b5d71d0b 1
2023-03-29 17:04:56 +08:00

68 lines
1.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class Emoji extends BaseModel
{
private static function defaultUseEmoji(){
return array(200001, 200002, 200003, 200004, 200005, 200006);
}
private static function defaultEmoji(){
$default = array();
$meta = mt\Parameter::getByName('emoji_default');
if ($meta){
$default = explode('|',$meta['param_value']) ;
}
return $default;
}
public static function emojiList(){
$data = self::DefaultEmoji();
//查询用户新获得的表情t_emoji 表)
return $data;
}
public static function getUseEmoji(){
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_user_use_emoji',
array(
'account_id'=> myself()->_getAccountId()
)
);
$value = array();
if ($row){
$value = $row['value'] ? explode('|',$row['value']) : array() ;
}else{
$value= self::defaultUseEmoji();
self::updateEmoji(implode('|',$value));
}
return $value;
}
public static function updateEmoji($fields){
SqlHelper::upsert
(myself()->_getSelfMysql(),
't_user_use_emoji',
array(
'account_id' => myself()->_getAccountId(),
),
array(
'value' => $fields,
'modifytime' => myself()->_getNowTime(),
),
array(
'account_id' => myself()->_getAccountId(),
'value' => $fields,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
);
}
}