58 lines
1.7 KiB
PHP
58 lines
1.7 KiB
PHP
<?php
|
||
|
||
namespace App\Services\Github;
|
||
use App\Services\TomTool\Http;
|
||
|
||
class Github {
|
||
|
||
public static function GetReadMe($aArticle)
|
||
{
|
||
list($sClass, $sFunc) = explode('#', $aArticle['mod']);
|
||
|
||
$sClass = "App\\Services\\Github\\Mod\\".$sClass;
|
||
|
||
if (method_exists($sClass, $sFunc)) {
|
||
$oInstans = new $sClass();
|
||
$oInstans->aHuodong = self::GetHuodong($aArticle);
|
||
$sReadMe = $oInstans->$sFunc($aArticle);
|
||
return $sReadMe;
|
||
} else {
|
||
// 处理方法不存在的情况(可选)
|
||
// $this->tgMessage("Method $sClass does not exist.");
|
||
return false;
|
||
}
|
||
|
||
}
|
||
|
||
public static function GetHuodong($aArticle)
|
||
{
|
||
|
||
$oHttp = new Http();
|
||
|
||
$sDateNow = date("Y-m-d");
|
||
$sDateNow = "2025-05-03";
|
||
|
||
$sHuodongUrl = env('api_url_jichang_base').'/'.'api/huodong/findbydate/'.$sDateNow;
|
||
$sHuodong = $oHttp->send($sHuodongUrl);
|
||
$oHuodong = json_decode($sHuodong, 1);
|
||
|
||
$sHuodongStr = "购买套餐时输入【".$aArticle['sale_code']."】优惠码,可享".$aArticle['sale_rate']."折优惠,折后低至8元/月。";
|
||
|
||
if ($oHuodong) {
|
||
$sStartDateStr = date("n月j日", strtotime($oHuodong['start_date']));
|
||
$sEndDateStr = date("n月j日", strtotime($oHuodong['end_date']));
|
||
|
||
$sHuodongStr .= "
|
||
|
||
🎁 ".$oHuodong['title'].":".$sStartDateStr."至".$sEndDateStr."期间,".$oHuodong['content'];
|
||
|
||
}
|
||
|
||
$oHuodong['str'] = $sHuodongStr;
|
||
|
||
return $oHuodong;
|
||
|
||
}
|
||
|
||
}
|