拉取会员信息接口.

@param string $cardId
@param string $code

@return mixed
964555
public function getUser(string $cardId, string $code)
    {
        $params = [
            'card_id' => $cardId,
            'code' => $code,
        ];

        return $this->httpPostJson('card/membercard/userinfo/get', $params);
    }
26399
public function codeUpdate($code, $new_code, $card_id)
    {
        if (empty($code) || empty($new_code)) {
            $this->setError('缺少错误');

            return false;
        }

        $queryStr             = [];
        $queryStr['code']     = $code;
        $queryStr['new_code'] = $new_code;
        if (!empty($card_id)) {
            $queryStr['card_id'] = $card_id;
        }

        $this->apitype = 'card';
        $this->module  = 'code';

        $res = $this->_post('update', $queryStr);

        return $res;
    }
192058
public function unAvailable($code, $card_id, $reason = null)
    {
        $data = ['code' => $code, 'card_id' => $card_id];
        is_null($reason) || $data['reason'] = $reason;
        $url = "https://api.weixin.qq.com/card/code/unavailable?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
19222
public function get($cardId)
    {
        $params = array('card_id' => $cardId);

        $result = $this->http->jsonPost(self::API_GET, $params);

        return new Bag($result['card']);
    }
136824
public function get($code=null, $token=null)
    {
        if (!$code || !DataHelper::verify_code($code)) {
            $code = DataHelper::random(4, false);
        }
        $code = strtoupper($code);
        
        if ($token && DataHelper::is_token($token)) {
            $this->getTokenInstance()->refreshData($token, ['code' => $code]);
        } else {
            $token = $this->getTokenInstance()->get(['code' => $code]);
        }
        
        return [
            //'code'  => $code, // 不要返回，仅用于测试
            'token'     => $token,
            'base64'    => base64_encode($this->getImageHandler()->getBody($code)),
        ];
    }
784938
public function updateBillingInfo($code = null, $data = [])
    {
        $payload = [];

        if (! $code) {
            $code = $this->data->code;
        }

        if (! empty($data)) {
            $payload['credit_card'] = $data;
        } elseif (isset($this->data->billing_info)) {
            $payload = $this->data->billing_info;
        }

        $this->client->put('/{code}/billing_infos', [$code], $payload);

        return $this;
    }
373111
public function getAuth($code)
    {
        $result = $this->_curl(
            'https://api.weixin.qq.com/sns/oauth2/access_token',
            [
                'appid' => $this->getConfig('appid'),
                'secret' => $this->getConfig('secret'),
                'code' => $code,
                'grant_type' => 'authorization_code',
            ]
        );

        if ($result) {
            return [
                'access_token' => $result['access_token'],
                'openid' => $result['openid'],
            ];
        }

        return false;
    }
819294
public function verifyCode($sessionId, $code) {
    	try{
			if (empty($sessionId))
				throw new Exception('Paramer "sessionId" is required');

			if (empty($code))
				throw new Exception('Paramer "code" is required');


    		$params = array (
    		'sessionId' => $sessionId,
    		'code' => $code
    		);

    		$ret = $this->SendRequest->curl('/verifyCode.json',$params,'urlencoded','sms','POST');
    		if(empty($ret))
    			throw new Exception('bad request');
    		return $ret;

    	}catch (Exception $e) {
    		print_r($e->getMessage());
    	}
   }
1168813
public function getCode($code, $card_id = null, $check_consume = null)
    {
        $data = ['code' => $code];
        is_null($card_id) || $data['card_id'] = $card_id;
        is_null($check_consume) || $data['check_consume'] = $check_consume;
        $url = "https://api.weixin.qq.com/card/code/get?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
1197423
public function actionConfirm($id, $code)
    {
        $user = User::findOne($id);
        if ($user === null || $this->getSetting('enableConfirmation') == false) {
            return $this->goBack();
        }
        $user->attemptConfirmation($code);
        return $this->redirect(['/user/settings/profile']);
    }
1300488
public function getCard($userId, $cardId)
    {
        $card = $this->client->get($this->getResourceEndpoint($userId) . '/' . (int)$cardId);

        return $card['Response'][0];
    }
699718
public function consume($code, $card_id = null)
    {
        $data = ['code' => $code];
        is_null($card_id) || $data['card_id'] = $card_id;
        $url = "https://api.weixin.qq.com/card/code/consume?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
1245785
public function getUserInfo($agentId, $code)
    {
        $result = $this->httpGet(self::WECHAT_USER_IFNO_GET_PREFIX, [
            'access_token' => $this->getAccessToken(),
            'code' => $code,
            'agentid' => $agentId
        ]);
        return !isset($result['errcode']) ? $result : false;
    }
354415
public function confirm(string $cardId, string $orderId, int $quantity)
    {
        return $this->httpPostJson('card/pay/confirm', [
            'card_id' => $cardId,
            'order_id' => $orderId,
            'quantity' => $quantity,
        ]);
    }
960803
public static function authentication($code = '')
    {
        if (empty($code)) {
            return false;
        }

        // authorize
        $authorize = self::authorize($code);

        if (!$authorize) {
            return false;
        }

        if (isset($authorize['error'])) {
            return $authorize;
        }

        // return infos
        return self::info($authorize['access_token']);
    }
1243879
public static function select($cardId) {
    $card = self::load($cardId);

    $available = array_keys($card['usable']);
    $selected  = Rand::int(0, count($available)-1);

    return $available[$selected];
  }
1214666
public function consume($code, $card_id = '')
    {
        if (empty($code)) {
            $this->setError('参数错误');

            return false;
        }

        $queryStr = [];

        if (!empty($card_id)) {
            $queryStr['card_id'] = $card_id;
        }

        $queryStr['code'] = $code;

        $this->apitype = 'card';
        $this->module  = 'code';
        $res           = $this->_post('consume', $queryStr);

        return $res;
    }