Commit 19e78464 authored by 杨培's avatar 杨培

提示服务支持异步调用

parent 55ac62b3
...@@ -11,4 +11,4 @@ use internalApi\ucenter\Notice; ...@@ -11,4 +11,4 @@ use internalApi\ucenter\Notice;
require __DIR__.'/_init.php'; require __DIR__.'/_init.php';
Notice::setDebug(); Notice::setDebug();
Notice::addToast(12, 'test'); Notice::addToastAsync(12, 'test '.date('Y-m-d H:i:s'));
...@@ -55,4 +55,46 @@ class Notice extends Client ...@@ -55,4 +55,46 @@ class Notice extends Client
self::call('notice.addToast', compact('uid', 'text', 'timeout')); self::call('notice.addToast', compact('uid', 'text', 'timeout'));
} }
/**
* 添加积分提示
*
* @param int $uid
* @param string $action 动作文字,如“发表帖子”
* @param array $credits 变化积分数字,以积分序号对应数字的形式
* @return int|false
*/
public static function addCreditAsync($uid, $action, $credits)
{
return self::emit('notice.addCredit', func_get_args());
}
/**
* 添加勋章提示
*
* @param int $uid
* @param string $icon
* @param string $name
* @param string $description
* @param $url
* @return int|false
*/
public static function addMedalAsync($uid, $icon, $name, $description, $url)
{
return self::emit('notice.addMedal', func_get_args());
}
/**
* 添加Toast提示
*
* @param int $uid
* @param string $text
* @param null|int $timeout 提示留存时间,毫秒单位,默认为 1500
* @return int|false
*/
public static function addToastAsync($uid, $text, $timeout=null)
{
return self::emit('notice.addToast', func_get_args());
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment