<?php
namespace WeChat;
use WeChat\Contracts\BasicWeChat;
class Product extends BasicWeChat
{
public function modStatus($keystandard, $keystr, $status = 'on')
{
$data = ['keystandard' => $keystandard, 'keystr' => $keystr, 'status' => $status];
$url = "https://api.weixin.qq.com/scan/product/modstatus?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->httpPostForJson($url, $data);
}
public function setTestWhiteList(array $openids = [], array $usernames = [])
{
$data = ['openid' => $openids, 'username' => $usernames];
$url = "https://api.weixin.qq.com/scan/testwhitelist/set?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->httpPostForJson($url, $data);
}
public function getQrcode($keystandard, $keystr, $qrcode_size, $extinfo = [])
{
$data = ['keystandard' => $keystandard, 'keystr' => $keystr, 'qrcode_size' => $qrcode_size];
empty($extinfo) || $data['extinfo'] = $extinfo;
$url = "https://api.weixin.qq.com/scan/product/getqrcode?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->httpPostForJson($url, $data);
}
public function getProduct($keystandard, $keystr)
{
$data = ['keystandard' => $keystandard, 'keystr' => $keystr];
empty($extinfo) || $data['extinfo'] = $extinfo;
$url = "https://api.weixin.qq.com/scan/product/get?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->httpPostForJson($url, $data);
}
public function getProductList($offset, $limit = 10, $status = null, $keystr = '')
{
$data = ['offset' => $offset, 'limit' => $limit];
is_null($status) || $data['status'] = $status;
empty($keystr) || $data['keystr'] = $keystr;
$url = "https://api.weixin.qq.com/scan/product/get?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->httpPostForJson($url, $data);
}
public function updateProduct(array $data)
{
$url = "https://api.weixin.qq.com/scan/product/update?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->httpPostForJson($url, $data);
}
public function clearProduct($keystandard, $keystr)
{
$url = "https://api.weixin.qq.com/scan/product/clear?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->httpPostForJson($url, ['keystandard' => $keystandard, 'keystr' => $keystr]);
}
public function scanTicketCheck($ticket)
{
$url = "https://api.weixin.qq.com/scan/scanticket/check?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->httpPostForJson($url, ['ticket' => $ticket]);
}
public function clearScanticket($keystandard, $keystr, $extinfo)
{
$data = ['keystandard' => $keystandard, 'keystr' => $keystr, 'extinfo' => $extinfo];
$url = "https://api.weixin.qq.com/scan/scanticket/check?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->httpPostForJson($url, $data);
}
}