61 lines
1.5 KiB
PHP
61 lines
1.5 KiB
PHP
<?php
|
||
|
||
|
||
namespace models;
|
||
|
||
use mt;
|
||
use phpcommon\SqlHelper;
|
||
class Emoji extends BaseModel
|
||
{
|
||
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 && $row['value']){
|
||
$value = explode('|',$row['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(),
|
||
)
|
||
);
|
||
}
|
||
|
||
} |