Commit 1ad14f1a by zhangheng

y

parent a36ccfbd
......@@ -42,5 +42,14 @@
<arguments>1.0-name-matches-false-false-node_modules</arguments>
</matcher>
</filter>
<filter>
<id>1566715415719</id>
<name></name>
<type>26</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-node_modules</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
......@@ -21,21 +21,21 @@ return array(
'MODULE_ALLOW_LIST' => array('Home', 'Cli', 'Api', 'User'),
'SHOW_PAGE_TRACE' => false,
'ERROR_PAGE' =>'/50x.html',
'SITE_URL' => 'http://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'dencare-year.dev.izhida.cn'),
'PUBLISH_MODE' => 'production', // development,test,production
'UPLOAD_SITEIMG_QINIU' => array(
'maxSize' => 5 * 1024 * 1024,//文件大小
'rootPath' => './',
'saveName' => array('uniqid', ''),
'driver' => 'Qiniu',
'driverConfig' => array(
'accessKey' => 'ggMPohY9_87Q69nDYUMwvR7XqlLYAREH-btbJG3U',
'secrectKey' => 'OPzIqCWVMDs7tAYjPi9Hn7JkxBj2CtHARCCEnrdd',
'domain' => 'media.izhida.cn',
'bucket' => 'media',
// 'domain' => '7xjtzd.com2.z0.glb.qiniucdn.com',
// 'bucket' => 'zhida-yingxiaoyi',
),
),
'SITE_URL' => 'http://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'moli.gnhj.izhida.cn'),
'PUBLISH_MODE' => 'production', // development,test,production
// 'UPLOAD_SITEIMG_QINIU' => array(
// 'maxSize' => 5 * 1024 * 1024,//文件大小
// 'rootPath' => './',
// 'saveName' => array('uniqid', ''),
// 'driver' => 'Qiniu',
// 'driverConfig' => array(
// 'accessKey' => 'ggMPohY9_87Q69nDYUMwvR7XqlLYAREH-btbJG3U',
// 'secrectKey' => 'OPzIqCWVMDs7tAYjPi9Hn7JkxBj2CtHARCCEnrdd',
// 'domain' => '7xou29.media1.z0.glb.clouddn.com',
// 'bucket' => 'zhida-stream',
//// 'domain' => '7xjtzd.com2.z0.glb.qiniucdn.com',
//// 'bucket' => 'zhida-yingxiaoyi',
// ),
// ),
);
\ No newline at end of file
<?php
return array(
'DB_TYPE' => 'mysql',
'DB_HOST' => 'localhost',
'DB_PORT' => '3306',
'DB_NAME' => 'dev_dencare_20181221_year', // <--- 修改这里
'DB_USER' => 'dev', // <--- 修改这里
'DB_PWD' => '1q2w3e', // <--- 修改这里
'DB_PREFIX' => '',
'DB_CHARSET' => 'utf8mb4',
);
//return array(
// 'DB_TYPE' => 'mysql',
// 'DB_HOST' => 'localhost',
// 'DB_PORT' => '3306',
// 'DB_NAME' => 'dev_dencare_20170119_photo', // <--- 修改这里
// 'DB_USER' => 'dev', // <--- 修改这里
// 'DB_PWD' => '1q2w3e', // <--- 修改这里
// 'DB_PREFIX' => '',
// 'DB_CHARSET' => 'utf8mb4',
//);
//return array(
// 'DB_TYPE' => 'mysql',
......
......@@ -81,11 +81,15 @@ trait ControllerTrait
'openid' => $openid
);
} else {
// unset($data['privilege']);
// $user = $data['user'];
unset($data['privilege']);
$user = array();
$user['openid'] = $data['user']['openid'];
$user['nickname'] = $data['user']['nickname'];
// $user['city'] = $data['user']['city'];
// $user['sex'] = $data['user']['sex'];
$user['headimgurl'] = preg_replace('@(/0)$@', '/132', $data['user']['headimgurl']);
$user['info'] = json_encode($data);
}
......@@ -94,11 +98,11 @@ trait ControllerTrait
if ($old_user) {
M('User')->token(false)->where(array('openid' => $openid))->save($user);
} else {
$user['created_at'] = $_SERVER['REQUEST_TIME'];
// $user['reg_ip'] = getIP();
$user['last_visit'] = time();
// $user['last_ip'] = getIP();
// $user['reg_ip'] = $this->getIP();
// $user['last_visit'] = time();
$user['last_ip'] = $this->getIP();
M('User')->token(false)->add($user);
}
$_SESSION['is_wechat'] = 1;
......
......@@ -11,7 +11,6 @@ use Think\Log;
class IndexController extends Controller
{
private $auth_type = OAuthHelperV3::SCOPE_BASE;
// private $auth_type = OAuthHelperV3::SCOPE_USERINFO;
private $cookie_uid_key = 'mtime-laopao-v1';
private $debug = 1;
private $today;
......@@ -42,275 +41,12 @@ class IndexController extends Controller
public function index()
{
$user = $this->get_user_info_from_cookie();
// 如果没有获取到用户信息,引导用户授权
if (!$user) {
$this->request_auth($this->get_url());
return;
}
$list = glob('Public/static/images/*');
foreach ($list as $key => $value) {
$list[$key] = '/' . $value;
}
// 计算统计使用的app_stat_key
$app_key = md5($this->app_stat_key);
// 将值传递给view页面
$image = json_encode($list);
$this->assign('image', $image);
// 展示页面
$this->display();
}
public function get_random_prize($user)
{
$v = rand(0, 1000000) / 1000000;
$today_ratio = 1;
if ($v > $today_ratio) {
return false;
}
// if (stripos($user['openid'], 'fake_') !== false) {
// return false;
// }
// $user_prize = M('UserPrize')->where(array(
// 'tel' => $_POST['tel']
// ))->find();
// if ($user_prize) {
// return false;
// }
$now = time();
$req_type = array();
$type_list = array(1, 2, 3, 4, 5);
$from = strtotime(date('Y-m-d', $now));
$to = strtotime(date('Y-m-d', $now + 86400));
foreach ($type_list as $type) {
$c = M('prize')->where(array(
'type' => $type,
'take_time' => array(array('gt', $from), array('lt', $to)),
'is_get' => 1,
))->count();
// 1是电影票
if ($type == 1) {
if ($c >= 2) {
continue;
}
}
// 1牙膏
if ($type == 2) {
if ($c >= 2) {
continue;
}
}
// 3是手机
if ($type == 3) {
if ($c >= 1) {
continue;
}
}
// 4是吹风机
if ($type == 4) {
if ($c >= 2) {
continue;
}
}
$req_type[] = $type;
}
if (empty($req_type)) {
return false;
}
$prize = M('Prize')->where(array(
'reward_time' => array('elt', $now),
'is_get' => 0,
'user_id' => 0,
'type' => array('in', $req_type),
))->order('rand()')->limit(1)->find();
if (!$prize) {
return false;
}
$result = M('Prize')->where(array(
'id' => $prize['id'],
'is_get' => 0,
'user_id' => 0,
))->save(array(
'is_get' => 1,
'user_id' => $user['id'],
'take_time' => $now,
));
if ($result > 0) {
return $prize;
}
return false;
}
public function addInfo()
{
$user = $this->get_user_info_from_cookie();
if (!$user) {
$this->ajaxReturn(array(
'errcode' => 1,
'errmsg' => '用户信息错误',
));
return;
}
$prize = M('Prize')->where(array(
'user_id' => $user['id']
))->find();
if ($prize) {
M('Prize')->where(array(
'user_id' => $user['id']
))->save(array(
'name' => $_POST['name'],
'tel' => $_POST['tel'],
'address' => $_POST['address'],
'reward_time' => time()
));
$this->ajaxReturn(array(
'errcode' => 0,
));
} else {
$this->ajaxReturn(array(
'errcode' => 1,
'errmsg' => '用户信息错误',
));
return;
}
}
public function get_prize()
{
//判断是否中奖过
//要是中奖过了,就不能在中奖
//查看各个奖品的数量是否已经满了
//满了提示没中奖的页面
//要是没中奖,跳到再玩一次页面
//中奖名称和中奖几率
$user = $this->get_user_info_from_cookie();
if (!$user) {
$this->ajaxReturn(array(
'errcode' => 1,
'errmsg' => '用户信息错误',
));
return;
}
M('User')->where(array(
'id'=>$user['id']
))->save(array(
'photo'=>$url = $this->saveCommonImageToQiniu($_POST['photo_url'], uniqid('missfresh_dianzan__'))
));
$prizeInfo = M('Prize')->where(array(
'user_id' => $user['id']
))->find();
if ($prizeInfo) {
$this->prizeSate($prizeInfo, 1);
} else {
$prize = $this->get_random_prize($user);
if ($prize) {
$this->prizeSate($prize, 2);
} else {
$this->ajaxReturn(array(
'errcode' => 0,
'data' => array(
'prize_type' => 0,
'info_type' => 2,
)
));
}
}
}
public function prizeSate($prize, $type)
{
if (!$prize['tel']) {
if ($type == 1) {
$type_id = 2;
} else {
$type_id = 0;
}
$this->ajaxReturn(array(
'errcode' => 0,
'data' => array(
'prize_type' => 1,
'info_type' => $type_id,
'prize_id' => $prize['type']
)
));
return;
} else {
$this->ajaxReturn(array(
'errcode' => 0,
'data' => array(
'prize_type' => 1,
'info_type' => 1,
'name'=>$prize['name'],
'tel'=>$prize['tel'],
'address'=>$prize['address'],
'prize_id' => $prize['type']
)
));
return;
}
$this->display();
}
private function saveCommonImageToQiniu($imgData, $fileNameWithoutExt)
{
$head = substr($imgData, 0, 20);
$type = 'png';
if (stripos($head, 'data:image/jpg;') !== false || stripos($head, 'data:image/jpeg;') !== false) {
$type = 'jpg';
$imgData = substr($imgData, strlen('data:image/jpeg;base64,'));
} else {
$imgData = substr($imgData, strlen('data:image/png;base64,'));
}
$imgData = str_replace(' ', '+', $imgData);
$data = base64_decode($imgData);
if (strlen($data) == 0) {
return false;
}
$fileName = $fileNameWithoutExt . '.' . $type;
$upfile = array(
'name' => 'file',
'fileName' => $fileName,
'fileBody' => $data,
);
$config = C('UPLOAD_SITEIMG_QINIU')['driverConfig'];
$qiniu = new QiniuStorage($config);
$opt = array();
$result = $qiniu->upload($opt, $upfile);
$url = $qiniu->downlink($fileName);
return $url;
}
public function prize()
{
for ($i = 0; $i < 3; $i++) {
M('Prize')->add(array(
'content' => '电影票',
'type' => 1,
));
}
for ($i = 0; $i < 3; $i++) {
M('Prize')->add(array(
'content' => '牙膏',
'type' => 2,
));
}
for ($i = 0; $i < 3; $i++) {
M('Prize')->add(array(
'content' => '手机',
'type' => 3,
));
}
for ($i = 0; $i < 3; $i++) {
M('Prize')->add(array(
'content' => '吹风机',
'type' => 4,
));
}
}
}
......@@ -28,9 +28,7 @@ class BaseUserController extends BackendController
$item_list = [
['id' => 1, 'parent_id' => 0, 'title' => '数据统计', 'url' => 'User/Report/index', 'seq' => 1,
'default' => true, 'match_type' => 'url', 'children' => null, 'css_class' => null],
['id' => 2, 'parent_id' => 0, 'title' => '中奖信息', 'url' => 'User/Check/index', 'seq' => 1,
'default' => false, 'match_type' => 'url', 'children' => null, 'css_class' => null],
['id' => 3, 'parent_id' => 0, 'title' => '照片', 'url' => 'User/Photo/index', 'seq' => 1,
['id' => 2, 'parent_id' => 0, 'title' => '照片', 'url' => 'User/Check/index', 'seq' => 1,
'default' => false, 'match_type' => 'url', 'children' => null, 'css_class' => null],
];
$tree = $this->buildTreeChildren($item_list, 0);
......
......@@ -7,11 +7,11 @@ class CheckController extends BaseUserController
{
public function index()
{
$count = M('Prize')->count();
$count = M('Photo')->count();
$page = new Page($count, 25);
$list = M('Prize')->where(array(
"user_id"=>array('NEQ','0')
))->select();
$list = M('Photo')->order('time DESC')
->limit($page->firstRow . ',' . $page->listRows)
->select();
$this->assign('page', $page->show());
$this->assign('list', $list);
$this->display();
......
......@@ -40,7 +40,7 @@ class HomeController extends Controller
// $this->display();
// return;
// }
if ($name != 'admin' || $password != '123456') {
if ($name != 'photo' || $password != 'photo') {
$error = '�û�����������';
$this->assign('error', $error);
$this->display();
......
<?php
namespace User\Controller;
use Think\Page;
class PhotoController extends BaseUserController
{
public function index()
{
$count = M('User')->count();
$page = new Page($count, 25);
$list = M('User')->where(array(
"photo"=>array('NEQ','NULL')
))->select();
$this->assign('page', $page->show());
$this->assign('list', $list);
$this->display();
}
}
\ No newline at end of file
......@@ -19,33 +19,12 @@ class ReportController extends BaseUserController
$channel = '__all__';
}
$url = "http://api2.izhida.cn/tongjiV2/report?app_stat_key=3Hak8h55DnysDSH5&app_stat_secret=zDWAssidakFaFyjH";
$url = "http://api2.izhida.cn/tongjiV2/report?app_stat_key=FhDnDjEF8Zjw52Xk&app_stat_secret=NSaCXrY7iRTzXhCw";
$content = file_get_contents($url);
$data = json_decode($content, true);
$data_list = $data['data'];
$event_meta_list = $this->get_event_meta();
$count_1=M('Prize')->where(array(
'type'=>1,
'is_get'=>0
))->count();
$count_2=M('Prize')->where(array(
'type'=>2,
'is_get'=>0
))->count();
$count_3=M('Prize')->where(array(
'type'=>3,
'is_get'=>0
))->count();
$count_4=M('Prize')->where(array(
'type'=>4,
'is_get'=>0
))->count();
$this->assign('count_1',$count_1);
$this->assign('count_2',$count_2);
$this->assign('count_3',$count_3);
$this->assign('count_4',$count_4);
$this->assign('event_meta_list', $event_meta_list);
$this->assign('data_list', $data_list[$channel]);
......@@ -58,7 +37,8 @@ class ReportController extends BaseUserController
if (!$channel) {
$channel = '__all__';
}
$url = "http://api2.izhida.cn/tongjiV2/report?app_stat_key=3Hak8h55DnysDSH5&app_stat_secret=zDWAssidakFaFyjH";
$url = "http://api2.izhida.cn/tongjiV2/report?app_stat_key=FhDnDjEF8Zjw52Xk&app_stat_secret=NSaCXrY7iRTzXhCw";
$content = file_get_contents($url);
$data = json_decode($content, true);
$data_list = $data['data'][$channel];
......@@ -90,52 +70,18 @@ class ReportController extends BaseUserController
}
public function export_photo()
{
$list = M('User')->where(array(
"photo"=>array('NEQ','NULL')
))->select();
$list = M('Photo')->order('time DESC')->select();
$default_0 = function ($v) {
if (isset($v)) {
return $v;
}
return 0;
};
$columns = array(
array('id', 'id', $default_0),
array('微信名字', 'nickname', $default_0),
array('头像', 'headimgurl', $default_0),
array('图片', 'photo', $default_0),
array('照片', 'photo_url', $default_0),
);
$file_name = 'prize_' . date('Y-m-d_H:i:s');
ExcelExporter::export($file_name, $columns, $list, 'prize');
}
public function export_prize()
{
$list = M('Prize')->where(array(
"user_id"=>array('NEQ','0')
))->select();
$default_0 = function ($v) {
if (isset($v)) {
return $v;
}
return 0;
};
$columns = array(
array('id', 'id', $default_0),
array('奖品名字', 'content', $default_0),
array('微信ID', 'user_id', $default_0),
array('名字', 'name', $default_0),
array('手机号码', 'tel', $default_0),
array('地区', 'address', $default_0),
// array('填写信息时间', 'reward_time', function($v){
// return date('Y年m月d日-H:i:s', $v);
// }),
array('中奖时间', 'take_time', function($v){
return date('Y年m月d日-H:i:s', $v);
}),
array('时间', 'time', $default_0),
);
$file_name = 'prize_' . date('Y-m-d_H:i:s');
......
......@@ -18,39 +18,22 @@
<thead>
<tr>
<th width="8%">ID</th>
<th width="20%">奖品名字</th>
<th width="20%">微信ID</th>
<th width="20%">名字</th>
<th width="20%">手机号码</th>
<th width="20%">地区</th>
<th width="20%">中奖时间</th>
<th width="20%">照片</th>
<th width="20%">时间</th>
</tr>
</thead>
<tbody>
{:foreach from=$list item="item" name="list"}
<tr>
<td class="vertical-mid">
{:$item.id}
</td>
<td class="vertical-mid">
{:$item.content}
</td>
<td class="vertical-mid">
{:$item.user_id}
</td>
<td class="vertical-mid">
{:$item.name}
</td>
<td class="vertical-mid">
{:$item.tel}
</td>
<td class="vertical-mid">
{:$item.address}
<td class="vertical-mid js-photo-size">
<img src="{:$item.photo_url}" style="width: 282px;height: 282px">
</td>
<td class="vertical-mid js-photo-size">
{:$item.take_time|date_format:'m-d H:i:s'}
{:$item.time|date_format:'m-d H:i:s'}
</td>
</tr>
......
{:extends file="groupuser_layout.tpl"}
{:block name=header_css append}
<style>
.photo{
height: 120px;
width: auto;
}
</style>
{:/block}
{:block name="content_title"}
{:/block}
{:block name="content_breadcrumb"}
{:/block}
{:block name="content_body"}
<div class="row" id="keyword-index-page">
<div class="col-sm-12 col-md-12">
<table class="wechat-account-table table table-striped mb30">
<thead>
<tr>
<th width="8%">ID</th>
<th width="20%">微信名字</th>
<th width="20%">头像</th>
<th width="20%">图片</th>
</tr>
</thead>
<tbody>
{:foreach from=$list item="item" name="list"}
<tr>
<td class="vertical-mid">
{:$item.id}
</td>
<td class="vertical-mid">
{:$item.nickname}
</td>
<td class="vertical-mid">
<img src="{:$item.headimgurl}" style="width: 100px;height: 100px">
</td>
<td class="vertical-mid">
<img src="{:$item.photo}" style="width: 100px;height: 100px">
</td>
</tr>
{:foreachelse}
<td colspan="7" class="text-center">暂无</td>
{:/foreach}
</tbody>
</table>
{:if $page}
<div>
<span class="pull-right single-msg-page">{:$page}</span
</div>
{:/if}
</div>
</div>
{:/block}
......@@ -8,19 +8,9 @@
{:block name="content_body"}
<div>
<a class="btn btn-default" target="_blank" href="{:url controller='user/report/export_pvuv'}">导出统计数据</a>
<a class="btn btn-default" target="_blank" href="{:url controller='user/report/export_prize'}">导出中奖信息</a>
<a class="btn btn-default" target="_blank" href="{:url controller='user/report/export_photo'}">导出用户照片</a>
<a class="btn btn-default" target="_blank" href="{:url controller='user/report/export_photo'}">导出照片</a>
</div>
<table class="table" class="table table-striped">
<tr>
<td style="width: 100px;">电影票剩余: <span style="color: red">{:$count_1}</span></td>
<td style="width: 100px">牙膏剩余: <span style="color: red">{:$count_2}</span></td>
<td style="width: 100px">手机剩余: <span style="color: red">{:$count_3}</span></td>
<td style="width: 100px">吹风机剩余: <span style="color: red">{:$count_4}</span></td>
</tr>
</table>
<br>
<br>
<table class="table" class="table table-striped">
......
......@@ -2,18 +2,19 @@
<style>
@font-face {
font-family: 'MyWebFont';
src: url('font.eot'); /* IE9 Compat Modes */
src: url('font.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('font.woff') format('woff'), /* Modern Browsers */
url('font.TTf') format('truetype'), /* Safari, Android, iOS */
url('font.svg#svgFontName') format('svg'); /* Legacy iOS */
src: url('MFLangQian-Bold.eot'); /* IE9 Compat Modes */
src: url('MFLangQian-Bold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('MFLangQian-Bold.woff') format('woff'), /* Modern Browsers */
url('MFLangQian-Bold.ttf') format('truetype'), /* Safari, Android, iOS */
url('MFLangQian-Bold.svg#svgFontName') format('svg'); /* Legacy iOS */
}
.content{
font-family: MyWebFont;
}
</style>
<body>
<span class="content">0123456789s</span>
<span class="content">已经有0123456789人闯关成功!召唤小伙伴一起来玩吧!</span>
</body>
</html>
\ No newline at end of file

74.8 KB | W: | H:

35.4 KB | W: | H:

Public/static/images/2-1.png
Public/static/images/2-1.png
Public/static/images/2-1.png
Public/static/images/2-1.png
  • 2-up
  • Swipe
  • Onion skin

79.7 KB | W: | H:

39.5 KB | W: | H:

Public/static/images/2-2.png
Public/static/images/2-2.png
Public/static/images/2-2.png
Public/static/images/2-2.png
  • 2-up
  • Swipe
  • Onion skin

41.9 KB | W: | H:

43.8 KB | W: | H:

Public/static/images/2-3.png
Public/static/images/2-3.png
Public/static/images/2-3.png
Public/static/images/2-3.png
  • 2-up
  • Swipe
  • Onion skin

40.6 KB | W: | H:

22.1 KB | W: | H:

Public/static/images/2-4.png
Public/static/images/2-4.png
Public/static/images/2-4.png
Public/static/images/2-4.png
  • 2-up
  • Swipe
  • Onion skin

1.9 KB | W: | H:

1.49 KB | W: | H:

Public/static/images/arrow-left.png
Public/static/images/arrow-left.png
Public/static/images/arrow-left.png
Public/static/images/arrow-left.png
  • 2-up
  • Swipe
  • Onion skin

1.97 KB | W: | H:

1.52 KB | W: | H:

Public/static/images/arrow-right.png
Public/static/images/arrow-right.png
Public/static/images/arrow-right.png
Public/static/images/arrow-right.png
  • 2-up
  • Swipe
  • Onion skin

6.06 KB | W: | H:

11.2 KB | W: | H:

Public/static/images/arrow.png
Public/static/images/arrow.png
Public/static/images/arrow.png
Public/static/images/arrow.png
  • 2-up
  • Swipe
  • Onion skin

243 KB | W: | H:

193 KB | W: | H:

Public/static/images/bj.jpg
Public/static/images/bj.jpg
Public/static/images/bj.jpg
Public/static/images/bj.jpg
  • 2-up
  • Swipe
  • Onion skin

2.98 KB | W: | H:

3.42 KB | W: | H:

Public/static/images/btn-z-y-1.png
Public/static/images/btn-z-y-1.png
Public/static/images/btn-z-y-1.png
Public/static/images/btn-z-y-1.png
  • 2-up
  • Swipe
  • Onion skin
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment