You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
namespace tencent\wechat\weixin\material;
use EasyWeChat\Factory;
use tencent\wechat\weixin\Base;
class Material extends Base
{
/**
* 获取全部素材列表
* @param string $type 素材的类型图片image、视频video、语音 voice、图文news
* @param int $offset 从全部素材的该偏移位置开始返回0表示从第一个素材 返回
* @param int $count 返回素材的数量取值在1到20之间
* @date 2022-12-01
*/
public function listMaterial($type, $offset, $count)
{
$app = Factory::officialAccount($this->weixinConfig);
$result = $app->material->list($type, $offset, $count);
// 记录日志
$uid = defined('UID') ? UID : '';
platformLog([
'type' => $type,
'offset' => $offset,
'count' => $count
], $result, 'easywechat_weixin_material_get_list_uid_' . $uid);
return $result;
}
/**
* 获取素材计数
* @date 2022-12-01
*/
public function countMaterial()
{
$app = Factory::officialAccount($this->weixinConfig);
$number = $app->material->stats();
// 记录日志
$uid = defined('UID') ? UID : '';
platformLog([], $number, 'easywechat_weixin_material_count_uid_' . $uid);
return $number;
}
}