88 lines
2.7 KiB
PHP
88 lines
2.7 KiB
PHP
<?php
|
||
|
||
namespace App\Services\Github;
|
||
use App\Services\TomTool\Http;
|
||
|
||
class Github {
|
||
|
||
public static function GetReadMe($aArticle)
|
||
{
|
||
list($sClassDir, $sClass) = explode('#', $aArticle['mod']);
|
||
|
||
$sClass = "App\\Services\\Github\\Mod\\".$sClass;
|
||
$sClass = "App\\Services\\Github\\Mod\\".$sClassDir."\\".$sClass;
|
||
|
||
$sFunc = "Get";
|
||
|
||
if (method_exists($sClass, $sFunc)) {
|
||
$oInstans = new $sClass();
|
||
// $oInstans->aHuodong = self::GetHuodong($aArticle);
|
||
$oInstans->aShip = self::GetShip($aArticle);
|
||
$sReadMe = $oInstans->$sFunc($aArticle);
|
||
return $sReadMe;
|
||
} else {
|
||
// 处理方法不存在的情况(可选)
|
||
// $this->tgMessage("Method $sClass does not exist.");
|
||
return false;
|
||
}
|
||
|
||
}
|
||
|
||
public static function GetShip($aArticle)
|
||
{
|
||
$oHttp = new Http();
|
||
|
||
$sDateNow = date("Y-m-d");
|
||
|
||
$sMasterUrl = "https://".env("www_master")."/api/ship/get/fuc/github/".$aArticle["user_name"]."-".$aArticle["project_name"];
|
||
|
||
$sShip = $oHttp->send($sMasterUrl);
|
||
$aShip = json_decode($sShip, true);
|
||
|
||
$aShip["youhui_str"] = "购买套餐时输入【".$aArticle['sale_code']."】优惠码,可享".$aArticle['sale_rate']."折优惠,折后低至8元/月。";
|
||
|
||
if ($aShip["huodong"]["str"]) {
|
||
$aShip["youhui_str"] .= "
|
||
|
||
".$aShip["huodong"]["str"];
|
||
}
|
||
|
||
// tomd(empty($aShip["huodong"]["str"]), 1);
|
||
// tomd($aShip, 1);
|
||
|
||
return $aShip;
|
||
}
|
||
|
||
|
||
// 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;
|
||
//
|
||
// }
|
||
|
||
}
|