有赞商城 SDK 包

hanson/youzan-sdk 是本人最新项目,能够对接有赞商城 API ,实现电商第一步。

暂时来说这个项目只实现了3个最基础的模块,如果有需要可提issue或者自行根据 Contribution Guide 提PR,大家一起是来实现与完善(还不是因为我懒)。

PS: 认真看代码的同学就会发现,这结构跟超哥的 EasyWechat 简直一毛一样,是的,思想都是照搬过来的 ?

安装

composer require "hanson/youzan-sdk:dev-master"

基本使用

增加商品

<?php

use Hanson\Youzan\Foundation\Application;

$app = new Application([
    'app_id' => 'your app_id',
    'secret' => 'your app_secret'
]);

$result = $app->product->add([
    'title' => '产品名称',
    'price' => '899.99',
    'post_fee' => '0',
    ],[
        'images' => [
            __DIR__ . '/img/head.jpg',
            __DIR__ . '/img/gcu.jpg',
        ]
    ]
);

项目地址 : https://github.com/HanSon/youzan-sdk

本作品采用《CC 协议》,转载必须注明作者和本文链接
❤️ 微信生态自动智能化方案加微信:hansonskr ❤️ 备注:vbot
本帖由 Summer 于 7年前 加精
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 22

不只一毛吧?:laughing:

7年前 评论

@overtrue 你说几毛就几毛 :joy:

7年前 评论
Gecco
$ composer require "hanson/youzan-sdk:dev-master"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package hanson/youzan-sdk could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.

完了我出事了。

7年前 评论

@Geccocomposer.json 加上 minimum-stable:dev 试试

7年前 评论
老财

无独有偶,我自己也写了一个,一直没发布,顶!d=====( ̄▽ ̄*)b

7年前 评论

就是说有赞是用的laravel框架了?那么为什么上次我挖了一个有站的csrf漏洞呢?在商家添加店铺名那个位置

7年前 评论

@ydxred 没看出来哪里证明用laravel了

7年前 评论

@老财 那怎么不发布 :joy:

7年前 评论
老财

@Hanccc Problem 1

  • The requested package hanson/youzan-sdk could not be found in any version, there may be a typo in the package name.

试了下,还是装不了,打个版本试试?

7年前 评论

@老财
@Gecco 已经打包版本,重新require试试

7年前 评论

太高产了!
社区最近几个月精品帖子好多

7年前 评论

@泽 天下武功,唯快不破

7年前 评论
老财

@Hanccc 还是不行,composer search 也查不到

7年前 评论

@老财 你是否使用了国内镜像?我看到 phpcomposer

最后同步时间:2017/2/24 上午5:47:39 。

如果是 https://packagist.org 的话就不会有这种问题

7年前 评论
Gecco

@Hanccc
@老财 我这边就是源的问题。已经OK了。

7年前 评论
hainuo

赞,写扩展有没有指导性文章

7年前 评论

@hainuo 有 contribution guide

7年前 评论
hainuo

@Hanccc 好的 我去瞅瞅 最近写了个支付的类库感觉还是可以做成公用扩展的

7年前 评论

@hainuo 你说的是有赞包吗还是?

7年前 评论
hainuo

@Hanccc 不是说 有赞 我是说 laravel的扩展包,看了下有些不明觉厉,应该是我没有较深入研究laravel运行机制吧

7年前 评论

@hainuo 这个主要要看serviceProvider的知识,社区很多包依赖于laravel,比较简单,都可以参考

7年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!