<?php
/* 各API 需有 token_verify() token驗證function ，因各API撈取API金鑰方式不同*/
class WebAPIForMenuPage extends base_class
{


    /**
     * Leo
     * 日結測試用API
     */
    public function Create_received_yesterday($params)
    {
        
        //設定寫入資料
        $s_received_date = (string) $params["received_date"];
        $s_received_date = date("Y-m-d", strtotime($s_received_date));
        //sp測試
        $sql = sprintf(
            "EXECUTE [%s].[dbo].[sp_yesterday_received_statement_test] @ReportDate = :ReportDate",
            $this->database_trend
        );
        $sth = $this->pdo_sql->prepare($sql);
        $sth->execute([
            "ReportDate" => $s_received_date
        ]);

        //sp測試
        $sql = sprintf(
            "EXECUTE [%s].[dbo].[sp_yesterday_currency_ledger_new_test] @ReportDate = :ReportDate",
            $this->database_trend
        );
        $sth = $this->pdo_sql->prepare($sql);
        $sth->execute([
            "ReportDate" => $s_received_date
        ]);

        return "OK";
    }
    /**
     * Leo
     * api 驗證 false:失敗 true:通過
     */
    public function api_verify($token, $params)
    {
        $res = false;
        return $res;
    }
}
