<?php

namespace App\Http\Controllers\API;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class DxAppController extends Controller
{
    //大兴app根据userid查询用户信息
    public function getUserInfo(){
        $userId=request('userId');
        $base_url="http://114.242.58.53:8782";
        $url =$base_url.'/family/api/getUserFamilyDataList?userId='.$userId;
        $encryptStr=self::post($url,'');
        $r_data=json_decode($encryptStr, true);
        return \Yz::Return(true,'',$r_data);
    }

    public function post($url, $data_string)
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
      //  curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($curl, CURLOPT_HTTPHEADER, [
            'Content-Type: application/json; charset=utf-8',
            'Content-Length: ' . strlen($data_string),
            "appCode: CwaYrR",
            "sign: 965E90EE2B2E216721FF54A32B6D699A",
            "APICODE: b317f8e3-66d7-4f75-b1c9-58ead6343e9f",
        ]);
      //  curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
        $r = curl_exec($curl);
        curl_close($curl);
        return $r;
    }
}
