diff --git a/common/libraries/Qyrobot.php b/common/libraries/Qyrobot.php
index 8c3fdc37..039d2fa6 100644
--- a/common/libraries/Qyrobot.php
+++ b/common/libraries/Qyrobot.php
@@ -12,12 +12,15 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class Qyrobot{
private $key = 'dfed1a38-c4e0-4904-94eb-306e9755be04'; //正式
+ private $fbook_url = 'https://open.feishu.cn/open-apis/bot/v2/hook/64c25369-a164-44ce-b3bc-92e807ae1421'; //飞书正式群
private $ci;
public function __construct($params=[]){
$this->ci = & get_instance();
if($_SERVER['CI_ENV'] == 'development' || $params['test']){ //测试环境
$this->key = '0b644923-4e5c-46be-9a87-6dfcb023d09c';
+ $this->fbook_url = "https://open.feishu.cn/open-apis/bot/v2/hook/b612d56e-c9b2-4e57-87b0-e6d1101944f5";
}
+ $this->ci->load->library('mycurl');
}
/**
* 支付定金推送消息
@@ -93,7 +96,6 @@ class Qyrobot{
$month_query['total'] && $month_count += $month_query['total'];
$url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key='.$this->key;
- $this->ci->load->library('mycurl');
$data = [
'msgtype' => 'markdown',
'markdown' => [
@@ -220,7 +222,6 @@ class Qyrobot{
$old_month_count && $month_count += $old_month_count;
$url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key='.$this->key;
- $this->ci->load->library('mycurl');
if(!$type){
$content = "🎉🎉🎉 **喜讯** 🎉🎉🎉 \n
恭喜 {$biz_info} 成交 {$car_info}({$order_row['owner_name']}) 一台。\n
@@ -246,6 +247,176 @@ class Qyrobot{
];
$res = $this->ci->mycurl->httpPost($url,$data,'is_json');
$result = json_decode($res,true);
+ //发送飞书
+ $info = [
+ 'biz_info' => $biz_info,
+ 'day' => $day,
+ 'car_info' => $car_info,
+ 'owner_name' => $order_row['owner_name'],
+ 'm_day' => $m_day,
+ 'today_count' => $today_count,
+ 'month_show' => $month_show,
+ 'month_count' => $month_count
+ ];
+ $send_msg = $this->fbook_formart($info,$type);
+ $this->send_fb($send_msg);
+ return $result;
+ }
+
+ public function fbook_formart($info,$type){
+ if(!$type){
+ $title = '🎉🎉🎉 **喜讯** 🎉🎉🎉';
+ $content = [
+ [
+ [
+ 'tag' => 'text',
+ 'text' => ' 恭喜',
+ ],
+ [
+ 'tag' => 'a',
+ 'text' => $info['biz_info'],
+ ],
+ [
+ 'tag' => 'text',
+ 'text' => '成交',
+ ],
+ [
+ 'tag' => 'a',
+ 'text' => $info['car_info']."({$info['owner_name']})",
+ ],
+ [
+ 'tag' => 'text',
+ 'text' => '一台。',
+ ],
+ ],
+ [
+ [
+ 'tag' => 'text',
+ 'text' => '本日累计成交:',
+ ],
+ [
+ 'tag' => 'a',
+ 'text' => $info['today_count'],
+ ],
+ [
+ 'tag' => 'text',
+ 'text' => '单',
+ ],
+ ],
+ [
+ [
+ 'tag' => 'text',
+ 'text' => '本月累计成交:',
+ ],
+ [
+ 'tag' => 'a',
+ 'text' => $info['month_count'],
+ ],
+ [
+ 'tag' => 'text',
+ 'text' => '单',
+ ],
+ ],
+ [
+ [
+ 'tag' => 'text',
+ 'text' => '### 狸车加油,冲冲冲!💪🏻💪🏻💪🏻',
+ ],
+ ],
+ ];
+
+ }else{
+ $title = '🎉🎉🎉 **喜讯-补报** 🎉🎉🎉 ';
+ $content = [
+ [
+ [
+ 'tag' => 'text',
+ 'text' => ' 恭喜',
+ ],
+ [
+ 'tag' => 'a',
+ 'text' => $info['biz_info'],
+ ],
+ [
+ 'tag' => 'a',
+ 'text' => $info['day'],
+ ],
+ [
+ 'tag' => 'text',
+ 'text' => '成交',
+ ],
+ [
+ 'tag' => 'a',
+ 'text' => $info['car_info'],
+ ],
+ [
+ 'tag' => 'text',
+ 'text' => '一台。',
+ ],
+ ],
+ [
+ [
+ 'tag' => 'a',
+ 'text' => $info['m_day'],
+ ],
+ [
+ 'tag' => 'text',
+ 'text' => '累计成交:',
+ ],
+ [
+ 'tag' => 'a',
+ 'text' => $info['today_count'],
+ ],
+ [
+ 'tag' => 'text',
+ 'text' => '单',
+ ],
+ ],
+ [
+ [
+ 'tag' => 'a',
+ 'text' => $info['month_show'],
+ ],
+ [
+ 'tag' => 'text',
+ 'text' => '累计成交:',
+ ],
+ [
+ 'tag' => 'a',
+ 'text' => $info['month_count'],
+ ],
+ [
+ 'tag' => 'text',
+ 'text' => '单',
+ ],
+ ],
+ [
+ [
+ 'tag' => 'text',
+ 'text' => '### 狸车加油,冲冲冲!💪🏻💪🏻💪🏻',
+ ],
+ ],
+ ];
+
+ }
+ $msg = [
+ 'title' => $title,
+ 'content' => $content,
+ ];
+ $data = [
+ 'msg_type' => 'post',
+ 'content' => [
+ 'post' => [
+ "zh_cn" => $msg
+ ]
+ ],
+ ];
+ return $data;
+ }
+ //推送飞书
+ public function send_fb($msg){
+ $res = $this->ci->mycurl->httpPost($this->fbook_url,$msg,'is_json');
+ $result = json_decode($res,true);
return $result;
}
}