Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信小店 #166

Merged
merged 2 commits into from
Nov 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ index.php
getcode.php
showlink.php
*.jpg
test/Config/Config.yml
test/Cert/
9 changes: 9 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"php":">=5.3",
"ext-mcrypt": "*"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"authors": [
{
"name": "overtrue",
Expand All @@ -23,5 +26,10 @@
"psr-4": {
"Overtrue\\Wechat\\": "src/Wechat/"
}
},
"autoload-dev": {
"psr-4": {
"Overtrue\\Wechat\\Test\\": "test/"
}
}
}
8 changes: 8 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./vendor/autoload.php" color="true">
<testsuites>
<testsuite name="testShop">
<directory>test/Shop</directory>
</testsuite>
</testsuites>
</phpunit>
24 changes: 24 additions & 0 deletions src/Wechat/Shop/AccessToken.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* AccessToken.php
*
* Part of Overtrue\Wechat\Shop
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author a9396 <[email protected]>
* @copyright 2015 a939638621 <[email protected]>
* @link https://github.com/a939638621
*/

namespace Overtrue\Wechat\Shop;


class AccessToken extends \Overtrue\Wechat\AccessToken
{
public function __construct(Config $config)
{
parent::__construct($config->appId, $config->appSecret);
}
}
96 changes: 96 additions & 0 deletions src/Wechat/Shop/Config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php
/**
* Config.php
*
* Part of Overtrue\Wechat\Shop
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author a9396 <[email protected]>
* @copyright 2015 a939638621 <[email protected]>
* @link https://github.com/a939638621
*/

namespace Overtrue\Wechat\Shop;


use Overtrue\Wechat\Utils\MagicAttributes;
/**
* Class Config
* @property $appId
* @property $appSecret
* @property $debug
*
* @property $token
* @property $encodingAESKey
*
* @property $mchId
* @property $mchKey
* @property $clientCert
* @property $clientKey
*
*/
Class Config extends MagicAttributes
{
/**
* 构造方法初始化参数
*
* @param null $appId
* @param null $appSecret
* @param bool|false $debug
*/
public function __construct($appId,$appSecret = null,$debug = false)
{
//调试
$this->debug = $debug;

//基础参数
$this->appId = $appId;
$this->appSecret = $appSecret;
}

/**
* 设置消息参数
*
* @param null $token
* @param null $encodingAESKey
*/
public function setMessageConfig($token,$encodingAESKey = null)
{
//消息参数
$this->token = $token;
$this->encodingAESKey = $encodingAESKey;
}

/**
* 设置支付参数
*
* @param null $mchId
* @param null $mchKey
*/
public function setPayConfig($mchId, $mchKey)
{
$this->mchId = $mchId;
$this->mchKey = $mchKey;

}

/**
* 设置证书
*
* @param null $clientCert
* @param null $clientKey
*/
public function setPEMConfig($clientCert, $clientKey)
{
$this->clientCert = $clientCert;
$this->clientKey = $clientKey;
}

public function __get($property)
{

return parent::__get($this->snake($property)); // TODO: Change the autogenerated stub
}
}
Loading