add-fbook-rebot

This commit is contained in:
lccsw
2022-07-06 14:52:18 +08:00
parent 8c353484f1
commit 1a56b782b3
4 changed files with 188 additions and 11 deletions
+8 -4
View File
@@ -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;
+5 -5
View File
@@ -103,35 +103,35 @@
</div>
<div class="tab-pane fade" id="jszc">
<div class="am-form-group wp50">
<label class="am-para-label">代理店单车毛利:</label>
<label class="am-para-label w140">代理店单车毛利:</label>
<div class="am-para-input">
<input type="text" placeholder="请输入代理店单车毛利" name="proxy_profix_car" v-model="info.proxy_profix_car" style="display: inline;width: 60%"/>
<span></span>
</div>
</div>
<div class="am-form-group wp50">
<label class="am-para-label">品牌店单车毛利:</label>
<label class="am-para-label w140">品牌店单车毛利:</label>
<div class="am-para-input">
<input type="text" placeholder="请输入品牌店单车毛利" name="profix_car" v-model="info.profix_car" style="display: inline;width: 60%"/>
<span></span>
</div>
</div>
<div class="am-form-group wp50">
<label class="am-para-label">上牌毛利:</label>
<label class="am-para-label w140">上牌毛利:</label>
<div class="am-para-input">
<input type="text" placeholder="请输入上牌毛利" name="profix_carno" v-model="info.profix_carno" style="display: inline;width: 60%"/>
<span></span>
</div>
</div>
<div class="am-form-group wp50">
<label class="am-para-label">保险毛利:</label>
<label class="am-para-label w140">保险毛利:</label>
<div class="am-para-input">
<input type="text" placeholder="请输入保险毛利" name="profix_insure" v-model="info.profix_insure" style="display: inline;width: 60%"/>
<span></span>
</div>
</div>
<div class="am-form-group wp50">
<label class="am-para-label">贷款毛利:</label>
<label class="am-para-label w140">贷款毛利:</label>
<div class="am-para-input">
<input type="text" placeholder="请输入贷款毛利" name="profix_loan" v-model="info.profix_loan" style="display: inline;width: 60%"/>
<span></span>
+2
View File
@@ -78,6 +78,7 @@
</select>
</div>
</div>
<!--
<div class="am-form-group fl">
<label class="am-para-label w80">公司:</label>
<div class="am-para-input w150">
@@ -87,6 +88,7 @@
</select>
</div>
</div>
-->
<div class="am-form-group fl">
<label class="am-para-label w100">渠道经理:</label>
<div class="am-para-inline w100">
+173 -2
View File
@@ -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
恭喜 <font color=\"warning\">{$biz_info}</font> 成交 <font color=\"warning\">{$car_info}({$order_row['owner_name']})</font> 一台。\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;
}
}