Files
huangjingfen/pro_v3.5.1_副本/vendor/aliyuncs/oss-sdk-php/README.md

151 lines
5.6 KiB
Markdown
Raw Normal View History

feat(fsgx): 完成全部24项开发任务 Phase1-7 Phase1 后端核心: - 新增 fsgx_v1.sql 迁移脚本(is_queue_goods/frozen_points/available_points/no_assess) - SystemConfigServices 返佣设置扩展(周期人数/分档比例/范围/时机) - StoreOrderCreateServices 周期循环佣金计算 - StoreOrderTakeServices 佣金发放后同步冻结积分 - StoreProductServices/StoreProduct 保存 is_queue_goods Phase2 后端接口: - GET /api/hjf/brokerage/progress 佣金周期进度 - GET /api/hjf/assets/overview 资产总览 - HjfPointsServices 每日 frozen_points 0.4‰ 释放定时任务 - PUT /adminapi/hjf/member/{uid}/no_assess 不考核接口 - GET /adminapi/hjf/points/release_log 积分日志接口 Phase3 前端清理: - hjfCustom.js 路由精简(仅保留 points/log) - hjfQueue.js/hjfMember.js API 清理/重定向至 CRMEB 原生接口 - pages.json 公排→推荐佣金/佣金记录/佣金规则 Phase4-5 前端改造: - queue/status.vue 推荐佣金进度页整体重写 - 商品详情/订单确认/支付结果页文案与逻辑改造 - 个人中心/资产页/引导页/规则页文案改造 - HjfQueueProgress/HjfRefundNotice/HjfAssetCard 组件改造 - 推广中心嵌入佣金进度摘要 - hjfMockData.js 全量更新(公排字段→佣金字段) Phase6 Admin 增强: - 用户列表新增 frozen_points/available_points 列及不考核操作按钮 - hjfPoints.js USE_MOCK=false 对接真实积分日志接口 Phase7 配置文档: - docs/fsgx-phase7-config-checklist.md 后台配置与全链路验收清单 Made-with: Cursor
2026-03-23 22:32:19 +08:00
# Alibaba Cloud OSS SDK for PHP
[![Latest Stable Version](https://poser.pugx.org/aliyuncs/oss-sdk-php/v/stable)](https://packagist.org/packages/aliyuncs/oss-sdk-php)
[![Build Status](https://travis-ci.org/aliyun/aliyun-oss-php-sdk.svg?branch=master)](https://travis-ci.org/aliyun/aliyun-oss-php-sdk)
[![Coverage Status](https://coveralls.io/repos/github/aliyun/aliyun-oss-php-sdk/badge.svg?branch=master)](https://coveralls.io/github/aliyun/aliyun-oss-php-sdk?branch=master)
## [README of Chinese](https://github.com/aliyun/aliyun-oss-php-sdk/blob/master/README-CN.md)
## Overview
Alibaba Cloud Object Storage Service (OSS) is a cloud storage service provided by Alibaba Cloud, featuring a massive capacity, security, a low cost, and high reliability. You can upload and download data on any application anytime and anywhere by calling APIs, and perform simple management of data through the web console. The OSS can store any type of files and therefore applies to various websites, development enterprises and developers.
## Run environment
- PHP 5.3+.
- cURL extension.
Tips:
- In Ubuntu, you can use the ***apt-get*** package manager to install the *PHP cURL extension*: `sudo apt-get install php5-curl`.
## Install OSS PHP SDK
- If you use the ***composer*** to manage project dependencies, run the following command in your project's root directory:
composer require aliyuncs/oss-sdk-php
You can also declare the dependency on Alibaba Cloud OSS SDK for PHP in the `composer.json` file.
"require": {
"aliyuncs/oss-sdk-php": "~2.0"
}
Then run `composer install` to install the dependency. After the Composer Dependency Manager is installed, import the dependency in your PHP code:
require_once __DIR__ . '/vendor/autoload.php';
- You can also directly download the packaged [PHAR File][releases-page], and
introduce the file to your code:
require_once '/path/to/oss-sdk-php.phar';
- Download the SDK source code, and introduce the `autoload.php` file under the SDK directory to your code:
require_once '/path/to/oss-sdk/autoload.php';
## Quick use
### Common classes
| Class | Explanation |
|:------------------|:------------------------------------|
|OSS\OssClient | OSS client class. An OssClient instance can be used to call the interface. |
|OSS\Core\OssException |OSS Exception class . You only need to pay attention to this exception when you use the OssClient. |
### Initialize an OssClient
The SDK's operations for the OSS are performed through the OssClient class. The code below creates an OssClient object:
```php
<?php
$accessKeyId = "<AccessKeyID that you obtain from OSS>";
$accessKeySecret = "<AccessKeySecret that you obtain from OSS>";
$endpoint = "<Domain that you select to access an OSS data center, such as "oss-cn-hangzhou.aliyuncs.com>";
try {
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint);
} catch (OssException $e) {
print $e->getMessage();
}
```
### Operations on objects
Objects are the most basic data units on the OSS. You can simply consider objects as files. The following code uploads an object:
```php
<?php
$bucket= "<Name of the bucket in use. Pay attention to naming conventions>";
$object = "<Name of the object in use. Pay attention to naming conventions>";
$content = "Hello, OSS!"; // Content of the uploaded file
try {
$ossClient->putObject($bucket, $object, $content);
} catch (OssException $e) {
print $e->getMessage();
}
```
### Operations on buckets
Buckets are the space that you use to manage the stored objects. It is an object management unit for users. Each object must belong to a bucket. You can create a bucket with the following code:
```php
<?php
$bucket= "<Name of the bucket in use. Pay attention to naming conventions>";
try {
$ossClient->createBucket($bucket);
} catch (OssException $e) {
print $e->getMessage();
}
```
### Handle returned results
The OssClient provides the following two types of returned data from interfaces:
- Put and Delete interfaces: The *PUT* and *DELETE* operations are deemed successful if *null* is returned by the interfaces without *OSSException*.
- Get and List interfaces: The *GET* and *LIST* operations are deemed successful if the desired data is returned by the interfaces without *OSSException*. For example,
```php
<?php
$bucketListInfo = $ossClient->listBuckets();
$bucketList = $bucketListInfo->getBucketList();
foreach($bucketList as $bucket) {
print($bucket->getLocation() . "\t" . $bucket->getName() . "\t" . $bucket->getCreateDate() . "\n");
}
```
In the above code, $bucketListInfo falls into the 'OSS\Model\BucketListInfo' data type.
### Run a sample project
- Modify `samples/Config.php` to complete the configuration information.
- Run `cd samples/ && php RunAll.php`.
### Run a unit test
- Run `composer install` to download the dependent libraries.
- Set the environment variable.
export OSS_ACCESS_KEY_ID=access-key-id
export OSS_ACCESS_KEY_SECRET=access-key-secret
export OSS_ENDPOINT=endpoint
export OSS_BUCKET=bucket-name
- Run `php vendor/bin/phpunit`
## License
- MIT
## Contact us
- [Alibaba Cloud OSS official website](http://oss.aliyun.com).
- [Alibaba Cloud OSS official forum](http://bbs.aliyun.com).
- [Alibaba Cloud OSS official documentation center](http://www.aliyun.com/product/oss#Docs).
- Alibaba Cloud official technical support: [Submit a ticket](https://workorder.console.aliyun.com/#/ticket/createIndex).
[releases-page]: https://github.com/aliyun/aliyun-oss-php-sdk/releases
[phar-composer]: https://github.com/clue/phar-composer