WithdrawService.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. <?php
  2. namespace App\Services;
  3. use App\Constants\StepStatus;
  4. use App\Models\Address;
  5. use App\Models\BalanceLog;
  6. use App\Models\Bank;
  7. use App\Models\Config;
  8. use App\Models\RoomUser;
  9. use App\Models\User;
  10. use App\Models\Wallet;
  11. use App\Models\Withdraw;
  12. use Illuminate\Support\Facades\Cache;
  13. use LaravelLang\Publisher\Console\Add;
  14. use Telegram\Bot\Api;
  15. use Telegram\Bot\Exceptions\TelegramSDKException;
  16. class WithdrawService
  17. {
  18. private $serviceCharge;
  19. public static function init(Api $telegram, $data, $chatId, $firstName, $messageId): void
  20. {
  21. switch ($data) {
  22. case "withdraw@@address"://地址管理
  23. $res = WithdrawService::getAddress($chatId, $messageId);
  24. $telegram->editMessageText($res);
  25. break;
  26. case "withdrawAddress@@done":
  27. $res = WithdrawService::done($chatId, $messageId, $firstName);
  28. $telegram->editMessageText($res);
  29. break;
  30. case "withdraw@@bill"://点击提现的账单按钮
  31. $res = WithdrawService::bill($chatId, $firstName, $messageId);
  32. $telegram->editMessageText($res);
  33. break;
  34. case "withdrawAddress@@add":
  35. $res = WithdrawService::addAddress($chatId, $messageId);
  36. $telegram->editMessageText($res);
  37. break;
  38. case "withdraw@@apply"://点击提现按钮
  39. $res = WithdrawService::apply($chatId, $messageId);
  40. $telegram->editMessageText($res);
  41. break;
  42. default:
  43. //选择提现地址
  44. $pattern = "/^withdrawAddress@@choose\d+$/";
  45. if (preg_match($pattern, $data)) {
  46. $id = preg_replace('/^withdrawAddress@@choose/', '', $data);
  47. $res = WithdrawService::chooseAddress($chatId, $firstName, $messageId, $id);
  48. $telegram->editMessageText($res);
  49. }
  50. //删除地址
  51. $pattern = "/^withdrawAddress@@del\d+$/";
  52. if (preg_match($pattern, $data)) {
  53. $id = preg_replace('/^withdrawAddress@@del/', '', $data);
  54. $res = WithdrawService::delAddress($chatId, $id, $messageId);
  55. $telegram->editMessageText($res);
  56. }
  57. //地址详情
  58. $pattern = "/^withdrawAddress@@detail\d+$/";
  59. if (preg_match($pattern, $data)) {
  60. $id = preg_replace('/^withdrawAddress@@detail/', '', $data);
  61. $res = WithdrawService::addressDetails($chatId, $messageId, $id);
  62. $telegram->editMessageText($res);
  63. }
  64. //提现账单,下一页
  65. $pattern = "/^withdrawBillNextPage@@\d+$/";
  66. if (preg_match($pattern, $data)) {
  67. $page = preg_replace('/^withdrawBillNextPage@@/', '', $data);
  68. $page = intval($page);
  69. $res = WithdrawService::bill($chatId, $firstName, $messageId, $page);
  70. $telegram->editMessageText($res);
  71. }
  72. break;
  73. }
  74. }
  75. public static function model(): string
  76. {
  77. return Withdraw::class;
  78. }
  79. public static function enum(): string
  80. {
  81. return '';
  82. }
  83. public static function getWhere(array $search = []): array
  84. {
  85. $where = [];
  86. if (isset($search['id']) && !empty($search['id'])) {
  87. $where[] = ['id', '=', $search['id']];
  88. }
  89. if (isset($search['member_id']) && !empty($search['member_id'])) {
  90. $where[] = ['member_id', '=', $search['member_id']];
  91. }
  92. if (isset($search['status']) && $search['status'] != '') {
  93. $where[] = ['status', '=', $search['status']];
  94. }
  95. return $where;
  96. }
  97. public static function findOne(array $search): ?Withdraw
  98. {
  99. return self::model()::where(self::getWhere($search))->first();
  100. }
  101. public static function findAll(array $search = [])
  102. {
  103. return self::model()::where(self::getWhere($search))->get();
  104. }
  105. public static function paginate(array $search = [])
  106. {
  107. $limit = isset($search['limit']) ? $search['limit'] : 10;
  108. $paginator = self::model()::where(self::getWhere($search))
  109. ->orderBy('created_at', 'desc')->paginate($limit);
  110. return ['total' => $paginator->total(), 'data' => $paginator->items()];
  111. }
  112. public function __construct()
  113. {
  114. $serviceCharge = Config::where('field', 'service_charge')->first()->val;
  115. $serviceCharge = floatval($serviceCharge);
  116. $this->serviceCharge = $serviceCharge;
  117. }
  118. public static function getServiceCharge(): float
  119. {
  120. $serviceCharge = Config::where('field', 'service_charge')->first()->val;
  121. return floatval($serviceCharge);
  122. }
  123. public static function notify($data)
  124. {
  125. try {
  126. $telegram = new Api(config('services.telegram.token'));
  127. $telegram->sendMessage($data);
  128. } catch (TelegramSDKException $e) {
  129. return false;
  130. }
  131. return true;
  132. }
  133. //提现账单
  134. public static function bill($chatId, $firstName, $messageId = null, $page = 1, $limit = 5)
  135. {
  136. $list = Withdraw::where('member_id', $chatId)
  137. ->orderBy('id', 'desc')
  138. ->forPage($page, $limit)
  139. ->get();
  140. $count = Withdraw::where('member_id', $chatId)
  141. ->whereIn('status', [0, 1])
  142. ->count();
  143. $status = [lang('等待放行'), lang('已到账'), lang("失败")];
  144. $text = "👤 {$firstName}({$chatId}) " . lang("钱包提现记录") . "\n\n";
  145. foreach ($list as $item) {
  146. $amount = floatval($item->amount);
  147. $balance = floatval($item->after_balance);
  148. $text .= "-------------------------------------\n";
  149. $text .= "➖ {$amount} USDT\n" . lang("余额") . ":{$balance} \n";
  150. $text .= lang("类别") . "类别:" . lang("提现") . "\n";
  151. $text .= lang("状态") . ":{$status[$item->status]}\n";
  152. if ($item->remark) {
  153. $text .= lang("说明") . ":{$item->remark}\n";
  154. }
  155. $text .= lang("日期") . ":{$item->created_at}\n";
  156. }
  157. if ($page > 1) {
  158. $keyboard[] = [
  159. ['text' => lang("👆上一页"), 'callback_data' => "withdrawBillNextPage@@" . ($page - 1)]
  160. ];
  161. }
  162. $allPage = ceil($count / $limit);
  163. if ($allPage > $page) {
  164. if ($page > 1) {
  165. $keyboard[count($keyboard) - 1][] = ['text' => lang("👇下一页"), 'callback_data' => "withdrawBillNextPage@@" . ($page + 1)];
  166. } else {
  167. $keyboard[] = [
  168. ['text' => lang("👇下一页"), 'callback_data' => "withdrawBillNextPage@@" . ($page + 1)]
  169. ];
  170. }
  171. }
  172. $keyboard[] = [
  173. ['text' => lang("↩️返回"), 'callback_data' => "withdraw@@home"]
  174. ];
  175. return [
  176. 'chat_id' => $chatId,
  177. 'text' => $text,
  178. 'message_id' => $messageId,
  179. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
  180. ];
  181. }
  182. //删除地址
  183. public static function delAddress($chatId, $id, $messageId)
  184. {
  185. Address::where('id', $id)
  186. ->where('member_id', $chatId)->delete();
  187. return WithdrawService::getAddress($chatId, $messageId);
  188. }
  189. //地址详情
  190. public static function addressDetails($chatId, $messageId, $id)
  191. {
  192. $text = lang("*TRC20 地址管理*") . "\n\n";
  193. $address = Address::where('id', $id)
  194. ->where('member_id', $chatId)->first();
  195. $text .= lang("地址") . ":{$address->address}\n";
  196. $text .= lang("别名") . ":{$address->alias}";
  197. $keyboard = [
  198. [['text' => lang('❌删除该地址'), 'callback_data' => "withdrawAddress@@del{$id}"]],
  199. [['text' => lang('↩️返回列表'), 'callback_data' => 'withdraw@@address']]
  200. ];
  201. return [
  202. 'chat_id' => $chatId,
  203. 'parse_mode' => 'MarkdownV2',
  204. 'text' => $text,
  205. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard]),
  206. 'message_id' => $messageId
  207. ];
  208. }
  209. //输入别名
  210. public static function inputAlias($chatId, $alias, $messageId)
  211. {
  212. if (mb_strlen($alias) > 20) {
  213. return [
  214. 'chat_id' => $chatId,
  215. 'text' => lang("别名不能超过20个字,请重新输入"),
  216. 'reply_to_message_id' => $messageId,
  217. ];
  218. }
  219. $address = Cache::get("{$chatId}_address");
  220. $a = new Address();
  221. $a->address = $address;
  222. $a->alias = $alias;
  223. $a->member_id = $chatId;
  224. $a->save();
  225. Cache::delete("{$chatId}_address");
  226. Cache::delete(get_step_key($chatId));
  227. return self::getAddress($chatId, $messageId);
  228. }
  229. //用户输入TRC20地址
  230. public static function inputAddress($chatId, $address, $messageId)
  231. {
  232. if (!preg_match('/^T[a-zA-Z1-9]{33}$/', $address)) {
  233. return [
  234. 'chat_id' => $chatId,
  235. 'text' => lang("地址输入不正确,请重新输入TRC20地址"),
  236. 'reply_to_message_id' => $messageId,
  237. ];
  238. }
  239. Cache::put("{$chatId}_address", $address);
  240. Cache::put(get_step_key($chatId), StepStatus::INPUT_ADDRESS_ALIAS);
  241. return [
  242. 'chat_id' => $chatId,
  243. 'text' => lang("请输入地址别名,便于区分多个地址"),
  244. ];
  245. }
  246. //添加地址
  247. public static function addAddress($chatId, $messageId)
  248. {
  249. $text = lang('请输入新的TRC20地址') . "\n";
  250. $keyboard = [[
  251. ['text' => lang('❌取消'), 'callback_data' => "message@@close"],
  252. ]];
  253. Cache::put(get_step_key($chatId), StepStatus::INPUT_ADDRESS_TRC20);
  254. return [
  255. 'chat_id' => $chatId,
  256. 'text' => $text,
  257. 'message_id' => $messageId,
  258. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
  259. ];
  260. }
  261. //地址管理
  262. public static function getAddress($chatId, $messageId)
  263. {
  264. $text = lang("🏠 地址管理");
  265. $text .= "\n--------------------------\n";
  266. $list = Address::where('member_id', $chatId)
  267. ->get();
  268. $keyboard = [];
  269. foreach ($list as $item) {
  270. $keyboard[] = [['text' => $item->alias, 'callback_data' => "withdrawAddress@@detail{$item->id}"]];
  271. }
  272. if (count($list) < 5) {
  273. $keyboard[] = [['text' => lang("➕ 添加地址"), 'callback_data' => "withdrawAddress@@add"]];
  274. }
  275. $keyboard[] = [['text' => lang("↩️返回"), 'callback_data' => "withdraw@@home"]];
  276. return [
  277. 'chat_id' => $chatId,
  278. 'text' => $text,
  279. 'message_id' => $messageId,
  280. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
  281. ];
  282. }
  283. //设置提现地址
  284. public function setAddress($chatId, $address)
  285. {
  286. $address = trim($address);
  287. if (!$address) return [['chat_id' => $chatId, 'text' => lang("提现地址不能为空")]];
  288. $user = User::where('member_id', $chatId)->first();
  289. $user->usdt = $address;
  290. $user->save();
  291. $wallet = Wallet::where('member_id', $chatId)->first();
  292. $temp = floatval($wallet->available_balance);
  293. $text = "✅ " . lang('提现地址已设置') . "\n\n";
  294. $text .= lang("请发送提现金额") . "\n";
  295. $text .= "💰 " . lang("当前可用余额") . ":{$temp}\n";
  296. $text .= "⚠️ " . lang('提现将收取') . "{$this->serviceCharge}" . lang("U作为手续费") . "\n";
  297. $text .= "------------------------------------\n";
  298. $text .= lang("例如您要提现100 USDT") . "\n";
  299. $text .= lang("那么请发送:【提现】100") . "\n";
  300. return [['chat_id' => $chatId, 'text' => $text]];
  301. }
  302. public static function done($chatId, $messageId, $firstName)
  303. {
  304. $serviceCharge = (new WithdrawService())->serviceCharge;
  305. $amount = Cache::get("{$chatId}_WITHDRAW_MONEY", '');
  306. $address = Cache::get("{$chatId}_WITHDRAW_ADDRESS", '');
  307. if (!$amount || !$address) return WithdrawService::index($chatId, $firstName, $messageId);
  308. $real = bcsub($amount, $serviceCharge, 10);
  309. $real = floatval($real);
  310. if ($amount <= $serviceCharge) {
  311. return [
  312. 'chat_id' => $chatId,
  313. 'text' => lang("⚠️提现不能少于") . "{$serviceCharge} USDT," . lang("请重试"),
  314. 'message_id' => $messageId
  315. ];
  316. }
  317. $wallet = Wallet::where('member_id', $chatId)->first();
  318. $temp = floatval($wallet->available_balance);
  319. // 汇率
  320. $rate = Config::where('field', 'exchange_rate_rmb')->first()->val ?? 1;
  321. $exchange_rate_difference = Config::where('field', 'exchange_rate_difference')->first()->val ?? 0;
  322. $rate = bcadd($rate, $exchange_rate_difference, 2);
  323. $rate_usdt_amount = bcdiv($temp, $rate, 2); // 钱包可用余额 折合USDT
  324. $rate_rmb_amount = bcmul($amount, $rate, 2); // 提现金额 折合RMB
  325. if ($amount > $rate_usdt_amount) {
  326. return [
  327. 'chat_id' => $chatId,
  328. 'text' => lang("⚠️可用余额不足,请重试"),
  329. 'message_id' => $messageId
  330. ];
  331. }
  332. $ru = RoomUser::where('member_id', $chatId)
  333. ->whereIn('status', [0, 1, 2, 3])
  334. ->first();
  335. if ($ru) {
  336. $text = lang("游戏未结算") . "\n";
  337. $text .= "⚠️ " . lang("您还有进行中的游戏,所有游戏结算后方可提现") . "\n";
  338. return [
  339. 'chat_id' => $chatId,
  340. 'text' => $text,
  341. 'message_id' => $messageId,
  342. 'reply_markup' => json_encode(['inline_keyboard' => [[
  343. ['text' => lang('进入房间'), 'callback_data' => "games@@home{$ru->room_id}"],
  344. ]]])
  345. ];
  346. }
  347. $withdraw = new Withdraw();
  348. $withdraw->member_id = $chatId;
  349. $withdraw->amount = $amount;
  350. $withdraw->service_charge = $serviceCharge;
  351. $withdraw->to_account = $real;
  352. $withdraw->address = $address;
  353. $withdraw->exchange_rate = $rate;
  354. $withdraw->status = 0;
  355. $withdraw->after_balance = bcdiv($wallet->available_balance, $rate, 2);
  356. $withdraw->save();
  357. $wallet = Wallet::where('member_id', $chatId)->first();
  358. $changeAmount = bcmul(($amount * -1), $rate, 2);
  359. $beforeBalance = $wallet->available_balance;
  360. $afterBalance = bcsub($wallet->available_balance, $rate_rmb_amount, 2);
  361. $wallet->available_balance = $afterBalance;
  362. $wallet->save();
  363. BalanceLogService::addLog($chatId, $changeAmount, $beforeBalance, $afterBalance, '提现', $withdraw->id, '');
  364. $temp = floatval($afterBalance);
  365. $text = "✅ " . lang("提现申请已提交!") . "\n\n";
  366. $text .= lang("钱包余额") . ":{$temp} RMB\n";
  367. $text .= lang("汇率") . ":1 USDT = {$rate} RMB\n";
  368. $text .= lang("剩余可用USDT余额") . ":" . number_format(bcdiv($temp, $rate, 2), 2) . " USDT\n";
  369. $text .= lang("提现金额") . ":{$amount} USDT\n";
  370. $text .= lang("实际到账") . ":{$real} USDT\n";
  371. $text .= lang("手续费") . ":{$serviceCharge} USDT\n\n";
  372. $text .= lang("⌛️请等待系统处理, 到账时间可能需要几分钟!") . "\n";
  373. Cache::delete(get_step_key($chatId));
  374. return [
  375. 'chat_id' => $chatId,
  376. 'text' => $text,
  377. 'message_id' => $messageId,
  378. ];
  379. }
  380. public static function chooseAddress($chatId, $firstName, $messageId, $id)
  381. {
  382. $serviceCharge = (new WithdrawService())->serviceCharge;
  383. $amount = Cache::get("{$chatId}_WITHDRAW_MONEY", '');
  384. if (!$amount) return WithdrawService::index($chatId, $firstName, $messageId);
  385. $amount = floatval($amount);
  386. $real = bcsub($amount, $serviceCharge, 10);
  387. $real = floatval($real);
  388. $address = Address::where('id', $id)
  389. ->where('member_id', $chatId)->first();
  390. $text = lang("请确认") . "\n\n";
  391. $text .= lang('手续费') . ":{$serviceCharge} USDT\n";
  392. $text .= lang("提现金额") . ":{$amount} USDT\n";
  393. $text .= lang("实际到账") . ":{$real} USDT\n";
  394. $text .= lang("提现地址") . ":{$address->address}\n";
  395. $keyboard = [
  396. [
  397. ['text' => lang('✅ 确认'), 'callback_data' => "withdrawAddress@@done"],
  398. ],
  399. [
  400. ['text' => lang('❌取消'), 'callback_data' => "message@@close"]
  401. ]
  402. ];
  403. Cache::put("{$chatId}_WITHDRAW_ADDRESS", $address->address);
  404. return [
  405. 'chat_id' => $chatId,
  406. 'text' => $text,
  407. 'message_id' => $messageId,
  408. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
  409. ];
  410. }
  411. //用户输入提现金额
  412. public function inputAmount($chatId, $amount, $messageId)
  413. {
  414. if (!preg_match('/^-?\d+(\.\d+)?$/', $amount)) {
  415. return [[
  416. 'chat_id' => $chatId,
  417. 'text' => lang("金额输入不正确,请发送提现数字"),
  418. 'reply_to_message_id' => $messageId
  419. ]];
  420. }
  421. $wallet = Wallet::where('member_id', $chatId)->first();
  422. $temp = floatval($wallet->available_balance);
  423. // 汇率
  424. $rate = Config::where('field', 'exchange_rate_rmb')->first()->val ?? 1;
  425. $rate_amount = bcdiv($temp, $rate, 2);
  426. if ($amount <= $this->serviceCharge) {
  427. return [[
  428. 'chat_id' => $chatId,
  429. 'text' => lang("⚠️提现不能少于") . "{$this->serviceCharge} USDT," . lang('请重试'),
  430. 'reply_to_message_id' => $messageId
  431. ]];
  432. }
  433. if ($amount > $rate_amount) {
  434. return [[
  435. 'chat_id' => $chatId,
  436. 'text' => lang("可用余额不足,请重试"),
  437. 'reply_to_message_id' => $messageId
  438. ]];
  439. }
  440. $ru = RoomUser::where('member_id', $chatId)
  441. ->whereIn('status', [0, 1, 2, 3])
  442. ->first();
  443. if ($ru) {
  444. $text = lang('*游戏未结算*') . "\n";
  445. $text .= lang("⚠️ 您还有进行中的游戏,所有游戏结算后方可提现") . "\n";
  446. return [[
  447. 'chat_id' => $chatId,
  448. 'text' => $text,
  449. 'parse_mode' => 'MarkdownV2',
  450. 'reply_markup' => json_encode(['inline_keyboard' => [[
  451. ['text' => lang('进入房间'), 'callback_data' => "games@@home{$ru->room_id}"],
  452. ]]])
  453. ]];
  454. }
  455. $list = Address::where('member_id', $chatId)->get();
  456. $keyboard = [];
  457. foreach ($list as $item) {
  458. $keyboard[] = [['text' => $item->alias, 'callback_data' => "withdrawAddress@@choose{$item->id}"]];
  459. }
  460. $keyboard[] = [
  461. ['text' => lang("🏠 地址管理"), 'callback_data' => "withdraw@@address"],
  462. ['text' => lang('❌取消'), 'callback_data' => "message@@close"]
  463. ];
  464. $text = lang('请直接选择下面的地址') . "\n";
  465. $text .= lang("⚠️提示:请务必确认提现地址正确无误,\n否则资金丢失将无法找回请自负!");
  466. Cache::put("{$chatId}_WITHDRAW_MONEY", $amount);
  467. Cache::put(get_step_key($chatId), StepStatus::CHOOSE_WITHDRAW_ADDRESS);
  468. return [[
  469. 'chat_id' => $chatId,
  470. 'text' => $text,
  471. 'reply_to_message_id' => $messageId,
  472. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
  473. ]];
  474. }
  475. //申请提现
  476. public static function apply($chatId, $messageId)
  477. {
  478. $wallet = Wallet::where('member_id', $chatId)->first();
  479. // 汇率
  480. $rate = Config::where('field', 'exchange_rate_rmb')->first()->val ?? 1;
  481. $exchange_rate_difference = Config::where('field', 'exchange_rate_difference')->first()->val ?? 0;
  482. $rate = bcadd($rate, $exchange_rate_difference, 2);
  483. $temp = floatval($wallet->available_balance);
  484. $amount = bcdiv($temp, $rate, 2);
  485. $serviceCharge = static::getServiceCharge();
  486. $text = lang("请发送提现金额");
  487. $text .= "\n💰 " . lang('当前余额') . ":{$temp} RMB\n";
  488. $text .= "⚠️" . lang('汇率') . ":1 USDT = {$rate} RMB\n";
  489. $text .= "💰 " . lang('当前可用USDT余额') . ":{$amount} USDT\n";
  490. $text .= "⚠️ " . lang('提现将收取') . "{$serviceCharge}" . lang('U作为手续费') . "\n";
  491. // $keyboard = [[
  492. // ['text' => "🔙返回", 'callback_data' => "withdraw@@home"],
  493. // ]];
  494. Cache::put(get_step_key($chatId), StepStatus::INPUT_WITHDRAW_MONEY);
  495. return [
  496. 'chat_id' => $chatId,
  497. 'text' => $text,
  498. 'message_id' => $messageId,
  499. // 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
  500. ];
  501. }
  502. //提现管理
  503. public static function index($chatId, $firstName, $messageId = null)
  504. {
  505. $wallet = Wallet::where('member_id', $chatId)->first();
  506. $text = "👤 {$firstName}({$chatId})\n\n";
  507. $text .= "💰钱包余额\n";
  508. $temp = floatval($wallet->available_balance);
  509. $text .= "USDT:{$temp}\n";
  510. $text .= "--------------------------\n";
  511. $serviceAccount = Config::where('field', 'service_account')->first()->val;
  512. $keyboard = [
  513. [
  514. ['text' => '➕ 提现', 'callback_data' => "withdraw@@apply"],
  515. ['text' => '🧾 账单', 'callback_data' => "withdraw@@bill"]
  516. ],
  517. [
  518. ['text' => lang("🏠 地址管理"), 'callback_data' => "withdraw@@address"],
  519. ['text' => lang('👩 客服帮助'), 'url' => "https://t.me/{$serviceAccount}"]
  520. ],
  521. [
  522. ['text' => lang('❌取消'), 'callback_data' => "message@@close"],
  523. ]
  524. ];
  525. return [
  526. 'chat_id' => $chatId,
  527. 'text' => $text,
  528. 'message_id' => $messageId,
  529. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
  530. ];
  531. }
  532. }