Example #1
0
 /**
  * @param $api 接口路径
  * @param $data 参数
  * @param array $cachekey 缓存key
  * @return mixed
  * @throws \mysoft\base\Exception|void
  */
 protected function _Proxy($api, $data, $cachekey = [])
 {
     $resdata = false;
     if ($cachekey != []) {
         $resdata = \yii::$app->cache->get($cachekey);
     }
     if ($resdata === false) {
         $client = new Client();
         $resultdata = json_decode($client->get($api, $data), true);
         if ($resultdata["success"] == "1") {
             $resdata = $resultdata["data"];
         } else {
             throw E(\mysoft\helpers\String::jsonEncode($resultdata["data"]));
         }
     }
     return $resdata;
 }
Example #2
0
 public function __construct($appid = '')
 {
     parent::__construct($appid);
     //调用父类初始化构建请求基础部分
 }