Skip to content

Commit

Permalink
version 1.0
Browse files Browse the repository at this point in the history
个人中心功能实现
  • Loading branch information
Yurisa committed Aug 22, 2017
0 parents commit 13f0d66
Show file tree
Hide file tree
Showing 628 changed files with 185,865 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
1 change: 1 addition & 0 deletions Application/Common/Common/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

4 changes: 4 additions & 0 deletions Application/Common/Conf/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
return array(
//'配置项'=>'配置值'
);
1 change: 1 addition & 0 deletions Application/Common/Conf/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions Application/Common/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

12 changes: 12 additions & 0 deletions Application/Home/Common/function.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

function log_result($file,$word)
{
$file= "./notify.log";//log文件路径

$fp = fopen($file,"a");
flock($fp, LOCK_EX) ;
fwrite($fp,"执行日期:".date("Y-m-d H:i:s",time())." ".$word."\r\n");
flock($fp, LOCK_UN);
fclose($fp);
}
1 change: 1 addition & 0 deletions Application/Home/Common/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

23 changes: 23 additions & 0 deletions Application/Home/Conf/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
return array(
//'配置项'=>'配置值'
'URL_MODEL' => '1',

'URL_CASE_INSENSITIVE' =>true ,
'DB_TYPE' => 'mysql',
'DB_HOST' => 'localhost',
'DB_NAME' => 'zuji',
'DB_USER' => 'root',
'DB_PWD' => '',
'DB_PORT' => 3307,
'DB_PREFIX' => '',
'DB_CHARSET' => 'utf8',
'DB_FIELDTYPE_CHECK' => false, // 是否进行字段类型检查
'DB_FIELDS_CACHE' => false, // 启用字段缓存
'DB_DEPLOY_TYPE' => 0, // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'DB_RW_SEPARATE' => false, // 数据库读写是否分离 主从式有效
'DB_MASTER_NUM' => 1, // 读写分离后 主服务器数量
'DB_SQL_BUILD_CACHE' => false, // 数据库查询的SQL创建缓存
'DB_SQL_BUILD_QUEUE' => 'file', // SQL缓存队列的缓存方式 支持 file xcache和apc
'DB_SQL_BUILD_LENGTH' => 20,
);
1 change: 1 addition & 0 deletions Application/Home/Conf/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

40 changes: 40 additions & 0 deletions Application/Home/Controller/CommonController.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
namespace Home\Controller;
use Think\Controller;
use Org\Util\String;

class CommonController extends Controller {

function __construct(){
parent::__construct();
header("Content-Type: text/html;charset=utf-8");
}

public function json($code, $result = 'ok', $body = NULL)
{
echo json_encode(array(
'code' => $code,
'result' => $result,
'body' => $body
));
exit();
}

//百度经纬度计算两地距离
function distanceBetween($fP1Lat, $fP1Lon, $fP2Lat, $fP2Lon){
$fEARTH_RADIUS = 6378137;
//角度换算成弧度
$fRadLon1 = deg2rad($fP1Lon);
$fRadLon2 = deg2rad($fP2Lon);
$fRadLat1 = deg2rad($fP1Lat);
$fRadLat2 = deg2rad($fP2Lat);
//计算经纬度的差值
$fD1 = abs($fRadLat1 - $fRadLat2);
$fD2 = abs($fRadLon1 - $fRadLon2);
//距离计算
$fP = pow(sin($fD1/2), 2) +
cos($fRadLat1) * cos($fRadLat2) * pow(sin($fD2/2), 2);
return intval($fEARTH_RADIUS * 2 * asin(sqrt($fP)) + 0.5);
}

}
66 changes: 66 additions & 0 deletions Application/Home/Controller/IndexController.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
namespace Home\Controller;

use Home\Controller\CommonController;
use Org\Util\Upload;
use Org\Util\Image;
use Think\Controller;
class IndexController extends Controller {

public function index(){

}
/**
* 上传图片
*/
Public function uploadImg()
{
$dir = './Uploads/img';
$dir_1 = $dir . '/' . date('Ym');
$dir_2 = $dir_1 . '/' . date('d');
if (! file_exists($dir_1))
@mkdir($dir_1);
if (! file_exists($dir_2))
@mkdir($dir_2);

if (isset($_FILES['file'])) {
$config = array(
'size' => 1024 * 1024 * 10,
'type' => array(
'image/png',
'image/jpeg',
'image/jpg'
),
'path' => $dir_2 . '/'
);

import('ORG.Util.Upload');
//$this->json(0, '测试下', $file);
$upload = new \Org\Util\Upload($config);

$file = $upload->receive($_FILES['file']);
// Image::water($file,"./ThinkPHP/zuji.png",null,50);
$image = new \Think\Image();
// 在图片左上角添加水印(水印文件位于./logo.png) 水印图片的透明度为50 并保存为water.jpg
$image->open($file)->water('./ThinkPHP/zuji.png',\Think\Image::IMAGE_WATER_NORTHWEST,50)->save($file);
if (is_file($file)) {

$width = I('request.width', NULL);
if ($width !== NULL) {
import('ORG.Util.Image');
$pathinfo = pathinfo($file);
$height = 999999999999;
$file = Image::thumb($file, $config['path'] . $pathinfo['filename'] . 'Wx' . $width . '.' . $pathinfo['extension'], strtolower($pathinfo['extension']), $width, $height);
}
$id = D('Img')->send($file);
$this->json(1, 'ok', array(
'id' => $id,
'file' => $file
));
} else {
$this->json(0, '文件上传失败', $file);
}
}
$this->json(0, '请选择文件');
}
}
Loading

0 comments on commit 13f0d66

Please sign in to comment.