|
|
@@ -2,8 +2,8 @@
|
|
|
|
|
|
namespace App\Http\Controllers\admin;
|
|
|
|
|
|
+use Illuminate\Http\JsonResponse;
|
|
|
use App\Constants\HttpStatus;
|
|
|
-use App\Constants\Util;
|
|
|
use App\Http\Controllers\Controller;
|
|
|
use App\Models\Config as ConfigModel;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
@@ -13,10 +13,22 @@ use Telegram\Bot\Api;
|
|
|
use Telegram\Bot\Exceptions\TelegramSDKException;
|
|
|
use Telegram\Bot\FileUpload\InputFile;
|
|
|
use App\Services\ConfigService;
|
|
|
-use Google\Service\ServiceManagement\ConfigSource;
|
|
|
|
|
|
class Config extends Controller
|
|
|
{
|
|
|
+ public function pcConfig(): JsonResponse
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $search['group_id'] = 4;
|
|
|
+ $result = ConfigService::paginate($search);
|
|
|
+ } catch (ValidationException $e) {
|
|
|
+ return $this->error(HttpStatus::VALIDATION_FAILED, $e->validator->errors()->first());
|
|
|
+ } catch (Exception $e) {
|
|
|
+ return $this->error(intval($e->getCode()));
|
|
|
+ }
|
|
|
+ return $this->success($result);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 分页数据
|
|
|
@@ -44,7 +56,8 @@ class Config extends Controller
|
|
|
* 修改|新增
|
|
|
*
|
|
|
*/
|
|
|
- public function store()
|
|
|
+ public
|
|
|
+ function store()
|
|
|
{
|
|
|
try {
|
|
|
$id = request()->post('id', '');
|
|
|
@@ -83,7 +96,8 @@ class Config extends Controller
|
|
|
/**
|
|
|
* 删除
|
|
|
*/
|
|
|
- public function destroy()
|
|
|
+ public
|
|
|
+ function destroy()
|
|
|
{
|
|
|
|
|
|
$id = request()->post('id');
|
|
|
@@ -151,7 +165,8 @@ class Config extends Controller
|
|
|
* ]
|
|
|
*
|
|
|
*/
|
|
|
- public function get()
|
|
|
+ public
|
|
|
+ function get()
|
|
|
{
|
|
|
try {
|
|
|
request()->validate([
|
|
|
@@ -190,7 +205,8 @@ class Config extends Controller
|
|
|
* @apiUse header
|
|
|
* @apiVersion 1.0.0
|
|
|
*/
|
|
|
- public function getAll()
|
|
|
+ public
|
|
|
+ function getAll()
|
|
|
{
|
|
|
$list = ConfigModel::where('id', '>', 0)->get();
|
|
|
$arr = [];
|
|
|
@@ -252,7 +268,8 @@ class Config extends Controller
|
|
|
* //更多行...
|
|
|
* ]
|
|
|
*/
|
|
|
- public function sendChannelMessage()
|
|
|
+ public
|
|
|
+ function sendChannelMessage()
|
|
|
{
|
|
|
set_time_limit(0);
|
|
|
DB::beginTransaction();
|
|
|
@@ -357,33 +374,33 @@ class Config extends Controller
|
|
|
return $this->success();
|
|
|
}
|
|
|
|
|
|
- // public function sendChannelVideo()
|
|
|
- // {
|
|
|
- // $chatId = request()->input('chatId');
|
|
|
- // $video = request()->input('video');
|
|
|
- // // $config = ConfigModel::where('field', 'channel_message')
|
|
|
- // // ->first()->val;
|
|
|
- // // $config = json_decode($config, true);
|
|
|
- // $telegram = new Api(config('services.telegram.token'));
|
|
|
- // // 发送图片消息
|
|
|
- // $response = $telegram->sendVideo([
|
|
|
- // 'chat_id' => "@{$chatId}",
|
|
|
- // 'caption' => '这是一个视频消息',
|
|
|
- // 'video' => InputFile::create($video),
|
|
|
- // 'protect_content' => false,
|
|
|
- // ]);
|
|
|
-
|
|
|
- // // 获取消息ID
|
|
|
- // $messageId = $response->get('message_id');
|
|
|
- // // 获取消息ID
|
|
|
- // $messageId = $response->get('message_id');
|
|
|
- // // 置顶消息
|
|
|
- // $telegram->pinChatMessage([
|
|
|
- // 'chat_id' => "@{$chatId}",
|
|
|
- // 'message_id' => $messageId
|
|
|
- // ]);
|
|
|
- // return $this->success($messageId);
|
|
|
- // }
|
|
|
+// public function sendChannelVideo()
|
|
|
+// {
|
|
|
+// $chatId = request()->input('chatId');
|
|
|
+// $video = request()->input('video');
|
|
|
+// // $config = ConfigModel::where('field', 'channel_message')
|
|
|
+// // ->first()->val;
|
|
|
+// // $config = json_decode($config, true);
|
|
|
+// $telegram = new Api(config('services.telegram.token'));
|
|
|
+// // 发送图片消息
|
|
|
+// $response = $telegram->sendVideo([
|
|
|
+// 'chat_id' => "@{$chatId}",
|
|
|
+// 'caption' => '这是一个视频消息',
|
|
|
+// 'video' => InputFile::create($video),
|
|
|
+// 'protect_content' => false,
|
|
|
+// ]);
|
|
|
+
|
|
|
+// // 获取消息ID
|
|
|
+// $messageId = $response->get('message_id');
|
|
|
+// // 获取消息ID
|
|
|
+// $messageId = $response->get('message_id');
|
|
|
+// // 置顶消息
|
|
|
+// $telegram->pinChatMessage([
|
|
|
+// 'chat_id' => "@{$chatId}",
|
|
|
+// 'message_id' => $messageId
|
|
|
+// ]);
|
|
|
+// return $this->success($messageId);
|
|
|
+// }
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -401,7 +418,8 @@ class Config extends Controller
|
|
|
* @apiParam {string} receiving_type 收款方式 1-自动 2-手动
|
|
|
*
|
|
|
*/
|
|
|
- public function set()
|
|
|
+ public
|
|
|
+ function set()
|
|
|
{
|
|
|
DB::beginTransaction();
|
|
|
try {
|