目录结构更新,增加composer支持

This commit is contained in:
2018-01-14 09:41:28 +08:00
parent ae46a73172
commit 0c7d06de51
29 changed files with 506 additions and 0 deletions

42
.travis.yml Normal file
View File

@@ -0,0 +1,42 @@
sudo: false
language: php
branches:
only:
- stable
cache:
directories:
- $HOME/.composer/cache
before_install:
- composer self-update
install:
- composer install --no-dev --no-interaction --ignore-platform-reqs
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
- composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
- composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
script:
- php think unit
deploy:
provider: releases
api_key:
secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
file:
- ThinkPHP_Core.zip
- ThinkPHP_Full.zip
skip_cleanup: true
on:
tags: true

32
LICENSE.txt Normal file
View File

@@ -0,0 +1,32 @@
ThinkPHP遵循Apache2开源协议发布并提供免费使用。
版权所有Copyright © 2006-2017 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
Apache Licence是著名的非盈利开源组织Apache采用的协议。
该协议和BSD类似鼓励代码共享和尊重原作者的著作权
允许代码修改,再作为开源或商业软件发布。需要满足
的条件:
1 需要给代码的用户一份Apache Licence
2 如果你修改了代码,需要在被修改的文件中说明;
3 在延伸的代码中(修改和有源代码衍生的代码中)需要
带有原来代码中的协议,商标,专利声明和其他原来作者规
定需要包含的说明;
4 如果再发布的产品中包含一个Notice文件则在Notice文
件中需要带有本协议内容。你可以在Notice中增加自己的
许可但不可以表现为对Apache Licence构成更改。
具体的协议参考http://www.apache.org/licenses/LICENSE-2.0
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

1
application/.htaccess Normal file
View File

@@ -0,0 +1 @@
deny from all

View File

@@ -0,0 +1,7 @@
<?php
namespace app\admin\controller;
class Goods
{
}

View File

@@ -0,0 +1 @@
<?php

12
application/command.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
return [];

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1,5 @@
<?php
//配置文件
return [
];

View File

@@ -0,0 +1,158 @@
<?php
namespace app\common\model;
class Member extends Base {
protected $createTime = 'reg_time';
protected $updateTime = 'last_login_time';
protected $insert = array('status'=>1, 'reg_time');
protected $type = array(
'uid' => 'integer',
'reg_time' => 'integer'
);
protected function getGroupListAttr($value, $data){
$sql = db('AuthGroupAccess')->where('uid', $data['uid'])->fetchSql(true)->column('group_id');
return db('AuthGroup')->where('id in ('.$sql.')')->column('title', 'id');
}
/**
* 用户登录模型
* @param string $username [description]
* @param string $password [description]
* @param integer $type 登录类型1为用户名登录2为邮箱登录3为手机登录4为用户ID登录5为微信登录
* @return [type] [description]
*/
public function login($username = '', $password = '', $type = 1) {
$map = array();
if (\think\Validate::is($username, 'email')) {
$type = 2;
} elseif (preg_match("/^1[34578]{1}\d{9}$/", $username)) {
$type = 3;
}
switch ($type) {
case 1:
$map['username'] = $username;
break;
case 2:
$map['email'] = $username;
break;
case 3:
$map['mobile'] = $username;
break;
case 4:
$map['uid'] = $username;
break;
case 5:
$map['openid'] = $username;
break;
default:
return 0; //参数错误
}
if (!$username) {
return false;
}
$user = $this->where($map)->find();
if (isset($user['uid']) && $user['uid'] && $user['status']) {
if ($type == 3) {
//手机验证手机动态密码
if ($password == session('mobile_login_code')) {
$this->autoLogin($user); //更新用户登录信息
return $user['uid'];
}else{
return -5;
}
} elseif ($type == 5) {
$this->autoLogin($user); //更新用户登录信息
return $user['uid'];
} else {
/* 验证用户密码 */
if (md5($password . $user['salt']) === $user['password']) {
$this->autoLogin($user); //更新用户登录信息
return $user['uid']; //登录成功返回用户ID
} else {
return -2; //密码错误
}
}
} else {
if ($type == 3 && preg_match("/^1[34578]{1}\d{9}$/", $username) && $password == session('mobile_login_code')) {
$data = array(
'username' => $username,
'mobile' => $username,
'salt' => rand_string(6),
'password' => $password,
);
$result = $this->save($data);
if ($result) {
$this->autoLogin($this->data); //更新用户登录信息
}
return $this->data['uid'];
} else {
return -1; //用户不存在或被禁用
}
}
}
/**
* 用户注册
* @param integer $user 用户信息数组
*/
function register($username, $password, $repassword, $email, $isautologin = true, $other = array()){
$data['username'] = $username;
$data['salt'] = rand_string(6);
$data['password'] = $password;
$data['repassword'] = $repassword;
$data['email'] = $email;
if (!empty($other)) {
$data = array_merge($data, $other);
}
$result = $this->validate(true)->save($data);
if ($result) {
$data['uid'] = $this->data['uid'];
if ($isautologin) {
$this->autoLogin($this->data);
}
return $result;
}else{
if (!$this->getError()) {
$this->error = "注册失败!";
}
return false;
}
}
/**
* 自动登录用户
* @param integer $user 用户信息数组
*/
private function autoLogin($user){
/* 更新登录信息 */
$data = array(
'uid' => $user['uid'],
'login' => array('exp', '`login`+1'),
'last_login_time' => time(),
'last_login_ip' => get_client_ip(1),
);
$this->where(array('uid'=>$user['uid']))->update($data);
$user = $this->where(array('uid'=>$user['uid']))->find();
/* 记录登录SESSION和COOKIES */
$auth = array(
'uid' => $user['uid'],
'username' => $user['username'],
'last_login_time' => $user['last_login_time'],
);
session('user_auth', $auth);
session('user_auth_sign', data_auth_sign($auth));
}
public function logout(){
session('user_auth', null);
session('user_auth_sign', null);
}
}

View File

@@ -0,0 +1,18 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
return [
// 验证码字体大小
'fontSize' => 25,
// 验证码位数
'length' => 3,
// 关闭验证码杂点
'useNoise' => false,
'useZh' => true
];

View File

@@ -0,0 +1,28 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
return [
'text' => ['title' => '单行文本', 'type' => 'varchar'],
'string' => ['title' => '字符串', 'type' => 'int'],
'password' => ['title' => '密码', 'type' => 'varchar'],
'textarea' => ['title' => '文本框', 'type' => 'text'],
'bool' => ['title' => '布尔型', 'type' => 'int'],
'select' => ['title' => '选择', 'type' => 'varchar'],
'num' => ['title' => '数字', 'type' => 'int'],
'decimal' => ['title' => '金额', 'type' => 'decimal'],
'tags' => ['title' => '标签', 'type' => 'varchar'],
'datetime' => ['title' => '时间控件', 'type' => 'int'],
'date' => ['title' => '日期控件', 'type' => 'varchar'],
'editor' => ['title' => '编辑器', 'type' => 'text'],
'bind' => ['title' => '模型绑定', 'type' => 'int'],
'image' => ['title' => '图片上传', 'type' => 'int'],
'images' => ['title' => '多图上传', 'type' => 'varchar'],
'attach' => ['title' => '文件上传', 'type' => 'varchar'],
];

View File

@@ -0,0 +1,6 @@
<?php
return array(
'template' => array(
'view_depr' => '_'
)
);

View File

@@ -0,0 +1,37 @@
<?php
namespace app\index\controller;
use EasyWeChat\Factory;
/**
* 微信
*/
class Wechat {
public function __construct() {
$this->options = [
'app_id' => 'wx3cf0f39249eb0exxx',
'secret' => 'f1c242f4f28f735d4687abb469072xxx',
'token' => 'easywechat',
'log' => [
'level' => 'debug',
'file' => RUNTIME_PATH . '/easywechat.log',
],
];
}
public function index(){
$app = Factory::officialAccount($this->options);
$server = $app->server;
$user = $app->user;
// $server->push(function($message) use ($user) {
// $fromUser = $user->get($message['FromUserName']);
// return "{$fromUser->nickname} 您好!欢迎关注 overtrue!";
// });
$server->serve()->send();
}
}

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1,5 @@
<?php
//配置文件
return [
];

28
build.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return [
// 生成应用公共文件
'__file__' => ['common.php', 'config.php', 'database.php'],
// 定义demo模块的自动生成 (按照实际定义的文件名生成)
'admin' => [
// '__file__' => ['common.php'],
'__dir__' => ['behavior', 'controller', 'model', 'view'],
'controller' => ['Fornt', 'Admin', 'Base', 'User'],
'model' => ['User', 'UserType'],
//'view' => ['index/index'],
],
'user' => [
'__dir__' => ['controller'],
]
// 其他更多的模块定义
];

41
composer.json Normal file
View File

@@ -0,0 +1,41 @@
{
"name": "topthink/think",
"description": "the new thinkphp framework",
"type": "project",
"keywords": [
"framework",
"thinkphp",
"ORM"
],
"homepage": "http://thinkphp.cn/",
"license": "Apache-2.0",
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"require": {
"php": ">=5.4.0",
"topthink/framework": "5.0.*",
"topthink/think-migration": "^2.0",
"topthink/think-captcha": "1.0.7",
"topthink/think-image": "^1.0",
"topthink/think-helper": "^1.0",
"overtrue/wechat": "~4.0",
"overtrue/easy-sms": "^1.0",
"riverslei/payment": "*",
"5ini99/think-auth": "^1.0"
},
"autoload": {
"psr-4": {
"app\\": "application"
}
},
"extra": {
"think-path": "framework"
},
"config": {
"preferred-install": "dist"
}
}

2
extend/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

17
think Normal file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env php
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
// 定义项目路径
define('APP_PATH', __DIR__ . '/application/');
// 加载框架引导文件
require __DIR__.'/framework/console.php';

8
web/.htaccess Normal file
View File

@@ -0,0 +1,8 @@
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

BIN
web/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

24
web/index.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
// [ 应用入口文件 ]
if(version_compare(PHP_VERSION,'5.4.0','<')) die('require PHP > 5.4.0 !');
// 定义应用目录
define('APP_PATH', __DIR__ . '/../application/');
define('BASE_PATH', substr($_SERVER['SCRIPT_NAME'], 0, -10));
/**
* 缓存目录设置
* 此目录必须可写建议移动到非WEB目录
*/
define ( 'RUNTIME_PATH', __DIR__ . '/../data/' );
// 加载框架引导文件
require __DIR__ . '/../framework/start.php';

2
web/robots.txt Normal file
View File

@@ -0,0 +1,2 @@
User-agent: *
Disallow:

17
web/router.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) {
return false;
} else {
if (!isset($_SERVER['PATH_INFO'])) {
$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'];
}
require __DIR__ . "/index.php";
}

2
web/static/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -0,0 +1 @@
{__TPL__}

View File

@@ -0,0 +1,9 @@
<?php
return array(
'name' => '默认模板', //模板名称
'remark' => '模板名称.', // 模板简单介绍
'img' => 'logo.png', // 后台显示模板缩列图 相对于模板目录路径
'type' => 'pc', //模板类型pc为PC端模板mobile为手机端模板
'version' => 'v1', // 模板版本
'author' => '郭平平', // 作者
);

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

View File

@@ -0,0 +1 @@
测试