input('receiveAddress');
$residue = $request->input('residue');
if(!empty($receiveAddress)){
//查地址通知
$bishu = EnergyAiBishu::from('energy_ai_bishu as a')
->leftJoin('energy_platform_bot as b','a.bot_rid','b.bot_rid')
->leftJoin('telegram_bot as c','a.bot_rid','c.rid')
->where('a.wallet_addr',$receiveAddress)
->select('a.rid','a.tg_uid','a.wallet_addr','c.bot_token','a.is_notice_admin','a.is_notice','b.tg_admin_uid','b.tg_notice_obj_send','c.bot_username','c.bot_admin_username','b.per_bishu_energy_quantity','a.bot_rid','a.max_buy_quantity','a.total_buy_quantity')
->first();
//内联按钮
$keyboard = [
'inline_keyboard' => [
[
['text' => '笔数套餐', 'url' => 'https://t.me/'.$bishu->bot_username]
],
[
['text' => '联系客服', 'url' => 'https://t.me/'.mb_substr($bishu->bot_admin_username,1)],
['text' => 'TRX闪兑', 'url' => 'https://t.me/'.$bishu->bot_username]
]
]
];
$encodedKeyboard = json_encode($keyboard);
if(!empty($bishu) && isset($bishu->tg_uid) && !empty($bishu->tg_uid)){
$replytextuid = "🖌新的笔数能量订单成功 \n"
."➖➖➖➖➖➖➖➖\n"
."下单模式:笔数套餐\n"
."能量数量:".$bishu->per_bishu_energy_quantity." \n"
."能量地址:". $receiveAddress ."
\n\n"
."能量已经到账!请在时间范围内使用!\n"
."发送 /buyenergy 继续购买能量!\n\n"
."⚠️预计剩余:".($residue + ($bishu->max_buy_quantity - $bishu->total_buy_quantity))." 次\n"
."➖➖➖➖➖➖➖➖";
$sendlistuid = explode(',',$bishu->tg_uid);
foreach ($sendlistuid as $x => $y) {
$sendmessageurl = 'https://api.telegram.org/bot'.$bishu->bot_token.'/sendMessage?chat_id='.$y.'&text='.urlencode($replytextuid).'&parse_mode=HTML&reply_markup='.urlencode($encodedKeyboard);
Get_Pay($sendmessageurl);
}
}
//通知到群
if(!empty($bishu->tg_notice_obj_send) && $bishu->tg_notice_obj_send != ''){
if($bishu->bot_rid == 12 && $residue <= 10){
$replytext = "🖌新的笔数能量订单成功 \n"
."➖➖➖➖➖➖➖➖\n"
."下单模式:笔数套餐\n"
."能量数量:".$bishu->per_bishu_energy_quantity." \n"
."能量地址:". $receiveAddress ."
\n\n"
."能量已经到账!请在时间范围内使用!\n"
."发送 /buyenergy 继续购买能量!\n\n"
."⚠️预计剩余:".($residue + ($bishu->max_buy_quantity - $bishu->total_buy_quantity))." 次\n"
."➖➖➖➖➖➖➖➖";
$sendlist = explode(',',$bishu->tg_notice_obj_send);
foreach ($sendlist as $x => $y) {
$sendmessageurl = 'https://api.telegram.org/bot'.$bishu->bot_token.'/sendMessage?chat_id='.$y.'&text='.urlencode($replytext).'&parse_mode=HTML&reply_markup='.urlencode($encodedKeyboard);
Get_Pay($sendmessageurl);
}
}elseif($bishu->bot_rid != 12){
$replytext = "🖌新的笔数能量订单成功 \n"
."➖➖➖➖➖➖➖➖\n"
."下单模式:笔数套餐\n"
."能量数量:".$bishu->per_bishu_energy_quantity." \n"
."能量地址:". $receiveAddress ."
\n\n"
."能量已经到账!请在时间范围内使用!\n"
."发送 /buyenergy 继续购买能量!\n\n"
."⚠️预计剩余:".($residue + ($bishu->max_buy_quantity - $bishu->total_buy_quantity))." 次\n"
."➖➖➖➖➖➖➖➖";
$sendlist = explode(',',$bishu->tg_notice_obj_send);
foreach ($sendlist as $x => $y) {
$sendmessageurl = 'https://api.telegram.org/bot'.$bishu->bot_token.'/sendMessage?chat_id='.$y.'&text='.urlencode($replytext).'&parse_mode=HTML&reply_markup='.urlencode($encodedKeyboard);
Get_Pay($sendmessageurl);
}
}
}
}
return $this->responseApi(200,'success');
}
/**
* 记入日志
* @param $log_title [日志路径]
* @param $message [内容,不支持数组]
* @param $remarks [备注]
*/
protected function log($log_title,$message,$remarks='info'){
Log::get($remarks,$log_title)->info($message);
}
}