From 1a56b782b37a2ca5077199b7ff8a295955b52fd4 Mon Sep 17 00:00:00 2001 From: lccsw <1127794702@qq.com> Date: Wed, 6 Jul 2022 14:52:18 +0800 Subject: [PATCH] add-fbook-rebot --- admin/controllers/biz/store/Store.php | 12 +- admin/views/auto/business/get.php | 10 +- admin/views/biz/store/lists.php | 2 + common/libraries/Qyrobot.php | 175 +++++++++++++++++++++++++- 4 files changed, 188 insertions(+), 11 deletions(-) diff --git a/admin/controllers/biz/store/Store.php b/admin/controllers/biz/store/Store.php index d1ec6c71..604ed965 100755 --- a/admin/controllers/biz/store/Store.php +++ b/admin/controllers/biz/store/Store.php @@ -65,13 +65,17 @@ class Store extends HD_Controller if ($city_id) { $this->data['countys'] = $this->area_model->select(array('city_id' => $city_id)); } - if (isset($status_arr[$status])) { + if (isset($status)) { $this->data['status'] = $status; - $where['status'] = $status_arr[$status]; + if(strlen($status_arr[$status])){ + $where['status'] = $status_arr[$status]; + }else{ + $where['status > -1'] = null; + } } else { - $where['status > -1'] = null; + $this->data['status'] = 'on'; + $where['status'] = 1; } - $company_id && $where['company_id'] = $company_id; !$page && $page = 1; diff --git a/admin/views/auto/business/get.php b/admin/views/auto/business/get.php index 09aec468..82dcc11f 100644 --- a/admin/views/auto/business/get.php +++ b/admin/views/auto/business/get.php @@ -103,35 +103,35 @@
- +
- +
- +
- +
- +
diff --git a/admin/views/biz/store/lists.php b/admin/views/biz/store/lists.php index 00409a1c..6d04eb5b 100755 --- a/admin/views/biz/store/lists.php +++ b/admin/views/biz/store/lists.php @@ -78,6 +78,7 @@
+
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; } }