github/app/Services/TG/Hook/Mod/SaleCode.php
2025-04-14 21:02:26 +08:00

49 lines
1.3 KiB
PHP

<?php
namespace App\Services\TG\Hook\Mod;
use App\Models\Article as ModelArticle;
class SaleCode extends Base {
public function SetRate($aParams)
{
$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));
$this->oHttp::response(200, 'ok');
}
public function List()
{
$aSaleCodeList = ModelArticle::select('sale_code', 'sale_rate')
->distinct()
->orderBy("sale_code")
->get()
->toArray();
$this->oTGHttp->sendToTG(json_encode($aSaleCodeList, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
$this->oHttp::response(200, 'ok');
}
public function Find($aParams)
{
$aSaleCodeList = ModelArticle::select('sale_code', 'sale_rate')
->where("sale_code", $aParams['aArg'][1])
->distinct()
->orderBy("sale_code")
->get()
->toArray();
$this->oTGHttp->sendToTG(json_encode($aSaleCodeList, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
$this->oHttp::response(200, 'ok');
}
}