123456789101112131415161718192021222324252627282930 |
- <?php
- namespace App\Http\Controllers\Core;
- use App\Http\Controllers\Controller;
- use Illuminate\Support\Facades\App;
- class Ding extends Controller
- {
- /**
- * @param array $data
- */
- public static function robot(array $data)
- {
- if (App::environment() == 'local') {
- return;
- }
- $url = "https://oapi.dingtalk.com/robot/send?access_token=3eecb1bcb942d7aa4776613faa1dce142923ed6964d04ac66f803c643ed8f653";
- $data = [
- "msgtype" => 'markdown',
- 'markdown' => [
- 'title' => $data['title'],
- 'text' => "#### **{$data['title']}** \n {$data['text']}"
- ],
- 'isAtAll' => true
- ];
- \Curl::to($url)->withData($data)->asJson('true')->post();
- }
- }
|