1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace App\Http\Controllers;
- use Illuminate\Http\Request;
- class NoticeController extends Controller
- {
- //
- public function read(Request $request)
- {
- $type = $request->input('log_type');
- $log_id = $request->input('log_id');
- switch ($type) {
- case "notice":
- $this->notice($log_id);
- break;
- case "push":
- $this->push($log_id);
- break;
- }
- return response()->json([
- 'code' => 200,
- 'message' => 'success'
- ]);
- }
- private function notice($uuid)
- {
- $log = \DB::connection('mysql_datalog')->table('notice_logs')->where('uuid', $uuid)->first();
- if ($log) {
- \DB::connection('mysql_datalog')->table('notice_logs')->where('id', $log->id)->update([
- 'read_at' => time()
- ]);
- }
- }
- private function push($uuid)
- {
- $host = "http://push.fenpeiduixiang.com";
- $url = $host . "/api/v1/message_client/report_landing";
- \Curl::to($url)->withData([
- 'uuid' => $uuid,
- 'authKey' => '0',
- 'authType' => '0',
- ])->post();
- }
- }
|