作者 潘浩文
1 个管道 的构建 通过 耗费 0 秒

1

@@ -180,13 +180,6 @@ class PrizeController extends WeChatBaseController @@ -180,13 +180,6 @@ class PrizeController extends WeChatBaseController
180 return $this->fetch('successupload'); 180 return $this->fetch('successupload');
181 } 181 }
182 182
183 -  
184 -  
185 -  
186 -  
187 -  
188 -  
189 -  
190 //兑奖记录 183 //兑奖记录
191 public function prizeRecord(){ 184 public function prizeRecord(){
192 $status=$this->request->param('status'); 185 $status=$this->request->param('status');
@@ -197,7 +190,7 @@ class PrizeController extends WeChatBaseController @@ -197,7 +190,7 @@ class PrizeController extends WeChatBaseController
197 ->where($where) 190 ->where($where)
198 ->select(); 191 ->select();
199 $this->assign('list',$data); 192 $this->assign('list',$data);
200 - return $this->fetch(); 193 + return $this->fetch('prize_record');
201 } 194 }
202 195
203 196
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | bronet [ 以客户为中心 以奋斗者为本 ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +namespace app\portal\controller;
  10 +
  11 +use app\portal\service\LikeService;
  12 +use cmf\controller\HomeBaseController;
  13 +use cmf\controller\WeChatBaseController;
  14 +use EasyWeChat\Foundation\Application;
  15 +use think\Db;
  16 +
  17 +class UserController extends WeChatBaseController
  18 +{
  19 + public function _initialize()
  20 + {
  21 + parent::_initialize();
  22 + $this->checkWeChatUserLogin();
  23 + }
  24 +
  25 + //兑奖记录
  26 + public function prizeRecord(){
  27 + $status=$this->request->param('status');
  28 + $where['p.status']=!empty($status)?$status:0;
  29 + $data=Db::name('prize_order')
  30 + ->alias('po')
  31 + ->join('prize p'.'po.prize_id=p.id')
  32 + ->where($where)
  33 + ->select();
  34 + $this->assign('list',$data);
  35 + return $this->fetch();
  36 + }
  37 +
  38 +
  39 +
  40 +
  41 + //个人首页
  42 + public function userIndex(){
  43 + $last = Db::name('users_score_log')->where(['users_id' => session('wechat_user')['users_id'], 'action' => '签到'])->max('create_time');
  44 + if (date('Ymd', time()) > date('Ymd', $last)) {
  45 + $is_qiandao=0;
  46 + }else{
  47 + $is_qiandao=1;
  48 + }
  49 + $data=Db::name('users')->where('id',session('wechat_user')['users_id'])->find();
  50 + $this->assign('list',$data);
  51 + $this->assign('qiandao',$is_qiandao);
  52 + return $this->fetch();
  53 + }
  54 + public function scoreRecord(){
  55 + $score=Db::name('users')->where('id',session('wechat_user')['users_id'])->find()['score'];
  56 + $data=Db::name('users_score_log')->where('users_id',session('wechat_user')['users_id'])->select();
  57 + $this->assign('score',$score);
  58 + $this->assign('list',$data);
  59 + return $this->fetch();
  60 + }
  61 + //每日签到功能
  62 + public function qiandao(){
  63 + $last = Db::name('users_score_log')->where(['users_id' => session('wechat_user')['users_id'], 'action' => '签到'])->max('create_time');
  64 + if (date('Ymd', time()) > date('Ymd', $last)) {
  65 + $data['score'] = 10;
  66 + $data['users_id'] = session('users_id');
  67 + $data['create_time'] = time();
  68 + $data['action'] = '签到';
  69 + Db::name('users_score_log')->insert($data);
  70 + Db::name('users')->where('id', session('wechat_user')['users_id'])->setInc('score', 10);
  71 + return 1;
  72 + } else {
  73 + return 0;
  74 + }
  75 + }
  76 +
  77 +}
  1 +<!DOCTYPE html>
  2 +<html lang="en">
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <link rel="stylesheet" href="__TMPL__/public/assets/css/base.css">
  6 + <script type="text/javascript" src="__TMPL__/public/assets/js/base.js"></script>
  7 + <title>兑换记录</title>
  8 + <style>
  9 + .head{
  10 + display:flex;
  11 + justify-content: space-between;
  12 + align-items: center;
  13 + padding: 0.27rem 1.47rem;
  14 + height:0.91rem;
  15 + border-bottom: 1px solid #f5f5f5;
  16 + border-top:1px solid #f5f5f5;
  17 + }
  18 +
  19 + .title img{
  20 + width:100%;
  21 + height:100%;
  22 + }
  23 + .verification{
  24 + color:#53575C;
  25 + font-size: 0.28rem;
  26 + }
  27 + .active{
  28 + color:#CA277B;
  29 + }
  30 + .type{
  31 + display:flex;
  32 + justify-content: space-between;
  33 + align-items: center;
  34 + height:0.8rem;
  35 + padding: 0.27rem 0.49rem;
  36 + background: #fff;
  37 + /*margin-top: 0.16rem;*/
  38 + }
  39 + .type li{
  40 + list-style: none;
  41 + font-size: 0.28rem;
  42 + color:#53575C;
  43 + }
  44 + .type .item{
  45 + color:#CA277B;
  46 + }
  47 + .integral_num{
  48 + font-size:0.32rem;
  49 + color:#CA277B;
  50 + font-weight: bold;
  51 + }
  52 + .integral_chinese{
  53 + font-size:0.32rem;
  54 + color:#CA277B;
  55 + }
  56 + .present_name{
  57 + color:#000000;
  58 + font-size: 0.32rem;
  59 + margin-top: 0.1rem;
  60 + margin-left: 0.32rem;
  61 + }
  62 + .integral{
  63 + font-size: 0;
  64 + margin-top: 0.08rem;
  65 + margin-left: 0.32rem;
  66 + }
  67 + .present_img{
  68 + width:3.71rem;
  69 + height:3.71rem;
  70 + font-size: 0;
  71 + }
  72 + .present_img img{
  73 + width:100%;
  74 + height:100%;
  75 + }
  76 + .presentlist{
  77 + overflow: hidden;
  78 + padding-bottom: 0.3rem;
  79 + }
  80 + .presentlist_item{
  81 + float:left;
  82 + margin-top: 0.3rem;
  83 + }
  84 + .presentlist_item:nth-child(2n){
  85 + margin-left: 0.08rem;
  86 + }
  87 + .presentlist_item:nth-child(1){
  88 + margin-top: 0;
  89 + }
  90 + .presentlist_item:nth-child(2){
  91 + margin-top: 0;
  92 + }
  93 + </style>
  94 +</head>
  95 +<body>
  96 +<div class="container">
  97 +
  98 + <div class="head">
  99 + <p class="verification active" data-id="0">未核销</p>
  100 + <p class="verification" data-id="1">已核销</p>
  101 + </div>
  102 + <div class="presentlist">
  103 + <foreach name="list" item="vo">
  104 + <div class="presentlist_item">
  105 + <p class="present_img">
  106 + <img src="{:cmf_get_image_preview_url($vo.thumbnail)}" alt="">
  107 + </p>
  108 + <p class="present_name">{$vo.name}</p>
  109 + <p class="integral">
  110 + <span class="integral_num">{$vo.score}</span>
  111 + <span class="integral_chinese">积分</span>
  112 + </p>
  113 + </div>
  114 + </foreach>
  115 + </div>
  116 +</div>
  117 +<script type="text/javascript" src="__TMPL__/public/assets/js/jquery.min.js"></script>
  118 +<script>
  119 + $(".verification").click(function(){
  120 + $(this).addClass("active");
  121 + $(this).siblings(".verification").removeClass("active")
  122 + })
  123 +</script>
  124 +</body>
  125 +</html>