日报
This commit is contained in:
@@ -141,17 +141,18 @@ class FeishuController
|
||||
|
||||
|
||||
/**
|
||||
* @param $receiveId openid
|
||||
* @param $title 推送标题
|
||||
* @param $content 推送内容
|
||||
* @param $href 详情链接
|
||||
* @param $receiveId //openid
|
||||
* @param $title //推送标题
|
||||
* @param $content //推送内容
|
||||
* @param $href //详情链接
|
||||
* @param $msgType = 'post'; //卡片消息:interactive,富文本消息:post
|
||||
* @return \support\Response
|
||||
*/
|
||||
public static function send($config='xinyouhe',$receiveId='ou_e33bb3017ada6c4781398a68e55a4696',$title='ceshi',$content='测试',$href='http://219.157.255.213:8085/pages/index/mine')
|
||||
public static function send($config='xinyouhe',$receiveId='ou_e33bb3017ada6c4781398a68e55a4696',$content = '' , $msgType = 'post')
|
||||
{
|
||||
// 获取凭证
|
||||
$certificate = config('feishu.'.$config);
|
||||
Log::info('feishu send', [$certificate,'config'=>$config,'receiveId' => $receiveId, 'title' => $title, 'content' => $content, 'href' => $href]);
|
||||
Log::info('feishu send', [$certificate,'config'=>$config,'receiveId' => $receiveId, 'content' => $content]);
|
||||
|
||||
// 飞书服务
|
||||
$class = new \app\service\FeishuService($certificate['appId'], $certificate['appSecret'], $certificate['state']);
|
||||
@@ -160,7 +161,7 @@ class FeishuController
|
||||
// $receiveId = 'ou_a3b97543acbf1b28d978356bb08f85dd';
|
||||
|
||||
// 富文本 类型
|
||||
$content = "{
|
||||
/*$content = "{
|
||||
\"zh_cn\":{
|
||||
\"title\":\"$title\",
|
||||
\"content\":[
|
||||
@@ -179,7 +180,7 @@ class FeishuController
|
||||
}]
|
||||
]
|
||||
}
|
||||
}";
|
||||
}";*/
|
||||
|
||||
// 卡片 类型
|
||||
/*$content = "{
|
||||
@@ -212,13 +213,88 @@ class FeishuController
|
||||
}
|
||||
}";*/
|
||||
// $msgType = 'interactive';
|
||||
$msgType = 'post'; //卡片消息:interactive,富文本消息:post
|
||||
// $msgType = 'post'; //卡片消息:interactive,富文本消息:post
|
||||
$receiveIdtype = 'open_id';
|
||||
|
||||
$result = $class->sendMessages($receiveId, $content, $msgType, $receiveIdtype);
|
||||
return json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 富文本消息
|
||||
* @param $title
|
||||
* @param $content
|
||||
* @param $href
|
||||
* @return string
|
||||
*/
|
||||
public static function postMsg($title,$content,$href)
|
||||
{
|
||||
// 富文本 类型
|
||||
$content = "{
|
||||
\"zh_cn\":{
|
||||
\"title\":\"$title\",
|
||||
\"content\":[
|
||||
[{
|
||||
\"tag\":\"text\",
|
||||
\"text\":\"$content\",
|
||||
\"style\":[\"bold\"]
|
||||
}],
|
||||
[{
|
||||
\"tag\":\"hr\"
|
||||
}],
|
||||
[{
|
||||
\"tag\":\"a\",
|
||||
\"href\":\"$href\",
|
||||
\"text\":\"查看详情\"
|
||||
}]
|
||||
]
|
||||
}
|
||||
}";
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡片消息
|
||||
* @param $title
|
||||
* @param $content
|
||||
* @param $href
|
||||
* @return string
|
||||
*/
|
||||
public static function interactiveMsg($title,$content,$href)
|
||||
{
|
||||
// 富文本 类型
|
||||
$content = "{
|
||||
\"config\":{
|
||||
\"wide_screen_mode\":true
|
||||
},
|
||||
\"elements\":[{
|
||||
\"tag\":\"div\",
|
||||
\"text\":{
|
||||
\"content\":\"$content \",
|
||||
\"tag\":\"lark_md\"
|
||||
}},{
|
||||
\"actions\":[{
|
||||
\"tag\":\"button\",
|
||||
\"text\":{
|
||||
\"content\":\"立即查看\",
|
||||
\"tag\":\"plain_text\"
|
||||
},
|
||||
\"type\":\"primary\",
|
||||
\"url\":\"$href\"
|
||||
}],
|
||||
\"tag\":\"action\"
|
||||
}],
|
||||
\"header\":{
|
||||
\"template\":\"turquoise\",
|
||||
\"title\":{
|
||||
\"content\":\"📚$title\",
|
||||
\"tag\":\"plain_text\"
|
||||
}
|
||||
}
|
||||
}";
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function show()
|
||||
{
|
||||
return '<div>查看详情 - 示例页面</div>';
|
||||
|
||||
Reference in New Issue
Block a user