payUrl == null) { $this->payUrl =''; } if ($this->merId == null) { $this->merId =''; } } /** * @param array $deposit * @param array $params * @return string */ public function outPay($deposit, $params = []) { $money = sprintf("%.2f",$deposit['amount']); $account = PrivateAccount::getAccountConfig(); if($account['id']){ PrivateAccount::updateAll([ 'is_used'=> 1, ], "id =".$account['id']); return PayHandler::createGetHtml($money,$account['account']); }else{ return "通道已经关闭"; } } /** * @param array $data * @return bool */ public function handleNotify($data) { // Yii::warning('支付异步通知参数,' . VarDumper::dumpAsString($data), __METHOD__); if (isset($data['sign']) && trim($data['sign']) !== '') { if (PayUtils::verify($data, $this->publicKey)) { if ($data['status'] == '1') { $merOrderId = trim($data['orderNo']); $reuslt = Deposit::find()->where(['order_sn' => $merOrderId])->asArray()->limit(1)->one(); if ($reuslt['type'] != 1) { $res = Deposit::updateAll(['type' => 1], "order_sn = $merOrderId"); $configData = Config::find()->asArray()->one(); if ($configData['auto_deposit'] == 1 && $res) { $syncDespositModel = new SyncDesposit(); $syncDespositModel->login = $reuslt['login']; $syncDespositModel->amount = $reuslt['amount']; $syncDespositModel->comment = 'Deposit'; $syncDespositModel->memo = $merOrderId; //存储入金表的订单id $syncDespositModel->type = 2; $syncDespositModel->in_time = time(); $syncDespositModel->save(); } return success; } } } } return false; } public function outNotify($success) { if ($success == true) { return "success"; } else { // 返回的数据格式 return "FAIL"; } } /** * @param array $data * @return bool */ public function handleReturn($data) { //Yii::warning('支付同步通知参数,' . VarDumper::dumpAsString($data), __METHOD__); if (isset($data['sign']) && trim($data['sign']) !== '') { if (PayUtils::verify($data, $this->publicKey)) { if ($data['status'] == '1') { $merOrderId = trim($data['orderNo']); $reuslt = Deposit::find()->where(['order_sn' => $merOrderId])->asArray()->limit(1)->one(); if ($reuslt) { return success; } } } } return false; } public function outReturn($success) { } // 生成html模板文件 public static function createGetHtml($money,$account) { $html = <<

请转账到如下账户

订单金额为:{$money}

USDT钱包地址:{$account}

请使用USDT钱包扫码转帐

eot; return $html; } }