From 6597028ce440e2bae67defa5708169e8d5e0ce23 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 25 May 2018 17:32:09 +0800 Subject: [PATCH 01/37] =?UTF-8?q?Restful=20api=E5=9F=BA=E7=B1=BB=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20apiVerion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplewind/cmf/controller/RestBaseController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/simplewind/cmf/controller/RestBaseController.php b/simplewind/cmf/controller/RestBaseController.php index 42be2f91f..6b985ca92 100644 --- a/simplewind/cmf/controller/RestBaseController.php +++ b/simplewind/cmf/controller/RestBaseController.php @@ -26,6 +26,8 @@ class RestBaseController //设备类型 protected $deviceType = ''; + protected $apiVersion; + //用户 id protected $userId = 0; @@ -68,6 +70,8 @@ public function __construct(Request $request = null) $this->request = $request; + $this->apiVersion = $this->request->header('XX-Api-Version'); + // 用户验证初始化 $this->_initUser(); From f276267490e7bbef951bb115888ff16f75291712 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 25 May 2018 18:40:32 +0800 Subject: [PATCH 02/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20tp=E5=92=8C=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.lock | 30 +-- simplewind/thinkphp/base.php | 2 +- simplewind/thinkphp/lang/zh-cn.php | 1 + simplewind/thinkphp/library/think/Model.php | 15 +- simplewind/thinkphp/library/think/Request.php | 10 +- simplewind/thinkphp/library/think/Route.php | 2 +- simplewind/thinkphp/library/think/Url.php | 2 +- .../thinkphp/library/think/db/Builder.php | 14 +- .../thinkphp/library/think/db/Connection.php | 33 ++- .../thinkphp/library/think/db/Query.php | 24 +- .../library/think/db/builder/Mysql.php | 7 +- .../library/think/db/builder/Pgsql.php | 8 +- .../library/think/db/builder/Sqlite.php | 8 +- .../library/think/db/builder/Sqlsrv.php | 6 +- .../think/model/relation/BelongsToMany.php | 26 ++- simplewind/vendor/composer/autoload_files.php | 4 +- simplewind/vendor/composer/autoload_psr4.php | 2 +- .../vendor/composer/autoload_static.php | 8 +- simplewind/vendor/composer/installed.json | 212 +++++++++--------- simplewind/vendor/qiniu/php-sdk/CHANGELOG.md | 10 + simplewind/vendor/qiniu/php-sdk/README.md | 2 +- .../vendor/qiniu/php-sdk/docs/rtc/README.md | 71 ++++++ .../vendor/qiniu/php-sdk/docs/rtc/example.php | 42 ++++ .../php-sdk/examples/rs_change_status.php | 20 ++ .../vendor/qiniu/php-sdk/src/Qiniu/Config.php | 4 +- .../qiniu/php-sdk/src/Qiniu/Http/Client.php | 13 +- .../qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php | 204 +++++++++++++++++ .../src/Qiniu/Storage/BucketManager.php | 17 ++ .../src/Qiniu/Storage/UploadManager.php | 1 - .../vendor/qiniu/php-sdk/src/Qiniu/Zone.php | 40 ++-- .../think-queue/src/queue/command/Listen.php | 7 +- .../src/queue/connector/Database.php | 2 +- 32 files changed, 644 insertions(+), 203 deletions(-) create mode 100755 simplewind/vendor/qiniu/php-sdk/docs/rtc/README.md create mode 100755 simplewind/vendor/qiniu/php-sdk/docs/rtc/example.php create mode 100644 simplewind/vendor/qiniu/php-sdk/examples/rs_change_status.php create mode 100755 simplewind/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php diff --git a/composer.lock b/composer.lock index 3afbc2b88..e31798ce3 100644 --- a/composer.lock +++ b/composer.lock @@ -420,16 +420,16 @@ }, { "name": "qiniu/php-sdk", - "version": "v7.2.3", + "version": "v7.2.6", "source": { "type": "git", "url": "https://github.com/qiniu/php-sdk.git", - "reference": "67852ba9cdd7f48e0e080961abebafee134fb329" + "reference": "305ce1c1c0c71f794661fe45a96facf61ef96c5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/67852ba9cdd7f48e0e080961abebafee134fb329", - "reference": "67852ba9cdd7f48e0e080961abebafee134fb329", + "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/305ce1c1c0c71f794661fe45a96facf61ef96c5d", + "reference": "305ce1c1c0c71f794661fe45a96facf61ef96c5d", "shasum": "" }, "require": { @@ -467,7 +467,7 @@ "sdk", "storage" ], - "time": "2018-02-20 13:59:54" + "time": "2018-05-18 04:37:29" }, { "name": "sabberworm/php-css-parser", @@ -515,16 +515,16 @@ }, { "name": "topthink/framework", - "version": "v5.0.19", + "version": "v5.0.20", "source": { "type": "git", "url": "https://github.com/top-think/framework.git", - "reference": "0ad75865563ee4c1ac2ca80061ed1d4fb54edb1d" + "reference": "e20f6e8cadbbc6e246a0c121c89bfd278f30c76b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/0ad75865563ee4c1ac2ca80061ed1d4fb54edb1d", - "reference": "0ad75865563ee4c1ac2ca80061ed1d4fb54edb1d", + "url": "https://api.github.com/repos/top-think/framework/zipball/e20f6e8cadbbc6e246a0c121c89bfd278f30c76b", + "reference": "e20f6e8cadbbc6e246a0c121c89bfd278f30c76b", "shasum": "" }, "require": { @@ -562,7 +562,7 @@ "orm", "thinkphp" ], - "time": "2018-04-25 02:43:06" + "time": "2018-05-11 08:02:47" }, { "name": "topthink/think-captcha", @@ -719,16 +719,16 @@ }, { "name": "topthink/think-queue", - "version": "v1.1.4", + "version": "v1.1.5", "source": { "type": "git", "url": "https://github.com/top-think/think-queue.git", - "reference": "ad709611d516e13d6760234bc98e91faa901cae8" + "reference": "465320c9cb7811df22d4ff8f29f58ead7d104348" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-queue/zipball/ad709611d516e13d6760234bc98e91faa901cae8", - "reference": "ad709611d516e13d6760234bc98e91faa901cae8", + "url": "https://api.github.com/repos/top-think/think-queue/zipball/465320c9cb7811df22d4ff8f29f58ead7d104348", + "reference": "465320c9cb7811df22d4ff8f29f58ead7d104348", "shasum": "" }, "require": { @@ -760,7 +760,7 @@ } ], "description": "The ThinkPHP5 Queue Package", - "time": "2017-06-25 00:49:56" + "time": "2018-05-04 05:29:53" } ], "packages-dev": [], diff --git a/simplewind/thinkphp/base.php b/simplewind/thinkphp/base.php index 87e1cc960..ee10934d8 100644 --- a/simplewind/thinkphp/base.php +++ b/simplewind/thinkphp/base.php @@ -9,7 +9,7 @@ // | Author: liu21st // +---------------------------------------------------------------------- -define('THINK_VERSION', '5.0.19'); +define('THINK_VERSION', '5.0.20'); define('THINK_START_TIME', microtime(true)); define('THINK_START_MEM', memory_get_usage()); define('EXT', '.php'); diff --git a/simplewind/thinkphp/lang/zh-cn.php b/simplewind/thinkphp/lang/zh-cn.php index c821f9fee..eb7a9142a 100644 --- a/simplewind/thinkphp/lang/zh-cn.php +++ b/simplewind/thinkphp/lang/zh-cn.php @@ -48,6 +48,7 @@ 'KVDB init error' => '没有初始化KVDB,请在SAE管理平台初始化KVDB服务', 'fields not exists' => '数据表字段不存在', 'where express error' => '查询表达式错误', + 'not support data' => '不支持的数据表达式', 'no data to update' => '没有任何数据需要更新', 'miss data to insert' => '缺少需要写入的数据', 'miss complex primary data' => '缺少复合主键数据', diff --git a/simplewind/thinkphp/library/think/Model.php b/simplewind/thinkphp/library/think/Model.php index 8c9679b8d..386660c4b 100644 --- a/simplewind/thinkphp/library/think/Model.php +++ b/simplewind/thinkphp/library/think/Model.php @@ -180,14 +180,15 @@ public function __construct($data = []) /** * 是否从主库读取数据(主从分布有效) * @access public - * @param bool $master 是否从主库读取 - * @return void + * @param bool $all 是否所有模型生效 + * @return $this */ - public function readMaster($master) + public function readMaster($all = false) { - if ($master) { - static::$readMaster[$this->class] = true; - } + $model = $all ? '*' : $this->class; + + static::$readMaster[$model] = true; + return $this; } /** @@ -213,7 +214,7 @@ protected function buildQuery() $queryClass = $this->query ?: $con->getConfig('query'); $query = new $queryClass($con, $this); - if (isset(static::$readMaster[$this->class])) { + if (isset(static::$readMaster['*']) || isset(static::$readMaster[$this->class])) { $query->master(true); } diff --git a/simplewind/thinkphp/library/think/Request.php b/simplewind/thinkphp/library/think/Request.php index 5710c5cb4..6a6e6b50f 100644 --- a/simplewind/thinkphp/library/think/Request.php +++ b/simplewind/thinkphp/library/think/Request.php @@ -1342,14 +1342,18 @@ public function query() /** * 当前请求的host * @access public + * @param bool $strict true 仅仅获取HOST * @return string */ - public function host() + public function host($strict = false) { if (isset($_SERVER['HTTP_X_REAL_HOST'])) { - return $_SERVER['HTTP_X_REAL_HOST']; + $host = $_SERVER['HTTP_X_REAL_HOST']; + } else { + $host = $this->server('HTTP_HOST'); } - return $this->server('HTTP_HOST'); + + return true === $strict && strpos($host, ':') ? strstr($host, ':', true) : $host; } /** diff --git a/simplewind/thinkphp/library/think/Route.php b/simplewind/thinkphp/library/think/Route.php index f940d28b6..99ffa706c 100644 --- a/simplewind/thinkphp/library/think/Route.php +++ b/simplewind/thinkphp/library/think/Route.php @@ -737,7 +737,7 @@ public static function checkDomain($request, &$currentRules, $method = 'get') $rules = self::$rules['domain']; // 开启子域名部署 支持二级和三级域名 if (!empty($rules)) { - $host = $request->host(); + $host = $request->host(true); if (isset($rules[$host])) { // 完整域名或者IP配置 $item = $rules[$host]; diff --git a/simplewind/thinkphp/library/think/Url.php b/simplewind/thinkphp/library/think/Url.php index 53a545f92..bb697192c 100644 --- a/simplewind/thinkphp/library/think/Url.php +++ b/simplewind/thinkphp/library/think/Url.php @@ -239,7 +239,7 @@ protected static function parseDomain(&$url, $domain) $rootDomain = Config::get('url_domain_root'); if (true === $domain) { // 自动判断域名 - $domain = Config::get('app_host') ?: $request->host(); + $domain = Config::get('app_host') ?: $request->host(true); $domains = Route::rules('domain'); if ($domains) { diff --git a/simplewind/thinkphp/library/think/db/Builder.php b/simplewind/thinkphp/library/think/db/Builder.php index abc51c1d7..30016f59d 100644 --- a/simplewind/thinkphp/library/think/db/Builder.php +++ b/simplewind/thinkphp/library/think/db/Builder.php @@ -113,13 +113,15 @@ protected function parseData($data, $options) } elseif (is_null($val)) { $result[$item] = 'NULL'; } elseif (is_array($val) && !empty($val)) { - switch ($val[0]) { + switch (strtolower($val[0])) { case 'inc': $result[$item] = $item . '+' . floatval($val[1]); break; case 'dec': $result[$item] = $item . '-' . floatval($val[1]); break; + case 'exp': + throw new Exception('not support data:[' . $val[0] . ']'); } } elseif (is_scalar($val)) { // 过滤非标量数据 @@ -266,10 +268,8 @@ public function buildWhere($where, $options) $str = []; foreach ($val as $field => $value) { if ($value instanceof Expression) { - $str[] = ' ' . $key . ' ( ' . $value->getValue() . ' )'; - continue; - } - if ($value instanceof \Closure) { + $str[] = ' ' . $key . ' ( ' . $field . ' ' . $value->getValue() . ' )'; + } elseif ($value instanceof \Closure) { // 使用闭包查询 $query = new Query($this->connection); call_user_func_array($value, [ & $query]); @@ -545,7 +545,9 @@ protected function parseJoin($join, $options = []) list($table, $type, $on) = $item; $condition = []; foreach ((array) $on as $val) { - if (strpos($val, '=')) { + if ($val instanceof Expression) { + $condition[] = $val->getValue(); + } elseif (strpos($val, '=')) { list($val1, $val2) = explode('=', $val, 2); $condition[] = $this->parseKey($val1, $options) . '=' . $this->parseKey($val2, $options); } else { diff --git a/simplewind/thinkphp/library/think/db/Connection.php b/simplewind/thinkphp/library/think/db/Connection.php index 731cb49a0..7720282df 100644 --- a/simplewind/thinkphp/library/think/db/Connection.php +++ b/simplewind/thinkphp/library/think/db/Connection.php @@ -380,7 +380,7 @@ public function query($sql, $bind = [], $master = false, $pdo = false) // 执行查询 $this->PDOStatement->execute(); // 调试结束 - $this->debug(false); + $this->debug(false, '', $master); // 返回结果集 return $this->getResult($pdo, $procedure); } catch (\PDOException $e) { @@ -448,27 +448,27 @@ public function execute($sql, $bind = [], Query $query = null) // 执行语句 $this->PDOStatement->execute(); // 调试结束 - $this->debug(false); + $this->debug(false, '', true); if ($query && !empty($this->config['deploy']) && !empty($this->config['read_master'])) { - $query->setModelReadMaster(true); + $query->readMaster(); } $this->numRows = $this->PDOStatement->rowCount(); return $this->numRows; } catch (\PDOException $e) { if ($this->isBreak($e)) { - return $this->close()->execute($sql, $bind); + return $this->close()->execute($sql, $bind, $query); } throw new PDOException($e, $this->config, $this->getLastsql()); } catch (\Throwable $e) { if ($this->isBreak($e)) { - return $this->close()->execute($sql, $bind); + return $this->close()->execute($sql, $bind, $query); } throw $e; } catch (\Exception $e) { if ($this->isBreak($e)) { - return $this->close()->execute($sql, $bind); + return $this->close()->execute($sql, $bind, $query); } throw $e; } @@ -911,9 +911,10 @@ public function quote($str, $master = true) * @access protected * @param boolean $start 调试开始标记 true 开始 false 结束 * @param string $sql 执行的SQL语句 留空自动获取 + * @param boolean $master 主从标记 * @return void */ - protected function debug($start, $sql = '') + protected function debug($start, $sql = '', $master = false) { if (!empty($this->config['debug'])) { // 开启数据库调试模式 @@ -930,7 +931,7 @@ protected function debug($start, $sql = '') $result = $this->getExplain($sql); } // SQL监听 - $this->trigger($sql, $runtime, $result); + $this->trigger($sql, $runtime, $result, $master); } } } @@ -952,19 +953,27 @@ public function listen($callback) * @param string $sql SQL语句 * @param float $runtime SQL运行时间 * @param mixed $explain SQL分析 - * @return bool + * @param bool $master 主从标记 + * @return void */ - protected function trigger($sql, $runtime, $explain = []) + protected function trigger($sql, $runtime, $explain = [], $master = false) { if (!empty(self::$event)) { foreach (self::$event as $callback) { if (is_callable($callback)) { - call_user_func_array($callback, [$sql, $runtime, $explain]); + call_user_func_array($callback, [$sql, $runtime, $explain, $master]); } } } else { // 未注册监听则记录到日志中 - Log::record('[ SQL ] ' . $sql . ' [ RunTime:' . $runtime . 's ]', 'sql'); + if ($this->config['deploy']) { + // 分布式记录当前操作的主从 + $master = $master ? 'master|' : 'slave|'; + } else { + $master = ''; + } + + Log::record('[ SQL ] ' . $sql . ' [ ' . $master . 'RunTime:' . $runtime . 's ]', 'sql'); if (!empty($explain)) { Log::record('[ EXPLAIN : ' . var_export($explain, true) . ' ]', 'sql'); } diff --git a/simplewind/thinkphp/library/think/db/Query.php b/simplewind/thinkphp/library/think/db/Query.php index f063b07cd..1f3ddc294 100644 --- a/simplewind/thinkphp/library/think/db/Query.php +++ b/simplewind/thinkphp/library/think/db/Query.php @@ -53,6 +53,8 @@ class Query protected static $info = []; // 回调事件 private static $event = []; + // 读取主库 + private static $readMaster = []; /** * 构造函数 @@ -141,16 +143,22 @@ public function getModel() } /** - * 设置模型从主库读取数据 + * 设置后续从主库读取数据 * @access public - * @param bool $master + * @param bool $allTable * @return void */ - public function setModelReadMaster($master = true) + public function readMaster($allTable = false) { - if ($this->model) { - $this->model->readMaster($master); + if ($allTable) { + $table = '*'; + } else { + $table = isset($this->options['table']) ? $this->options['table'] : $this->getTable(); } + + static::$readMaster[$table] = true; + + return $this; } /** @@ -916,7 +924,7 @@ public function raw($value) * @access public * @param string|array $table 数据表 * @param string|array $field 查询字段 - * @param string|array $on JOIN条件 + * @param mixed $on JOIN条件 * @param string $type JOIN类型 * @return $this */ @@ -2936,6 +2944,10 @@ protected function parseExpress() } } + if (isset(static::$readMaster['*']) || (is_string($options['table']) && isset(static::$readMaster[$options['table']]))) { + $options['master'] = true; + } + foreach (['join', 'union', 'group', 'having', 'limit', 'order', 'force', 'comment'] as $name) { if (!isset($options[$name])) { $options[$name] = ''; diff --git a/simplewind/thinkphp/library/think/db/builder/Mysql.php b/simplewind/thinkphp/library/think/db/builder/Mysql.php index 94f82b832..8eee746f6 100644 --- a/simplewind/thinkphp/library/think/db/builder/Mysql.php +++ b/simplewind/thinkphp/library/think/db/builder/Mysql.php @@ -82,15 +82,18 @@ public function insertAll($dataSet, $options = [], $replace = false) /** * 字段和表名处理 * @access protected - * @param string $key + * @param mixed $key * @param array $options * @return string */ protected function parseKey($key, $options = [], $strict = false) { - if (is_int($key)) { + if (is_numeric($key)) { return $key; + } elseif ($key instanceof Expression) { + return $key->getValue(); } + $key = trim($key); if (strpos($key, '$.') && false === strpos($key, '(')) { // JSON字段支持 diff --git a/simplewind/thinkphp/library/think/db/builder/Pgsql.php b/simplewind/thinkphp/library/think/db/builder/Pgsql.php index 5885e7219..acc228961 100644 --- a/simplewind/thinkphp/library/think/db/builder/Pgsql.php +++ b/simplewind/thinkphp/library/think/db/builder/Pgsql.php @@ -44,12 +44,18 @@ public function parseLimit($limit) /** * 字段和表名处理 * @access protected - * @param string $key + * @param mixed $key * @param array $options * @return string */ protected function parseKey($key, $options = [], $strict = false) { + if (is_numeric($key)) { + return $key; + } elseif ($key instanceof Expression) { + return $key->getValue(); + } + $key = trim($key); if (strpos($key, '$.') && false === strpos($key, '(')) { // JSON字段支持 diff --git a/simplewind/thinkphp/library/think/db/builder/Sqlite.php b/simplewind/thinkphp/library/think/db/builder/Sqlite.php index fbd3bbaf3..c727f04b8 100644 --- a/simplewind/thinkphp/library/think/db/builder/Sqlite.php +++ b/simplewind/thinkphp/library/think/db/builder/Sqlite.php @@ -52,12 +52,18 @@ protected function parseRand() /** * 字段和表名处理 * @access protected - * @param string $key + * @param mixed $key * @param array $options * @return string */ protected function parseKey($key, $options = [], $strict = false) { + if (is_numeric($key)) { + return $key; + } elseif ($key instanceof Expression) { + return $key->getValue(); + } + $key = trim($key); if (strpos($key, '.')) { list($table, $key) = explode('.', $key, 2); diff --git a/simplewind/thinkphp/library/think/db/builder/Sqlsrv.php b/simplewind/thinkphp/library/think/db/builder/Sqlsrv.php index e904827a9..f79ae030e 100644 --- a/simplewind/thinkphp/library/think/db/builder/Sqlsrv.php +++ b/simplewind/thinkphp/library/think/db/builder/Sqlsrv.php @@ -73,14 +73,16 @@ protected function parseRand() /** * 字段和表名处理 * @access protected - * @param string $key + * @param mixed $key * @param array $options * @return string */ protected function parseKey($key, $options = [], $strict = false) { - if (is_int($key)) { + if (is_numeric($key)) { return $key; + } elseif ($key instanceof Expression) { + return $key->getValue(); } $key = trim($key); if (strpos($key, '.') && !preg_match('/[,\'\"\(\)\[\s]/', $key)) { diff --git a/simplewind/thinkphp/library/think/model/relation/BelongsToMany.php b/simplewind/thinkphp/library/think/model/relation/BelongsToMany.php index c9845a9e5..787edc074 100644 --- a/simplewind/thinkphp/library/think/model/relation/BelongsToMany.php +++ b/simplewind/thinkphp/library/think/model/relation/BelongsToMany.php @@ -71,17 +71,31 @@ public function pivot($pivot) } /** - * 实例化中间表模型 + * 获取中间表更新条件 * @param $data + * @return array + */ + protected function getUpdateWhere($data) + { + return [ + $this->localKey => $data[$this->localKey], + $this->foreignKey => $data[$this->foreignKey], + ]; + } + + /** + * 实例化中间表模型 + * @param array $data + * @param bool $isUpdate * @return Pivot * @throws Exception */ - protected function newPivot($data = []) + protected function newPivot($data = [], $isUpdate = false) { $class = $this->pivotName ?: '\\think\\model\\Pivot'; $pivot = new $class($data, $this->parent, $this->middle); if ($pivot instanceof Pivot) { - return $pivot; + return $isUpdate ? $pivot->isUpdate(true, $this->getUpdateWhere($data)) : $pivot; } else { throw new Exception('pivot model must extends: \think\model\Pivot'); } @@ -104,7 +118,7 @@ protected function hydratePivot($models) } } } - $model->setRelation('pivot', $this->newPivot($pivot)); + $model->setRelation('pivot', $this->newPivot($pivot, true)); } } @@ -370,7 +384,7 @@ protected function eagerlyManyToMany($where, $relation, $subRelation = '') } } } - $set->setRelation('pivot', $this->newPivot($pivot)); + $set->setRelation('pivot', $this->newPivot($pivot, true)); $data[$pivot[$this->localKey]][] = $set; } return $data; @@ -473,7 +487,7 @@ public function attach($data, $pivot = []) foreach ($ids as $id) { $pivot[$this->foreignKey] = $id; $this->pivot->insert($pivot, true); - $result[] = $this->newPivot($pivot); + $result[] = $this->newPivot($pivot, true); } if (count($result) == 1) { // 返回中间表模型对象 diff --git a/simplewind/vendor/composer/autoload_files.php b/simplewind/vendor/composer/autoload_files.php index 7c83c4c7c..a248414c7 100644 --- a/simplewind/vendor/composer/autoload_files.php +++ b/simplewind/vendor/composer/autoload_files.php @@ -8,7 +8,7 @@ return array( '9b552a3cc426e3287cc811caefa3cf53' => $vendorDir . '/topthink/think-helper/src/helper.php', '1cfd2761b63b0a29ed23657ea394cb2d' => $vendorDir . '/topthink/think-captcha/src/helper.php', - 'cc56288302d9df745d97c934d6a6e5f0' => $vendorDir . '/topthink/think-queue/src/common.php', - '841780ea2e1d6545ea3a253239d59c05' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/functions.php', '2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', + '841780ea2e1d6545ea3a253239d59c05' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/functions.php', + 'cc56288302d9df745d97c934d6a6e5f0' => $vendorDir . '/topthink/think-queue/src/common.php', ); diff --git a/simplewind/vendor/composer/autoload_psr4.php b/simplewind/vendor/composer/autoload_psr4.php index 4387618a1..95bca036f 100644 --- a/simplewind/vendor/composer/autoload_psr4.php +++ b/simplewind/vendor/composer/autoload_psr4.php @@ -9,7 +9,7 @@ 'think\\helper\\' => array($vendorDir . '/topthink/think-helper/src'), 'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'), 'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'), - 'think\\' => array($vendorDir . '/topthink/think-image/src', $vendorDir . '/topthink/think-queue/src', $baseDir . '/simplewind/thinkphp/library/think'), + 'think\\' => array($vendorDir . '/topthink/think-image/src', $baseDir . '/simplewind/thinkphp/library/think', $vendorDir . '/topthink/think-queue/src'), 'mindplay\\annotations\\' => array($vendorDir . '/mindplay/annotations/src/annotations'), 'Qiniu\\' => array($vendorDir . '/qiniu/php-sdk/src/Qiniu'), 'FontLib\\' => array($vendorDir . '/phenx/php-font-lib/src/FontLib'), diff --git a/simplewind/vendor/composer/autoload_static.php b/simplewind/vendor/composer/autoload_static.php index 19367956b..4795c6dd7 100644 --- a/simplewind/vendor/composer/autoload_static.php +++ b/simplewind/vendor/composer/autoload_static.php @@ -9,9 +9,9 @@ class ComposerStaticInit929fb365b9981d29459d58f676689cf7 public static $files = array ( '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', '1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php', - 'cc56288302d9df745d97c934d6a6e5f0' => __DIR__ . '/..' . '/topthink/think-queue/src/common.php', - '841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php', '2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', + '841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php', + 'cc56288302d9df745d97c934d6a6e5f0' => __DIR__ . '/..' . '/topthink/think-queue/src/common.php', ); public static $prefixLengthsPsr4 = array ( @@ -56,8 +56,8 @@ class ComposerStaticInit929fb365b9981d29459d58f676689cf7 'think\\' => array ( 0 => __DIR__ . '/..' . '/topthink/think-image/src', - 1 => __DIR__ . '/..' . '/topthink/think-queue/src', - 2 => __DIR__ . '/../../..' . '/simplewind/thinkphp/library/think', + 1 => __DIR__ . '/../../..' . '/simplewind/thinkphp/library/think', + 2 => __DIR__ . '/..' . '/topthink/think-queue/src', ), 'mindplay\\annotations\\' => array ( diff --git a/simplewind/vendor/composer/installed.json b/simplewind/vendor/composer/installed.json index fec6aa16f..e40937825 100644 --- a/simplewind/vendor/composer/installed.json +++ b/simplewind/vendor/composer/installed.json @@ -229,53 +229,6 @@ ], "description": "The ThinkPHP5 Helper Package" }, - { - "name": "topthink/think-queue", - "version": "v1.1.4", - "version_normalized": "1.1.4.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-queue.git", - "reference": "ad709611d516e13d6760234bc98e91faa901cae8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-queue/zipball/ad709611d516e13d6760234bc98e91faa901cae8", - "reference": "ad709611d516e13d6760234bc98e91faa901cae8", - "shasum": "" - }, - "require": { - "topthink/think-helper": ">=1.0.4", - "topthink/think-installer": ">=1.0.10" - }, - "time": "2017-06-25 00:49:56", - "type": "think-extend", - "extra": { - "think-config": { - "queue": "src/config.php" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "think\\": "src" - }, - "files": [ - "src/common.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "The ThinkPHP5 Queue Package" - }, { "name": "phpmailer/phpmailer", "version": "v5.2.26", @@ -546,59 +499,6 @@ "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", "homepage": "https://github.com/dompdf/dompdf" }, - { - "name": "qiniu/php-sdk", - "version": "v7.2.3", - "version_normalized": "7.2.3.0", - "source": { - "type": "git", - "url": "https://github.com/qiniu/php-sdk.git", - "reference": "67852ba9cdd7f48e0e080961abebafee134fb329" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/67852ba9cdd7f48e0e080961abebafee134fb329", - "reference": "67852ba9cdd7f48e0e080961abebafee134fb329", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.3" - }, - "time": "2018-02-20 13:59:54", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Qiniu\\": "src/Qiniu" - }, - "files": [ - "src/Qiniu/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Qiniu", - "email": "sdk@qiniu.com", - "homepage": "http://www.qiniu.com" - } - ], - "description": "Qiniu Resource (Cloud) Storage SDK for PHP", - "homepage": "http://developer.qiniu.com/", - "keywords": [ - "cloud", - "qiniu", - "sdk", - "storage" - ] - }, { "name": "ezyang/htmlpurifier", "version": "v4.10.0", @@ -735,17 +635,17 @@ }, { "name": "topthink/framework", - "version": "v5.0.19", - "version_normalized": "5.0.19.0", + "version": "v5.0.20", + "version_normalized": "5.0.20.0", "source": { "type": "git", "url": "https://github.com/top-think/framework.git", - "reference": "0ad75865563ee4c1ac2ca80061ed1d4fb54edb1d" + "reference": "e20f6e8cadbbc6e246a0c121c89bfd278f30c76b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/0ad75865563ee4c1ac2ca80061ed1d4fb54edb1d", - "reference": "0ad75865563ee4c1ac2ca80061ed1d4fb54edb1d", + "url": "https://api.github.com/repos/top-think/framework/zipball/e20f6e8cadbbc6e246a0c121c89bfd278f30c76b", + "reference": "e20f6e8cadbbc6e246a0c121c89bfd278f30c76b", "shasum": "" }, "require": { @@ -760,7 +660,7 @@ "phpunit/phpunit": "4.8.*", "sebastian/phpcpd": "2.*" }, - "time": "2018-04-25 02:43:06", + "time": "2018-05-11 08:02:47", "type": "think-framework", "installation-source": "dist", "autoload": { @@ -785,5 +685,105 @@ "orm", "thinkphp" ] + }, + { + "name": "qiniu/php-sdk", + "version": "v7.2.6", + "version_normalized": "7.2.6.0", + "source": { + "type": "git", + "url": "https://github.com/qiniu/php-sdk.git", + "reference": "305ce1c1c0c71f794661fe45a96facf61ef96c5d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/305ce1c1c0c71f794661fe45a96facf61ef96c5d", + "reference": "305ce1c1c0c71f794661fe45a96facf61ef96c5d", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.3" + }, + "time": "2018-05-18 04:37:29", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Qiniu\\": "src/Qiniu" + }, + "files": [ + "src/Qiniu/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Qiniu", + "email": "sdk@qiniu.com", + "homepage": "http://www.qiniu.com" + } + ], + "description": "Qiniu Resource (Cloud) Storage SDK for PHP", + "homepage": "http://developer.qiniu.com/", + "keywords": [ + "cloud", + "qiniu", + "sdk", + "storage" + ] + }, + { + "name": "topthink/think-queue", + "version": "v1.1.5", + "version_normalized": "1.1.5.0", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-queue.git", + "reference": "465320c9cb7811df22d4ff8f29f58ead7d104348" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-queue/zipball/465320c9cb7811df22d4ff8f29f58ead7d104348", + "reference": "465320c9cb7811df22d4ff8f29f58ead7d104348", + "shasum": "" + }, + "require": { + "topthink/think-helper": ">=1.0.4", + "topthink/think-installer": ">=1.0.10" + }, + "time": "2018-05-04 05:29:53", + "type": "think-extend", + "extra": { + "think-config": { + "queue": "src/config.php" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "think\\": "src" + }, + "files": [ + "src/common.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "description": "The ThinkPHP5 Queue Package" } ] diff --git a/simplewind/vendor/qiniu/php-sdk/CHANGELOG.md b/simplewind/vendor/qiniu/php-sdk/CHANGELOG.md index 8547bd882..37ce7f8e8 100644 --- a/simplewind/vendor/qiniu/php-sdk/CHANGELOG.md +++ b/simplewind/vendor/qiniu/php-sdk/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 7.2.6 (2018-05-18) +* 修复rs,rsf在不同机房默认的https域名 + +## 7.2.5 (2018-05-10) +* 修复表单上传中多余的参数checkCrc导致的fname错位问题 + +## 7.2.4 (2018-05-09) +### 增加 +* 连麦功能 + ## 7.2.3 (2018-01-20) ### 增加 * 新加坡机房 diff --git a/simplewind/vendor/qiniu/php-sdk/README.md b/simplewind/vendor/qiniu/php-sdk/README.md index 453eef4d1..16c8b49f5 100644 --- a/simplewind/vendor/qiniu/php-sdk/README.md +++ b/simplewind/vendor/qiniu/php-sdk/README.md @@ -1,4 +1,4 @@ -# Qiniu Resource Storage SDK for PHP +# Qiniu Cloud SDK for PHP [![doxygen.io](http://doxygen.io/github.com/qiniu/php-sdk/?status.svg)](http://doxygen.io/github.com/qiniu/php-sdk/) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE) [![Build Status](https://travis-ci.org/qiniu/php-sdk.svg)](https://travis-ci.org/qiniu/php-sdk) diff --git a/simplewind/vendor/qiniu/php-sdk/docs/rtc/README.md b/simplewind/vendor/qiniu/php-sdk/docs/rtc/README.md new file mode 100755 index 000000000..7b98ca0f9 --- /dev/null +++ b/simplewind/vendor/qiniu/php-sdk/docs/rtc/README.md @@ -0,0 +1,71 @@ +# Rtc Streaming Cloud Server-Side Library For PHP + +## Features + +- Appclient + - [x] 创建房间: client->createApp() + - [x] 查看房间: client->getApp() + - [x] 删除房间: client->deleteApp() + - [x] 生成房间token: client->appToken() + + + +## Contents + +- [Installation](#installation) +- [Usage](#usage) + - [Configuration](#configuration) + - [App](#app) + - [Create a app](#create-a-app) + - [Get a app](#get-a-app) + - [Delete a app](#delete-a-app) + - [Generate a app token](#generate-a-app-token) + + +## Usage + +### App + +#### Create a app + +```php +$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5"; +$sk = "xxxx"; +$auth = new Auth($ak, $sk); +$client = new Qiniu\Rtc\AppClient($auth); +$resp=$client->createApp("901","testApp"); +print_r($resp); +``` + +#### Get an app + +```php +$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5"; +$sk = "xxxx"; +$auth = new Auth($ak, $sk); +$client = new Qiniu\Rtc\AppClient($auth); +$resp=$client->getApp("deq02uhb6"); +print_r($resp); +``` + +#### Delete an app + +```php +$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5"; +$sk = "xxxx"; +$auth = new Auth($ak, $sk); +$client = new Qiniu\Rtc\AppClient($auth); +$resp=$client->deleteApp("deq02uhb6"); +print_r($resp); +``` + +#### Generate an app token + +```php +$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5"; +$sk = "xxxx"; +$auth = new Auth($ak, $sk); +$client = new Qiniu\Rtc\AppClient($auth); +$resp=$client->appToken("deq02uhb6", "lfx", '1111', (time()+3600), 'user'); +print_r($resp); +``` \ No newline at end of file diff --git a/simplewind/vendor/qiniu/php-sdk/docs/rtc/example.php b/simplewind/vendor/qiniu/php-sdk/docs/rtc/example.php new file mode 100755 index 000000000..f30b9b415 --- /dev/null +++ b/simplewind/vendor/qiniu/php-sdk/docs/rtc/example.php @@ -0,0 +1,42 @@ +createApp($hub, $title, $maxUsers); + print_r($resp); + // 获取app状态 + $resp = $client->getApp('dgdl5ge8y'); + print_r($resp); + //修改app状态 + $mergePublishRtmp = null; + $mergePublishRtmp['enable'] = true; + $resp = $client->updateApp('dgdl5ge8y', $hub, $title, $maxUsers, $mergePublishRtmp); + print_r($resp); + //删除app + $resp = $client->deleteApp('dgdl5ge8y'); + print_r($resp); + //获取房间连麦的成员 + $resp=$client->listUser("dgbfvvzid", 'lfxl'); + print_r($resp); + //剔除房间的连麦成员 + $resp=$client->kickUser("dgbfvvzid", 'lfx', "qiniu-f6e07b78-4dc8-45fb-a701-a9e158abb8e6"); + print_r($resp); + // 列举房间 + $resp=$client->listActiveRooms("dgbfvvzid", 'lfx', null, null); + print_r($resp); + //鉴权的有效时间: 1个小时. + $resp = $client->appToken("dgd4vecde", "lfxl", '1111', (time()+3600), 'user'); + print_r($resp); +} catch (\Exception $e) { + echo "Error:", $e, "\n"; +} diff --git a/simplewind/vendor/qiniu/php-sdk/examples/rs_change_status.php b/simplewind/vendor/qiniu/php-sdk/examples/rs_change_status.php new file mode 100644 index 000000000..cbcea5c28 --- /dev/null +++ b/simplewind/vendor/qiniu/php-sdk/examples/rs_change_status.php @@ -0,0 +1,20 @@ +changeStatus($bucket, $key, $status); +if ($err) { + print_r($err); +} diff --git a/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Config.php b/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Config.php index 296caa9cd..f9377ce05 100644 --- a/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Config.php +++ b/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Config.php @@ -3,7 +3,7 @@ final class Config { - const SDK_VER = '7.2.3'; + const SDK_VER = '7.2.5'; const BLOCK_SIZE = 4194304; //4*1024*1024 分块上传块大小,该参数为接口规格,不能修改 @@ -11,6 +11,8 @@ final class Config const API_HOST = 'api.qiniu.com'; 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 RTCAPI_VERSION = 'v3'; // Zone 空间对应的机房 public $zone; diff --git a/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php b/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php index 21beb05f8..425c314cf 100644 --- a/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php +++ b/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php @@ -13,6 +13,12 @@ public static function get($url, array $headers = array()) return self::sendRequest($request); } + public static function delete($url, array $headers = array()) + { + $request = new Request('DELETE', $url, $headers); + return self::sendRequest($request); + } + public static function post($url, $body, array $headers = array()) { $request = new Request('POST', $url, $headers, $body); @@ -129,7 +135,7 @@ private static function parseHeaders($raw) $headerLine = trim($line); $kv = explode(':', $headerLine); if (count($kv) > 1) { - $kv[0] = ucwords($kv[0], '-'); + $kv[0] =self::ucwordsHyphen($kv[0]); $headers[$kv[0]] = trim($kv[1]); } } @@ -142,4 +148,9 @@ private static function escapeQuotes($str) $replace = array("\\\\", "\\\""); return str_replace($find, $replace, $str); } + + private static function ucwordsHyphen($str) + { + return str_replace('- ', '-', ucwords(str_replace('-', '- ', $str))); + } } diff --git a/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php b/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php new file mode 100755 index 000000000..c07ee72f3 --- /dev/null +++ b/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php @@ -0,0 +1,204 @@ +auth = $auth; + + $this->baseURL = sprintf("%s/%s/apps", Config::RTCAPI_HOST, Config::RTCAPI_VERSION); + } + + /* + * hub: 直播空间名 + * title: app 的名称 注意,Title 不是唯一标识,重复 create 动作将生成多个 app + * maxUsers:人数限制 + * NoAutoKickUser: bool 类型,可选,禁止自动踢人(抢流)。默认为 false , + 即同一个身份的 client (app/room/user) ,新的连麦请求可以成功,旧连接被关闭。 + */ + public function createApp($hub, $title, $maxUsers = null, $noAutoKickUser = null) + { + $params['hub'] = $hub; + $params['title'] = $title; + if (!empty($maxUsers)) { + $params['maxUsers'] = $maxUsers; + } + if (!empty($noAutoKickUser)) { + $params['noAutoKickUser'] = $noAutoKickUser; + } + $body = json_encode($params); + $ret = $this->post($this->baseURL, $body); + return $ret; + } + + /* + * appId: app 的唯一标识,创建的时候由系统生成。 + * Title: app 的名称, 可选。 + * Hub: 绑定的直播 hub,可选,用于合流后 rtmp 推流。 + * MaxUsers: int 类型,可选,连麦房间支持的最大在线人数。 + * NoAutoKickUser: bool 类型,可选,禁止自动踢人。 + * MergePublishRtmp: 连麦合流转推 RTMP 的配置,可选择。其详细配置包括如下 + Enable: 布尔类型,用于开启和关闭所有房间的合流功能。 + AudioOnly: 布尔类型,可选,指定是否只合成音频。 + Height, Width: int64,可选,指定合流输出的高和宽,默认为 640 x 480。 + OutputFps: int64,可选,指定合流输出的帧率,默认为 25 fps 。 + OutputKbps: int64,可选,指定合流输出的码率,默认为 1000 。 + URL: 合流后转推旁路直播的地址,可选,支持魔法变量配置按照连麦房间号生成不同的推流地址。如果是转推到七牛直播云,不建议使用该配置。 + StreamTitle: 转推七牛直播云的流名,可选,支持魔法变量配置按照连麦房间号生成不同的流名。例如,配置 Hub 为 qn-zhibo ,配置 StreamTitle 为 $(roomName) ,则房间 meeting-001 的合流将会被转推到 rtmp://pili-publish.qn-zhibo.***.com/qn-zhibo/meeting-001地址。详细配置细则,请咨询七牛技术支持。 + */ + public function updateApp($appId, $hub, $title, $maxUsers = null, $mergePublishRtmp = null, $noAutoKickUser = null) + { + $url = $this->baseURL . '/' . $appId; + $params['hub'] = $hub; + $params['title'] = $title; + if (!empty($maxUsers)) { + $params['maxUsers'] = $maxUsers; + } + if (!empty($noAutoKickUser)) { + $params['noAutoKickUser'] = $noAutoKickUser; + } + if (!empty($mergePublishRtmp)) { + $params['mergePublishRtmp'] = $mergePublishRtmp; + } + $body = json_encode($params); + $ret = $this->post($url, $body); + return $ret; + } + + /* + * appId: app 的唯一标识,创建的时候由系统生成。 + */ + public function getApp($appId) + { + $url = $this->baseURL . '/' . $appId; + $ret = $this->get($url); + return $ret; + } + + /* + * appId: app 的唯一标识,创建的时候由系统生成 + */ + public function deleteApp($appId) + { + $url = $this->baseURL . '/' . $appId; + list(, $err) = $this->delete($url); + return $err; + } + + /* + * 获取房间的人数 + * appId: app 的唯一标识,创建的时候由系统生成。 + * roomName: 操作所查询的连麦房间。 + */ + public function listUser($appId, $roomName) + { + $url = sprintf("%s/%s/rooms/%s/users", $this->baseURL, $appId, $roomName); + $ret = $this->get($url); + return $ret; + } + + /* + * 踢出玩家 + * appId: app 的唯一标识,创建的时候由系统生成。 + * roomName: 连麦房间 + * userId: 请求加入房间的用户ID + */ + public function kickUser($appId, $roomName, $userId) + { + $url = sprintf("%s/%s/rooms/%s/users/%s", $this->baseURL, $appId, $roomName, $userId); + list(, $err) = $this->delete($url); + return $err; + } + + /* + * 获取房间的人数 + * appId: app 的唯一标识,创建的时候由系统生成。 + * prefix: 所查询房间名的前缀索引,可以为空。 + * offset: int 类型,分页查询的位移标记。 + * limit: int 类型,此次查询的最大长度。 + * GET /v3/apps//rooms?prefix=&offset=&limit= + */ + public function listActiveRooms($appId, $prefix = null, $offset = null, $limit = null) + { + if (isset($prefix)) { + $query['prefix'] = $prefix; + } + if (isset($offset)) { + $query['offset'] = $offset; + } + if (isset($limit)) { + $query['limit'] = $limit; + } + if (isset($query) && !empty($query)) { + $query = '?' . http_build_query($query); + $url = sprintf("%s/%s/rooms%s", $this->baseURL, $appId, $query); + } else { + $url = sprintf("%s/%s/rooms", $this->baseURL, $appId); + } + $ret = $this->get($url); + return $ret; + } + + /* + * appId: app 的唯一标识,创建的时候由系统生成。 + * roomName: 房间名称,需满足规格 ^[a-zA-Z0-9_-]{3,64}$ + * userId: 请求加入房间的用户 ID,需满足规格 ^[a-zA-Z0-9_-]{3,50}$ + * expireAt: int64 类型,鉴权的有效时间,传入以秒为单位的64位Unix + 绝对时间,token 将在该时间后失效。 + * permission: 该用户的房间管理权限,"admin" 或 "user",默认为 "user" 。 + 当权限角色为 "admin" 时,拥有将其他用户移除出房间等特权. + */ + public function appToken($appId, $roomName, $userId, $expireAt, $permission) + { + $params['appId'] = $appId; + $params['userId'] = $userId; + $params['roomName'] = $roomName; + $params['permission'] = $permission; + $params['expireAt'] = $expireAt; + $appAccessString = json_encode($params); + return $this->auth->signWithData($appAccessString); + } + + private function get($url, $cType = null) + { + $rtcToken = $this->auth->authorizationV2($url, "GET", null, $cType); + $rtcToken['Content-Type'] = $cType; + $ret = Client::get($url, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + return array($ret->json(), null); + } + + private function delete($url, $contentType = 'application/json') + { + $rtcToken = $this->auth->authorizationV2($url, "DELETE", null, $contentType); + $rtcToken['Content-Type'] = $contentType; + $ret = Client::delete($url, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + return array($ret->json(), null); + } + + private function post($url, $body, $contentType = 'application/json') + { + $rtcToken = $this->auth->authorizationV2($url, "POST", $body, $contentType); + $rtcToken['Content-Type'] = $contentType; + $ret = Client::post($url, $body, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + return array($r, null); + } +} diff --git a/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php b/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php index d5269f381..2e82a1477 100644 --- a/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php +++ b/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php @@ -225,6 +225,23 @@ public function changeType($bucket, $key, $fileType) return $error; } + /** + * 修改文件的存储状态,即禁用状态和启用状态间的的互相转换 + * + * @param $bucket 待操作资源所在空间 + * @param $key 待操作资源文件名 + * @param $status 待操作文件目标文件类型 + * + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + * @link https://developer.qiniu.com/kodo/api/4173/modify-the-file-status + */ + public function changeStatus($bucket, $key, $status) + { + $resource = \Qiniu\entry($bucket, $key); + $path = '/chstatus/' . $resource . '/status/' . $status; + list(, $error) = $this->rsPost($path); + return $error; + } /** * 从指定URL抓取资源,并将该资源存储到指定空间中 diff --git a/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php b/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php index ce58b2fe9..7b3517047 100644 --- a/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php +++ b/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php @@ -108,7 +108,6 @@ public function putFile( $this->config, $params, $mime, - $checkCrc, basename($filePath) ); } diff --git a/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Zone.php b/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Zone.php index 1a66d39bf..caedc2649 100644 --- a/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Zone.php +++ b/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Zone.php @@ -44,8 +44,8 @@ public static function zone0() $Zone_z0 = new Zone( array("up.qiniup.com", 'up-jjh.qiniup.com', 'up-xs.qiniup.com'), array('upload.qiniup.com', 'upload-jjh.qiniup.com', 'upload-xs.qiniup.com'), - 'rs.qiniu.com', - 'rsf.qiniu.com', + 'rs.qbox.me', + 'rsf.qbox.me', 'api.qiniu.com', 'iovip.qbox.me' ); @@ -58,8 +58,8 @@ public static function zone1() $Zone_z1 = new Zone( array('up-z1.qiniup.com'), array('upload-z1.qiniup.com'), - "rs-z1.qiniu.com", - "rsf-z1.qiniu.com", + "rs-z1.qbox.me", + "rsf-z1.qbox.me", "api-z1.qiniu.com", "iovip-z1.qbox.me" ); @@ -73,8 +73,8 @@ public static function zone2() $Zone_z2 = new Zone( array('up-z2.qiniup.com', 'up-dg.qiniup.com', 'up-fs.qiniup.com'), array('upload-z2.qiniup.com', 'upload-dg.qiniup.com', 'upload-fs.qiniup.com'), - "rs-z2.qiniu.com", - "rsf-z2.qiniu.com", + "rs-z2.qbox.me", + "rsf-z2.qbox.me", "api-z2.qiniu.com", "iovip-z2.qbox.me" ); @@ -88,8 +88,8 @@ public static function zoneNa0() $Zone_na0 = new Zone( array('up-na0.qiniup.com'), array('upload-na0.qiniup.com'), - "rs-na0.qiniu.com", - "rsf-na0.qiniu.com", + "rs-na0.qbox.me", + "rsf-na0.qbox.me", "api-na0.qiniu.com", "iovip-na0.qbox.me" ); @@ -103,8 +103,8 @@ public static function zoneAs0() $Zone_as0 = new Zone( array('up-as0.qiniup.com'), array('upload-as0.qiniup.com'), - "rs-as0.qiniu.com", - "rsf-as0.qiniu.com", + "rs-as0.qbox.me", + "rsf-as0.qbox.me", "api-as0.qiniu.com", "iovip-as0.qbox.me" ); @@ -145,24 +145,24 @@ public static function queryZone($ak, $bucket) //set specific hosts if (strstr($zone->iovipHost, "z1") !== false) { - $zone->rsHost = "rs-z1.qiniu.com"; - $zone->rsfHost = "rsf-z1.qiniu.com"; + $zone->rsHost = "rs-z1.qbox.me"; + $zone->rsfHost = "rsf-z1.qbox.me"; $zone->apiHost = "api-z1.qiniu.com"; } elseif (strstr($zone->iovipHost, "z2") !== false) { - $zone->rsHost = "rs-z2.qiniu.com"; - $zone->rsfHost = "rsf-z2.qiniu.com"; + $zone->rsHost = "rs-z2.qbox.me"; + $zone->rsfHost = "rsf-z2.qbox.me"; $zone->apiHost = "api-z2.qiniu.com"; } elseif (strstr($zone->iovipHost, "na0") !== false) { - $zone->rsHost = "rs-na0.qiniu.com"; - $zone->rsfHost = "rsf-na0.qiniu.com"; + $zone->rsHost = "rs-na0.qbox.me"; + $zone->rsfHost = "rsf-na0.qbox.me"; $zone->apiHost = "api-na0.qiniu.com"; } elseif (strstr($zone->iovipHost, "as0") !== false) { - $zone->rsHost = "rs-as0.qiniu.com"; - $zone->rsfHost = "rsf-as0.qiniu.com"; + $zone->rsHost = "rs-as0.qbox.me"; + $zone->rsfHost = "rsf-as0.qbox.me"; $zone->apiHost = "api-as0.qiniu.com"; } else { - $zone->rsHost = "rs.qiniu.com"; - $zone->rsfHost = "rsf.qiniu.com"; + $zone->rsHost = "rs.qbox.me"; + $zone->rsfHost = "rsf.qbox.me"; $zone->apiHost = "api.qiniu.com"; } diff --git a/simplewind/vendor/topthink/think-queue/src/queue/command/Listen.php b/simplewind/vendor/topthink/think-queue/src/queue/command/Listen.php index 3f6cd639c..475913511 100644 --- a/simplewind/vendor/topthink/think-queue/src/queue/command/Listen.php +++ b/simplewind/vendor/topthink/think-queue/src/queue/command/Listen.php @@ -36,7 +36,7 @@ public function configure() public function initialize(Input $input, Output $output) { - $this->listener = new Listener(getcwd()); + $this->listener = new Listener($this->findCommandPath()); $this->listener->setSleep($input->getOption('sleep')); $this->listener->setMaxTries($input->getOption('tries')); @@ -57,4 +57,9 @@ public function execute(Input $input, Output $output) $this->listener->listen($queue, $delay, $memory, $timeout); } + + protected function findCommandPath() + { + return defined('ROOT_PATH') ? ROOT_PATH : dirname($_SERVER['argv'][0]); + } } diff --git a/simplewind/vendor/topthink/think-queue/src/queue/connector/Database.php b/simplewind/vendor/topthink/think-queue/src/queue/connector/Database.php index 71296a441..ad7c60107 100644 --- a/simplewind/vendor/topthink/think-queue/src/queue/connector/Database.php +++ b/simplewind/vendor/topthink/think-queue/src/queue/connector/Database.php @@ -150,7 +150,7 @@ protected function releaseJobsThatHaveBeenReservedTooLong($queue) ->update([ 'reserved' => 0, 'reserved_at' => null, - 'attempts' => ['exp', 'attempts + 1'] + 'attempts' => ['inc', 1] ]); } From b4297aa97163730b2c3a31994f9c3e81c42d4bb8 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Tue, 29 May 2018 19:10:44 +0800 Subject: [PATCH 03/37] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E5=8F=91=E9=80=81=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/user/controller/VerificationCodeController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/user/controller/VerificationCodeController.php b/app/user/controller/VerificationCodeController.php index b7dccf76a..b4616fa9f 100644 --- a/app/user/controller/VerificationCodeController.php +++ b/app/user/controller/VerificationCodeController.php @@ -83,7 +83,7 @@ public function send() $username = empty($user['user_nickname']) ? $user['user_login'] : $user['user_nickname']; $message = htmlspecialchars_decode($emailTemplate['template']); - $message = $this->display($message, ['code' => $code, 'username' => $username]); + $message = $this->view->display($message, ['code' => $code, 'username' => $username]); $subject = empty($emailTemplate['subject']) ? 'ThinkCMF验证码' : $emailTemplate['subject']; $result = cmf_send_email($data['username'], $subject, $message); From 64fdd7897832e7c3eb14a46406f7db9f407ee6b1 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Tue, 29 May 2018 19:13:50 +0800 Subject: [PATCH 04/37] =?UTF-8?q?=E4=BC=98=E5=8C=96get=5Fclient=5Fip()?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E9=BB=98=E8=AE=A4=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E9=AB=98=E7=BA=A7=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplewind/cmf/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simplewind/cmf/common.php b/simplewind/cmf/common.php index b9c5c3957..0f788586b 100644 --- a/simplewind/cmf/common.php +++ b/simplewind/cmf/common.php @@ -1489,7 +1489,7 @@ function cmf_is_sae() * @param boolean $adv 是否进行高级模式获取(有可能被伪装) * @return string */ -function get_client_ip($type = 0, $adv = false) +function get_client_ip($type = 0, $adv = true) { return request()->ip($type, $adv); } From 602002b0412515def1b5bc344efbd9fc943df75f Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 1 Jun 2018 07:35:35 +0800 Subject: [PATCH 05/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=88=A4=E6=96=AD=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=99=A8=E6=96=B9=E6=B3=95=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=BA=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=88=99?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20html=20=E7=B1=BB=E5=9E=8B=E8=BF=94?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplewind/cmf/controller/BaseController.php | 29 ------------- simplewind/thinkphp/library/think/App.php | 44 ++++++++++---------- 2 files changed, 22 insertions(+), 51 deletions(-) diff --git a/simplewind/cmf/controller/BaseController.php b/simplewind/cmf/controller/BaseController.php index aa89628a0..95ddbd8f6 100644 --- a/simplewind/cmf/controller/BaseController.php +++ b/simplewind/cmf/controller/BaseController.php @@ -82,33 +82,4 @@ protected function listOrders($model) return true; } - /** - * 加载模板输出 - * @access protected - * @param string $template 模板文件名 - * @param array $vars 模板输出变量 - * @param array $replace 模板替换 - * @param array $config 模板参数 - * @return mixed - */ - protected function fetch($template = '', $vars = [], $replace = [], $config = []) - { - return Response::create($this->view->fetch($template, $vars, $replace, $config), '\\cmf\\response\\Html'); - } - - /** - * 渲染内容输出 - * @access protected - * @param string $content 模板内容 - * @param array $vars 模板输出变量 - * @param array $replace 替换内容 - * @param array $config 模板参数 - * @return mixed - */ - protected function display($content = '', $vars = [], $replace = [], $config = []) - { - return Response::create($this->view->display($content, $vars, $replace, $config), '\\cmf\\response\\Html'); - } - - } \ No newline at end of file diff --git a/simplewind/thinkphp/library/think/App.php b/simplewind/thinkphp/library/think/App.php index 3c5f81f0c..c4fff9d75 100644 --- a/simplewind/thinkphp/library/think/App.php +++ b/simplewind/thinkphp/library/think/App.php @@ -149,9 +149,9 @@ public static function run(Request $request = null) $response = $data; } elseif (!is_null($data)) { // 默认自动识别响应输出类型 - $type = $request->isAjax() ? - Config::get('default_ajax_return') : - Config::get('default_return_type'); + $type = $request->isAjax() && !is_string($data) ? + Config::get('default_ajax_return') : + Config::get('default_return_type'); $response = Response::create($data, $type); } else { @@ -292,8 +292,8 @@ private static function init($module = '') /** * 设置当前请求的调度信息 * @access public - * @param array|string $dispatch 调度信息 - * @param string $type 调度类型 + * @param array|string $dispatch 调度信息 + * @param string $type 调度类型 * @return void */ public static function dispatch($dispatch, $type = 'module') @@ -305,7 +305,7 @@ public static function dispatch($dispatch, $type = 'module') * 执行函数或者闭包方法 支持参数调用 * @access public * @param string|array|\Closure $function 函数或者闭包 - * @param array $vars 变量 + * @param array $vars 变量 * @return mixed */ public static function invokeFunction($function, $vars = []) @@ -323,7 +323,7 @@ public static function invokeFunction($function, $vars = []) * 调用反射执行类的方法 支持参数绑定 * @access public * @param string|array $method 方法 - * @param array $vars 变量 + * @param array $vars 变量 * @return mixed */ public static function invokeMethod($method, $vars = []) @@ -347,7 +347,7 @@ public static function invokeMethod($method, $vars = []) * 调用反射执行类的实例化 支持依赖注入 * @access public * @param string $class 类名 - * @param array $vars 变量 + * @param array $vars 变量 * @return mixed */ public static function invokeClass($class, $vars = []) @@ -363,7 +363,7 @@ public static function invokeClass($class, $vars = []) * 绑定参数 * @access private * @param \ReflectionMethod|\ReflectionFunction $reflect 反射类 - * @param array $vars 变量 + * @param array $vars 变量 * @return array */ private static function bindParams($reflect, $vars = []) @@ -371,8 +371,8 @@ private static function bindParams($reflect, $vars = []) // 自动获取请求变量 if (empty($vars)) { $vars = Config::get('url_param_type') ? - Request::instance()->route() : - Request::instance()->param(); + Request::instance()->route() : + Request::instance()->param(); } $args = []; @@ -392,9 +392,9 @@ private static function bindParams($reflect, $vars = []) /** * 获取参数值 * @access private - * @param \ReflectionParameter $param 参数 - * @param array $vars 变量 - * @param string $type 类别 + * @param \ReflectionParameter $param 参数 + * @param array $vars 变量 + * @param string $type 类别 * @return array */ private static function getParamValue($param, &$vars, $type) @@ -418,8 +418,8 @@ private static function getParamValue($param, &$vars, $type) } $result = method_exists($className, 'instance') ? - $className::instance() : - new $className; + $className::instance() : + new $className; } } elseif (1 == $type && !empty($vars)) { $result = array_shift($vars); @@ -438,7 +438,7 @@ private static function getParamValue($param, &$vars, $type) * 执行调用分发 * @access protected * @param array $dispatch 调用信息 - * @param array $config 配置信息 + * @param array $config 配置信息 * @return Response|mixed * @throws \InvalidArgumentException */ @@ -485,9 +485,9 @@ protected static function exec($dispatch, $config) /** * 执行模块 * @access public - * @param array $result 模块/控制器/操作 - * @param array $config 配置参数 - * @param bool $convert 是否自动转换控制器和操作名 + * @param array $result 模块/控制器/操作 + * @param array $config 配置参数 + * @param bool $convert 是否自动转换控制器和操作名 * @return mixed * @throws HttpException */ @@ -610,7 +610,7 @@ public static function module($result, $config, $convert = null) * URL路由检测(根据PATH_INFO) * @access public * @param \think\Request $request 请求实例 - * @param array $config 配置信息 + * @param array $config 配置信息 * @return array * @throws \think\Exception */ @@ -661,7 +661,7 @@ public static function routeCheck($request, array $config) * 设置应用的路由检测机制 * @access public * @param bool $route 是否需要检测路由 - * @param bool $must 是否强制检测路由 + * @param bool $must 是否强制检测路由 * @return void */ public static function route($route, $must = false) From 1f92b5ea9f4a04697ad7cbc0453d4ef70bb40dbb Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Tue, 5 Jun 2018 18:43:01 +0800 Subject: [PATCH 06/37] =?UTF-8?q?=E4=B8=83=E7=89=9B=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=9C=E5=8D=97=E4=BA=9A=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/plugins/qiniu/config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/public/plugins/qiniu/config.php b/public/plugins/qiniu/config.php index 0938b7b5e..fb53e3410 100644 --- a/public/plugins/qiniu/config.php +++ b/public/plugins/qiniu/config.php @@ -79,6 +79,7 @@ 'z1' => '华北', 'z2' => '华南', 'na0' => '北美', + 'as0' => '东南亚', ], 'value' => 'http', "rule" => [ From c4189fadd237e2c7842a55640d45b0dcfe3a789d Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Tue, 5 Jun 2018 18:43:56 +0800 Subject: [PATCH 07/37] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BE=E5=BA=A6?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=A7=86=E9=A2=91=E4=B8=8A=E4=BC=A0=E5=90=8E?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=86=8D=E7=BC=96=E8=BE=91=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/js/ueditor/ueditor.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/static/js/ueditor/ueditor.config.js b/public/static/js/ueditor/ueditor.config.js index 07e786de7..e76ff1cfc 100644 --- a/public/static/js/ueditor/ueditor.config.js +++ b/public/static/js/ueditor/ueditor.config.js @@ -410,7 +410,7 @@ hr: ['class', 'style', 'id'], i: ['class', 'style', 'id'], iframe: ['src', 'width', 'height', 'class', 'id', 'style', 'frameborder', 'name'], - img: ['src', 'alt', 'title', 'width', 'height', 'id', '_src', 'loadingclass', '_url', 'data-latex','style'], + img: ['src', 'alt', 'title', 'width', 'height', 'id', '_src', 'loadingclass', 'class', 'style','_url', 'data-latex'], ins: ['datetime', 'class', 'style', 'id'], li: ['class', 'style', 'id'], mark: [], From aac54cddb9ece88687c97c901e7581f4632f4159 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Tue, 5 Jun 2018 18:44:55 +0800 Subject: [PATCH 08/37] =?UTF-8?q?=E5=89=8D=E5=8F=B0=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=A7=A3=E6=9E=90=E6=A0=87=E5=87=86=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplewind/cmf/controller/HomeBaseController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simplewind/cmf/controller/HomeBaseController.php b/simplewind/cmf/controller/HomeBaseController.php index ee1f0f2e0..c1b049b91 100644 --- a/simplewind/cmf/controller/HomeBaseController.php +++ b/simplewind/cmf/controller/HomeBaseController.php @@ -121,7 +121,7 @@ private function parseTemplate($template) if ($controller) { if ('' == $template) { // 如果模板文件名为空 按照默认规则定位 - $template = str_replace('.', DS, $controller) . $depr . $request->action(); + $template = str_replace('.', DS, $controller) . $depr . cmf_parse_name($request->action(true)); } elseif (false === strpos($template, $depr)) { $template = str_replace('.', DS, $controller) . $depr . $template; } From ee7bef4fc52b82a359c39797fcab8fdc8b683b54 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Tue, 5 Jun 2018 18:45:39 +0800 Subject: [PATCH 09/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=20api=20=E5=9F=BA?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplewind/cmf/controller/RestBaseController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simplewind/cmf/controller/RestBaseController.php b/simplewind/cmf/controller/RestBaseController.php index 6b985ca92..e49732974 100644 --- a/simplewind/cmf/controller/RestBaseController.php +++ b/simplewind/cmf/controller/RestBaseController.php @@ -70,7 +70,7 @@ public function __construct(Request $request = null) $this->request = $request; - $this->apiVersion = $this->request->header('XX-Api-Version'); + $this->apiVersion = $this->request->header('XX-Api-Version',''); // 用户验证初始化 $this->_initUser(); From 8a2e1ad8a6aa3046724da7848ef6587f66254170 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Tue, 5 Jun 2018 18:45:54 +0800 Subject: [PATCH 10/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update/update.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 update/update.sql diff --git a/update/update.sql b/update/update.sql new file mode 100644 index 000000000..1917e1202 --- /dev/null +++ b/update/update.sql @@ -0,0 +1,4 @@ +-- 增缩略图字段 +ALTER TABLE `cmf_portal_post` ADD `thumbnail` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '缩略图' AFTER `post_source`; + +ALTER TABLE `cmf_auth_rule` CHANGE `app` `app` VARCHAR(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '规则所属app'; \ No newline at end of file From 018e7b7ced31d227866747db29310f4552bc7ef5 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Wed, 6 Jun 2018 12:25:02 +0800 Subject: [PATCH 11/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E5=8F=B7=E6=A3=80=E6=9F=A5=E6=94=AF=E6=8C=81=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/user/controller/LoginController.php | 4 ++-- app/user/controller/RegisterController.php | 6 +++--- app/user/controller/VerificationCodeController.php | 2 +- simplewind/cmf/common.php | 11 +++++++++++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/user/controller/LoginController.php b/app/user/controller/LoginController.php index a784079d9..7620002a7 100644 --- a/app/user/controller/LoginController.php +++ b/app/user/controller/LoginController.php @@ -69,7 +69,7 @@ public function doLogin() if (Validate::is($data['username'], 'email')) { $user['user_email'] = $data['username']; $log = $userModel->doEmail($user); - } else if (preg_match('/(^(13\d|15[^4\D]|17[013678]|18\d)\d{8})$/', $data['username'])) { + } else if (cmf_check_mobile($data['username'])) { $user['mobile'] = $data['username']; $log = $userModel->doMobile($user); } else { @@ -148,7 +148,7 @@ public function passwordReset() $log = $userModel->emailPasswordReset($data['username'], $data['password']); - } else if (preg_match('/(^(13\d|15[^4\D]|17[013678]|18\d)\d{8})$/', $data['username'])) { + } else if (cmf_check_mobile($data['username'])) { $user['mobile'] = $data['username']; $log = $userModel->mobilePasswordReset($data['username'], $data['password']); } else { diff --git a/app/user/controller/RegisterController.php b/app/user/controller/RegisterController.php index ac47824e0..9f1bb428e 100644 --- a/app/user/controller/RegisterController.php +++ b/app/user/controller/RegisterController.php @@ -86,10 +86,10 @@ public function doRegister() $user['user_pass'] = $data['password']; if (Validate::is($data['username'], 'email')) { $user['user_email'] = $data['username']; - $log = $register->register($user,3); - } else if (preg_match('/(^(13\d|15[^4\D]|17[013678]|18\d)\d{8})$/', $data['username'])) { + $log = $register->register($user, 3); + } else if (cmf_check_mobile($data['username'])) { $user['mobile'] = $data['username']; - $log = $register->register($user,2); + $log = $register->register($user, 2); } else { $log = 2; } diff --git a/app/user/controller/VerificationCodeController.php b/app/user/controller/VerificationCodeController.php index b4616fa9f..d4e52df6f 100644 --- a/app/user/controller/VerificationCodeController.php +++ b/app/user/controller/VerificationCodeController.php @@ -50,7 +50,7 @@ public function send() if (Validate::is($data['username'], 'email')) { $accountType = 'email'; - } else if (preg_match('/(^(13\d|15[^4\D]|17[013678]|18\d)\d{8})$/', $data['username'])) { + } else if (cmf_check_mobile($data['username'])) { $accountType = 'mobile'; } else { $this->error("请输入正确的手机或者邮箱格式!"); diff --git a/simplewind/cmf/common.php b/simplewind/cmf/common.php index 0f788586b..9754f4f27 100644 --- a/simplewind/cmf/common.php +++ b/simplewind/cmf/common.php @@ -1879,4 +1879,15 @@ function cmf_data_to_xml($data, $item = 'item', $id = 'id') $xml .= ""; } return $xml; +} + +/** + * 检查手机格式,中国手机不带国家代码,国际手机号格式为:国家代码-手机号 + * @param $mobile + * @return bool + */ +function cmf_check_mobile($mobile) +{ + return preg_match('/(^(13\d|14\d|15\d|16\d|17\d|18\d|19\d)\d{8})$/', $mobile) || + preg_match('/^\d{1,4}-\d{5,11}$/', $mobile); } \ No newline at end of file From 87010a69014e4c69cfcbf5e2dafe5a0cb1f059a7 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Thu, 7 Jun 2018 11:29:12 +0800 Subject: [PATCH 12/37] =?UTF-8?q?=E4=BC=98=E5=8C=96rest=20api=20=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplewind/cmf/controller/RestBaseController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simplewind/cmf/controller/RestBaseController.php b/simplewind/cmf/controller/RestBaseController.php index e49732974..6b985ca92 100644 --- a/simplewind/cmf/controller/RestBaseController.php +++ b/simplewind/cmf/controller/RestBaseController.php @@ -70,7 +70,7 @@ public function __construct(Request $request = null) $this->request = $request; - $this->apiVersion = $this->request->header('XX-Api-Version',''); + $this->apiVersion = $this->request->header('XX-Api-Version'); // 用户验证初始化 $this->_initUser(); From 718a6eea7a2c014a9f4e55676779fb560c3c7f07 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Thu, 7 Jun 2018 11:29:37 +0800 Subject: [PATCH 13/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E5=8F=B7=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplewind/cmf/common.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/simplewind/cmf/common.php b/simplewind/cmf/common.php index 9754f4f27..3b7c982bc 100644 --- a/simplewind/cmf/common.php +++ b/simplewind/cmf/common.php @@ -1888,6 +1888,18 @@ function cmf_data_to_xml($data, $item = 'item', $id = 'id') */ function cmf_check_mobile($mobile) { - return preg_match('/(^(13\d|14\d|15\d|16\d|17\d|18\d|19\d)\d{8})$/', $mobile) || - preg_match('/^\d{1,4}-\d{5,11}$/', $mobile); + if (preg_match('/(^(13\d|14\d|15\d|16\d|17\d|18\d|19\d)\d{8})$/', $mobile)) { + return true; + } else { + if (preg_match('/^\d{1,4}-\d{5,11}$/', $mobile)) { + if (preg_match('/^\d{1,4}-0+/', $mobile)) { + //不能以0开头 + return false; + } + + return true; + } + + return false; + } } \ No newline at end of file From e3ca9d2605573d8345c8b56014d25a32c17f9dfe Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Mon, 11 Jun 2018 10:20:20 +0800 Subject: [PATCH 14/37] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8F=92=E4=BB=B6=20re?= =?UTF-8?q?st=20api=E5=9F=BA=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PluginRestBaseController.php | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 simplewind/cmf/controller/PluginRestBaseController.php diff --git a/simplewind/cmf/controller/PluginRestBaseController.php b/simplewind/cmf/controller/PluginRestBaseController.php new file mode 100644 index 000000000..302907572 --- /dev/null +++ b/simplewind/cmf/controller/PluginRestBaseController.php @@ -0,0 +1,107 @@ + +// +---------------------------------------------------------------------- +namespace cmf\controller; + +use think\exception\ValidateException; +use think\Request; +use think\Loader; + +class PluginRestBaseController extends RestBaseController +{ + + /** + * @var \cmf\lib\Plugin + */ + private $plugin; + + /** + * 构造函数 + * @param Request $request Request对象 + * @access public + */ + public function __construct(Request $request = null) + { + parent::__construct($request); + + $this->getPlugin(); + } + + public function getPlugin() + { + + if (is_null($this->plugin)) { + $pluginName = $this->request->param('_plugin'); + $pluginName = cmf_parse_name($pluginName, 1); + $class = cmf_get_plugin_class($pluginName); + $this->plugin = new $class; + } + + return $this->plugin; + + } + + // 初始化 + protected function _initialize() + { + } + + /** + * 验证数据 + * @access protected + * @param array $data 数据 + * @param string|array $validate 验证器名或者验证规则数组 + * @param array $message 提示信息 + * @param bool $batch 是否批量验证 + * @param mixed $callback 回调方法(闭包) + * @return array|string|true + * @throws ValidateException + */ + protected function validate($data, $validate, $message = [], $batch = false, $callback = null) + { + if (is_array($validate)) { + $v = Loader::validate(); + $v->rule($validate); + } else { + if (strpos($validate, '.')) { + // 支持场景 + list($validate, $scene) = explode('.', $validate); + } + $v = Loader::validate('\\plugins\\' . cmf_parse_name($this->plugin->getName()) . '\\validate\\' . $validate . 'Validate'); + if (!empty($scene)) { + $v->scene($scene); + } + } + // 是否批量验证 + if ($batch || $this->batchValidate) { + $v->batch(true); + } + + if (is_array($message)) { + $v->message($message); + } + + if ($callback && is_callable($callback)) { + call_user_func_array($callback, [$v, &$data]); + } + + if (!$v->check($data)) { + if ($this->failException) { + throw new ValidateException($v->getError()); + } else { + return $v->getError(); + } + } else { + return true; + } + } + + +} \ No newline at end of file From 9dd1addaacbbfd2b36b858a5f84a5e5720c6d752 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Tue, 12 Jun 2018 10:39:58 +0800 Subject: [PATCH 15/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=20rest=20api=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E7=B1=BB=E5=9E=8B=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplewind/cmf/controller/RestBaseController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simplewind/cmf/controller/RestBaseController.php b/simplewind/cmf/controller/RestBaseController.php index 6b985ca92..2ed1ac31c 100644 --- a/simplewind/cmf/controller/RestBaseController.php +++ b/simplewind/cmf/controller/RestBaseController.php @@ -279,7 +279,7 @@ protected function error($msg = '', $data = '', array $header = []) */ protected function getResponseType() { - return Config::get('default_return_type'); + return 'json'; } /** From 14c8552352a63c05e640e285818c546e5ac7e713 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Wed, 13 Jun 2018 18:04:34 +0800 Subject: [PATCH 16/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=20rest=20api=E5=9F=BA?= =?UTF-8?q?=E7=B1=BB=E8=AE=BE=E5=A4=87=E7=B1=BB=E5=9E=8B=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplewind/cmf/controller/RestBaseController.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/simplewind/cmf/controller/RestBaseController.php b/simplewind/cmf/controller/RestBaseController.php index 2ed1ac31c..82e656e11 100644 --- a/simplewind/cmf/controller/RestBaseController.php +++ b/simplewind/cmf/controller/RestBaseController.php @@ -98,10 +98,6 @@ private function _initUser() $token = $this->request->header('XX-Token'); $deviceType = $this->request->header('XX-Device-Type'); - if (empty($token)) { - return; - } - if (empty($deviceType)) { return; } @@ -110,9 +106,14 @@ private function _initUser() return; } - $this->token = $token; $this->deviceType = $deviceType; + if (empty($token)) { + return; + } + + $this->token = $token; + $user = Db::name('user_token') ->alias('a') ->field('b.*') From 0fd36fcac81c5e8e77a1d63f5d5508f44008a334 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Thu, 14 Jun 2018 10:26:58 +0800 Subject: [PATCH 17/37] =?UTF-8?q?=E4=BC=98=E5=8C=96rest=20api=E7=94=A8?= =?UTF-8?q?=E6=88=B7=20token=20=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplewind/cmf/common.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/simplewind/cmf/common.php b/simplewind/cmf/common.php index 3b7c982bc..0833913f1 100644 --- a/simplewind/cmf/common.php +++ b/simplewind/cmf/common.php @@ -1385,7 +1385,9 @@ function cmf_generate_user_token($userId, $deviceType) 'device_type' => $deviceType ]); } else { - if ($findUserToken['expire_time'] <= time()) { + if ($findUserToken['expire_time'] > time() && !empty($findUserToken['token'])) { + $token = $findUserToken['token']; + } else { Db::name("user_token") ->where('user_id', $userId) ->where('device_type', $deviceType) @@ -1394,8 +1396,6 @@ function cmf_generate_user_token($userId, $deviceType) 'expire_time' => $expireTime, 'create_time' => $currentTime ]); - } else { - $token = $findUserToken['token']; } } From 8f52d94307a03470d9b6fecd5a7fd53832c9eb09 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 15 Jun 2018 17:14:53 +0800 Subject: [PATCH 18/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E6=8E=A7=E5=88=B6=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplewind/cmf/controller/CaptchaController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simplewind/cmf/controller/CaptchaController.php b/simplewind/cmf/controller/CaptchaController.php index 4780dd157..d9bafba5c 100644 --- a/simplewind/cmf/controller/CaptchaController.php +++ b/simplewind/cmf/controller/CaptchaController.php @@ -77,7 +77,7 @@ public function index(Request $request) $defaultCaptchaConfig = config('captcha'); if ($defaultCaptchaConfig && is_array($defaultCaptchaConfig)) { - $config = array_merge($defaultCaptchaConfig, $config); + $config = array_merge($config, $defaultCaptchaConfig); } $captcha = new Captcha($config); From 1fe24278cd50c8a47ca6b1f077740257ce62428f Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 15 Jun 2018 17:25:28 +0800 Subject: [PATCH 19/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=92=8C=E6=96=87=E4=BB=B6=E9=93=BE=E6=8E=A5=E8=BD=AC=E5=8C=96?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplewind/cmf/common.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/simplewind/cmf/common.php b/simplewind/cmf/common.php index 0833913f1..073e2ddfb 100644 --- a/simplewind/cmf/common.php +++ b/simplewind/cmf/common.php @@ -693,6 +693,10 @@ function cmf_get_asset_url($file, $style = '') */ function cmf_get_image_url($file, $style = 'watermark') { + if (empty($file)) { + return ''; + } + if (strpos($file, "http") === 0) { return $file; } else if (strpos($file, "/") === 0) { @@ -719,6 +723,10 @@ function cmf_get_image_url($file, $style = 'watermark') */ function cmf_get_image_preview_url($file, $style = 'watermark') { + if (empty($file)) { + return ''; + } + if (strpos($file, "http") === 0) { return $file; } else if (strpos($file, "/") === 0) { @@ -745,6 +753,10 @@ function cmf_get_image_preview_url($file, $style = 'watermark') */ function cmf_get_file_download_url($file, $expires = 3600) { + if (empty($file)) { + return ''; + } + if (strpos($file, "http") === 0) { return $file; } else if (strpos($file, "/") === 0) { From 2a2fa55b9a609ff849db04747161aa82cac97ef1 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 22 Jun 2018 11:25:28 +0800 Subject: [PATCH 20/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=99=BE=E5=BA=A6?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E8=A7=86=E9=A2=91=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/js/ueditor/dialogs/video/video.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/static/js/ueditor/dialogs/video/video.js b/public/static/js/ueditor/dialogs/video/video.js index 0d82d72bd..b15b6e6ce 100644 --- a/public/static/js/ueditor/dialogs/video/video.js +++ b/public/static/js/ueditor/dialogs/video/video.js @@ -395,6 +395,7 @@ server: actionUrl, fileVal: editor.getOpt('videoFieldName'), duplicate: true, + timeout: 0, fileSingleSizeLimit: fileMaxSize, compress: false, chunked: true,//开启分片 From 5700c9ed1118a27dd213e78edeb9954e7cb7f6aa Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 22 Jun 2018 11:26:42 +0800 Subject: [PATCH 21/37] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E7=BC=A9=E7=95=A5=E5=9B=BE=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/portal/model/PortalPostModel.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/portal/model/PortalPostModel.php b/app/portal/model/PortalPostModel.php index fc0af1f25..88bc1fc16 100644 --- a/app/portal/model/PortalPostModel.php +++ b/app/portal/model/PortalPostModel.php @@ -91,6 +91,7 @@ public function adminAddArticle($data, $categories) if (!empty($data['more']['thumbnail'])) { $data['more']['thumbnail'] = cmf_asset_relative_url($data['more']['thumbnail']); + $data['thumbnail'] = $data['more']['thumbnail']; } $this->allowField(true)->data($data, true)->isUpdate(false)->save(); @@ -124,6 +125,7 @@ public function adminEditArticle($data, $categories) if (!empty($data['more']['thumbnail'])) { $data['more']['thumbnail'] = cmf_asset_relative_url($data['more']['thumbnail']); + $data['thumbnail'] = $data['more']['thumbnail']; } $this->allowField(true)->isUpdate(true)->data($data, true)->save(); From d87f2688b6ad31ad7dbcd81f8fc977a8c208a758 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 22 Jun 2018 11:29:40 +0800 Subject: [PATCH 22/37] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E5=AE=89=E8=A3=85sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/install/data/thinkcmf.sql | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/app/install/data/thinkcmf.sql b/app/install/data/thinkcmf.sql index 0bad27d04..0a0c5cc99 100644 --- a/app/install/data/thinkcmf.sql +++ b/app/install/data/thinkcmf.sql @@ -1105,3 +1105,32 @@ CREATE TABLE IF NOT EXISTS `cmf_verification_code` ( `account` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '手机号或者邮箱', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='手机邮箱数字验证码表'; + + +-- 增缩略图字段 +ALTER TABLE `cmf_portal_post` ADD `thumbnail` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '缩略图' AFTER `post_source`; + +ALTER TABLE `cmf_auth_rule` CHANGE `app` `app` VARCHAR(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '规则所属app'; + +ALTER TABLE `cmf_portal_post` ADD `post_favorites` INT UNSIGNED NOT NULL DEFAULT '0' COMMENT '收藏数' AFTER `post_hits`; + +ALTER TABLE `cmf_user_favorite` ADD `thumbnail` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '缩略图' AFTER `title`; + +ALTER TABLE `cmf_user_favorite` CHANGE `url` `url` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收藏内容的原文地址,JSON格式'; +ALTER TABLE `cmf_user_favorite` CHANGE `description` `description` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收藏内容的描述'; +ALTER TABLE `cmf_user_favorite` CHANGE `table_name` `table_name` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '收藏实体以前所在表,不带前缀'; + + +CREATE TABLE `cmf_user_like` IF NOT EXISTS `cmf_user_like`; ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `user_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '用户 id', + `object_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '内容原来的主键id', + `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + `table_name` varchar(64) NOT NULL DEFAULT '' COMMENT '内容以前所在表,不带前缀', + `url` varchar(255) NOT NULL DEFAULT '' COMMENT '内容的原文地址,JSON格式', + `title` varchar(100) NOT NULL DEFAULT '' COMMENT '内容的标题', + `thumbnail` varchar(100) NOT NULL DEFAULT '' COMMENT '缩略图', + `description` text COMMENT '内容的描述', + PRIMARY KEY (`id`), + KEY `uid` (`user_id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='用户点赞表'; From ba9a3d42b71d0ba4abe0990d3eea81b443f21ccf Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 22 Jun 2018 11:32:21 +0800 Subject: [PATCH 23/37] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update/update 5.0.180525 to 5.0.180626.sql | 28 ++++++++++++++++++++++ update/update.sql | 4 ---- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 update/update 5.0.180525 to 5.0.180626.sql delete mode 100644 update/update.sql diff --git a/update/update 5.0.180525 to 5.0.180626.sql b/update/update 5.0.180525 to 5.0.180626.sql new file mode 100644 index 000000000..35d456c07 --- /dev/null +++ b/update/update 5.0.180525 to 5.0.180626.sql @@ -0,0 +1,28 @@ +-- 增缩略图字段 +ALTER TABLE `cmf_portal_post` ADD `thumbnail` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '缩略图' AFTER `post_source`; + +ALTER TABLE `cmf_auth_rule` CHANGE `app` `app` VARCHAR(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '规则所属app'; + +ALTER TABLE `cmf_portal_post` ADD `post_favorites` INT UNSIGNED NOT NULL DEFAULT '0' COMMENT '收藏数' AFTER `post_hits`; + +ALTER TABLE `cmf_user_favorite` ADD `thumbnail` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '缩略图' AFTER `title`; + +ALTER TABLE `cmf_user_favorite` CHANGE `url` `url` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收藏内容的原文地址,JSON格式'; +ALTER TABLE `cmf_user_favorite` CHANGE `description` `description` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收藏内容的描述'; +ALTER TABLE `cmf_user_favorite` CHANGE `table_name` `table_name` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '收藏实体以前所在表,不带前缀'; + + +CREATE TABLE `cmf_user_like` IF NOT EXISTS `cmf_user_like`; ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `user_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '用户 id', + `object_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '内容原来的主键id', + `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + `table_name` varchar(64) NOT NULL DEFAULT '' COMMENT '内容以前所在表,不带前缀', + `url` varchar(255) NOT NULL DEFAULT '' COMMENT '内容的原文地址,JSON格式', + `title` varchar(100) NOT NULL DEFAULT '' COMMENT '内容的标题', + `thumbnail` varchar(100) NOT NULL DEFAULT '' COMMENT '缩略图', + `description` text COMMENT '内容的描述', + PRIMARY KEY (`id`), + KEY `uid` (`user_id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='用户点赞表'; + diff --git a/update/update.sql b/update/update.sql deleted file mode 100644 index 1917e1202..000000000 --- a/update/update.sql +++ /dev/null @@ -1,4 +0,0 @@ --- 增缩略图字段 -ALTER TABLE `cmf_portal_post` ADD `thumbnail` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '缩略图' AFTER `post_source`; - -ALTER TABLE `cmf_auth_rule` CHANGE `app` `app` VARCHAR(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '规则所属app'; \ No newline at end of file From 954725fccaa87322d2cee404d32c40c7903c2709 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 22 Jun 2018 11:43:42 +0800 Subject: [PATCH 24/37] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E8=A7=84=E5=88=99?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 ++++++++++++++++ app/install/data/thinkcmf.sql | 2 ++ update/update 5.0.180525 to 5.0.180626.sql | 2 ++ 3 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 3a1383263..6f23078fa 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,22 @@ http://www.thinkcmf.com/topic/index/index/cat/11.html https://github.com/thinkcmf/thinkcmf/issues ### 更新日志 +#### 5.0.180626 +* Restful api基类增加apiVerion属性 +* 修复邮箱验证码发送失败 +* 七牛插件增加东南亚节点 +* 优化百度编辑器视频上传 +* 优化get_client_ip()方法,默认使用高级模式 +* 前台模板文件解析标准化 +* 优化手机号检查支持国际手机号 +* 优化图片和文件链接转化函数 +* 增加插件REST api基类`PluginRestBaseController` +* 增加我的喜欢功能 + +[门户应用] +* 增加文章`thumbnail`字段 +* 增加文章收藏数功能 + #### 5.0.180525 * 修复ajax请求普通页面时返回格式为json * 优化图片链接生成 diff --git a/app/install/data/thinkcmf.sql b/app/install/data/thinkcmf.sql index 0a0c5cc99..1dadbf742 100644 --- a/app/install/data/thinkcmf.sql +++ b/app/install/data/thinkcmf.sql @@ -1134,3 +1134,5 @@ CREATE TABLE `cmf_user_like` IF NOT EXISTS `cmf_user_like`; ( PRIMARY KEY (`id`), KEY `uid` (`user_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='用户点赞表'; + +ALTER TABLE `cmf_user` CHANGE `mobile` `mobile` VARCHAR(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '中国手机不带国家代码,国际手机号格式为:国家代码-手机号'; diff --git a/update/update 5.0.180525 to 5.0.180626.sql b/update/update 5.0.180525 to 5.0.180626.sql index 35d456c07..5ecb08688 100644 --- a/update/update 5.0.180525 to 5.0.180626.sql +++ b/update/update 5.0.180525 to 5.0.180626.sql @@ -26,3 +26,5 @@ CREATE TABLE `cmf_user_like` IF NOT EXISTS `cmf_user_like`; ( KEY `uid` (`user_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='用户点赞表'; +ALTER TABLE `cmf_user` CHANGE `mobile` `mobile` VARCHAR(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '中国手机不带国家代码,国际手机号格式为:国家代码-手机号'; + From 4c5fba0eeb5af011d5195dd22ea20f10d91ce3b5 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 22 Jun 2018 12:00:27 +0800 Subject: [PATCH 25/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=92=8C=E5=8D=87=E7=BA=A7=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- public/index.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6f23078fa..755d58069 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ https://github.com/thinkcmf/thinkcmf/issues ### 更新日志 #### 5.0.180626 -* Restful api基类增加apiVerion属性 +* Restful api基类增加apiVersion属性 * 修复邮箱验证码发送失败 * 七牛插件增加东南亚节点 * 优化百度编辑器视频上传 @@ -138,6 +138,7 @@ https://github.com/thinkcmf/thinkcmf/issues * 优化图片和文件链接转化函数 * 增加插件REST api基类`PluginRestBaseController` * 增加我的喜欢功能 +* 升级TP到`5.0.20` [门户应用] * 增加文章`thumbnail`字段 diff --git a/public/index.php b/public/index.php index c858956b3..9ce10883e 100644 --- a/public/index.php +++ b/public/index.php @@ -32,7 +32,7 @@ define('RUNTIME_PATH', CMF_ROOT . 'data/runtime/'); // 定义CMF 版本号 -define('THINKCMF_VERSION', '5.0.180525'); +define('THINKCMF_VERSION', '5.0.180626'); // 加载框架基础文件 require CMF_ROOT . 'simplewind/thinkphp/base.php'; From 4a640473fc935f86a60242151697b25e390c62f4 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 22 Jun 2018 12:01:35 +0800 Subject: [PATCH 26/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 755d58069..6aeef99ef 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -ThinkCMF 5.0.180525 正式版 +ThinkCMF 5.0.180626 Beta版 =============== ### 系列讲座 From 950ef7cf73e077991babbb468212f7deee80eddc Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 22 Jun 2018 12:37:24 +0800 Subject: [PATCH 27/37] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Demo=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=20API=E6=8E=A7=E5=88=B6=E5=99=A8=E6=BC=94=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/controller/ApiIndexController.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 public/plugins/demo/controller/ApiIndexController.php diff --git a/public/plugins/demo/controller/ApiIndexController.php b/public/plugins/demo/controller/ApiIndexController.php new file mode 100644 index 000000000..568edab9c --- /dev/null +++ b/public/plugins/demo/controller/ApiIndexController.php @@ -0,0 +1,23 @@ + +// +---------------------------------------------------------------------- +namespace plugins\demo\controller; //Demo插件英文名,改成你的插件英文就行了 +use cmf\controller\PluginRestBaseController; +use plugins\Demo\Model\PluginDemoModel; +use think\Db; + +class ApiIndexController extends PluginRestBaseController +{ + + public function index() + { + + $this->success('success', ['hello' => 'hello ThinkCMF!']); + } + +} From f55e721d9819dd4fb5e1d16c65da3298805c9630 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 22 Jun 2018 15:13:20 +0800 Subject: [PATCH 28/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=A9=BA=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/plugins/demo/controller/ApiIndexController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/public/plugins/demo/controller/ApiIndexController.php b/public/plugins/demo/controller/ApiIndexController.php index 568edab9c..e9ffe9a88 100644 --- a/public/plugins/demo/controller/ApiIndexController.php +++ b/public/plugins/demo/controller/ApiIndexController.php @@ -16,7 +16,6 @@ class ApiIndexController extends PluginRestBaseController public function index() { - $this->success('success', ['hello' => 'hello ThinkCMF!']); } From b27dc474a1bfb158ee3e296afd30efc9318d634c Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Fri, 22 Jun 2018 15:34:06 +0800 Subject: [PATCH 29/37] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/install/data/thinkcmf.sql | 4 ++-- update/update 5.0.180525 to 5.0.180626.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/install/data/thinkcmf.sql b/app/install/data/thinkcmf.sql index 1dadbf742..0b34a39c6 100644 --- a/app/install/data/thinkcmf.sql +++ b/app/install/data/thinkcmf.sql @@ -1121,13 +1121,13 @@ ALTER TABLE `cmf_user_favorite` CHANGE `description` `description` TEXT CHARACTE ALTER TABLE `cmf_user_favorite` CHANGE `table_name` `table_name` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '收藏实体以前所在表,不带前缀'; -CREATE TABLE `cmf_user_like` IF NOT EXISTS `cmf_user_like`; ( +CREATE TABLE `cmf_user_like` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `user_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '用户 id', `object_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '内容原来的主键id', `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `table_name` varchar(64) NOT NULL DEFAULT '' COMMENT '内容以前所在表,不带前缀', - `url` varchar(255) NOT NULL DEFAULT '' COMMENT '内容的原文地址,JSON格式', + `url` varchar(255) NOT NULL DEFAULT '' COMMENT '内容的原文地址,不带域名', `title` varchar(100) NOT NULL DEFAULT '' COMMENT '内容的标题', `thumbnail` varchar(100) NOT NULL DEFAULT '' COMMENT '缩略图', `description` text COMMENT '内容的描述', diff --git a/update/update 5.0.180525 to 5.0.180626.sql b/update/update 5.0.180525 to 5.0.180626.sql index 5ecb08688..e5ef02955 100644 --- a/update/update 5.0.180525 to 5.0.180626.sql +++ b/update/update 5.0.180525 to 5.0.180626.sql @@ -12,13 +12,13 @@ ALTER TABLE `cmf_user_favorite` CHANGE `description` `description` TEXT CHARACTE ALTER TABLE `cmf_user_favorite` CHANGE `table_name` `table_name` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '收藏实体以前所在表,不带前缀'; -CREATE TABLE `cmf_user_like` IF NOT EXISTS `cmf_user_like`; ( +CREATE TABLE `cmf_user_like` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `user_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '用户 id', `object_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '内容原来的主键id', `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `table_name` varchar(64) NOT NULL DEFAULT '' COMMENT '内容以前所在表,不带前缀', - `url` varchar(255) NOT NULL DEFAULT '' COMMENT '内容的原文地址,JSON格式', + `url` varchar(255) NOT NULL DEFAULT '' COMMENT '内容的原文地址,不带域名', `title` varchar(100) NOT NULL DEFAULT '' COMMENT '内容的标题', `thumbnail` varchar(100) NOT NULL DEFAULT '' COMMENT '缩略图', `description` text COMMENT '内容的描述', From 41f70b0ba3d136ebf85d5ef8b061af74cc81921a Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Mon, 25 Jun 2018 10:30:20 +0800 Subject: [PATCH 30/37] =?UTF-8?q?=E6=96=87=E7=AB=A0=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=B2=A1=E7=BC=A9=E7=95=A5=E5=9B=BE=E6=97=B6=EF=BC=8C=E7=94=A8?= =?UTF-8?q?x=E8=A1=A8=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/themes/admin_simpleboot3/portal/admin_article/index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/themes/admin_simpleboot3/portal/admin_article/index.html b/public/themes/admin_simpleboot3/portal/admin_article/index.html index 74c038695..1937c1bce 100644 --- a/public/themes/admin_simpleboot3/portal/admin_article/index.html +++ b/public/themes/admin_simpleboot3/portal/admin_article/index.html @@ -148,6 +148,8 @@ + + From f436ad23129c8a44fec5fb01c94e13cc0f89ecb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E9=9D=A1=E5=85=A8=E7=90=83=E5=B0=91=E5=A5=B3?= =?UTF-8?q?=E7=9A=84=E5=B0=8F=E5=A4=8F?= <449134904@qq.com> Date: Mon, 25 Jun 2018 10:56:04 +0800 Subject: [PATCH 31/37] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E4=B8=8B=E7=9A=84=E5=AD=90=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/portal/service/ApiService.php | 39 +++++++++++++++++-------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/app/portal/service/ApiService.php b/app/portal/service/ApiService.php index 9ff0671d2..c03225f7d 100644 --- a/app/portal/service/ApiService.php +++ b/app/portal/service/ApiService.php @@ -333,23 +333,28 @@ public static function category($id) return $portalCategoryModel->where($where)->find(); } - /** - * 返回指定分类下的子分类 - * @param int $categoryId 分类id - * @return false|\PDOStatement|string|\think\Collection 返回指定分类下的子分类 - */ - public static function subCategories($categoryId) - { - $portalCategoryModel = new PortalCategoryModel(); - - $where = [ - 'status' => 1, - 'delete_time' => 0, - 'parent_id' => $categoryId - ]; - - return $portalCategoryModel->where($where)->select(); - } + /** + * 返回指定分类下的子分类 + * @param int $categoryId 分类id + * @return false|\PDOStatement|string|\think\Collection 返回指定分类下的子分类 + * @param $field string 指定查询字段 + * @return false|\PDOStatement|string|\think\Collection + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + */ + public static function subCategories($categoryId,$field='*') + { + $portalCategoryModel = new PortalCategoryModel(); + + $where = [ + 'status' => 1, + 'delete_time' => 0, + 'parent_id' => $categoryId + ]; + + return $portalCategoryModel->field($field)->where($where)->select(); + } /** * 返回指定分类下的所有子分类 From 6771881078a592adb3e4b323ebf8b2272d7a1d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E9=9D=A1=E5=85=A8=E7=90=83=E5=B0=91=E5=A5=B3?= =?UTF-8?q?=E7=9A=84=E5=B0=8F=E5=A4=8F?= <449134904@qq.com> Date: Mon, 25 Jun 2018 10:57:15 +0800 Subject: [PATCH 32/37] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E4=B8=8B=E7=9A=84=E5=AD=90=E5=88=86=E7=B1=BB?= =?UTF-8?q?=20=20=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/portal/service/ApiService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/portal/service/ApiService.php b/app/portal/service/ApiService.php index c03225f7d..68078ff92 100644 --- a/app/portal/service/ApiService.php +++ b/app/portal/service/ApiService.php @@ -336,12 +336,12 @@ public static function category($id) /** * 返回指定分类下的子分类 * @param int $categoryId 分类id - * @return false|\PDOStatement|string|\think\Collection 返回指定分类下的子分类 * @param $field string 指定查询字段 * @return false|\PDOStatement|string|\think\Collection * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException + * @return false|\PDOStatement|string|\think\Collection 返回指定分类下的子分类 */ public static function subCategories($categoryId,$field='*') { From 53d0ad551a14e60f5eb947021a92c253bf571df2 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Mon, 25 Jun 2018 19:03:37 +0800 Subject: [PATCH 33/37] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20android,ios=20?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- simplewind/cmf/common.php | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6aeef99ef..485283e30 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -ThinkCMF 5.0.180626 Beta版 +ThinkCMF 5.0.180626 正式版 =============== ### 系列讲座 diff --git a/simplewind/cmf/common.php b/simplewind/cmf/common.php index 073e2ddfb..f530c554f 100644 --- a/simplewind/cmf/common.php +++ b/simplewind/cmf/common.php @@ -938,6 +938,32 @@ function cmf_is_wechat() return false; } +/** + * 判断是否为Android访问 + * @return boolean + */ +function cmf_is_android() +{ + if (strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false) { + return true; + } + return false; +} + +/** + * 判断是否为ios访问 + * @return boolean + */ +function cmf_is_ios() +{ + if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')) { + { + return true; + } + return false; + } +} + /** * 添加钩子 * @param string $hook 钩子名称 From 9c708ff86d7f919a48a86b1178122828dd8be793 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Tue, 26 Jun 2018 06:38:58 +0800 Subject: [PATCH 34/37] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20iphone,ipad=20?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplewind/cmf/common.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/simplewind/cmf/common.php b/simplewind/cmf/common.php index f530c554f..73d76466c 100644 --- a/simplewind/cmf/common.php +++ b/simplewind/cmf/common.php @@ -964,6 +964,34 @@ function cmf_is_ios() } } +/** + * 判断是否为iPhone访问 + * @return boolean + */ +function cmf_is_iphone() +{ + if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')) { + { + return true; + } + return false; + } +} + +/** + * 判断是否为iPad访问 + * @return boolean + */ +function cmf_is_ipad() +{ + if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')) { + { + return true; + } + return false; + } +} + /** * 添加钩子 * @param string $hook 钩子名称 From ca958913269ee66a366b28716cb482024ff7a8e7 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Tue, 26 Jun 2018 06:45:39 +0800 Subject: [PATCH 35/37] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 485283e30..51c6ccbea 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ https://github.com/thinkcmf/thinkcmf/issues * 增加插件REST api基类`PluginRestBaseController` * 增加我的喜欢功能 * 升级TP到`5.0.20` +* 增加手机相关设备类型判断 [门户应用] * 增加文章`thumbnail`字段 From 992c65bee7266a6552857f53482990549e45563e Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Tue, 26 Jun 2018 06:52:17 +0800 Subject: [PATCH 36/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 51c6ccbea..4a2ad2dbc 100644 --- a/README.md +++ b/README.md @@ -128,18 +128,18 @@ https://github.com/thinkcmf/thinkcmf/issues ### 更新日志 #### 5.0.180626 -* Restful api基类增加apiVersion属性 -* 修复邮箱验证码发送失败 -* 七牛插件增加东南亚节点 +* 升级TP到`5.0.20` +* 增加插件REST api基类`PluginRestBaseController` +* 增加我的喜欢功能 +* 增加手机相关设备类型判断函数 * 优化百度编辑器视频上传 * 优化get_client_ip()方法,默认使用高级模式 -* 前台模板文件解析标准化 * 优化手机号检查支持国际手机号 * 优化图片和文件链接转化函数 -* 增加插件REST api基类`PluginRestBaseController` -* 增加我的喜欢功能 -* 升级TP到`5.0.20` -* 增加手机相关设备类型判断 +* Restful api基类增加apiVersion属性 +* 修复邮箱验证码发送失败 +* 七牛插件增加东南亚节点 +* 前台模板文件解析标准化 [门户应用] * 增加文章`thumbnail`字段 From 78b07855f422c7c847ce1c8ada8155082c71adf6 Mon Sep 17 00:00:00 2001 From: zxxjjforever Date: Tue, 26 Jun 2018 07:06:21 +0800 Subject: [PATCH 37/37] =?UTF-8?q?=20=E4=B8=83=E7=89=9B=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/plugins/qiniu/QiniuPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/plugins/qiniu/QiniuPlugin.php b/public/plugins/qiniu/QiniuPlugin.php index 1f1834781..339cd016c 100644 --- a/public/plugins/qiniu/QiniuPlugin.php +++ b/public/plugins/qiniu/QiniuPlugin.php @@ -18,7 +18,7 @@ class QiniuPlugin extends Plugin public $info = [ 'name' => 'Qiniu', 'title' => '七牛云存储', - 'description' => '七牛云存储', + 'description' => 'ThinkCMF七牛专享优惠码:507670e8', 'status' => 1, 'author' => 'ThinkCMF', 'version' => '1.0'