| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- namespace app\api\controller;
- use app\common\model\ApiUser;
- use app\common\model\Orders;
- use app\common\model\ShopList;
- use think\facade\Db;
- use think\Exception;
- use think\facade\Request;
- use think\Log;
- class Shops extends Base
- {
- // protected $noNeedLogin = [''];
- /**
- * @return void 全部平台
- */
- public function getPlatform(){
- $list = site_config('addonsd.platform_list');
- $this->success('提交成功', $list);
- }
- //获取店铺
- public function getShop(ShopList $shopList){
-
- $platform_id = $this->request->post('platform_id/d');
- if(empty($platform_id)){
- $this->error('参数有误');
- }
- return $this->success('ok', $shopList->where('platform', $platform_id)->column('name', 'id'));
- }
- public function createAddress(){
- $tx_hash = Request::post('tx_hash');
- $api_url = 'http://127.0.0.1:3389/api/txDetail';
- if(empty($tx_hash)){
- $this->error('参数有误');
- }
- $data = [
- 'api_id' => 1,
- 'coin_type' => 'BEP20',
- 'user_no' => 1,
- 'time_stamp' => 1122,
- 'reset' => true
- ];
- $body = $this->doCurlPostRequest($api_url, $data);
- //dump($body);
- $info = json_decode($body, true);
- //dump($body);
- //$body = $this->getInfoByTransactionHash($txhash);
- if($info['code'] == 200){
- $this->success('', $info['data']);
- }
- $this->error($info['message']);
- }
- function doCurlPostRequest($url = '',Array $data = array())
- {
- $data_string = json_encode($data,JSON_UNESCAPED_UNICODE);
- // $data_string = $data;
- $curl_con = curl_init();
- curl_setopt($curl_con, CURLOPT_URL,$url);
- curl_setopt($curl_con, CURLOPT_HEADER, false);
- curl_setopt($curl_con, CURLOPT_POST, true);
- curl_setopt($curl_con, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($curl_con, CURLOPT_CONNECTTIMEOUT, 5);
- curl_setopt($curl_con, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- 'Content-Length: ' . strlen($data_string))
- );
- curl_setopt($curl_con, CURLOPT_POSTFIELDS, $data_string);
- $res = curl_exec($curl_con);
- $status = curl_getinfo($curl_con);
- curl_close($curl_con);
- if (isset($status['http_code']) && $status['http_code'] == 200) {
- return $res;
- } else {
- return FALSE;
- }
- }
- }
|