123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- namespace bibidd\Controller;
- use Bibidd\Controller\CommonBaseController;
- /**
- * 口令红包,人工充值通道
- */
- class HongbaoController extends CommonBaseController
- {
- /**
- * 发起口令红包,50-> 50,100->135,200->300
- * @return void
- */
- public function send()
- {
- $this->addHeaders(); //添加头部请求
- $user_info = $this->checkUserIsExist($_POST['uid']); //检查用户
- //视频id
- $uid= $_POST['uid'];
- $amount= $_POST['amount']; //充值金额
- $pwd= $_POST['pwd']; //口令红包1
- $pwd1= $_POST['pwd1']; //口令红包2
- $user_name = $user_info['name'];
- if(empty($amount) || !is_numeric($amount))
- {
- $this->returnDataAndSendMsg("请选择充值金额.");
- die();
- }
- if(empty($pwd)||empty($pwd1))
- {
- $this->returnDataAndSendMsg("请输入口令.");
- die();
- }
- if(mb_strlen($pwd)!=8 || mb_strlen($pwd1)!=8 )
- {
- $this->returnDataAndSendMsg("口令长度不正确.");
- die();
- }
- if(!is_numeric($pwd) || !is_numeric($pwd1))
- {
- $this->returnDataAndSendMsg("口令格式不正确.");
- die();
- }
- if($pwd!=$pwd1)
- {
- $this->returnDataAndSendMsg("口令红包输入不一致.");
- die();
- }
- //验证用户当天只能提交5次
- $count_submit = M("pay_test")->where("uid='$uid' AND order_str='人工通道:支付宝口令红包' AND TO_DAYS(apply_date)=TO_DAYS(NOW())")->count();
- if($count_submit>5)
- {
- $this->returnDataAndSendMsg("人工充值,每天最多提交5次.");
- die();
- }
- //连续错误5次永久封禁
- $count_submit1 = M("pay_test")->where("uid='$uid' AND order_str='人工通道:支付宝口令红包' AND order_type = '红包失效'")->count();
- if($count_submit1>10)
- {
- $this->returnDataAndSendMsg("发送错误红包口令10次以上<br>已永久禁用人工充值");
- die();
- }
- //一分钟内不能重复发
- $check_info = M("pay_test")->where("uid='$uid' AND order_str='人工通道:支付宝口令红包' AND apply_date > NOW() - INTERVAL 1 MINUTE")->find();
- if(!empty($check_info))
- {
- $this->returnDataAndSendMsg("口令红包发送需间隔1分钟");
- die();
- }
- $pay_info['uid'] = $uid;
- $pay_info['order_str'] = "人工通道:支付宝口令红包";
- $pay_info['apply_date'] = date('Y-m-d H:i:s');
- $pay_info['apply_time'] = time();
- $pay_info['order_type'] = '待支付';
- $pay_info['order_id'] = $pwd;
- $pay_info['order_ip'] = $this->getIp();
- $pay_info['amount'] = $amount;
- $rs = M("pay_test")->add($pay_info);
- $data['code'] = '200';
- $data['message'] = 'ok';
- $data['data'] = $rs;
- echo json_encode($data);
- //发送机器人
- $text = "口令红包🧧🧧🧧\n"."9169用户: ".$user_name."\n"."口令红包: ".$pwd."\n"."充值".$amount."元\n加金币".$amount."\n\n请尽快收红包·加金币";
- // 11 22 用户ID : 6199511960
- //群id
- $this->send_msg_to_telegram("6543542631:AAGRvYWAXAk4VV45yEHtQY3mG8h13MhLT-k","-4190639794",$text);
- }
- }
|