正在显示
2 个修改的文件
包含
149 行增加
和
60 行删除
@@ -16,71 +16,17 @@ use think\Db; | @@ -16,71 +16,17 @@ use think\Db; | ||
16 | 16 | ||
17 | class PrizeController extends WeChatBaseController | 17 | class PrizeController extends WeChatBaseController |
18 | { | 18 | { |
19 | + protected $options; | ||
19 | public function _initialize() | 20 | public function _initialize() |
20 | { | 21 | { |
21 | parent::_initialize(); | 22 | parent::_initialize(); |
22 | $this->checkWeChatUserLogin(); | 23 | $this->checkWeChatUserLogin(); |
23 | - | ||
24 | - } | ||
25 | - //活动首页 | ||
26 | - public function active(){ | ||
27 | - $this->checkUser(); | ||
28 | - $banner=Db::name('active')->where('is_top',1)->field('thumbnail')->select(); | ||
29 | - $this->assign('banner',$banner); | ||
30 | - $data=Db::name('active')->where('status',1)->select(); | ||
31 | - $this->assign('list',$data); | ||
32 | - return $this->fetch(); | ||
33 | - } | ||
34 | - //活动首页ajax | ||
35 | - public function activeAjax(){ | ||
36 | - $this->checkUser(); | ||
37 | - $status=$this->request->param('status'); | ||
38 | - $data=Db::name('active')->where('status',$status)->select()->toArray(); | ||
39 | - foreach ($data as $k => $v) { | ||
40 | - $data[$k]['url']=url('portal/active/activeDetail',array('id'=>$data[$k]['id'])); | ||
41 | - $data[$k]['image'] = cmf_get_image_preview_url($data[$k]['thumbnail']); | ||
42 | - $data[$k]['active_time'] = date('Y-m-d',$data[$k]['active_time']); | ||
43 | - $data[$k]['end_time'] = date('Y-m-d',$data[$k]['end_time']); | ||
44 | - }; | ||
45 | - return $data; | ||
46 | - } | ||
47 | - | ||
48 | - //活动详情 | ||
49 | - public function activeDetail() | ||
50 | - { | ||
51 | - $re=$this->checkUser(); | ||
52 | - $id=$this->request->param('id'); | ||
53 | - $data=Db::name('active') | ||
54 | - ->where('id',$id) | ||
55 | - ->find(); | ||
56 | - $data['more']=json_decode($data['more'],true); | ||
57 | - $data['content']=cmf_replace_content_file_url(htmlspecialchars_decode($data['content'])); | ||
58 | - $like=Db::name('like')->where(['cid'=>$id,'users_id'=>$re['id'],'status'=>2])->find(); | ||
59 | - if ($like){ | ||
60 | - $like=1; | ||
61 | - }else{ | ||
62 | - $like=0; | ||
63 | - } | ||
64 | - $comment=Db::name('comment') | ||
65 | - ->alias('c') | ||
66 | - ->join('users u','c.users_id=u.id') | ||
67 | - ->join('brand b','c.cid=b.id') | ||
68 | - ->where(['b.id'=>$id,'c.status'=>2]) | ||
69 | - ->field('c.*,u.*') | ||
70 | - ->select(); | ||
71 | - $this->assign('comment',$comment); | ||
72 | - $this->assign('like',$like); | ||
73 | - $this->assign('list',$data); | ||
74 | - return $this->fetch('active_detail'); | 24 | + $this->options = [ |
25 | + 'app_id' => config('wechat_config.app_id'), | ||
26 | + 'secret' => config('wechat_config.secret'), | ||
27 | + 'payment' => config('wechat_config.payment'), | ||
28 | + ]; | ||
75 | } | 29 | } |
76 | - | ||
77 | - | ||
78 | - | ||
79 | - | ||
80 | - | ||
81 | - | ||
82 | - | ||
83 | - | ||
84 | //兑奖首页 | 30 | //兑奖首页 |
85 | public function prize(){ | 31 | public function prize(){ |
86 | $re=$this->checkUser(); | 32 | $re=$this->checkUser(); |
@@ -189,6 +135,15 @@ class PrizeController extends WeChatBaseController | @@ -189,6 +135,15 @@ class PrizeController extends WeChatBaseController | ||
189 | Db::name('prize_order')->insert($data); | 135 | Db::name('prize_order')->insert($data); |
190 | return 1; | 136 | return 1; |
191 | } | 137 | } |
138 | + | ||
139 | + public function getScore(){ | ||
140 | + $app = new Application($this->options); | ||
141 | + $js = $app->js; | ||
142 | + $this->assign('js',$js); | ||
143 | + return $this->fetch('getScore'); | ||
144 | + } | ||
145 | + | ||
146 | + | ||
192 | //上传小票 | 147 | //上传小票 |
193 | public function upload(){ | 148 | public function upload(){ |
194 | $options = [ | 149 | $options = [ |
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 | + body,html{ | ||
11 | + background: #fff; | ||
12 | + } | ||
13 | + .container{ | ||
14 | + position:absolute; | ||
15 | + top:50%; | ||
16 | + left:50%; | ||
17 | + transform: translate(-50%,-50%); | ||
18 | + } | ||
19 | + | ||
20 | + #preview{ | ||
21 | + width:2.59rem; | ||
22 | + height:2.59rem; | ||
23 | + font-size: 0; | ||
24 | + | ||
25 | + } | ||
26 | + #preview img{ | ||
27 | + width:100%; | ||
28 | + height:100%; | ||
29 | + } | ||
30 | + .uploadword{ | ||
31 | + width:2.59rem; | ||
32 | + text-align: center; | ||
33 | + color:#252729; | ||
34 | + font-size: 0.32rem; | ||
35 | + margin-top: 0.35rem; | ||
36 | + } | ||
37 | + .footer{ | ||
38 | + width:6.86rem; | ||
39 | + text-align: center; | ||
40 | + height:0.88rem; | ||
41 | + line-height: 0.88rem; | ||
42 | + position:fixed; | ||
43 | + bottom:0.55rem; | ||
44 | + left:0; | ||
45 | + right:0; | ||
46 | + margin: 0 auto; | ||
47 | + background:#CA277B ; | ||
48 | + border-radius: 0.44rem; | ||
49 | + color:#fff; | ||
50 | + font-size:0.32rem ; | ||
51 | + } | ||
52 | + </style> | ||
53 | +</head> | ||
54 | +<body> | ||
55 | + <div class="container"> | ||
56 | + <!--<div class="upload">--> | ||
57 | + <!--<img src="img/upload.png" alt="">--> | ||
58 | + <!--</div>--> | ||
59 | + <div id="preview"> | ||
60 | + <img id="imghead" border="0" src="img/upload.png" style="width:100%;height:100%" onclick="$('#previewImg').click();"> | ||
61 | + </div> | ||
62 | + <!--<img src="../img/delet.png" alt="" style="position:absolute;bottom:92px;left:46px" class="deleteimg"/>--> | ||
63 | + <input type="file" onchange="previewImage(this)" style="display: none;" id="previewImg"> | ||
64 | + | ||
65 | + <p class="uploadword">上传小票图片</p> | ||
66 | + </div> | ||
67 | +<div class="footer">确定</div> | ||
68 | + <script type="text/javascript" src="js/jquery.min.js"></script> | ||
69 | + <script> | ||
70 | + function clacImgZoomParam(maxWidth, maxHeight, width, height) { | ||
71 | + var param = { | ||
72 | + top: 0, | ||
73 | + left: 0, | ||
74 | + width: width, | ||
75 | + height: height | ||
76 | + }; | ||
77 | + if(width > maxWidth || height > maxHeight) { | ||
78 | + rateWidth = width / maxWidth; | ||
79 | + rateHeight = height / maxHeight; | ||
80 | + | ||
81 | + if(rateWidth > rateHeight) { | ||
82 | + param.width = maxWidth; | ||
83 | + param.height = Math.round(height / rateWidth); | ||
84 | + } else { | ||
85 | + param.width = Math.round(width / rateHeight); | ||
86 | + param.height = maxHeight; | ||
87 | + } | ||
88 | + } | ||
89 | + param.left = Math.round((maxWidth - param.width) / 2); | ||
90 | + param.top = Math.round((maxHeight - param.height) / 2); | ||
91 | + return param; | ||
92 | + } | ||
93 | + | ||
94 | + function previewImage(file) { | ||
95 | + var MAXWIDTH = 50; | ||
96 | + var MAXHEIGHT = 50; | ||
97 | + var div = document.getElementById('preview'); | ||
98 | + if(file.files && file.files[0]) { | ||
99 | + div.innerHTML = '<img id=imghead onclick=$("#previewImg").click()>'; | ||
100 | + var img = document.getElementById('imghead'); | ||
101 | + img.onload = function() { | ||
102 | + var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight); | ||
103 | + img.width = rect.width; | ||
104 | + img.height = rect.height; | ||
105 | + // img.style.marginLeft = rect.left+'px'; | ||
106 | + img.style.marginTop = rect.top + 'px'; | ||
107 | + } | ||
108 | + var reader = new FileReader(); | ||
109 | + reader.onload = function(evt) { | ||
110 | + img.src = evt.target.result; | ||
111 | + } | ||
112 | + reader.readAsDataURL(file.files[0]); | ||
113 | + } else //兼容IE | ||
114 | + { | ||
115 | + var sFilter = 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="'; | ||
116 | + file.select(); | ||
117 | + var src = document.selection.createRange().text; | ||
118 | + div.innerHTML = '<img id=imghead>'; | ||
119 | + var img = document.getElementById('imghead'); | ||
120 | + img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src; | ||
121 | + var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight); | ||
122 | + status = ('rect:' + rect.top + ',' + rect.left + ',' + rect.width + ',' + rect.height); | ||
123 | + div.innerHTML = "<div id=divhead style='width:" + rect.width + "px;height:" + rect.height + "px;margin-top:" + rect.top + "px;" + sFilter + src + "\"'></div>"; | ||
124 | + } | ||
125 | + | ||
126 | + } | ||
127 | + | ||
128 | + //确定上传小票 | ||
129 | + $(".footer").click(function(){ | ||
130 | + window.location.href='successupload.html' | ||
131 | + }) | ||
132 | + </script> | ||
133 | +</body> | ||
134 | +</html> |
-
请 注册 或 登录 后发表评论