[更新]ComposerUpdate

This commit is contained in:
Anyon 2018-11-12 11:48:10 +08:00
parent 71ab008f05
commit fa5c040c28
88 changed files with 1397 additions and 234 deletions

View File

@ -1,4 +1,4 @@
![](http://www.thinkphp.cn/Uploads/editor/2016-06-23/576b4732a6e04.png)
![](https://box.kancloud.cn/5a0aaa69a5ff42657b5c4715f3d49221)
ThinkPHP 5.1LTS —— 12载初心你值得信赖的PHP框架
===============

View File

@ -20,7 +20,7 @@ use think\route\Dispatch;
*/
class App extends Container
{
const VERSION = '5.1.28 LTS';
const VERSION = '5.1.29 LTS';
/**
* 当前模块路径

View File

@ -187,7 +187,7 @@ class Config implements \ArrayAccess
*/
public function has($name)
{
if (!strpos($name, '.')) {
if (false === strpos($name, '.')) {
$name = $this->prefix . '.' . $name;
}
@ -225,7 +225,7 @@ class Config implements \ArrayAccess
*/
public function get($name = null, $default = null)
{
if ($name && !strpos($name, '.')) {
if ($name && false === strpos($name, '.')) {
$name = $this->prefix . '.' . $name;
}
@ -272,7 +272,7 @@ class Config implements \ArrayAccess
public function set($name, $value = null)
{
if (is_string($name)) {
if (!strpos($name, '.')) {
if (false === strpos($name, '.')) {
$name = $this->prefix . '.' . $name;
}
@ -314,7 +314,7 @@ class Config implements \ArrayAccess
*/
public function remove($name)
{
if (!strpos($name, '.')) {
if (false === strpos($name, '.')) {
$name = $this->prefix . '.' . $name;
}

View File

@ -43,7 +43,7 @@ class Env
* @param mixed $default 默认值
* @return mixed
*/
public function get($name = null, $default = null)
public function get($name = null, $default = null, $php_prefix = true)
{
if (is_null($name)) {
return $this->data;
@ -55,12 +55,16 @@ class Env
return $this->data[$name];
}
return $this->getEnv($name, $default);
return $this->getEnv($name, $default, $php_prefix);
}
protected function getEnv($name, $default = null)
protected function getEnv($name, $default = null, $php_prefix = true)
{
$result = getenv('PHP_' . $name);
if ($php_prefix) {
$name = 'PHP_' . $name;
}
$result = getenv($name);
if (false === $result) {
return $default;

View File

@ -334,9 +334,10 @@ class File extends SplFileObject
* @param string $path 保存路径
* @param string|bool $savename 保存的文件名 默认自动生成
* @param boolean $replace 同名文件是否覆盖
* @param bool $autoAppendExt 自动补充扩展名
* @return false|File false-失败 否则返回File实例
*/
public function move($path, $savename = true, $replace = true)
public function move($path, $savename = true, $replace = true, $autoAppendExt = true)
{
// 文件上传失败,捕获错误代码
if (!empty($this->info['error'])) {
@ -357,7 +358,7 @@ class File extends SplFileObject
$path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
// 文件保存命名规则
$saveName = $this->buildSaveName($savename);
$saveName = $this->buildSaveName($savename, $autoAppendExt);
$filename = $path . $saveName;
// 检测目录
@ -391,9 +392,10 @@ class File extends SplFileObject
* 获取保存文件名
* @access protected
* @param string|bool $savename 保存的文件名 默认自动生成
* @param bool $autoAppendExt 自动补充扩展名
* @return string
*/
protected function buildSaveName($savename)
protected function buildSaveName($savename, $autoAppendExt = true)
{
if (true === $savename) {
// 自动生成文件名
@ -403,7 +405,7 @@ class File extends SplFileObject
$savename = $this->getInfo('name');
}
if (!strpos($savename, '.')) {
if ($autoAppendExt && false === strpos($savename, '.')) {
$savename .= '.' . pathinfo($this->getInfo('name'), PATHINFO_EXTENSION);
}

View File

@ -192,7 +192,7 @@ class Hook
if ($class instanceof \Closure) {
$call = $class;
$class = 'Closure';
} elseif (strpos($class, '::')) {
} elseif (is_array($class) || strpos($class, '::')) {
$call = $class;
} else {
$obj = Container::get($class);

View File

@ -299,9 +299,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
call_user_func_array([$this, 'base'], [ & $query]);
}
$globalScope = is_array($useBaseQuery) && $useBaseQuery ?: $this->globalScope;
$globalScope = is_array($useBaseQuery) && $useBaseQuery ? $useBaseQuery : $this->globalScope;
if ($globalScope) {
if ($globalScope && false !== $useBaseQuery) {
$query->scope($globalScope);
}

View File

@ -326,7 +326,7 @@ class Route
// 支持多个域名使用相同路由规则
$domainName = is_array($name) ? array_shift($name) : $name;
if ('*' != $domainName && !strpos($domainName, '.')) {
if ('*' != $domainName && false === strpos($domainName, '.')) {
$domainName .= '.' . $this->request->rootDomain();
}
@ -344,7 +344,7 @@ class Route
if (is_array($name) && !empty($name)) {
$root = $this->request->rootDomain();
foreach ($name as $item) {
if (!strpos($item, '.')) {
if (false === strpos($item, '.')) {
$item .= '.' . $root;
}
@ -394,7 +394,7 @@ class Route
$domain = $this->domain;
} elseif (true === $domain) {
return $this->bind;
} elseif (!strpos($domain, '.')) {
} elseif (false === strpos($domain, '.')) {
$domain .= '.' . $this->request->rootDomain();
}

View File

@ -387,7 +387,7 @@ class Template
}
// 优化生成的php代码
$content = preg_replace('/\?>\s*<\?php\s(?!echo\b)/s', '', $content);
$content = preg_replace('/\?>\s*<\?php\s(?!echo\b|\bend)/s', '', $content);
// 模板过滤输出
$replace = $this->config['tpl_replace_string'];
@ -1269,9 +1269,9 @@ class Template
switch ($tagName) {
case 'block':
if ($single) {
$regex = $begin . '(?:' . $tagName . '\b(?>(?:(?!name=).)*)\bname=([\'\"])(?P<name>[\$\w\-\/\.]+)\\1(?>[^' . $end . ']*)|\/' . $tagName . ')' . $end;
$regex = $begin . '(?:' . $tagName . '\b\s+(?>(?:(?!name=).)*)\bname=([\'\"])(?P<name>[\$\w\-\/\.]+)\\1(?>[^' . $end . ']*)|\/' . $tagName . ')' . $end;
} else {
$regex = $begin . '(?:' . $tagName . '\b(?>(?:(?!name=).)*)\bname=([\'\"])(?P<name>[\$\w\-\/\.]+)\\1(?>(?:(?!' . $end . ').)*)|\/' . $tagName . ')' . $end;
$regex = $begin . '(?:' . $tagName . '\b\s+(?>(?:(?!name=).)*)\bname=([\'\"])(?P<name>[\$\w\-\/\.]+)\\1(?>(?:(?!' . $end . ').)*)|\/' . $tagName . ')' . $end;
}
break;
case 'literal':
@ -1297,9 +1297,9 @@ class Template
$name = 'name';
}
if ($single) {
$regex = $begin . $tagName . '\b(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?P<name>[\$\w\-\/\.\:@,\\\\]+)\\1(?>[^' . $end . ']*)' . $end;
$regex = $begin . $tagName . '\b\s+(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?P<name>[\$\w\-\/\.\:@,\\\\]+)\\1(?>[^' . $end . ']*)' . $end;
} else {
$regex = $begin . $tagName . '\b(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?P<name>[\$\w\-\/\.\:@,\\\\]+)\\1(?>(?:(?!' . $end . ').)*)' . $end;
$regex = $begin . $tagName . '\b\s+(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?P<name>[\$\w\-\/\.\:@,\\\\]+)\\1(?>(?:(?!' . $end . ').)*)' . $end;
}
break;
}

View File

@ -316,7 +316,7 @@ class Url
}
}
}
} elseif (!strpos($domain, '.')) {
} elseif (0 !== strpos($domain, $rootDomain) && false === strpos($domain, '.')) {
$domain .= '.' . $rootDomain;
}

View File

@ -331,10 +331,10 @@ class Validate
* 移除某个字段的验证规则
* @access public
* @param string|array $field 字段名
* @param mixed $rule 验证规则 true 移除所有规则
* @param mixed $rule 验证规则 null 移除所有规则
* @return $this
*/
public function remove($field, $rule = true)
public function remove($field, $rule = null)
{
if (is_array($field)) {
foreach ($field as $key => $rule) {
@ -419,7 +419,7 @@ class Validate
continue;
}
// 获取数据 支持维数组
// 获取数据 支持维数组
$value = $this->getDataValue($data, $key);
// 字段验证
@ -548,7 +548,7 @@ class Validate
if (!empty($msg[$i])) {
$message = $msg[$i];
if (is_string($message) && strpos($message, '{%') === 0) {
$message = Lang::get(substr($message, 2, -1));
$message = facade\Lang::get(substr($message, 2, -1));
}
} else {
$message = $this->getRuleMsg($field, $title, $info, $rule);
@ -1404,7 +1404,7 @@ class Validate
* 获取数据值
* @access protected
* @param array $data 数据
* @param string $key 数据标识 支持
* @param string $key 数据标识 支持
* @return mixed
*/
protected function getDataValue($data, $key)
@ -1412,9 +1412,14 @@ class Validate
if (is_numeric($key)) {
$value = $key;
} elseif (strpos($key, '.')) {
// 支持二维数组验证
list($name1, $name2) = explode('.', $key);
$value = isset($data[$name1][$name2]) ? $data[$name1][$name2] : null;
// 支持多维数组验证
foreach (explode('.', $key) as $key) {
if (!isset($data[$key])) {
$value = null;
break;
}
$value = $data = $data[$key];
}
} else {
$value = isset($data[$key]) ? $data[$key] : null;
}

View File

@ -53,7 +53,7 @@ class Schema extends Command
return;
} elseif ($input->hasOption('table')) {
$table = $input->getOption('table');
if (!strpos($table, '.')) {
if (false === strpos($table, '.')) {
$dbName = Db::getConfig('database');
}

View File

@ -147,7 +147,7 @@ class Choice extends Question
$result = $value;
}
if (empty($result)) {
if (false === $result) {
throw new \InvalidArgumentException(sprintf($errorMessage, $value));
}
array_push($multiselectChoices, $result);

View File

@ -174,9 +174,9 @@ abstract class Builder
return $data->getValue();
}
$query->bind($data, isset($bind[$key]) ? $bind[$key] : PDO::PARAM_STR);
$name = $query->bind($data, isset($bind[$key]) ? $bind[$key] : PDO::PARAM_STR);
return '?';
return ':' . $name;
}
/**
@ -411,8 +411,8 @@ abstract class Builder
}
if (is_scalar($value) && !in_array($exp, ['EXP', 'NOT NULL', 'NULL', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN']) && strpos($exp, 'TIME') === false) {
$query->bind($value, $bindType);
$value = '?';
$name = $query->bind($value, $bindType);
$value = ':' . $name;
}
// 解析查询表达式
@ -447,12 +447,10 @@ abstract class Builder
// 模糊匹配
if (is_array($value)) {
foreach ($value as $item) {
$bind[] = [$item, $bindType];
$array[] = $key . ' ' . $exp . ' ?';
$name = $query->bind($item, $bindType);
$array[] = $key . ' ' . $exp . ' :' . $name;
}
$query->bind($bind);
$whereStr = '(' . implode($array, ' ' . strtoupper($logic) . ' ') . ')';
} else {
$whereStr = $key . ' ' . $exp . ' ' . $value;
@ -534,12 +532,10 @@ abstract class Builder
// BETWEEN 查询
$data = is_array($value) ? $value : explode(',', $value);
$bind[] = [$data[0], $bindType];
$bind[] = [$data[1], $bindType];
$min = $query->bind($data[0], $bindType);
$max = $query->bind($data[1], $bindType);
$query->bind($bind);
return $key . ' ' . $exp . ' ? AND ? ';
return $key . ' ' . $exp . ' :' . $min . ' AND :' . $max . ' ';
}
/**
@ -651,16 +647,14 @@ abstract class Builder
} else {
$value = array_unique(is_array($value) ? $value : explode(',', $value));
$bind = [];
$array = [];
foreach ($value as $k => $v) {
$bind[] = [$v, $bindType];
$array[] = '?';
$name = $query->bind($v, $bindType);
$array[] = ':' . $name;
}
$zone = implode(',', $array);
$query->bind($bind);
$value = empty($zone) ? "''" : $zone;
}
@ -728,9 +722,9 @@ abstract class Builder
}
}
$query->bind($value, $bindType);
$name = $query->bind($value, $bindType);
return '?';
return ':' . $name;
}
/**

View File

@ -361,7 +361,7 @@ abstract class Connection
list($tableName) = explode(' ', $tableName);
if (!strpos($tableName, '.')) {
if (false === strpos($tableName, '.')) {
$schema = $this->getConfig('database') . '.' . $tableName;
} else {
$schema = $tableName;
@ -1472,10 +1472,7 @@ abstract class Connection
// 判断占位符
$sql = is_numeric($key) ?
substr_replace($sql, $value, strpos($sql, '?'), 1) :
str_replace(
[':' . $key . ')', ':' . $key . ',', ':' . $key . ' ', ':' . $key . PHP_EOL],
[$value . ')', $value . ',', $value . ' ', $value . PHP_EOL],
$sql . ' ');
substr_replace($sql, $value, strpos($sql, ':' . $key), strlen(':' . $key));
}
return rtrim($sql);
@ -1494,7 +1491,7 @@ abstract class Connection
{
foreach ($bind as $key => $val) {
// 占位符
$param = is_numeric($key) ? $key + 1 : ':' . $key;
$param = is_int($key) ? $key + 1 : ':' . $key;
if (is_array($val)) {
if (PDO::PARAM_INT == $val[1] && '' === $val[0]) {
@ -1530,7 +1527,7 @@ abstract class Connection
protected function bindParam($bind)
{
foreach ($bind as $key => $val) {
$param = is_numeric($key) ? $key + 1 : ':' . $key;
$param = is_int($key) ? $key + 1 : ':' . $key;
if (is_array($val)) {
array_unshift($val, $param);

View File

@ -1417,23 +1417,18 @@ class Query
* 指定Exp查询条件
* @access public
* @param mixed $field 查询字段
* @param string $condition 查询条件
* @param string $where 查询条件
* @param array $bind 参数绑定
* @param string $logic 查询逻辑 and or xor
* @return $this
*/
public function whereExp($field, $condition, $bind = [], $logic = 'AND')
public function whereExp($field, $where, $bind = [], $logic = 'AND')
{
if ($bind) {
foreach ($bind as $key => $value) {
if (!is_numeric($key)) {
$where = str_replace(':' . $key, '?', $where);
}
}
$this->bind(array_values($bind));
$this->bindParams($where, $bind);
}
$this->options['where'][$logic][] = [$field, 'EXP', $this->raw($condition)];
$this->options['where'][$logic][] = [$field, 'EXP', $this->raw($where)];
return $this;
}
@ -1449,13 +1444,7 @@ class Query
public function whereRaw($where, $bind = [], $logic = 'AND')
{
if ($bind) {
foreach ($bind as $key => $value) {
if (!is_numeric($key)) {
$where = str_replace(':' . $key, '?', $where);
}
}
$this->bind(array_values($bind));
$this->bindParams($where, $bind);
}
$this->options['where'][$logic][] = $this->raw($where);
@ -1463,6 +1452,30 @@ class Query
return $this;
}
/**
* 参数绑定
* @access public
* @param string $sql 绑定的sql表达式
* @param array $bind 参数绑定
* @return void
*/
protected function bindParams(&$sql, array $bind = [])
{
foreach ($bind as $key => $value) {
if (is_array($value)) {
$name = $this->bind($value[0], $value[1], isset($value[2]) ? $value[2] : null);
} else {
$name = $this->bind($value);
}
if (is_numeric($key)) {
$sql = substr_replace($sql, ':' . $name, strpos($sql, '?'), 1);
} else {
$sql = str_replace(':' . $key, ':' . $name, $sql);
}
}
}
/**
* 指定表达式查询条件 OR
* @access public
@ -1500,7 +1513,7 @@ class Query
return $this;
}
if (is_string($field) && !empty($this->options['via']) && !strpos($field, '.')) {
if (is_string($field) && !empty($this->options['via']) && false === strpos($field, '.')) {
$field = $this->options['via'] . '.' . $field;
}
@ -1893,13 +1906,7 @@ class Query
public function orderRaw($field, $bind = [])
{
if ($bind) {
foreach ($bind as $key => $value) {
if (!is_numeric($key)) {
$field = str_replace(':' . $key, '?', $field);
}
}
$this->bind(array_values($bind));
$this->bindParams($field, $bind);
}
$this->options['order'][] = $this->raw($field);
@ -2444,14 +2451,18 @@ class Query
* @access public
* @param mixed $value 绑定变量值
* @param integer $type 绑定类型
* @return $this
* @param string $name 绑定名称
* @return $this|string
*/
public function bind($value = false, $type = PDO::PARAM_STR)
public function bind($value, $type = PDO::PARAM_STR, $name = null)
{
if (is_array($value)) {
$this->bind = array_merge($this->bind, $value);
} else {
$this->bind[] = [$value, $type];
$name = $name ?: 'ThinkBind_' . (count($this->bind) + 1) . '_';
$this->bind[$name] = [$value, $type];
return $name;
}
return $this;
@ -3648,7 +3659,7 @@ class Query
$options['field'] = '*';
}
foreach (['data', 'order'] as $name) {
foreach (['data', 'order', 'join', 'union'] as $name) {
if (!isset($options[$name])) {
$options[$name] = [];
}
@ -3668,7 +3679,7 @@ class Query
$options['master'] = true;
}
foreach (['join', 'union', 'group', 'having', 'limit', 'force', 'comment'] as $name) {
foreach (['group', 'having', 'limit', 'force', 'comment'] as $name) {
if (!isset($options[$name])) {
$options[$name] = '';
}

View File

@ -23,8 +23,8 @@ use think\Facade;
* @method \think\View exists(mixed $name) static 检查模板是否存在
* @method \think\View filter(Callable $filter) static 视图内容过滤
* @method \think\View engine(mixed $engine = []) static 设置当前模板解析的引擎
* @method string fetch(string $template = '', array $vars = [], array $replace = [], array $config = [], bool $renderContent = false) static 解析和获取模板内容
* @method string display(string $content = '', array $vars = [], array $replace = [], array $config = []) static 渲染内容输出
* @method string fetch(string $template = '', array $vars = [], array $config = [], bool $renderContent = false) static 解析和获取模板内容
* @method string display(string $content = '', array $vars = [], array $config = []) static 渲染内容输出
*/
class View extends Facade
{

View File

@ -80,6 +80,8 @@ trait ModelEvent
*/
public static function observe($class)
{
self::flushEvent();
foreach (static::$observe as $event) {
$eventFuncName = Loader::parseName($event, 1, false);

View File

@ -212,7 +212,7 @@ trait SoftDelete
return false;
}
if (!strpos($field, '.')) {
if (false === strpos($field, '.')) {
$field = '__TABLE__.' . $field;
}

View File

@ -114,7 +114,7 @@ class BelongsTo extends OneToOne
if ($closure) {
$return = $closure($this->query);
if ($resturn && is_string($return)) {
if ($return && is_string($return)) {
$name = $return;
}
}
@ -135,7 +135,19 @@ class BelongsTo extends OneToOne
*/
public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER')
{
return $this->parent;
$table = $this->query->getTable();
$model = basename(str_replace('\\', '/', get_class($this->parent)));
$relation = basename(str_replace('\\', '/', $this->model));
$localKey = $this->localKey;
$foreignKey = $this->foreignKey;
return $this->parent->db()
->alias($model)
->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey) {
$query->table([$table => $relation])
->field($relation . '.' . $localKey)
->whereExp($model . '.' . $foreignKey, '=' . $relation . '.' . $localKey);
});
}
/**

View File

@ -165,7 +165,7 @@ class HasMany extends Relation
if ($closure) {
$return = $closure($this->query);
if ($resturn && is_string($return)) {
if ($return && is_string($return)) {
$name = $return;
}
}
@ -195,7 +195,7 @@ class HasMany extends Relation
}
return $this->query
->whereExp($this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->parent->getPk())
->whereExp($this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey)
->fetchSql()
->$aggregate($field);
}

View File

@ -88,7 +88,7 @@ class HasOne extends OneToOne
}
return $this->query
->whereExp($this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->parent->getPk())
->whereExp($this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey)
->fetchSql()
->$aggregate($field);
}
@ -113,7 +113,7 @@ class HasOne extends OneToOne
if ($closure) {
$return = $closure($this->query);
if ($resturn && is_string($return)) {
if ($return && is_string($return)) {
$name = $return;
}
}

View File

@ -128,7 +128,7 @@ class Download extends Response
{
$this->name = $filename;
if ($extension && !strpos($filename, '.')) {
if ($extension && false === strpos($filename, '.')) {
$this->name .= '.' . pathinfo($this->data, PATHINFO_EXTENSION);
}

View File

@ -681,10 +681,10 @@ abstract class Rule
/**
* 合并分组参数
* @access protected
* @access public
* @return array
*/
protected function mergeGroupOptions()
public function mergeGroupOptions()
{
if (!$this->lockOption) {
$parentOption = $this->parent->getOption();

View File

@ -189,7 +189,7 @@ class RuleGroup extends Rule
$result = new UrlDispatch($request, $this, $this->auto . '/' . $url, ['auto_search' => false]);
} elseif ($this->miss && in_array($this->miss->getMethod(), ['*', $method])) {
// 未匹配所有路由的路由规则处理
$result = $this->miss->parseRule($request, '', $this->miss->getRoute(), $url, $this->miss->getOption());
$result = $this->miss->parseRule($request, '', $this->miss->getRoute(), $url, $this->miss->mergeGroupOptions());
} else {
$result = false;
}

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInite9f61c7f17c1efc184e83ad53ffe6a75::getLoader();
return ComposerAutoloaderInitbe36bc09417ef093d568a98d90fda606::getLoader();

View File

@ -6,6 +6,13 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'AliPay\\App' => $vendorDir . '/zoujingli/wechat-developer/AliPay/App.php',
'AliPay\\Bill' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Bill.php',
'AliPay\\Pos' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Pos.php',
'AliPay\\Scan' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Scan.php',
'AliPay\\Transfer' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Transfer.php',
'AliPay\\Wap' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Wap.php',
'AliPay\\Web' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Web.php',
'Endroid\\QrCode\\Bundle\\Controller\\QrCodeController' => $vendorDir . '/endroid/qr-code/src/Bundle/Controller/QrCodeController.php',
'Endroid\\QrCode\\Bundle\\DependencyInjection\\Configuration' => $vendorDir . '/endroid/qr-code/src/Bundle/DependencyInjection/Configuration.php',
'Endroid\\QrCode\\Bundle\\DependencyInjection\\EndroidQrCodeExtension' => $vendorDir . '/endroid/qr-code/src/Bundle/DependencyInjection/EndroidQrCodeExtension.php',
@ -97,6 +104,7 @@ return array(
'Qiniu\\Processing\\Operation' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/Operation.php',
'Qiniu\\Processing\\PersistentFop' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/PersistentFop.php',
'Qiniu\\Rtc\\AppClient' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php',
'Qiniu\\Storage\\ArgusManager' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/ArgusManager.php',
'Qiniu\\Storage\\BucketManager' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php',
'Qiniu\\Storage\\FormUploader' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php',
'Qiniu\\Storage\\ResumeUploader' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/ResumeUploader.php',
@ -116,9 +124,10 @@ return array(
'Symfony\\Component\\OptionsResolver\\OptionsResolver' => $vendorDir . '/symfony/options-resolver/OptionsResolver.php',
'We' => $vendorDir . '/zoujingli/wechat-developer/We.php',
'WeChat\\Card' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Card.php',
'WeChat\\Contracts\\BasicPay' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Contracts/BasicPay.php',
'WeChat\\Contracts\\BasicAliPay' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Contracts/BasicAliPay.php',
'WeChat\\Contracts\\BasicPushEvent' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Contracts/BasicPushEvent.php',
'WeChat\\Contracts\\BasicWeChat' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Contracts/BasicWeChat.php',
'WeChat\\Contracts\\BasicWePay' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Contracts/BasicWePay.php',
'WeChat\\Contracts\\DataArray' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Contracts/DataArray.php',
'WeChat\\Contracts\\DataError' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Contracts/DataError.php',
'WeChat\\Contracts\\Tools' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Contracts/Tools.php',

View File

@ -17,4 +17,5 @@ return array(
'Qiniu\\' => array($vendorDir . '/qiniu/php-sdk/src/Qiniu'),
'OSS\\' => array($vendorDir . '/aliyuncs/oss-sdk-php/src/OSS'),
'Endroid\\QrCode\\' => array($vendorDir . '/endroid/qr-code/src'),
'AliPay\\' => array($vendorDir . '/zoujingli/wechat-developer/AliPay'),
);

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInite9f61c7f17c1efc184e83ad53ffe6a75
class ComposerAutoloaderInitbe36bc09417ef093d568a98d90fda606
{
private static $loader;
@ -19,15 +19,15 @@ class ComposerAutoloaderInite9f61c7f17c1efc184e83ad53ffe6a75
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInite9f61c7f17c1efc184e83ad53ffe6a75', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitbe36bc09417ef093d568a98d90fda606', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInite9f61c7f17c1efc184e83ad53ffe6a75', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitbe36bc09417ef093d568a98d90fda606', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInite9f61c7f17c1efc184e83ad53ffe6a75::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitbe36bc09417ef093d568a98d90fda606::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
@ -48,19 +48,19 @@ class ComposerAutoloaderInite9f61c7f17c1efc184e83ad53ffe6a75
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInite9f61c7f17c1efc184e83ad53ffe6a75::$files;
$includeFiles = Composer\Autoload\ComposerStaticInitbe36bc09417ef093d568a98d90fda606::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequiree9f61c7f17c1efc184e83ad53ffe6a75($fileIdentifier, $file);
composerRequirebe36bc09417ef093d568a98d90fda606($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequiree9f61c7f17c1efc184e83ad53ffe6a75($fileIdentifier, $file)
function composerRequirebe36bc09417ef093d568a98d90fda606($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInite9f61c7f17c1efc184e83ad53ffe6a75
class ComposerStaticInitbe36bc09417ef093d568a98d90fda606
{
public static $files = array (
'1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php',
@ -44,6 +44,10 @@ class ComposerStaticInite9f61c7f17c1efc184e83ad53ffe6a75
array (
'Endroid\\QrCode\\' => 15,
),
'A' =>
array (
'AliPay\\' => 7,
),
);
public static $prefixDirsPsr4 = array (
@ -93,9 +97,20 @@ class ComposerStaticInite9f61c7f17c1efc184e83ad53ffe6a75
array (
0 => __DIR__ . '/..' . '/endroid/qr-code/src',
),
'AliPay\\' =>
array (
0 => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay',
),
);
public static $classMap = array (
'AliPay\\App' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/App.php',
'AliPay\\Bill' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Bill.php',
'AliPay\\Pos' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Pos.php',
'AliPay\\Scan' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Scan.php',
'AliPay\\Transfer' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Transfer.php',
'AliPay\\Wap' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Wap.php',
'AliPay\\Web' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Web.php',
'Endroid\\QrCode\\Bundle\\Controller\\QrCodeController' => __DIR__ . '/..' . '/endroid/qr-code/src/Bundle/Controller/QrCodeController.php',
'Endroid\\QrCode\\Bundle\\DependencyInjection\\Configuration' => __DIR__ . '/..' . '/endroid/qr-code/src/Bundle/DependencyInjection/Configuration.php',
'Endroid\\QrCode\\Bundle\\DependencyInjection\\EndroidQrCodeExtension' => __DIR__ . '/..' . '/endroid/qr-code/src/Bundle/DependencyInjection/EndroidQrCodeExtension.php',
@ -187,6 +202,7 @@ class ComposerStaticInite9f61c7f17c1efc184e83ad53ffe6a75
'Qiniu\\Processing\\Operation' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/Operation.php',
'Qiniu\\Processing\\PersistentFop' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/PersistentFop.php',
'Qiniu\\Rtc\\AppClient' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php',
'Qiniu\\Storage\\ArgusManager' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/ArgusManager.php',
'Qiniu\\Storage\\BucketManager' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php',
'Qiniu\\Storage\\FormUploader' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php',
'Qiniu\\Storage\\ResumeUploader' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/ResumeUploader.php',
@ -206,9 +222,10 @@ class ComposerStaticInite9f61c7f17c1efc184e83ad53ffe6a75
'Symfony\\Component\\OptionsResolver\\OptionsResolver' => __DIR__ . '/..' . '/symfony/options-resolver/OptionsResolver.php',
'We' => __DIR__ . '/..' . '/zoujingli/wechat-developer/We.php',
'WeChat\\Card' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Card.php',
'WeChat\\Contracts\\BasicPay' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Contracts/BasicPay.php',
'WeChat\\Contracts\\BasicAliPay' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Contracts/BasicAliPay.php',
'WeChat\\Contracts\\BasicPushEvent' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Contracts/BasicPushEvent.php',
'WeChat\\Contracts\\BasicWeChat' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Contracts/BasicWeChat.php',
'WeChat\\Contracts\\BasicWePay' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Contracts/BasicWePay.php',
'WeChat\\Contracts\\DataArray' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Contracts/DataArray.php',
'WeChat\\Contracts\\DataError' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Contracts/DataError.php',
'WeChat\\Contracts\\Tools' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Contracts/Tools.php',
@ -303,9 +320,9 @@ class ComposerStaticInite9f61c7f17c1efc184e83ad53ffe6a75
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInite9f61c7f17c1efc184e83ad53ffe6a75::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInite9f61c7f17c1efc184e83ad53ffe6a75::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInite9f61c7f17c1efc184e83ad53ffe6a75::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitbe36bc09417ef093d568a98d90fda606::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitbe36bc09417ef093d568a98d90fda606::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitbe36bc09417ef093d568a98d90fda606::$classMap;
}, null, ClassLoader::class);
}

View File

@ -50,17 +50,17 @@
},
{
"name": "topthink/framework",
"version": "v5.1.28",
"version_normalized": "5.1.28.0",
"version": "v5.1.29",
"version_normalized": "5.1.29.0",
"source": {
"type": "git",
"url": "https://github.com/top-think/framework.git",
"reference": "8102ec96136a66f926bae89faea540b91687de37"
"reference": "f1d8ee3a91e8f504507edb5dcc49c50c47b4500f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/framework/zipball/8102ec96136a66f926bae89faea540b91687de37",
"reference": "8102ec96136a66f926bae89faea540b91687de37",
"url": "https://api.github.com/repos/top-think/framework/zipball/f1d8ee3a91e8f504507edb5dcc49c50c47b4500f",
"reference": "f1d8ee3a91e8f504507edb5dcc49c50c47b4500f",
"shasum": "",
"mirrors": [
{
@ -82,7 +82,7 @@
"sebastian/phpcpd": "2.*",
"squizlabs/php_codesniffer": "2.*"
},
"time": "2018-10-28T12:24:29+00:00",
"time": "2018-11-11T01:17:33+00:00",
"type": "think-framework",
"installation-source": "dist",
"notification-url": "https://packagist.org/downloads/",
@ -156,17 +156,17 @@
},
{
"name": "qiniu/php-sdk",
"version": "v7.2.6",
"version_normalized": "7.2.6.0",
"version": "v7.2.7",
"version_normalized": "7.2.7.0",
"source": {
"type": "git",
"url": "https://github.com/qiniu/php-sdk.git",
"reference": "305ce1c1c0c71f794661fe45a96facf61ef96c5d"
"reference": "88d11a5857ebc6871204e9be6ceec54bf5f381e6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/qiniu/php-sdk/zipball/305ce1c1c0c71f794661fe45a96facf61ef96c5d",
"reference": "305ce1c1c0c71f794661fe45a96facf61ef96c5d",
"url": "https://api.github.com/repos/qiniu/php-sdk/zipball/88d11a5857ebc6871204e9be6ceec54bf5f381e6",
"reference": "88d11a5857ebc6871204e9be6ceec54bf5f381e6",
"shasum": "",
"mirrors": [
{
@ -182,7 +182,7 @@
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.3"
},
"time": "2018-05-18T04:37:29+00:00",
"time": "2018-11-06T13:34:32+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -215,8 +215,8 @@
},
{
"name": "symfony/options-resolver",
"version": "v3.4.17",
"version_normalized": "3.4.17.0",
"version": "v3.4.18",
"version_normalized": "3.4.18.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
@ -443,17 +443,17 @@
},
{
"name": "zoujingli/wechat-developer",
"version": "v1.1.17",
"version_normalized": "1.1.17.0",
"version": "v1.2.2",
"version_normalized": "1.2.2.0",
"source": {
"type": "git",
"url": "https://github.com/zoujingli/WeChatDeveloper.git",
"reference": "7438d3b7081ddbdb8320cf7762896d705710cf28"
"reference": "7e89f110da89e44e32b1abf5a15b2d107e3b30d5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zoujingli/WeChatDeveloper/zipball/7438d3b7081ddbdb8320cf7762896d705710cf28",
"reference": "7438d3b7081ddbdb8320cf7762896d705710cf28",
"url": "https://api.github.com/repos/zoujingli/WeChatDeveloper/zipball/7e89f110da89e44e32b1abf5a15b2d107e3b30d5",
"reference": "7e89f110da89e44e32b1abf5a15b2d107e3b30d5",
"shasum": "",
"mirrors": [
{
@ -468,7 +468,7 @@
"ext-openssl": "*",
"php": ">=5.4"
},
"time": "2018-10-27T07:50:34+00:00",
"time": "2018-11-03T01:01:29+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -477,8 +477,9 @@
],
"psr-4": {
"WePay\\": "WePay",
"WeMini\\": "WeMini",
"WeChat\\": "WeChat",
"WeMini\\": "WeMini"
"AliPay\\": "AliPay"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -497,6 +498,7 @@
"keywords": [
"WeChatDeveloper",
"WeMini",
"alipay",
"wechat",
"wechatpay",
"wepay"

View File

@ -1,5 +1,8 @@
# Changelog
## 7.2.7 (2018-11-06)
* 添加 QVM 内网上传到 KODO 的 zone 设置
## 7.2.6 (2018-05-18)
* 修复rsrsf在不同机房默认的https域名

View File

@ -3,10 +3,16 @@ require_once __DIR__ . '/../autoload.php';
use Qiniu\Processing\PersistentFop;
$pfop = new Qiniu\Processing\PersistentFop(null, null);
// 触发持久化处理后返回的 Id
$persistentId = 'z0.564d5f977823de48a85ece59';
$persistentId = 'z1.5b8a48e5856db843bc24cfc3';
// 通过persistentId查询该 触发持久化处理的状态
$status = PersistentFop::status($persistentId);
list($ret, $err) = $pfop->status($persistentId);
var_dump($status);
if ($err) {
print_r($err);
} else {
print_r($ret);
}

View File

@ -0,0 +1,55 @@
<?php
require_once __DIR__ . '/../autoload.php';
use Qiniu\Auth;
use Qiniu\Http\Client;
$accessKey = getenv('QINIU_ACCESS_KEY');
$secretKey = getenv('QINIU_SECRET_KEY');
$auth = new Auth($accessKey, $secretKey);
$config = new \Qiniu\Config();
$argusManager = new \Qiniu\Storage\ArgusManager($auth, $config);
$reqBody = array();
$reqBody['uri'] = "xxxx";
$ops = array();
$ops = array(
array(
'op' => 'pulp',
'params' => array(
'labels' => array(
array(
'label' => "1",
'select' => 1,
'score' => 2,
),
)
)
),
);
$params = array();
$params = array(
'async' => false,
'vframe' => array(
'mode' => 1,
'interval' => 8,
)
);
$req = array();
$req['data'] = $reqBody;
$req['ops'] = $ops;
$req['params'] = $params;
$body = json_encode($req);
$vid = "xxxx";
list($ret, $err) = $argusManager->pulpVideo($body, $vid);
if ($err !== null) {
var_dump($err);
} else {
var_dump($ret);
}

View File

@ -4,6 +4,13 @@ require_once __DIR__ . '/../autoload.php';
use Qiniu\Auth;
use Qiniu\Storage\UploadManager;
// use Qiniu\Config;
// use Qiniu\Zone;
// 指定zone上传
// $zone = Zone::zoneZ0(); //华东QVM内网上传指定host
// $config = new Config($zone);
$accessKey = getenv('QINIU_ACCESS_KEY');
$secretKey = getenv('QINIU_SECRET_KEY');
$bucket = getenv('QINIU_TEST_BUCKET');
@ -20,6 +27,8 @@ $uptoken = $auth->uploadToken($bucket, null, 3600, $policy);
//上传文件的本地路径
$filePath = './php-logo.png';
//指定 config
// $uploadMgr = new UploadManager($config);
$uploadMgr = new UploadManager();
list($ret, $err) = $uploadMgr->putFile($uptoken, null, $filePath);

View File

@ -175,6 +175,7 @@ final class CdnManager
$deadline = time() + $durationInSeconds;
$expireHex = dechex($deadline);
$path = isset($parsedUrl['path']) ? $parsedUrl['path'] : '';
$path = implode('/', array_map('rawurlencode', explode('/', $path)));
$strToSign = $encryptKey . $path . $expireHex;
$signStr = md5($strToSign);

View File

@ -3,7 +3,7 @@ namespace Qiniu;
final class Config
{
const SDK_VER = '7.2.5';
const SDK_VER = '7.2.7';
const BLOCK_SIZE = 4194304; //4*1024*1024 分块上传块大小,该参数为接口规格,不能修改
@ -12,6 +12,7 @@ final class Config
const RS_HOST = 'rs.qiniu.com'; //RS Host
const UC_HOST = 'https://api.qiniu.com'; //UC Host
const RTCAPI_HOST = 'http://rtc.qiniuapi.com';
const ARGUS_HOST = 'argus.atlab.ai';
const RTCAPI_VERSION = 'v3';
// Zone 空间对应的机房

View File

@ -0,0 +1,73 @@
<?php
namespace Qiniu\Storage;
use Qiniu\Auth;
use Qiniu\Config;
use Qiniu\Zone;
use Qiniu\Http\Client;
use Qiniu\Http\Error;
/**
* 主要涉及了鉴黄接口的实现,具体的接口规格可以参考
*
* @link https://developer.qiniu.com/dora/manual/3674/kodo-product-introduction
*/
final class ArgusManager
{
private $auth;
private $config;
public function __construct(Auth $auth, Config $config = null)
{
$this->auth = $auth;
if ($config == null) {
$this->config = new Config();
} else {
$this->config = $config;
}
}
/**
* 视频鉴黄
*
* @param $body body信息
* @param $vid videoID
*
* @return mixed 成功返回NULL失败返回对象Qiniu\Http\Error
* @link https://developer.qiniu.com/dora/manual/4258/video-pulp
*/
public function pulpVideo($body, $vid)
{
$path = '/v1/video/' . $vid;
return $this->arPost($path, $body);
}
private function getArHost()
{
$scheme = "http://";
if ($this->config->useHTTPS == true) {
$scheme = "https://";
}
return $scheme . Config::ARGUS_HOST;
}
private function arPost($path, $body = null)
{
$url = $this->getArHost() . $path;
return $this->post($url, $body);
}
private function post($url, $body)
{
$headers = $this->auth->authorizationV2($url, 'POST', $body, 'application/json');
$headers['Content-Type']='application/json';
$ret = Client::post($url, $body, $headers);
if (!$ret->ok()) {
print($ret->statusCode);
return array(null, new Error($url, $ret));
}
$r = ($ret->body === null) ? array() : $ret->json();
return array($r, null);
}
}

View File

@ -133,8 +133,9 @@ final class UploadManager
}
$ret = array();
foreach ($params as $k => $v) {
$pos = strpos($k, 'x:');
if ($pos === 0 && !empty($v)) {
$pos1 = strpos($k, 'x:');
$pos2 = strpos($k, 'x-qn-meta-');
if (($pos1 === 0 || $pos2 === 0) && !empty($v)) {
$ret[$k] = $v;
}
}

View File

@ -52,6 +52,32 @@ final class Zone
return $Zone_z0;
}
//华东机房内网上传
public static function zoneZ0()
{
$Zone_z01 = new Zone(
array("free-qvm-z0-xs.qiniup.com"),
'rs.qbox.me',
'rsf.qbox.me',
'api.qiniu.com',
'iovip.qbox.me'
);
return $Zone_z01;
}
//华北机房内网上传
public static function zoneZ1()
{
$Zone_z12 = new Zone(
array("free-qvm-z1-zz.qiniup.com"),
"rs-z1.qbox.me",
"rsf-z1.qbox.me",
"api-z1.qiniu.com",
"iovip-z1.qbox.me"
);
return $Zone_z12;
}
//华北机房
public static function zone1()
{

View File

@ -255,7 +255,7 @@ if (!defined('QINIU_FUNCTIONS_VERSION')) {
return array(null, null, "invalid uptoken");
}
$accessKey = $items[0];
$putPolicy = json_decode(base64_decode($items[2]));
$putPolicy = json_decode(base64_urlSafeDecode($items[2]));
$scope = $putPolicy->scope;
$scopeItems = explode(':', $scope);
$bucket = $scopeItems[0];

View File

@ -35,7 +35,7 @@ class ResumeUpTest extends \PHPUnit_Framework_TestCase
public function test4ML2()
{
$key = 'resumePutFile4ML';
$zone = new Zone(array('up.fake.qiniu.com'), array('up.qiniup.com'));
$zone = new Zone(array('up.qiniup.com'));
$cfg = new Config($zone);
$upManager = new UploadManager($cfg);
$token = $this->auth->uploadToken($this->bucketName, $key);

View File

@ -0,0 +1,48 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
namespace AliPay;
use WeChat\Contracts\BasicAliPay;
/**
* 支付宝App支付网关
* Class App
* @package AliPay
*/
class App extends BasicAliPay
{
/**
* App constructor.
* @param array $options
*/
public function __construct(array $options)
{
parent::__construct($options);
$this->options->set('method', 'alipay.trade.app.pay');
$this->params->set('product_code', 'QUICK_MSECURITY_PAY');
}
/**
* 创建数据操作
* @param array $options
* @return string
*/
public function apply($options)
{
$this->applyData($options);
return http_build_query($this->options->get());
}
}

View File

@ -0,0 +1,46 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
namespace AliPay;
use WeChat\Contracts\BasicAliPay;
/**
* 支付宝电子面单下载
* Class Bill
* @package AliPay
*/
class Bill extends BasicAliPay
{
/**
* Bill constructor.
* @param array $options
*/
public function __construct(array $options)
{
parent::__construct($options);
$this->options->set('method', 'alipay.data.dataservice.bill.downloadurl.query');
}
/**
* 创建数据操作
* @param array $options
* @return mixed
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function apply($options)
{
return $this->getResult($options);
}
}

View File

@ -0,0 +1,47 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
namespace AliPay;
use WeChat\Contracts\BasicAliPay;
/**
* 支付宝刷卡支付
* Class Pos
* @package AliPay
*/
class Pos extends BasicAliPay
{
/**
* Pos constructor.
* @param array $options
*/
public function __construct(array $options)
{
parent::__construct($options);
$this->options->set('method', 'alipay.trade.pay');
$this->params->set('product_code', 'FACE_TO_FACE_PAYMENT');
}
/**
* 创建数据操作
* @param array $options
* @return mixed
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function apply($options)
{
return $this->getResult($options);
}
}

View File

@ -0,0 +1,46 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
namespace AliPay;
use WeChat\Contracts\BasicAliPay;
/**
* 支付宝扫码支付
* Class Scan
* @package AliPay
*/
class Scan extends BasicAliPay
{
/**
* Scan constructor.
* @param array $options
*/
public function __construct(array $options)
{
parent::__construct($options);
$this->options->set('method', 'alipay.trade.precreate');
}
/**
* 创建数据操作
* @param array $options
* @return mixed
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function apply($options)
{
return $this->getResult($options);
}
}

View File

@ -0,0 +1,47 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
namespace AliPay;
use WeChat\Contracts\BasicAliPay;
/**
* 支付宝转账到账户
* Class Transfer
* @package AliPay
*/
class Transfer extends BasicAliPay
{
/**
* Transfer constructor.
* @param array $options
*/
public function __construct(array $options)
{
parent::__construct($options);
$this->options->set('method', 'alipay.fund.trans.toaccount.transfer');
}
/**
* 创建数据操作
* @param array $options
* @return mixed
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function apply($options)
{
return $this->getResult($options);
}
}

View File

@ -0,0 +1,47 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
namespace AliPay;
use WeChat\Contracts\BasicAliPay;
/**
* 手机WAP网站支付支持
* Class Wap
* @package AliPay
*/
class Wap extends BasicAliPay
{
/**
* Wap constructor.
* @param array $options
*/
public function __construct(array $options)
{
parent::__construct($options);
$this->options->set('method', 'alipay.trade.wap.pay');
$this->params->set('product_code', 'QUICK_WAP_WAY');
}
/**
* 创建数据操作
* @param array $options
* @return string
*/
public function apply($options)
{
parent::applyData($options);
return $this->buildPayHtml();
}
}

View File

@ -0,0 +1,47 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
namespace AliPay;
use WeChat\Contracts\BasicAliPay;
/**
* 支付宝网站支付
* Class Web
* @package AliPay
*/
class Web extends BasicAliPay
{
/**
* Web constructor.
* @param array $options
*/
public function __construct(array $options)
{
parent::__construct($options);
$this->options->set('method', 'alipay.trade.page.pay');
$this->params->set('product_code', 'FAST_INSTANT_TRADE_PAY');
}
/**
* 创建数据操作
* @param array $options
* @return string
*/
public function apply($options)
{
parent::applyData($options);
return $this->buildPayHtml();
}
}

View File

@ -4,7 +4,7 @@
[![License](https://poser.pugx.org/zoujingli/wechat-developer/license)](https://packagist.org/packages/zoujingli/wechat-developer)
WeChatDeveloper for PHP
--
----
* WeChatDeveloper 是基于 [wechat-php-sdk](https://github.com/zoujingli/wechat-php-sdk) 重构,优化并完善;
* 运行最底要求 PHP 版本 5.4 , 建议在 PHP7 上运行以获取最佳性能;
* WeChatDeveloper 针对 access_token 失效增加了自动刷新机制;
@ -12,9 +12,15 @@ WeChatDeveloper for PHP
* 我们鼓励大家使用 composer 来管理您的第三方库,方便后期更新操作;
* WeChatDeveloper 已历经数个线上项目考验,欢迎 fork 或 star 此项目。
功能描述
----
* 微信小程序,服务端接口支持
* 微信认证服务号,服务端接口支持
* 微信支付账单、卡券、红包、退款、转账、App支付、JSAPI支付、Web支付、扫码支付等
* 支付宝支付账单、转账、App支付、刷卡支付、扫码支付、Web支付、Wap支付等
Documentation
--
技术帮助
----
PHP开发技术交流QQ群 513350915
[![PHP微信开发群 (SDK)](http://pub.idqqimg.com/wpa/images/group.png)](http://shang.qq.com/wpa/qunwpa?idkey=ae25cf789dafbef62e50a980ffc31242f150bc61a61164458216dd98c411832a)
@ -25,21 +31,27 @@ WeChatDeveloper 是基于官方接口封装,在做微信开发前,必需先
针对 WeChatDeveloper 也有一准备了帮助资料可供参考。
* ThinkAdminhttps://github.com/zoujingli/Think.Admin
* 开发文档地址https://www.kancloud.cn/zoujingli/wechat-developer
* WeChatDeveloperhttps://www.kancloud.cn/zoujingli/wechat-developer
Repositorie
--
代码仓库
----
WeChatDeveloper 为开源项目,允许把它用于任何地方,不受任何约束,欢迎 fork 项目。
* Gitee 托管地址https://gitee.com/zoujingli/WeChatDeveloper
* GitHub 托管地址https://github.com/zoujingli/WeChatDeveloper
ClassMap
--
文件说明
----
|文件名|类名|描述|类型|加载 ①|
|---|---|---|---|---|
| App.php | AliPay\App | 支付宝App支付 | 支付宝 | \We::AliPayApp() |
| Bill.php | AliPay\Bill | 支付宝账单下载 | 支付宝 | \We::AliPayBill() |
| Pos.php | AliPay\Pos | 支付宝刷卡支付 | 支付宝 | \We::AliPayPos() |
| Scan.php | AliPay\Scan | 支付宝扫码支付 | 支付宝 | \We::AliPayScan() |
| Transfer.php | AliPay\Transfer | 支付宝转账 | 支付宝 | \We::AliPayTransfer() |
| Wap.php | AliPay\Wap | 支付宝Wap支付 | 支付宝 | \We::AliPayWap() |
| Web.php | AliPay\Web | 支付宝Web支付 | 支付宝 | \We::AliPayWeb() |
| Card.php | WeChat\Card | 微信卡券接口支持 | 认证服务号 | \We::WeChatCard() |
| Custom.php | WeChat\Custom | 微信客服消息接口支持 | 认证服务号 | \We::WeChatCustom() |
| Media.php | WeChat\Media | 微信媒体素材接口支持 | 认证服务号 | \We::WeChatMedia() |
@ -70,8 +82,8 @@ ClassMap
| Total.php | WeMini\Total | 微信小程序数据接口 | 微信小程序 | \We::WeMiniTotal() |
Install
--
安装使用
----
1.1 通过 Composer 来管理安装
```shell
# 首次安装 线上版本(稳定)
@ -130,45 +142,13 @@ try {
}
```
Encapsulation
--
* 接入验证 (初级权限)
* 自动回复(文本、图片、语音、视频、音乐、图文) (初级权限)
* 菜单操作(查询、创建、删除) (菜单权限)
* 客服消息(文本、图片、语音、视频、音乐、图文) (认证权限)
* 二维码创建临时、永久二维码获取二维码URL (服务号、认证权限)
* 长链接转短链接接口 (服务号、认证权限)
* 标签操作(查询、创建、修改、移动用户到标签) (认证权限)
* 网页授权(基本授权,用户信息授权) (服务号、认证权限)
* 用户信息(查询用户基本信息、获取关注者列表) (认证权限)
* 多客服功能(客服管理、获取客服记录、客服会话管理) (认证权限)
* 媒体文件(上传、获取) (认证权限)
* 高级群发 (认证权限)
* 模板消息(设置所属行业、添加模板、发送模板消息) (服务号、认证权限)
* 卡券管理(创建、修改、删除、发放、门店管理等) (认证权限)
* 语义理解 (服务号、认证权限)
* 获取微信服务器IP列表 (初级权限)
* 微信JSAPI授权(获取ticket、获取签名) (初级权限)
* 数据统计(用户、图文、消息、接口分析数据) (认证权限)
* 微信支付(网页支付、扫码支付、交易退款、给粉丝打款)(认证服务号并开通支付功能)
Permission
--
* 初级权限:基本权限,任何正常的公众号都有此权限
* 菜单权限:正常的服务号、认证后的订阅号拥有此权限
* 认证权限:分为订阅号、服务号认证,如前缀服务号则仅认证的服务号有此权限
* 支付权限:仅认证后的服务号可以申请此权限
Copyright
--
开源协议
----
* WeChatDeveloper 基于`MIT`协议发布,任何人可以用在任何地方,不受约束
* WeChatDeveloper 部分代码来自互联网,若有异议,可以联系作者进行删除
Sponsor
--
赞助支持
----
![赞助](http://zoujingli.oschina.io/static/pay.png)

View File

@ -58,6 +58,15 @@ use WeChat\Exceptions\InvalidInstanceException;
* @method \WePay\Redpack WePayRedpack($options = []) static 微信红包支持
* @method \WePay\Transfers WePayTransfers($options = []) static 微信商户打款到零钱
* @method \WePay\TransfersBank WePayTransfersBank($options = []) static 微信商户打款到银行卡
*
* ----- AliPay ----
* @method \AliPay\App AliPayApp($options) static 支付宝App支付网关
* @method \AliPay\Bill AliPayBill($options) static 支付宝电子面单下载
* @method \AliPay\Pos AliPayPos($options) static 支付宝刷卡支付
* @method \AliPay\Scan AliPayScan($options) static 支付宝扫码支付
* @method \AliPay\Transfer AliPayTransfer($options) static 支付宝转账到账户
* @method \AliPay\Wap AliPayWap($options) static 支付宝手机网站支付
* @method \AliPay\Web AliPayWeb($options) static 支付宝网站支付
*/
class We
{
@ -65,7 +74,7 @@ class We
* 定义当前版本
* @var string
*/
const VERSION = '1.1.12';
const VERSION = '1.2.2';
/**
* 静态配置
@ -104,6 +113,8 @@ class We
$class = 'WeMini\\' . substr($name, 6);
} elseif (substr($name, 0, 5) === 'WePay') {
$class = 'WePay\\' . substr($name, 5);
} elseif (substr($name, 0, 6) === 'AliPay') {
$class = 'AliPay\\' . substr($name, 6);
}
if (!empty($class) && class_exists($class)) {
$option = array_shift($arguments);

View File

@ -0,0 +1,235 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
namespace WeChat\Contracts;
use WeChat\Exceptions\InvalidArgumentException;
/**
* 支付宝支付基类
* Class AliPay
* @package AliPay\Contracts
*/
abstract class BasicAliPay
{
/**
* 支持配置
* @var DataArray
*/
protected $config;
/**
* 当前请求数据
* @var DataArray
*/
protected $options;
/**
* DzContent数据
* @var DataArray
*/
protected $params;
/**
* 正常请求网关
* @var string
*/
protected $gateway = 'https://openapi.alipay.com/gateway.do?charset=utf-8';
/**
* AliPay constructor.
* @param array $options
*/
public function __construct($options)
{
$this->params = new DataArray([]);
$this->config = new DataArray($options);
if (empty($options['appid'])) {
throw new InvalidArgumentException("Missing Config -- [appid]");
}
if (empty($options['public_key'])) {
throw new InvalidArgumentException("Missing Config -- [public_key]");
}
if (empty($options['private_key'])) {
throw new InvalidArgumentException("Missing Config -- [private_key]");
}
if (!empty($options['debug'])) {
$this->gateway = 'https://openapi.alipaydev.com/gateway.do?charset=utf-8';
}
$this->options = new DataArray([
'app_id' => $this->config->get('appid'),
'charset' => empty($options['charset']) ? 'utf-8' : $options['charset'],
'format' => 'JSON',
'version' => '1.0',
'sign_type' => 'RSA2',
'timestamp' => date('Y-m-d H:i:s'),
]);
if (isset($options['notify_url']) && $options['notify_url'] !== '') {
$this->options->set('notify_url', $options['notify_url']);
}
if (isset($options['return_url']) && $options['return_url'] !== '') {
$this->options->set('return_url', $options['return_url']);
}
if (isset($options['app_auth_token']) && $options['app_auth_token'] !== '') {
$this->options->set('app_auth_token', $options['app_auth_token']);
}
}
/**
* 查询支付宝订单状态
* @param string $out_trade_no
* @return array|boolean
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function query($out_trade_no = '')
{
$this->options['method'] = 'alipay.trade.query';
return $this->getResult(['out_trade_no' => $out_trade_no]);
}
/**
* 支付宝订单退款操作
* @param array|string $options 退款参数或退款商户订单号
* @param null $refund_amount 退款金额
* @return array|boolean
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function refund($options, $refund_amount = null)
{
if (!is_array($options)) $options = ['out_trade_no' => $options, 'refund_amount' => $refund_amount];
$this->options['method'] = 'alipay.trade.refund';
return $this->getResult($options);
}
/**
* 关闭支付宝进行中的订单
* @param array|string $options
* @return array|boolean
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function close($options)
{
if (!is_array($options)) $options = ['out_trade_no' => $options];
$this->options['method'] = 'alipay.trade.close';
return $this->getResult($options);
}
/**
* 验证支付宝支付宝通知
* @param array $data 通知数据
* @param null $sign 数据签名
* @param boolean $sync
* @return array|bool
*/
public function verify($data, $sign = null, $sync = false)
{
if (is_null($this->config->get('public_key'))) {
throw new InvalidArgumentException('Missing Config -- [public_key]');
}
$sign = is_null($sign) ? $data['sign'] : $sign;
$content = wordwrap($this->config->get('public_key'), 64, "\n", true);
$string = $sync ? json_encode($data) : $this->getSignContent($data, true);
$res = "-----BEGIN PUBLIC KEY-----\n{$content}\n-----END PUBLIC KEY-----";
return openssl_verify($string, base64_decode($sign), $res, OPENSSL_ALGO_SHA256) === 1 ? $data : false;
}
/**
* 获取数据签名
* @return string
*/
protected function getSign()
{
if (is_null($this->config->get('private_key'))) {
throw new InvalidArgumentException('Missing Config -- [private_key]');
}
$content = wordwrap($this->config->get('private_key'), 64, "\n", true);
$string = "-----BEGIN RSA PRIVATE KEY-----\n{$content}\n-----END RSA PRIVATE KEY-----";
openssl_sign($this->getSignContent($this->options->get()), $sign, $string, OPENSSL_ALGO_SHA256);
return base64_encode($sign);
}
/**
* 数据签名处理
* @param array $data
* @param boolean $verify
* @param array $strs
* @return bool|string
*/
private function getSignContent(array $data, $verify = false, $strs = [])
{
ksort($data);
foreach ($data as $k => $v) if ($v !== '') {
if ($verify && $k != 'sign' && $k != 'sign_type') array_push($strs, "{$k}={$v}");
if (!$verify && $v !== '' && !is_null($v) && $k != 'sign' && '@' != substr($v, 0, 1)) array_push($strs, "{$k}={$v}");
}
return join('&', $strs);
}
/**
* 数据包生成及数据签名
* @param array $options
*/
protected function applyData($options)
{
$this->options['biz_content'] = json_encode($options, JSON_UNESCAPED_UNICODE);
$this->options['sign'] = $this->getSign();
}
/**
* 请求接口并验证访问数据
* @param array $options
* @return array|boolean
* @throws \WeChat\Exceptions\InvalidResponseException
*/
protected function getResult($options)
{
$this->applyData($options);
$data = json_decode(Tools::post($this->gateway, $this->options->get()), true);
$method = str_replace('.', '_', $this->options['method']) . '_response';
if (!isset($data[$method]['code']) || $data[$method]['code'] !== '10000') {
throw new \WeChat\Exceptions\InvalidResponseException(
"\nResultError" .
(empty($data[$method]['code']) ? '' : "\n{$data[$method]['msg']}[{$data[$method]['code']}]") .
(empty($data[$method]['sub_code']) ? '' : "\n{$data[$method]['sub_msg']}[{$data[$method]['sub_code']}]\n"),
$data[$method]['code'],
$data
);
}
return $this->verify($data[$method], $data['sign'], true);
}
/**
* 生成支付html代码
* @return string
*/
protected function buildPayHtml()
{
$html = "<form id='alipaysubmit' name='alipaysubmit' action='{$this->gateway}' method='post'>";
foreach ($this->params->get() as $key => $value) {
$value = str_replace("'", '&apos;', $value);
$html .= "<input type='hidden' name='{$key}' value='{$value}'/>";
}
$html .= "<input type='submit' value='ok' style='display:none;'></form>";
return "{$html}<script>document.forms['alipaysubmit'].submit();</script>";
}
/**
* 应用数据操作
* @param array $options
* @return mixed
*/
abstract public function apply($options);
}

View File

@ -22,7 +22,7 @@ use WeChat\Exceptions\InvalidResponseException;
* Class BasicPay
* @package WeChat\Contracts
*/
class BasicPay
class BasicWePay
{
/**
* 商户配置

View File

@ -14,7 +14,7 @@
namespace WeChat;
use WeChat\Contracts\BasicPay;
use WeChat\Contracts\BasicWePay;
use WeChat\Exceptions\InvalidResponseException;
use WePay\Bill;
use WePay\Order;
@ -27,13 +27,14 @@ use WePay\TransfersBank;
* Class Pay
* @package WeChat\Contracts
*/
class Pay extends BasicPay
class Pay extends BasicWePay
{
/**
* 统一下单
* @param array $options
* @return array
* @throws Exceptions\LocalCacheException
* @throws InvalidResponseException
*/
public function createOrder(array $options)
@ -69,6 +70,7 @@ class Pay extends BasicPay
* 查询订单
* @param array $options
* @return array
* @throws Exceptions\LocalCacheException
* @throws InvalidResponseException
*/
public function queryOrder(array $options)
@ -81,6 +83,7 @@ class Pay extends BasicPay
* 关闭订单
* @param string $out_trade_no 商户订单号
* @return array
* @throws Exceptions\LocalCacheException
* @throws InvalidResponseException
*/
public function closeOrder($out_trade_no)
@ -93,6 +96,7 @@ class Pay extends BasicPay
* 申请退款
* @param array $options
* @return array
* @throws Exceptions\LocalCacheException
* @throws InvalidResponseException
*/
public function createRefund(array $options)
@ -105,6 +109,7 @@ class Pay extends BasicPay
* 查询退款
* @param array $options
* @return array
* @throws Exceptions\LocalCacheException
* @throws InvalidResponseException
*/
public function queryRefund(array $options)
@ -117,6 +122,7 @@ class Pay extends BasicPay
* 交易保障
* @param array $options
* @return array
* @throws Exceptions\LocalCacheException
* @throws InvalidResponseException
*/
public function report(array $options)
@ -129,6 +135,7 @@ class Pay extends BasicPay
* 授权码查询openid
* @param string $authCode 扫码支付授权码,设备读取用户微信中的条码或者二维码信息
* @return array
* @throws Exceptions\LocalCacheException
* @throws InvalidResponseException
*/
public function queryAuthCode($authCode)
@ -167,7 +174,8 @@ class Pay extends BasicPay
* 企业付款到零钱
* @param array $options
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
* @throws InvalidResponseException
*/
public function createTransfers(array $options)
{
@ -179,6 +187,7 @@ class Pay extends BasicPay
* 查询企业付款到零钱
* @param string $partner_trade_no 商户调用企业付款API时使用的商户订单号
* @return array
* @throws Exceptions\LocalCacheException
* @throws InvalidResponseException
*/
public function queryTransfers($partner_trade_no)
@ -205,6 +214,7 @@ class Pay extends BasicPay
* 商户企业付款到银行卡操作进行结果查询
* @param string $partner_trade_no 商户订单号,需保持唯一
* @return array
* @throws Exceptions\LocalCacheException
* @throws InvalidResponseException
*/
public function queryTransFresBank($partner_trade_no)

View File

@ -14,7 +14,7 @@
namespace WePay;
use WeChat\Contracts\BasicPay;
use WeChat\Contracts\BasicWePay;
use WeChat\Contracts\Tools;
use WeChat\Exceptions\InvalidResponseException;
@ -23,7 +23,7 @@ use WeChat\Exceptions\InvalidResponseException;
* Class Bill
* @package WePay
*/
class Bill extends BasicPay
class Bill extends BasicWePay
{
/**
* 下载对账单
@ -51,7 +51,8 @@ class Bill extends BasicPay
* 拉取订单评价数据
* @param array $options
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function comment(array $options)
{

View File

@ -14,20 +14,21 @@
namespace WePay;
use WeChat\Contracts\BasicPay;
use WeChat\Contracts\BasicWePay;
/**
* 微信商户代金券
* Class Coupon
* @package WePay
*/
class Coupon extends BasicPay
class Coupon extends BasicWePay
{
/**
* 发放代金券
* @param array $options
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function create(array $options)
{
@ -40,6 +41,7 @@ class Coupon extends BasicPay
* @param array $options
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function queryStock(array $options)
{
@ -52,6 +54,7 @@ class Coupon extends BasicPay
* @param array $options
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function queryInfo(array $options)
{

View File

@ -14,7 +14,7 @@
namespace WePay;
use WeChat\Contracts\BasicPay;
use WeChat\Contracts\BasicWePay;
use WeChat\Contracts\Tools;
/**
@ -22,7 +22,7 @@ use WeChat\Contracts\Tools;
* Class Order
* @package WePay
*/
class Order extends BasicPay
class Order extends BasicWePay
{
/**
@ -30,6 +30,7 @@ class Order extends BasicPay
* @param array $options
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function create(array $options)
{
@ -42,6 +43,7 @@ class Order extends BasicPay
* @param array $options
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function query(array $options)
{
@ -54,6 +56,7 @@ class Order extends BasicPay
* @param string $outTradeNo 商户订单号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function close($outTradeNo)
{
@ -102,6 +105,7 @@ class Order extends BasicPay
* @param array $options
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function reverse(array $options)
{
@ -114,6 +118,7 @@ class Order extends BasicPay
* @param string $authCode 扫码支付授权码,设备读取用户微信中的条码或者二维码信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function queryAuthCode($authCode)
{
@ -126,6 +131,7 @@ class Order extends BasicPay
* @param array $options
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function report(array $options)
{

View File

@ -14,14 +14,14 @@
namespace WePay;
use WeChat\Contracts\BasicPay;
use WeChat\Contracts\BasicWePay;
/**
* 微信红包支持
* Class Redpack
* @package WePay
*/
class Redpack extends BasicPay
class Redpack extends BasicWePay
{
/**
@ -29,6 +29,7 @@ class Redpack extends BasicPay
* @param array $options
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function create(array $options)
{
@ -43,6 +44,7 @@ class Redpack extends BasicPay
* @param array $options
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function groups(array $options)
{
@ -57,6 +59,7 @@ class Redpack extends BasicPay
* @param string $mchBillno 商户发放红包的商户订单号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function query($mchBillno)
{

View File

@ -14,7 +14,7 @@
namespace WePay;
use WeChat\Contracts\BasicPay;
use WeChat\Contracts\BasicWePay;
use WeChat\Contracts\Tools;
use WeChat\Exceptions\InvalidResponseException;
@ -23,14 +23,15 @@ use WeChat\Exceptions\InvalidResponseException;
* Class Refund
* @package WePay
*/
class Refund extends BasicPay
class Refund extends BasicWePay
{
/**
* 创建退款订单
* @param array $options
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function create(array $options)
{
@ -42,7 +43,8 @@ class Refund extends BasicPay
* 查询退款
* @param array $options
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function query(array $options)
{

View File

@ -14,14 +14,14 @@
namespace WePay;
use WeChat\Contracts\BasicPay;
use WeChat\Contracts\BasicWePay;
/**
* 微信商户打款到零钱
* Class Transfers
* @package WePay
*/
class Transfers extends BasicPay
class Transfers extends BasicWePay
{
/**
@ -29,6 +29,7 @@ class Transfers extends BasicPay
* @param array $options
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function create(array $options)
{
@ -45,6 +46,7 @@ class Transfers extends BasicPay
* @param string $partnerTradeNo 商户调用企业付款API时使用的商户订单号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function query($partnerTradeNo)
{

View File

@ -14,7 +14,7 @@
namespace WePay;
use WeChat\Contracts\BasicPay;
use WeChat\Contracts\BasicWePay;
use WeChat\Contracts\Tools;
use WeChat\Exceptions\InvalidArgumentException;
use WeChat\Exceptions\InvalidDecryptException;
@ -25,7 +25,7 @@ use WeChat\Exceptions\InvalidResponseException;
* Class TransfersBank
* @package WePay
*/
class TransfersBank extends BasicPay
class TransfersBank extends BasicWePay
{
/**

View File

@ -0,0 +1,37 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
// 1. 手动加载入口文件
include "../include.php";
// 2. 准备公众号配置参数
$config = include "./alipay.php";
try {
// 实例支付对象
$pay = \We::AliPayApp($config);
// $pay = new \AliPay\App($config);
// 请参考请求参数https://docs.open.alipay.com/api_1/alipay.trade.app.pay
$result = $pay->apply([
'out_trade_no' => time(), // 商户订单号
'total_amount' => '1', // 支付金额
'subject' => 'test subject', // 支付订单描述
]);
echo '<pre>';
var_export($result);
} catch (Exception $e) {
echo $e->getMessage();
}

View File

@ -0,0 +1,36 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
// 1. 手动加载入口文件
include "../include.php";
// 2. 准备公众号配置参数
$config = include "./alipay.php";
try {
// 实例支付对象
$pay = \We::AliPayBill($config);
// $pay = new \AliPay\Bill($config);
// 请参考请求参数https://docs.open.alipay.com/api_15/alipay.data.dataservice.bill.downloadurl.query
$result = $pay->apply([
'bill_date' => '2017-11-03', // 账单时间(日账单yyyy-MM-dd,月账单 yyyy-MM)
'bill_type' => 'signcustomer', // 账单类型(trade指商户基于支付宝交易收单的业务账单,signcustomer是指基于商户支付宝余额收入及支出等资金变动的帐务账单)
]);
echo '<pre>';
var_export($result);
} catch (Exception $e) {
echo $e->getMessage();
}

View File

@ -0,0 +1,37 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
// 1. 手动加载入口文件
include "../include.php";
// 2. 准备公众号配置参数
$config = include "./alipay.php";
// 实例支付对象
$pay = \We::AliPayApp($config);
// $pay = new \AliPay\App($config);
if ($pay->verify($_POST)) {
file_put_contents('notify.txt', "收到来自支付宝的异步通知\r\n", FILE_APPEND);
file_put_contents('notify.txt', '订单号:' . $_POST['out_trade_no'] . "\r\n", FILE_APPEND);
file_put_contents('notify.txt', '订单金额:' . $_POST['total_amount'] . "\r\n\r\n", FILE_APPEND);
} else {
file_put_contents('notify.txt', "收到异步通知\r\n", FILE_APPEND);
}
// 下面是支付通知处理
$pay = new \AliPay\App($config);
$notify = $pay->verify($_POST);
if (in_array($notify['trade_status'], ['TRADE_SUCCESS', 'TRADE_FINISHED'])) {
// @todo 更新订单状态,支付完成
}

View File

@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
// 1. 手动加载入口文件
include "../include.php";
// 2. 准备公众号配置参数
$config = include "./alipay.php";
try {
// 实例支付对象
$pay = We::AliPayPos($config);
// $pay = new \AliPay\Pos($config);
// 参数链接https://docs.open.alipay.com/api_1/alipay.trade.pay
$result = $pay->apply([
'out_trade_no' => '4312412343', // 订单号
'total_amount' => '13', // 订单金额,单位:元
'subject' => '订单商品标题', // 订单商品标题
'auth_code' => '123456', // 授权码
]);
echo '<pre>';
var_export($result);
} catch (Exception $e) {
echo $e->getMessage();
}

View File

@ -0,0 +1,36 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
// 1. 手动加载入口文件
include "../include.php";
// 2. 准备公众号配置参数
$config = include "./alipay.php";
// 原商户订单号
$out_trade_no = '56737188841424';
// 申请退款金额
$refund_fee = '1.00';
try {
// 实例支付对象
$pay = We::AliPayApp($config);
// $pay = new \AliPay\App($config);
// 参考链接https://docs.open.alipay.com/api_1/alipay.trade.refund
$result = $pay->refund($out_trade_no, $refund_fee);
echo '<pre>';
var_export($result);
} catch (Exception $e) {
echo $e->getMessage();
}

View File

@ -0,0 +1,37 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
// 1. 手动加载入口文件
include "../include.php";
// 2. 准备公众号配置参数
$config = include "./alipay.php";
try {
// 实例支付对象
$pay = We::AliPayScan($config);
// $pay = new \AliPay\Scan($config);
// 参考链接https://docs.open.alipay.com/api_1/alipay.trade.precreate
$result = $pay->apply([
'out_trade_no' => '14321412', // 订单号
'total_amount' => '13', // 订单金额,单位:元
'subject' => '订单商品标题', // 订单商品标题
]);
echo '<pre>';
var_export($result);
} catch (Exception $e) {
echo $e->getMessage();
}

View File

@ -0,0 +1,40 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
// 1. 手动加载入口文件
include "../include.php";
// 2. 准备公众号配置参数
$config = include "./alipay.php";
try {
// 实例支付对象
$pay = We::AliPayTransfer($config);
// $pay = new \AliPay\Scan($config);
// 参考链接https://docs.open.alipay.com/api_28/alipay.fund.trans.toaccount.transfer
$result = $pay->apply([
'out_biz_no' => '', // 订单号
'payee_type' => 'ALIPAY_LOGONID', // 收款方账户类型(ALIPAY_LOGONID | ALIPAY_USERID)
'payee_account' => 'demo@sandbox.com', // 收款方账户
'amount' => '10', // 转账金额
'payer_show_name' => '未寒', // 付款方姓名
'payee_real_name' => '张三', // 收款方真实姓名
'remark' => '张三', // 转账备注
]);
echo '<pre>';
var_export($result);
} catch (Exception $e) {
echo $e->getMessage();
}

View File

@ -0,0 +1,40 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
// 1. 手动加载入口文件
include "../include.php";
// 2. 准备公众号配置参数
$config = include "./alipay.php";
// 参考公共参数 https://docs.open.alipay.com/203/107090/
$config['notify_url'] = 'http://pay.thinkadmin.top/test/alipay-notify.php';
$config['return_url'] = 'http://pay.thinkadmin.top/test/alipay-success.php';
try {
// 实例支付对象
$pay = We::AliPayWap($config);
// $pay = new \AliPay\Wap($config);
// 参考链接https://docs.open.alipay.com/api_1/alipay.trade.wap.pay
$result = $pay->apply([
'out_trade_no' => time(), // 商户订单号
'total_amount' => '1', // 支付金额
'subject' => '支付订单描述', // 支付订单描述
]);
echo '<pre>';
var_export($result);
} catch (Exception $e) {
echo $e->getMessage();
}

View File

@ -0,0 +1,41 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
// 1. 手动加载入口文件
include "../include.php";
// 2. 准备公众号配置参数
$config = include "./alipay.php";
// 参考公共参数 https://docs.open.alipay.com/203/107090/
$config['notify_url'] = 'http://pay.thinkadmin.top/test/alipay-notify.php';
$config['return_url'] = 'http://pay.thinkadmin.top/test/alipay-success.php';
try {
// 实例支付对象
$pay = We::AliPayWeb($config);
// $pay = new \AliPay\Web($config);
// 参考链接https://docs.open.alipay.com/api_1/alipay.trade.page.pay
$result = $pay->apply([
'out_trade_no' => time(), // 商户订单号
'total_amount' => '1', // 支付金额
'subject' => '支付订单描述', // 支付订单描述
]);
echo '<pre>';
var_export($result);
} catch (Exception $e) {
echo $e->getMessage();
}

View File

@ -0,0 +1,15 @@
<?php
// 沙箱模式
return [
'debug' => true,
// 应用ID
'appid' => '2016090900468879',
// 支付宝公钥(1行填写)
'public_key' => 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtU71NY53UDGY7JNvLYAhsNa+taTF6KthIHJmGgdio9bkqeJGhHk6ttkTKkLqFgwIfgAkHpdKiOv1uZw6gVGZ7TCu5LfHTqKrCd6Uz+N7hxhY+4IwicLgprcV1flXQLmbkJYzFMZqkXGkSgOsR2yXh4LyQZczgk9N456uuzGtRy7MoB4zQy34PLUkkxR6W1B2ftNbLRGXv6tc7p/cmDcrY6K1bSxnGmfRxFSb8lRfhe0V0UM6pKq2SGGSeovrKHN0OLp+Nn5wcULVnFgATXGCENshRlp96piPEBFwneXs19n+sX1jx60FTR7/rME3sW3AHug0fhZ9mSqW4x401WjdnwIDAQAB',
// 支付宝私钥(1行填写)
'private_key' => 'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC3pbN7esinxgjE8uxXAsccgGNKIq+PR1LteNTFOy0fsete43ObQCrzd9DO0zaUeBUzpIOnxrKxez7QoZROZMYrinttFZ/V5rbObEM9E5AR5Tv/Fr4IBywoS8ZtN16Xb+fZmibfU91yq9O2RYSvscncU2qEYmmaTenM0QlUO80ZKqPsM5JkgCNdcYZTUeHclWeyER3dSImNtlSKiSBSSTHthb11fkudjzdiUXua0NKVWyYuAOoDMcpXbD6NJmYqEA/iZ/AxtQt08pv0Mow581GPB0Uop5+qA2hCV85DpagE94a067sKcRui0rtkJzHem9k7xVL+2RoFm1fv3RnUkMwhAgMBAAECggEAAetkddzxrfc+7jgPylUIGb8pyoOUTC4Vqs/BgZI9xYAJksNT2QKRsFvHPfItNt4Ocqy8h4tnIL3GCU43C564B4p6AcjhE85GiN/O0BudPOKlfuQQ9mqExqMMHuYeQfz0cmzPDTSGMwWiv9v4KBH2pyvkCCAzNF6uG+rvawb4/NNVuiI7C8Ku/wYsamtbgjMZVOFFdScYgIw1BgA99RUU/fWBLMnTQkoyowSRb9eSmEUHjt/WQt+/QgKAT2WmuX4RhaGy0qcQLbNaJNKXdJ+PVhQrSiasINNtqYMa8GsQuuKsk3X8TCg9K6/lowivt5ruhyWcP2sx93zY/LGzIHgHcQKBgQDoZlcs9RWxTdGDdtH8kk0J/r+QtMijNzWI0a+t+ZsWOyd3rw+uM/8O4JTNP4Y98TvvxhJXewITbfiuOIbW1mxh8bnO/fcz7+RXZKgPDeoTeNo717tZFZGBEyUdH9M9Inqvht7+hjVDIMCYBDomYebdk3Xqo4mDBjLRdVNGrhGmVQKBgQDKS/MgTMK8Ktfnu1KzwCbn/FfHTOrp1a1t1wWPv9AW0rJPYeaP6lOkgIoO/1odG9qDDhdB6njqM+mKY5Yr3N94PHamHbwJUCmbkqEunCWpGzgcQZ1Q254xk9D7UKq/XUqW2WDqDq80GQeNial+fBc46yelQzokwdA+JdIFKoyinQKBgQCBems9V/rTAtkk1nFdt6EGXZEbLS3PiXXhGXo4gqV+OEzf6H/i/YMwJb2hsK+5GQrcps0XQihA7PctEb9GOMa/tu5fva0ZmaDtc94SLR1p5d4okyQFGPgtIp594HpPSEN0Qb9BrUJFeRz0VP6U3dzDPGHo7V4yyqRLgIN6EIcy1QKBgAqdh6mHPaTAHspDMyjJiYEc5cJIj/8rPkmIQft0FkhMUB0IRyAALNlyAUyeK61hW8sKvz+vPR8VEEk5xpSQp41YpuU6pDZc5YILZLfca8F+8yfQbZ/jll6Foi694efezl4yE/rUQG9cbOAJfEJt4o4TEOaEK5XoMbRBKc8pl22lAoGARTq0qOr9SStihRAy9a+8wi2WEwL4QHcmOjH7iAuJxy5b5TRDSjlk6h+0dnTItiFlTXdfpO8KhWA8EoSJVBZ1kcACQDFgMIA+VM+yXydtzMotOn21W4stfZ4I6dHFiujMsnKpNYVpQh3oCrJf4SeXiQDdiSCodqb1HlKkEc6naHQ=',
// 支付成功通知地址
'notify_url' => '',
// 网页支付回跳地址
'return_url' => '',
];

View File

@ -21,9 +21,9 @@ return [
'mch_id' => "1332187001",
'mch_key' => 'A82DC5BD1F3359081049C568D8502BC5',
// 配置商户支付双向证书目录 p12 | key,cert 二选一两者都配置时p12优先
// 'ssl_p12' => __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . 'apiclient_cert.p12',
'ssl_key' => __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . 'apiclient_key.pem',
'ssl_cer' => __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . 'apiclient_cert.pem',
'ssl_p12' => __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . '1332187001_20181030_cert.p12',
// 'ssl_key' => __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . '1332187001_20181030_key.pem',
// 'ssl_cer' => __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . '1332187001_20181030_cert.pem',
// 配置缓存目录,需要拥有写权限
'cache_path' => '',
];

View File

@ -13,6 +13,7 @@
],
"keywords": [
"WePay",
"AliPay",
"WeMini",
"WeChat",
"WeChatPay",
@ -30,8 +31,9 @@
],
"psr-4": {
"WePay\\": "WePay",
"WeMini\\": "WeMini",
"WeChat\\": "WeChat",
"WeMini\\": "WeMini"
"AliPay\\": "AliPay"
}
}
}

View File

@ -13,20 +13,12 @@
// +----------------------------------------------------------------------
spl_autoload_register(function ($classname) {
$separator = DIRECTORY_SEPARATOR;
$filename = __DIR__ . $separator . str_replace('\\', $separator, $classname) . '.php';
$filename = __DIR__ . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $classname) . '.php';
if (file_exists($filename)) {
if (stripos($classname, 'WeChat') === 0) {
include $filename;
}
if (stripos($classname, 'WeMini') === 0) {
include $filename;
}
if (stripos($classname, 'WePay') === 0) {
include $filename;
}
if ($classname === 'We') {
include $filename;
}
if (stripos($classname, 'WeChat') === 0) include $filename;
elseif (stripos($classname, 'WeMini') === 0) include $filename;
elseif (stripos($classname, 'AliPay') === 0) include $filename;
elseif (stripos($classname, 'WePay') === 0) include $filename;
elseif ($classname === 'We') include $filename;
}
});