diff --git a/app/portal/controller/PrizeController.php b/app/portal/controller/PrizeController.php index a68d53c..5b02c70 100644 --- a/app/portal/controller/PrizeController.php +++ b/app/portal/controller/PrizeController.php @@ -180,13 +180,6 @@ class PrizeController extends WeChatBaseController return $this->fetch('successupload'); } - - - - - - - //兑奖记录 public function prizeRecord(){ $status=$this->request->param('status'); @@ -197,7 +190,7 @@ class PrizeController extends WeChatBaseController ->where($where) ->select(); $this->assign('list',$data); - return $this->fetch(); + return $this->fetch('prize_record'); } diff --git a/app/user/controller/UserController.php b/app/user/controller/UserController.php new file mode 100644 index 0000000..eebc905 --- /dev/null +++ b/app/user/controller/UserController.php @@ -0,0 +1,77 @@ +<?php +// +---------------------------------------------------------------------- +// | bronet [ 以客户为中心 以奋斗者为本 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) +// +---------------------------------------------------------------------- +namespace app\portal\controller; + +use app\portal\service\LikeService; +use cmf\controller\HomeBaseController; +use cmf\controller\WeChatBaseController; +use EasyWeChat\Foundation\Application; +use think\Db; + +class UserController extends WeChatBaseController +{ + public function _initialize() + { + parent::_initialize(); + $this->checkWeChatUserLogin(); + } + + //兑奖记录 + public function prizeRecord(){ + $status=$this->request->param('status'); + $where['p.status']=!empty($status)?$status:0; + $data=Db::name('prize_order') + ->alias('po') + ->join('prize p'.'po.prize_id=p.id') + ->where($where) + ->select(); + $this->assign('list',$data); + return $this->fetch(); + } + + + + + //个人首页 + public function userIndex(){ + $last = Db::name('users_score_log')->where(['users_id' => session('wechat_user')['users_id'], 'action' => '签到'])->max('create_time'); + if (date('Ymd', time()) > date('Ymd', $last)) { + $is_qiandao=0; + }else{ + $is_qiandao=1; + } + $data=Db::name('users')->where('id',session('wechat_user')['users_id'])->find(); + $this->assign('list',$data); + $this->assign('qiandao',$is_qiandao); + return $this->fetch(); + } + public function scoreRecord(){ + $score=Db::name('users')->where('id',session('wechat_user')['users_id'])->find()['score']; + $data=Db::name('users_score_log')->where('users_id',session('wechat_user')['users_id'])->select(); + $this->assign('score',$score); + $this->assign('list',$data); + return $this->fetch(); + } + //每日签到功能 + public function qiandao(){ + $last = Db::name('users_score_log')->where(['users_id' => session('wechat_user')['users_id'], 'action' => '签到'])->max('create_time'); + if (date('Ymd', time()) > date('Ymd', $last)) { + $data['score'] = 10; + $data['users_id'] = session('users_id'); + $data['create_time'] = time(); + $data['action'] = '签到'; + Db::name('users_score_log')->insert($data); + Db::name('users')->where('id', session('wechat_user')['users_id'])->setInc('score', 10); + return 1; + } else { + return 0; + } + } + +} diff --git a/public/themes/simpleboot3/portal/prize/prize_record.html b/public/themes/simpleboot3/portal/prize/prize_record.html new file mode 100644 index 0000000..c90b23b --- /dev/null +++ b/public/themes/simpleboot3/portal/prize/prize_record.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <link rel="stylesheet" href="__TMPL__/public/assets/css/base.css"> + <script type="text/javascript" src="__TMPL__/public/assets/js/base.js"></script> + <title>兑换记录</title> + <style> + .head{ + display:flex; + justify-content: space-between; + align-items: center; + padding: 0.27rem 1.47rem; + height:0.91rem; + border-bottom: 1px solid #f5f5f5; + border-top:1px solid #f5f5f5; + } + + .title img{ + width:100%; + height:100%; + } + .verification{ + color:#53575C; + font-size: 0.28rem; + } + .active{ + color:#CA277B; + } + .type{ + display:flex; + justify-content: space-between; + align-items: center; + height:0.8rem; + padding: 0.27rem 0.49rem; + background: #fff; + /*margin-top: 0.16rem;*/ + } + .type li{ + list-style: none; + font-size: 0.28rem; + color:#53575C; + } + .type .item{ + color:#CA277B; + } + .integral_num{ + font-size:0.32rem; + color:#CA277B; + font-weight: bold; + } + .integral_chinese{ + font-size:0.32rem; + color:#CA277B; + } + .present_name{ + color:#000000; + font-size: 0.32rem; + margin-top: 0.1rem; + margin-left: 0.32rem; + } + .integral{ + font-size: 0; + margin-top: 0.08rem; + margin-left: 0.32rem; + } + .present_img{ + width:3.71rem; + height:3.71rem; + font-size: 0; + } + .present_img img{ + width:100%; + height:100%; + } + .presentlist{ + overflow: hidden; + padding-bottom: 0.3rem; + } + .presentlist_item{ + float:left; + margin-top: 0.3rem; + } + .presentlist_item:nth-child(2n){ + margin-left: 0.08rem; + } + .presentlist_item:nth-child(1){ + margin-top: 0; + } + .presentlist_item:nth-child(2){ + margin-top: 0; + } + </style> +</head> +<body> +<div class="container"> + + <div class="head"> + <p class="verification active" data-id="0">未核销</p> + <p class="verification" data-id="1">已核销</p> + </div> + <div class="presentlist"> + <foreach name="list" item="vo"> + <div class="presentlist_item"> + <p class="present_img"> + <img src="{:cmf_get_image_preview_url($vo.thumbnail)}" alt=""> + </p> + <p class="present_name">{$vo.name}</p> + <p class="integral"> + <span class="integral_num">{$vo.score}</span> + <span class="integral_chinese">积分</span> + </p> + </div> + </foreach> + </div> +</div> +<script type="text/javascript" src="__TMPL__/public/assets/js/jquery.min.js"></script> +<script> + $(".verification").click(function(){ + $(this).addClass("active"); + $(this).siblings(".verification").removeClass("active") + }) +</script> +</body> +</html>