钉钉消息通知

parent 27fef5a8
......@@ -26,6 +26,16 @@ class HomeController extends Controller
*/
public function index()
{
// $data = [
// 'name'=>rand(100,100000),
// 'inquiry_sn'=>rand(100,100000),
// ];
// $res = SendMsg($data,'semour_inquire',['13713025362']);
// print_r($res);
// die();
return view('home.home');
}
}
......@@ -26,6 +26,36 @@ if (!function_exists('generate_letters')) {
}
/*
* 发送信息
* @param array $data 替换的内容数组,["name"=>"小红"]
* @param string $key 在消息系统新建的模板编号,如:
semour_inquire 深茂询价消息
semour_order 深茂订单消息
* @param array $ToUser 指定接收人 [13713025362,13713025363]
*/
function SendMsg($data=[], $key = '', $ToUser = 'INNER_PERSON'){
if ($key == ""){
return false;
}
$touser_json = json_encode($ToUser);
$check['touser'] = $touser_json;
$check['data'] = urldecode(json_encode($data,JSON_UNESCAPED_UNICODE));
# $check['data'] ="{\"goods_name\":\"MPVZ5004GW7U\",\"brand_name\":\"恩智浦牌\\/NXP牌\",\"goods_title\":\"多元件集成电路\",\"material_sn\":\"WL2021060300070421\",\"tax_rate_low\":\"0.7000\",\"tax_rate_land\":\"0.0000\",\"tax_rate_added\":\"13.0000\",\"supervision_con\":\"\",\"number\":\"8542391000\"}";
$check['pf'] = 1;
$check['keyword'] = $key;
$check['is_ignore'] = 0;
$check['k1']=time();
$check['k2']=MD5(MD5($check['k1'])."fh6y5t4rr351d2c3bryi");
$response = Http::asForm()->post("http://api.ichunt.com/msg/sendMessageByAuto", $check);
$res = json_decode($response->body(),true);
if(empty($res['err_code']) || $res['err_code']!=0) return false;
return true;
}
/*
* 反爬虫用html标签替换数字,不包括“.”
* $number 数字串
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment