zhaojs
2023-07-06 094f629bdcb97b15f301980d48120718732fbbe3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
 
/*
 * This file is part of the overtrue/wechat.
 *
 * (c) overtrue <i@overtrue.me>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */
 
namespace EasyWeChat\OpenPlatform\Authorizer\MiniProgram\Account;
 
use EasyWeChat\OpenPlatform\Authorizer\Aggregate\Account\Client as BaseClient;
 
/**
 * Class Client.
 *
 * @author ClouderSky <clouder.flow@gmail.com>
 */
class Client extends BaseClient
{
    /**
     * 获取账号基本信息.
     */
    public function getBasicInfo()
    {
        return $this->httpPostJson('cgi-bin/account/getaccountbasicinfo');
    }
 
    /**
     * 修改头像.
     *
     * @param string $mediaId 头像素材mediaId
     * @param float  $left    剪裁框左上角x坐标(取值范围:[0, 1])
     * @param float  $top     剪裁框左上角y坐标(取值范围:[0, 1])
     * @param float  $right   剪裁框右下角x坐标(取值范围:[0, 1])
     * @param float  $bottom  剪裁框右下角y坐标(取值范围:[0, 1])
     *
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
     *
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public function updateAvatar(
        string $mediaId,
        float $left = 0.0,
        float $top = 0.0,
        float $right = 1.0,
        float $bottom = 1.0
    ) {
        $params = [
            'head_img_media_id' => $mediaId,
            'x1' => $left, 'y1' => $top, 'x2' => $right, 'y2' => $bottom,
        ];
 
        return $this->httpPostJson('cgi-bin/account/modifyheadimage', $params);
    }
 
    /**
     * 修改功能介绍.
     *
     * @param string $signature 功能介绍(简介)
     *
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
     *
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public function updateSignature(string $signature)
    {
        $params = ['signature' => $signature];
 
        return $this->httpPostJson('cgi-bin/account/modifysignature', $params);
    }
}