github/app/Services/TG/Hook/Mod/SaleCode.php
2025-06-26 21:10:32 +08:00

54 lines
1.5 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]]);
return $this->toJson($updatedRows);
// $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();
return $this->toJson($aSaleCodeList);
// $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();
return $this->toJson($aSaleCodeList);
// $this->oTGHttp->sendToTG(json_encode($aSaleCodeList, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
// $this->oHttp::response(200, 'ok');
}
}