getConfig(); } /** * 获取配置信息 */ private function getConfig() { // 域名 $this->domain = "https://ubcagent.rosettawe.com"; // 参数配置 $config = Db::name('pay_channel')->where('key','USDT')->value('value'); $config = json_decode($config,true); $this->merchAddr = $config['merch_addr']; $this->merchType = $config['merch_type']; $this->accessToken = $config['access_token']; } /** * 新用户生成钱包 */ public function newUserWallet() { $key = '/usr/newUserWallet'; $requestUrl = $this->domain . $key; $requestUrl .= '?'. $this->dataGet($key); $result = null;//httpGet($requestUrl); // 临时屏蔽 2023-09-16 return $result; } /** * 用户提现 */ public function applyUserWithdraw($orderNo,$toAddress,$amount) { $key = '/usr/applyUserWithdraw'; $requestUrl = $this->domain . $key; $data = [ 'uuid' => $orderNo, 'user_addr' => $this->merchAddr, 'to_addr' => $toAddress, 'asset' => 'USDT', 'amount' => $amount, 'try_count' => '5', ]; $requestUrl .= '?'. $this->dataGet($key,$data); $result = httpGet($requestUrl); return $result; } /** * get请求参数设置 * @param $key * @param array $data * @return string */ private function dataGet($key,$data=[]) { $time = time(); $str = "key=".$key; $str .= "&merch_addr=".$this->merchAddr; $str .= "&merch_type=".$this->merchType; $str .= '×tamp='.$time."&"; foreach($data as $k => $v){ $str .= $k ."=" . $v . "&"; } $str .= "sign=".$this->getSign($key,$time); return $str; } /** * 签名 * @param $data * @return string */ private function getSign($key,$timestamp) { $signData = "key=".urlencode($key); $signData .= "&merch_addr=".$this->merchAddr; $signData .= "&merch_type=".$this->merchType; $signData .= "×tamp=".$timestamp; $signData .= "&access_token=".$this->accessToken; $sign = sha1($signData); return $sign; } }