ritaswc / lark-card-message-builder
Lark/飞书,机器人消息,卡片消息构建工具
Installs: 1 767
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=7.4
- ext-json: *
This package is auto-updated.
Last update: 2024-12-07 03:51:29 UTC
README
Lark/飞书,机器人消息,卡片消息构建工具
官方文档
使用示例
单列-表单类信息展示-按钮
$card = (new CardMessageBuilder('单列-表单类信息展示-按钮')) ->template('blue') ->addElement(Tag::divMarkdown('**门店所在区域: **上海市-上海市-松江区')) ->addElement(Tag::divMarkdown('**门店编号: **8888')) ->addElement(Tag::divMarkdown('**提交时间: **2024-01-25 09:29:36')) ->addElement(Tag::divMarkdown('**督导: **隔壁老李')) ->addElement(Tag::actions()->addAction( Tag::button()->text('点击查看')->url('https://www.baidu.com')->type('primary') ));
带表头表格类-列权重-小字
$cardWeight = [3, 5, 2, 2, 2, 2]; $card = (new CardMessageBuilder('带表头表格类-列权重-小字')) ->template('purple') ->addElement( Tag::columnSet() ->flexMode('none') ->backgroundStyle('grey') ->addColumn(Tag::column()->weight($cardWeight[0])->width('weighted')->addElement(Tag::markdown('**字段1**'))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[1])->width('weighted')->addElement(Tag::markdown('**字段2**'))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[2])->width('weighted')->addElement(Tag::markdown('**字段3**'))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[3])->width('weighted')->addElement(Tag::markdown('**字段4**'))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[4])->width('weighted')->addElement(Tag::markdown('**字段5**'))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[5])->width('weighted')->addElement(Tag::markdown('**字段6**'))->verticalAlign('center')) ); $card->addElement( Tag::columnSet() ->flexMode('none') ->backgroundStyle('default') ->horizontalSpacing('small') ->addColumn(Tag::column()->weight($cardWeight[0])->width('weighted')->addElement(Tag::markdown("1markdown1"))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[1])->width('weighted')->addElement(Tag::markdown("1markdown2"))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[2])->width('weighted')->addElement(Tag::markdown("1markdown3"))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[3])->width('weighted')->addElement(Tag::markdown("1markdown4"))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[4])->width('weighted')->addElement(Tag::markdown("1markdown5"))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[5])->width('weighted')->addElement(Tag::markdown("1markdown6"))->verticalAlign('center')) ); $card->addElement( Tag::columnSet() ->flexMode('none') ->backgroundStyle('default') ->horizontalSpacing('small') ->addColumn(Tag::column()->weight($cardWeight[0])->width('weighted')->addElement(Tag::markdown("2markdown1"))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[1])->width('weighted')->addElement(Tag::markdown("2markdown2"))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[2])->width('weighted')->addElement(Tag::markdown("2markdown3"))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[3])->width('weighted')->addElement(Tag::markdown("2markdown4"))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[4])->width('weighted')->addElement(Tag::markdown("2markdown5"))->verticalAlign('center')) ->addColumn(Tag::column()->weight($cardWeight[5])->width('weighted')->addElement(Tag::markdown("2markdown6"))->verticalAlign('center')) ); $card->addElement(Tag::hr()); $card->addElement( Tag::note()->add(Tag::noteText('🕐' . date('Y-m-d H:i:s') . ' 📝J9044024949393' ) ) );