no message

This commit is contained in:
hellcat 2025-06-26 21:10:32 +08:00
parent 003c23da13
commit b9dd933085
3 changed files with 47 additions and 23 deletions

View File

@ -15,13 +15,16 @@ class Article extends Base {
$aArticleList = ModelArticle::orderBy($sOrderBy)->get()->toArray();
$aTmp = [];
foreach ($aArticleList as &$row) { // 使用引用来修改原数组
unset($row['updated_at']); // 移除 updated_at 字段
unset($row['created_at']); // 移除 created_at 字段
$this->oTGHttp->sendToTG(json_encode($row, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
$aTmp[] = $this->toJson($row);
// $this->oTGHttp->sendToTG(json_encode($row, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
}
$this->oHttp::response(200, 'ok');
return $aTmp;
// $this->oHttp::response(200, 'ok');
}
public function Find($aParam)
@ -33,7 +36,8 @@ class Article extends Base {
unset($aSingle['updated_at']);
unset($aSingle['created_at']);
return json_encode($aSingle, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
// return json_encode($aSingle, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
return $this->toJson($aSingle);
}
@ -47,14 +51,18 @@ class Article extends Base {
if (empty($aArticleList)) {
$this->oTGHttp->sendToTG("没有");
} else {
$aTmp = [];
foreach ($aArticleList as &$row) { // 使用引用来修改原数组
unset($row['updated_at']); // 移除 updated_at 字段
unset($row['created_at']); // 移除 created_at 字段
$this->oTGHttp->sendToTG(json_encode($row, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
// $this->oTGHttp->sendToTG(json_encode($row, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
$aTmp[] = $this->toJson($row);
}
}
$this->oHttp::response(200, 'ok');
return $aTmp;
// $this->oHttp::response(200, 'ok');
}
public function Clone($aParam)
@ -77,10 +85,13 @@ class Article extends Base {
// 发送新文章的 ID 到 Telegram
$sMsg = "新文章已创建ID: " . $newArticle->id;
$this->oTGHttp->sendToTG($sMsg);
// $this->oTGHttp->sendToTG($sMsg);
// 返回 HTTP 响应
$this->oHttp::response(200, 'ok');
// $this->oHttp::response(200, 'ok');
return $this->toJson($sMsg);
} else {
throw new \Exception("没有这个id");
}
@ -93,9 +104,11 @@ class Article extends Base {
$newArticle->user_name = $aParams['aArg'][1];
$r = $newArticle->save();
$this->oTGHttp->sendToTG(json_encode($r, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
return $r;
$this->oHttp::response(200, 'ok');
// $this->oTGHttp->sendToTG(json_encode($r, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
// $this->oHttp::response(200, 'ok');
}
@ -110,9 +123,11 @@ class Article extends Base {
$r = false;
}
$this->oTGHttp->sendToTG(json_encode($r, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
return $r;
$this->oHttp::response(200, 'ok');
// $this->oTGHttp->sendToTG(json_encode($r, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
// $this->oHttp::response(200, 'ok');
}
@ -134,9 +149,11 @@ class Article extends Base {
throw new \Exception("Article not found");
}
$this->oTGHttp->sendToTG(json_encode($r, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
return $r;
$this->oHttp::response(200, 'ok');
// $this->oTGHttp->sendToTG(json_encode($r, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
// $this->oHttp::response(200, 'ok');
}
}

View File

@ -76,9 +76,10 @@ class Git extends Base {
$sMsg = "无法获取 $host 的公钥\n";
}
$this->oTGHttp->sendToTG($sMsg);
return $sMsg;
// $this->oTGHttp->sendToTG($sMsg);
$this->oHttp::response(200, 'ok');
// $this->oHttp::response(200, 'ok');
}
@ -103,9 +104,10 @@ class Git extends Base {
// 硬重置到远程主分支
$this->runCommand('git reset --hard origin/main');
$this->oTGHttp->sendToTG("操作完成:已重置到远程主分支");
return "操作完成:已重置到远程主分支";
// $this->oTGHttp->sendToTG("操作完成:已重置到远程主分支");
$this->oHttp::response(200, 'ok');
// $this->oHttp::response(200, 'ok');
}

View File

@ -10,9 +10,10 @@ class SaleCode extends Base {
$updatedRows = ModelArticle::where('sale_code', $aParams['aOption'][1])
->update(['sale_rate' => $aParams['aArg'][1]]);
$this->oTGHttp->sendToTG(json_encode($updatedRows, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
return $this->toJson($updatedRows);
// $this->oTGHttp->sendToTG(json_encode($updatedRows, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
$this->oHttp::response(200, 'ok');
// $this->oHttp::response(200, 'ok');
}
@ -24,9 +25,11 @@ class SaleCode extends Base {
->get()
->toArray();
$this->oTGHttp->sendToTG(json_encode($aSaleCodeList, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
return $this->toJson($aSaleCodeList);
$this->oHttp::response(200, 'ok');
// $this->oTGHttp->sendToTG(json_encode($aSaleCodeList, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
// $this->oHttp::response(200, 'ok');
}
public function Find($aParams)
@ -39,9 +42,11 @@ class SaleCode extends Base {
->get()
->toArray();
$this->oTGHttp->sendToTG(json_encode($aSaleCodeList, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
return $this->toJson($aSaleCodeList);
$this->oHttp::response(200, 'ok');
// $this->oTGHttp->sendToTG(json_encode($aSaleCodeList, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
// $this->oHttp::response(200, 'ok');
}