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

1

@@ -137,6 +137,7 @@ class PrizeController extends WeChatBaseController @@ -137,6 +137,7 @@ class PrizeController extends WeChatBaseController
137 } 137 }
138 138
139 public function getScore(){ 139 public function getScore(){
  140 + $this->checkUser();
140 $app = new Application($this->options); 141 $app = new Application($this->options);
141 $js = $app->js; 142 $js = $app->js;
142 $jss = $js->config(['chooseImage', 'uploadImage', 'previewImage'], $debug = true, $beta = false, $json = true); 143 $jss = $js->config(['chooseImage', 'uploadImage', 'previewImage'], $debug = true, $beta = false, $json = true);
@@ -146,16 +147,14 @@ class PrizeController extends WeChatBaseController @@ -146,16 +147,14 @@ class PrizeController extends WeChatBaseController
146 147
147 //上传小票提交 148 //上传小票提交
148 public function uploadPost(){ 149 public function uploadPost(){
  150 + $re=$this->checkUser();
149 $param = $this->request->param(); 151 $param = $this->request->param();
150 - $options = [  
151 - 'app_id' => config('wechat_config.app_id'),  
152 - 'secret' => config('wechat_config.secret'),  
153 - 'payment' => config('wechat_config.payment'),  
154 - ];  
155 - $app = new Application($options); 152 + $app = new Application($this->options);
156 // 获取 access token 实例 153 // 获取 access token 实例
157 $access_token = $app->access_token; 154 $access_token = $app->access_token;
158 - return $this->getmedia($access_token, $param['media'], date('Ymd')); 155 + $save_name=$this->getmedia($access_token, $param['media'], date('Ymd'));
  156 + Db::name('users_score_log')->insert(['users_id'=>$re['id'],'create_time'=>time(),'thumbnail'=>$save_name]);
  157 + return 1;
159 } 158 }
160 private function getmedia($access_token, $media_id, $foldername) 159 private function getmedia($access_token, $media_id, $foldername)
161 { 160 {
@@ -176,6 +175,17 @@ class PrizeController extends WeChatBaseController @@ -176,6 +175,17 @@ class PrizeController extends WeChatBaseController
176 return $saveName; 175 return $saveName;
177 } 176 }
178 177
  178 + public function uploadSuccess(){
  179 + return $this->fetch('successupload');
  180 + }
  181 +
  182 +
  183 +
  184 +
  185 +
  186 +
  187 +
  188 +
179 //兑奖记录 189 //兑奖记录
180 public function prizeRecord(){ 190 public function prizeRecord(){
181 $status=$this->request->param('status'); 191 $status=$this->request->param('status');
@@ -160,7 +160,22 @@ wx.ready(function () { @@ -160,7 +160,22 @@ wx.ready(function () {
160 }); 160 });
161 //确定上传小票 161 //确定上传小票
162 $(".footer").click(function(){ 162 $(".footer").click(function(){
163 - window.location.href='successupload.html' 163 + $.ajax({
  164 + url: "{:url('portal/prize/uploadPost')}",
  165 + type: "post",
  166 + data: {
  167 + 'media': serverIds,
  168 + },
  169 + success: function (data) {
  170 + if (data == 1) {
  171 + mui.toast('保存成功')
  172 + window.location.href = "{:url('portal/prize/uploadSuccess')}"
  173 + } else {
  174 + mui.alert('保存失败');
  175 + return false
  176 + }
  177 + }
  178 + })
164 }) 179 })
165 </script> 180 </script>
166 </body> 181 </body>
  1 +<!DOCTYPE html>
  2 +<html lang="en">
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  6 + <link rel="stylesheet" href="__TMPL__/public/assets/css/base.css">
  7 + <script type="text/javascript" src="__TMPL__/public/assets/js/base.js"></script>
  8 + <title>上传成功</title>
  9 + <style>
  10 + .container{
  11 + padding-top: 3.8rem;
  12 + }
  13 + .success{
  14 + width:1.04rem;
  15 + height:1.04rem;
  16 + margin:0 auto;
  17 + font-size: 0;
  18 + }
  19 + .success img{
  20 + width:100%;
  21 + height:100%;
  22 + }
  23 + .successword{
  24 + text-align: center;
  25 + color:#CA277B;
  26 + font-size: 0.36rem;
  27 + margin-top: 0.2rem;
  28 + }
  29 + .upsuccess{
  30 + width:3.65rem;
  31 + margin: 0 auto;
  32 + color:#252729;
  33 + font-size: 0.26rem;
  34 + }
  35 + .increase{
  36 + width:3.62rem;
  37 + margin: 0 auto;
  38 + text-align: center;
  39 + color:#252729;
  40 + font-size: 0.26rem;
  41 + margin-top: 0.2rem;
  42 + }
  43 + .word{
  44 + margin-top: 0.68rem;
  45 + }
  46 + .footer{
  47 + width:6.86rem;
  48 + text-align: center;
  49 + height:0.88rem;
  50 + line-height: 0.88rem;
  51 + position:fixed;
  52 + bottom:0.55rem;
  53 + left:0;
  54 + right:0;
  55 + margin: 0 auto;
  56 + background:#CA277B ;
  57 + border-radius: 0.44rem;
  58 + color:#fff;
  59 + font-size:0.32rem ;
  60 + }
  61 +
  62 + </style>
  63 +</head>
  64 +<body>
  65 + <div class="container">
  66 + <div class="success">
  67 + <img src="__TMPL__/public/assets/images/img/successupload.png" alt="">
  68 + </div>
  69 + <p class="successword">上传成功</p>
  70 + </div>
  71 +<div class="word">
  72 + <p class="upsuccess">上传成功,等待后台审核通过后</p>
  73 + <P class="increase">增加相应积分</P>
  74 +</div>
  75 +<div class="footer">
  76 + 返回
  77 +</div>
  78 +
  79 +<script type="text/javascript" src="__TMPL__/public/assets/js/jquery.min.js"></script>
  80 +<script>
  81 + $(".footer").click(function(){
  82 + window.location.href='uploadticket.html'
  83 + })
  84 +</script>
  85 +</body>
  86 +</html>