Weatherwarningapi.php 656 字节
<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;

/**
 * 首页接口
 */
class Weatherwarningapi extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];
    /**
     * 天气预警计划任务
     * @return void
     */
    public function weatherwarning(){
        $res=Db::name("weatherwarning")
            ->alias('a')
            ->join("detectionaddress b","a.detectionaddress_id=b.id")
            ->field("a.describe,a.warning_grade,b.name")
            ->order("a.id desc")
            ->limit(24)
            ->select();
        $this->success("天气预警成功",$res);
    }
}