83 lines
2.1 KiB
PHP
83 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* 2025 D1m Group
|
|
*
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
|
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
|
*
|
|
* @copyright 2025 D1m Group
|
|
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
|
*/
|
|
|
|
namespace Stemcell\Commerce\Api;
|
|
|
|
use Magento\Customer\Api\Data\CustomerInterface;
|
|
use Magento\Framework\Webapi\Exception;
|
|
|
|
/**
|
|
* 微信小程序用户管理接口
|
|
*
|
|
* @api
|
|
*/
|
|
interface CustomerManagementInterface
|
|
{
|
|
/**
|
|
* 通过微信小程序code获取openid
|
|
*
|
|
* @param string $code 微信登录临时凭证
|
|
* @return array 返回包含openid的数组
|
|
* @throws Exception
|
|
*/
|
|
public function getWechatOpenid($code);
|
|
|
|
/**
|
|
* 通过微信小程序创建用户
|
|
*
|
|
* @param string $code 手机号获取凭证
|
|
* @param string $openid 用户openid
|
|
* @return CustomerInterface
|
|
* @throws Exception
|
|
*/
|
|
public function loginByMobile($code, $openid);
|
|
|
|
/**
|
|
* 更新用户信息
|
|
*
|
|
* @param string $name 用户姓名
|
|
* @param string $email 用户邮箱
|
|
* @param string $mobile 用户手机号
|
|
* @param string $company 用户单位/公司
|
|
* @param string|null $wechatAvatar 微信头像URL
|
|
* @return CustomerInterface
|
|
* @throws Exception
|
|
*/
|
|
public function updateCustomerInfo($name, $email, $mobile, $company, $wechatAvatar = null);
|
|
|
|
/**
|
|
* 微信一键登录
|
|
*
|
|
* @param string $code 微信登录临时凭证
|
|
* @return \Magento\Framework\DataObject 返回包含access_token和用户信息的数组
|
|
* @throws Exception
|
|
*/
|
|
public function wechatLogin($code);
|
|
|
|
/**
|
|
* 用户登出
|
|
*
|
|
* @return bool
|
|
* @throws Exception
|
|
*/
|
|
public function logout();
|
|
|
|
/**
|
|
* 获取用户信息
|
|
*
|
|
* @return array 返回包含用户信息的数组,包含mobile、email、company、name字段
|
|
* @throws Exception
|
|
*/
|
|
public function getCustomerInfo();
|
|
}
|