Commit ad1d0f9b4d17e624f06573bc4287652e79835e98
1 parent
81865270
Exists in
master
1. 去除UUID中的@版本号,调整图片下载失败的问题。
Showing
8 changed files
with
31 additions
and
23 deletions
Show diff stats
app-wx/controllers/QrcodeController.php
... | ... | @@ -32,7 +32,7 @@ class QrcodeController extends BaseController |
32 | 32 | { |
33 | 33 | $uuid = Yii::$app->request->get("uuid"); |
34 | 34 | // 判断路径中是否存在UUID |
35 | - if (empty($uuid)) { | |
35 | + /*if (empty($uuid)) { | |
36 | 36 | $this->jumpError(); |
37 | 37 | } |
38 | 38 | if (strstr($uuid, "@") === false) { |
... | ... | @@ -42,13 +42,13 @@ class QrcodeController extends BaseController |
42 | 42 | if (empty($explodArrar)) { |
43 | 43 | $this->jumpError(); |
44 | 44 | } |
45 | - $uuid = $explodArrar[0]; | |
45 | + $uuid = $explodArrar[0];*/ | |
46 | 46 | // @todo 校验UUID是否有效 -2 无效 0 有效未激活 2 有效已激活 |
47 | 47 | $startTime = microtime(true); |
48 | 48 | $result = CheckActiveHelper::getAppCheck($uuid, ""); |
49 | 49 | $etime=microtime(true);//获取程序执行结束的时间 |
50 | 50 | $total=$etime-$startTime; //计算差值 |
51 | - Log::DEBUG("调用检查接口结果:" . json_encode($result) . '执行时间:' . $total . "秒"); | |
51 | + Log::DEBUG("调用检查接口结果[uuid=$uuid]:" . json_encode($result) . '执行时间:' . $total . "秒"); | |
52 | 52 | if (isset($result["code"])) { |
53 | 53 | if ($result["code"] == 2) { |
54 | 54 | $hasRecord = SellerInputRecordRepository::findOne(["uuid" => $uuid]); | ... | ... |
app-wx/controllers/TestController.php
... | ... | @@ -24,8 +24,8 @@ class TestController extends Controller |
24 | 24 | } |
25 | 25 | public function actionTestMsg() |
26 | 26 | { |
27 | - //$sms = new SmsMessage(); | |
28 | - //$sms->sendGetCode("15999944931", "333333"); | |
27 | + $sms = new SmsMessage(); | |
28 | + $sms->sendGetCode("15999944931", "333333"); | |
29 | 29 | $fileName = "IMG_iGavHy6K1TIqPba6888879_1577200522.jpg"; |
30 | 30 | $fileFullName = "https://smart-anti-fake.oss-cn-hongkong.aliyuncs.com/check/20191224/8/IMG_iGavHy6K1TIqPba6888879_1577200522.jpg"; |
31 | 31 | var_dump(CheckActiveHelper::checkAppQrv($fileFullName, $fileName, "")); | ... | ... |
app-wx/modules/check/controllers/DefaultController.php
... | ... | @@ -144,6 +144,7 @@ class DefaultController extends BaseController |
144 | 144 | $e->message = '缺少必要参数!'; |
145 | 145 | return $this->renderJson($e); |
146 | 146 | } |
147 | + Log::DEBUG("保存图片失败:" . '保存失败!'); | |
147 | 148 | $filename = $this->saveWxImgToRemoveServer($wechat, $uploadFile, $uuid); |
148 | 149 | if (!$filename) { |
149 | 150 | $e->message = '保存失败!'; |
... | ... | @@ -168,15 +169,13 @@ class DefaultController extends BaseController |
168 | 169 | if (empty($tr)) { |
169 | 170 | return false; |
170 | 171 | } |
171 | - | |
172 | - $qrcodeArr = $wechat->getMedia($tr, 1); | |
172 | + $qrcodeArr = $wechat->getMedia($tr, 0); | |
173 | 173 | if (empty($qrcodeArr['body'])) { |
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | $filename_root = $_SERVER['DOCUMENT_ROOT']; |
177 | 177 | $baseUrl = Yii::$app->params['baseUrl']; |
178 | 178 | $path = $filename_root . '/tmp/'. date("Ymd") . '/'; |
179 | - | |
180 | 179 | if (!is_dir($path)) { |
181 | 180 | @mkdir($path, 0777); |
182 | 181 | } | ... | ... |
app-wx/web/dist/js/check-app.js
1 | -define("check-app",["mk7/app"],function(t){var n=Dom7,e=function(){var t=n(".ui-loading-block");0==t.length&&(n(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var t=document.getElementById("loader-inner"),n=document.createElement("p");n.className="notice",t&&(n.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',t.appendChild(n))},window.waitingTime))},o=!0;return t.name="check",t.routes={index:function(){return o=!1,e(),t.runController("index")},"*":function(){return o=!1,e(),t.runController("index")},"scan-count/:uuid/:scancount":function(n,i){return o=!1,e(),t.runController("scan-count",{uuid:n,scancount:i})},"warning/:uuid":function(n){return o=!1,e(),t.runController("warning",{uuid:n})},"submit/:uuid":function(n){return o=!1,e(),t.runController("submit",{uuid:n})},"error/:uuid":function(n){return o=!1,e(),t.runController("error",{uuid:n})},"success/:uuid":function(n){return o=!1,e(),t.runController("success",{uuid:n})},"info/:uuid/:number_code":function(n,i){return o=!1,e(),t.runController("info",{uuid:n,number_code:i})}},t}),define("check/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7;Template7;return t.run=function(){var t=this;t.setPageTitle("验证结果"),t.render()},t.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},t}),define("check/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,1),r=0,s=2,u=0;return t.run=function(){var t=this;t.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),t.scanQrcode(),t.render(),c(".scan-button").attr("disabled","disabled"),c(".scan-button").text("正在调起扫码……")},t.bindEvents=function(){var t=this;c(".scan-button").click(function(){t.scanQrcode()})},t.scanQrcode=function(){var t=this;i.ready(function(){i.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(o){var i=o.resultStr;if(""==i||void 0==i||i.indexOf("http://smart.zhoundlee.com")<0)return e.toast({content:"该智能防伪二维码无效"}),!1;var d=c.parseUrlQuery(i);if(null!=d&&void 0!==d&&null!=d.uuid&&void 0!==d.uuid){if(d.uuid.indexOf("@")==-1)return e.toast({content:"该智能防伪二维码无效"}),!1;var d=d.uuid.split("@"),l=n.to("check#warning/"+d[0]),m=n.to("check#scan-count/"+d[0]+"/"+u);c.ajax({method:"POST",url:n.to("check/default/check-active"),data:{uuid:d[0]},dataType:"json",beforeSend:function(){t.showIndicator()},success:function(t){u=t.scan_count,m=n.to("check#scan-count/"+d[0]+"/"+u),t.success==a?window.location.href=m:t.success==r?window.location.href=l:t.success==s?e.toast({content:"该智能防伪二维码无效"}):e.toast({content:"该智能防伪二维码无效"})},error:function(t){},complete:function(n){t.hideIndicator()}})}else e.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){c(".scan-button").removeAttr("disabled"),c(".scan-button").text("点击扫描标签")},1e3)})},t}),define("check/info-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7;Template7;return i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["previewImage"]}),t.run=function(){var t=this;t.setPageTitle("隐私信息"),t.loadData(t.params.uuid,t.params.number_code),t.popstate()},t.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)}),c(".image_button").click(function(){var t=c(this).attr("data-url");return e.isEmpty(t)?(e.toast({content:"该图片不存在",closeDelay:3e3}),!1):(c(".scan-image-div").html('<img src="'+t+'" class="scan-image"/>'),void c(".scan-image").click(function(){var t=[],n=c("#info").find(".image_button");c.each(n,function(n,e){var o=c(e).attr("data-url");t.push(o)});var e=c(this).attr("src");i.previewImage({current:e,urls:t})}))}),c(".scan-image").click(function(){var t=[],n=c("#info").find(".image_button");c.each(n,function(n,e){var o=c(e).attr("data-url");t.push(o)});var e=c(this).attr("src");i.previewImage({current:e,urls:t})}),c(".vedio_button").click(function(){var t=c(this).attr("data-url");if(e.isEmpty(t))return e.toast({content:"该视频不存在",closeDelay:3e3}),!1;var n="<video class='scan-image' style='border: 1px solid #cce1f1;object-fit: fill;height:15rem;' alt='商品视频' ";n+="controls='controls'> <source src='"+t+"' type='video/mp4'>您的浏览器不支持 video 标签。</video>",c(".scan-image-div").html(n)})},t.loadData=function(t,o){var i=this;c.ajax({method:"POST",url:n.to("check/default/get-info"),data:{uuid:t,number_code:o},dataType:"json",beforeSend:function(){i.showIndicator()},success:function(t){try{t.success?i.render(t.data):e.toast({content:t.message,closeDelay:3e3})}catch(n){e.toast({content:"出错",closeDelay:3e3})}},error:function(t){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(t){i.hideIndicator()}})},t.popstate=function(){window.addEventListener("popstate",function(t){window.location.href=n.to("check#index")},!1)},t}),define("check/scan-count-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,0),r="";return t.run=function(){var t=this;a=parseInt(t.params.scancount),r=t.params.uuid,t.setPageTitle("验证标签"),t.render(),c(".count-num").html(a)},t.bindEvents=function(){c(".scan-button").click(function(){""!=r&&void 0!=r?window.location.href=n.to("check#submit/"+r):window.location.href=n.to("check#index")})},t}),define("check/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,"");return t.run=function(){var t=this;a=t.params.uuid,t.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),t.render()},t.bindEvents=function(){var t=this;c(".scan-image").click(function(){t.uploadImg(c(this))}),c(".scan-button").click(function(){var o=c(".scan-image").attr("data");if(e.isEmpty(o))return e.toast({content:"请拍照文件上传后再试!"}),!1;var i=c(this);c.ajax({method:"POST",url:n.to("check/default/check-actived"),data:{upload_file:o,uuid:a},dataType:"json",beforeSend:function(){t.showIndicator(),i.html("验证中…")},success:function(t){try{t.success?1==t.code?window.location.href=n.to("check#success/"+a):e.toast({content:t.message,closeDelay:3e3}):window.location.href=n.to("check#error/"+a)}catch(o){e.toast({content:"校验失败,请重拍图片再试!",closeDelay:3e3})}},error:function(t){e.toast({content:"校验失败,请重拍图片再试!"}),i.html("提交验证")},complete:function(n){t.hideIndicator(),i.html("提交验证")}})})},t.uploadImg=function(t){var n=this;i.ready(function(){i.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(e){e.localIds.length>0&&n.upload(e.localIds,t)}})})},t.upload=function(t,o){var r=this;return void 0==t[0]?"":void i.uploadImage({localId:t[0],isShowProgressTips:1,success:function(t){c.ajax({method:"POST",url:n.to("check/default/update-serviceid"),data:{service_id:t.serverId,uuid:a},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(t){try{if(t.success){var n=t.img_path;o.attr("data",n),o.attr("src",t.show_path)}else e.toast({content:t.message,closeDelay:3e3})}catch(i){e.toast({content:"图片上传失败!",closeDelay:3e3}),r.hideIndicator()}},error:function(t){e.toast({content:"图片上传失败!"}),r.hideIndicator()},complete:function(t){r.hideIndicator()}})},fail:function(t){r.app.alert(JSON.stringify(t))}})},t}),define("check/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,"");return t.run=function(){var t=this;a=t.params.uuid,t.setPageTitle("验证结果"),t.render()},t.bindEvents=function(){var t=this;c(".btn-submit").click(function(){var o=c(".input-num").val();return e.isEmpty(o)?(e.toast({content:"请填写提取码"}),c(".input-num").focus(),!1):e.isEmpty(a)?(e.toast({content:"缺少必要参数请退出重试"}),!1):void c.ajax({method:"POST",url:n.to("check/default/get-info"),data:{uuid:a,number_code:o},dataType:"json",beforeSend:function(){t.showIndicator()},success:function(t){try{t.success?window.location.href=n.to("check#info/"+a+"/"+o):e.toast({content:t.message,closeDelay:3e3})}catch(i){e.toast({content:"出错",closeDelay:3e3})}},error:function(t){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){t.hideIndicator()}})})},t}),define("check/warning-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,"");return t.run=function(){var t=this;a=t.params.uuid,t.setPageTitle("验证标签"),t.render()},t.bindEvents=function(){c(".scan-jump-button").click(function(){""!=a&&void 0!=a?window.location.href=n.to("smart#enter/"+a):window.location.href=n.to("check#index")})},t}); | |
2 | 1 | \ No newline at end of file |
2 | +define("check-app",["mk7/app"],function(t){var n=Dom7,e=function(){var t=n(".ui-loading-block");0==t.length&&(n(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var t=document.getElementById("loader-inner"),n=document.createElement("p");n.className="notice",t&&(n.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',t.appendChild(n))},window.waitingTime))},o=!0;return t.name="check",t.routes={index:function(){return o=!1,e(),t.runController("index")},"*":function(){return o=!1,e(),t.runController("index")},"scan-count/:uuid/:scancount":function(n,i){return o=!1,e(),t.runController("scan-count",{uuid:n,scancount:i})},"warning/:uuid":function(n){return o=!1,e(),t.runController("warning",{uuid:n})},"submit/:uuid":function(n){return o=!1,e(),t.runController("submit",{uuid:n})},"error/:uuid":function(n){return o=!1,e(),t.runController("error",{uuid:n})},"success/:uuid":function(n){return o=!1,e(),t.runController("success",{uuid:n})},"info/:uuid/:number_code":function(n,i){return o=!1,e(),t.runController("info",{uuid:n,number_code:i})}},t}),define("check/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7;Template7;return t.run=function(){var t=this;t.setPageTitle("验证结果"),t.render()},t.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},t}),define("check/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,1),r=0,s=2,u=0;return t.run=function(){var t=this;t.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),t.scanQrcode(),t.render(),c(".scan-button").attr("disabled","disabled"),c(".scan-button").text("正在调起扫码……")},t.bindEvents=function(){var t=this;c(".scan-button").click(function(){t.scanQrcode()})},t.scanQrcode=function(){var t=this;i.ready(function(){i.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(o){var i=o.resultStr;if(""==i||void 0==i||i.indexOf("http://smart.zhoundlee.com")<0)return e.toast({content:"该智能防伪二维码无效"}),!1;var d=c.parseUrlQuery(i);if(null!=d&&void 0!==d&&null!=d.uuid&&void 0!==d.uuid){var l=d.uuid,m=n.to("check#warning/"+l),f=n.to("check#scan-count/"+l+"/"+u);c.ajax({method:"POST",url:n.to("check/default/check-active"),data:{uuid:l},dataType:"json",beforeSend:function(){t.showIndicator()},success:function(t){u=t.scan_count,f=n.to("check#scan-count/"+l+"/"+u),t.success==a?window.location.href=f:t.success==r?window.location.href=m:t.success==s?e.toast({content:"该智能防伪二维码无效"}):e.toast({content:"该智能防伪二维码无效"})},error:function(t){},complete:function(n){t.hideIndicator()}})}else e.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){c(".scan-button").removeAttr("disabled"),c(".scan-button").text("点击扫描标签")},1e3)})},t}),define("check/info-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7;Template7;return i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["previewImage"]}),t.run=function(){var t=this;t.setPageTitle("隐私信息"),t.loadData(t.params.uuid,t.params.number_code),t.popstate()},t.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)}),c(".image_button").click(function(){var t=c(this).attr("data-url");return e.isEmpty(t)?(e.toast({content:"该图片不存在",closeDelay:3e3}),!1):(c(".scan-image-div").html('<img src="'+t+'" class="scan-image"/>'),void c(".scan-image").click(function(){var t=[],n=c("#info").find(".image_button");c.each(n,function(n,e){var o=c(e).attr("data-url");t.push(o)});var e=c(this).attr("src");i.previewImage({current:e,urls:t})}))}),c(".scan-image").click(function(){var t=[],n=c("#info").find(".image_button");c.each(n,function(n,e){var o=c(e).attr("data-url");t.push(o)});var e=c(this).attr("src");i.previewImage({current:e,urls:t})}),c(".vedio_button").click(function(){var t=c(this).attr("data-url");if(e.isEmpty(t))return e.toast({content:"该视频不存在",closeDelay:3e3}),!1;var n="<video class='scan-image' style='border: 1px solid #cce1f1;object-fit: fill;height:15rem;' alt='商品视频' ";n+="controls='controls'> <source src='"+t+"' type='video/mp4'>您的浏览器不支持 video 标签。</video>",c(".scan-image-div").html(n)})},t.loadData=function(t,o){var i=this;c.ajax({method:"POST",url:n.to("check/default/get-info"),data:{uuid:t,number_code:o},dataType:"json",beforeSend:function(){i.showIndicator()},success:function(t){try{t.success?i.render(t.data):e.toast({content:t.message,closeDelay:3e3})}catch(n){e.toast({content:"出错",closeDelay:3e3})}},error:function(t){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(t){i.hideIndicator()}})},t.popstate=function(){window.addEventListener("popstate",function(t){window.location.href=n.to("check#index")},!1)},t}),define("check/scan-count-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,0),r="";return t.run=function(){var t=this;a=parseInt(t.params.scancount),r=t.params.uuid,t.setPageTitle("验证标签"),t.render(),c(".count-num").html(a)},t.bindEvents=function(){c(".scan-button").click(function(){""!=r&&void 0!=r?window.location.href=n.to("check#submit/"+r):window.location.href=n.to("check#index")})},t}),define("check/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,"");return t.run=function(){var t=this;a=t.params.uuid,t.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),t.render()},t.bindEvents=function(){var t=this;c(".scan-image").click(function(){t.uploadImg(c(this))}),c(".scan-button").click(function(){var o=c(".scan-image").attr("data");if(e.isEmpty(o))return e.toast({content:"请拍照文件上传后再试!"}),!1;var i=c(this);c.ajax({method:"POST",url:n.to("check/default/check-actived"),data:{upload_file:o,uuid:a},dataType:"json",beforeSend:function(){t.showIndicator(),i.html("验证中…")},success:function(t){try{t.success?1==t.code?window.location.href=n.to("check#success/"+a):e.toast({content:t.message,closeDelay:3e3}):window.location.href=n.to("check#error/"+a)}catch(o){e.toast({content:"校验失败,请重拍图片再试!",closeDelay:3e3})}},error:function(t){e.toast({content:"校验失败,请重拍图片再试!"}),i.html("提交验证")},complete:function(n){t.hideIndicator(),i.html("提交验证")}})})},t.uploadImg=function(t){var n=this;i.ready(function(){i.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(e){e.localIds.length>0&&n.upload(e.localIds,t)}})})},t.upload=function(t,o){var r=this;return void 0==t[0]?"":void i.uploadImage({localId:t[0],isShowProgressTips:1,success:function(t){c.ajax({method:"POST",url:n.to("check/default/update-serviceid"),data:{service_id:t.serverId,uuid:a},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(t){try{if(t.success){var n=t.img_path;o.attr("data",n),o.attr("src",t.show_path)}else e.toast({content:t.message,closeDelay:3e3})}catch(i){e.toast({content:"图片上传失败!",closeDelay:3e3}),r.hideIndicator()}},error:function(t){e.toast({content:"图片上传失败!"}),r.hideIndicator()},complete:function(t){r.hideIndicator()}})},fail:function(t){r.app.alert(JSON.stringify(t))}})},t}),define("check/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,"");return t.run=function(){var t=this;a=t.params.uuid,t.setPageTitle("验证结果"),t.render()},t.bindEvents=function(){var t=this;c(".btn-submit").click(function(){var o=c(".input-num").val();return e.isEmpty(o)?(e.toast({content:"请填写提取码"}),c(".input-num").focus(),!1):e.isEmpty(a)?(e.toast({content:"缺少必要参数请退出重试"}),!1):void c.ajax({method:"POST",url:n.to("check/default/get-info"),data:{uuid:a,number_code:o},dataType:"json",beforeSend:function(){t.showIndicator()},success:function(t){try{t.success?window.location.href=n.to("check#info/"+a+"/"+o):e.toast({content:t.message,closeDelay:3e3})}catch(i){e.toast({content:"出错",closeDelay:3e3})}},error:function(t){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){t.hideIndicator()}})})},t}),define("check/warning-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,"");return t.run=function(){var t=this;a=t.params.uuid,t.setPageTitle("验证标签"),t.render()},t.bindEvents=function(){c(".scan-jump-button").click(function(){""!=a&&void 0!=a?window.location.href=n.to("smart#enter/"+a):window.location.href=n.to("check#index")})},t}); | |
3 | 3 | \ No newline at end of file | ... | ... |
app-wx/web/dist/js/smart-app.js
1 | -define("smart/actived-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活标签"),e.render()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}),define("smart-app",["mk7/app"],function(e){var t=Dom7,n=function(){var e=t(".ui-loading-block");0==e.length&&(t(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var e=document.getElementById("loader-inner"),t=document.createElement("p");t.className="notice",e&&(t.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',e.appendChild(t))},window.waitingTime))},i=!0;return e.name="smart",e.routes={index:function(){return i=!1,n(),e.runController("index")},"enter/:uuid":function(t){i=!1,n();var o={uuid:t};return e.runController("enter",o)},"*":function(){return i=!1,n(),e.runController("index")},actived:function(){return i=!1,n(),e.runController("actived")},error:function(){return i=!1,n(),e.runController("error")},success:function(){return i=!1,n(),e.runController("success")},"error-url":function(){return i=!1,n(),e.runController("error-url")}},e}),define("smart/enter-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin","mk7/uploadjs"],function(e,t,n,i,o,r){var e=new e,s=Dom7,a=(Template7,"smart/default/upload-img"),l="smart/default/upload-vedio",c="smart/default/submit",d=3,u=1,m="",f=!1;return e.run=function(){var e=this;e.setPageTitle("激活标签"),o.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),m=e.params.uuid,e.hideAllNonBaseMenuItem(window.$site),e.render(),e.loadAddress()},e.bindEvents=function(){var e=this;s("#upload-btn").change(function(e){if(""!=s(this).val()&&null!=s(this).val()){var t=e.currentTarget.files[0].name,i=e.currentTarget.files[0].size,o=t.lastIndexOf("."),l=t.substr(o+1);if("jpg"!=l&&"gif"!=l&&"png"!=l&&"jpeg"!=l&&"ico"!=l&&"bmp"!=l)return n.toast({content:"该文件不能作为商品图片",closeDelay:3e3}),!1;if(i>5242880)return n.toast({content:"图片大小不能超过5M",closeDelay:3e3}),!1;if(d==s("#image-list").find(".up-img").length)return n.toast({content:"最多只能上传三张商品图片",closeDelay:3e3}),!1;var c=s(this).parents("li");r.uploadFile({selector:"#upload-btn",url:a,processAppendTo:"#enter",success:function(e,t){try{if(e.success){var i=e.tmpUrl,o="";0==s("#image-list").find(".convert-img").length&&(o='<div class="convert-img">封面</div>'),s('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+i+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')">'+o+'</div><span class="del-img"></span></li>').insertBefore(c),d==s("#image-list").find(".up-img").length&&s(".upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(r){console.log(r),n.toast({content:"出错",closeDelay:5e3})}},error:function(e,t){n.toast({content:"文件上传失败",closeDelay:5e3})}})}}),s("#upload-vedio-btn").change(function(e){if(""!=s(this).val()&&null!=s(this).val()){var t=e.currentTarget.files[0].name,i=e.currentTarget.files[0].size,o=t.lastIndexOf(".");t.substr(o+1);if(u==s("#vedio-list").find(".up-vedio-img").length)return n.toast({content:"只能上传一个商品视频",closeDelay:3e3}),!1;if(i>10485760)return n.toast({content:"图片大小不能超过10M",closeDelay:3e3}),!1;var a=s(this).parents("li");r.uploadFile({selector:"#upload-vedio-btn",url:l,processAppendTo:"#enter",success:function(e,t){try{if(e.success){var i=e.tmpUrl,o="";0==s("#vedio-list").find(".convert-img").length&&(o='<div class="convert-img">封面</div>'),s('<li class="upload-vedio-li up-vedio-img"><div data="'+e.tmpFile+'" data-url="'+i+'" class="upload-vedio-item" style="background-image:url('+e.tmpMinUrl+')">'+o+'</div><span class="del-vedio-img"></span></li>').insertBefore(a),u==s("#vedio-list").find(".up-vedio-img").length&&s(".upload-vedio-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(r){console.log(r),n.toast({content:"出错",closeDelay:5e3})}},error:function(e,t){n.toast({content:"文件上传失败",closeDelay:5e3})}})}}),s("#enter").on("click",".del-img",function(e){s(this).parent().remove(),d>=s("#image-list").find(".up-img").length&&s(".upload-btn-li").show()}),s("#enter").on("click",".del-vedio-img",function(e){s(this).parent().remove(),u>=s("#vedio-list").find(".up-vedio-img").length&&s(".upload-vedio-btn-li").show()}),s("#enter").on("click","#dropdown-address",function(e){s(".address-input").val(s(this).html())}),s("#enter").on("click",".submit-btn",function(){if(n.isEmpty(m))return n.toast({content:"进入方式不对,请从新扫码激活",closeDelay:3e3}),!1;var i=s(".upload-vedio-item").attr("data"),o="";s(".upload-item").each(function(){var e=s(this).attr("data");n.isEmpty(e)||(o+=s(this).attr("data")+",")}),""!=o&&(o=o.substring(0,o.length-1));var r=s(".address-input").val(),a=s(".logistics_number").val(),l=s(".content-cls").val(),d=s(".phone-number").val(),u=s(".phone-number-header").val();if(!(n.isEmpty(i)&&n.isEmpty(o)&&n.isEmpty(r)&&n.isEmpty(a)&&n.isEmpty(l))){if(n.isEmpty(u))return n.toast({content:"请填写国家区号",closeDelay:3e3}),s(".phone-number-header").focus(),!1;if("86"==u&&!n.isMobile(d))return n.toast({content:"请填写正确手机号码",closeDelay:3e3}),s(".phone-number").focus(),!1}s(".submit-btn").attr("disabled","disabled"),s.ajax({method:"POST",url:c,data:{file_data:o,vedio_data:i,address:r,content:l,phone:d,logistics_number:a,phone_header:u,uuid:m},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success?(s(".submit-btn").removeAttr("disabled"),window.location.href=t.to("smart#success")):window.location.href=t.to("smart#error")},error:function(e){n.alert(e.responseText)},complete:function(t){s(".submit-btn").removeAttr("disabled"),e.hideIndicator()}})})},e.uploadImg=function(e){var t=this;o.ready(function(){o.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(n){n.localIds.length>0&&t.upload(n.localIds,e)}})})},e.upload=function(e,i){var r=this;return void 0==e[0]?"":void o.uploadImage({localId:e[0],isShowProgressTips:1,success:function(e){s.ajax({method:"POST",url:t.to("smart/default/update-serviceid"),data:{service_id:e.serverId},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(e){try{if(e.success){var t=e.img_path,o="";0==s("#image-list").find(".convert-img").length&&(o='<div class="convert-img">封面</div>'),s('<li class="upload-li up-img"><div data="'+e.img_path+'" data-url="'+t+'" class="upload-item" style="background-image:url('+e.show_path+')">'+o+'</div><span class="del-img"></span></li>').insertBefore(i),d==s("#image-list").find(".up-img").length&&s(".upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:3e3})}catch(r){n.toast({content:"出错",closeDelay:3e3})}},error:function(e){alert(e.responseText),n.toast({content:"提交出错,请联系系统管理员"+e.responseText})},complete:function(e){r.hideIndicator()}})},fail:function(e){r.app.alert(JSON.stringify(e))}})},e.loadAddress=function(){var e=this;s.ajax({method:"POST",url:t.to("smart/default/select-address"),data:{},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){try{e.success&&""!=e.address&&(f=!0,s("#dropdown-address").html(e.address),s(".address-input").focus(function(e){f&&s("#dropdown-address").show()}),s(".address-input").blur(function(e){f&&s("#dropdown-address").hide()}))}catch(t){}},error:function(e){},complete:function(t){e.hideIndicator()}})},e}),define("smart/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活结果"),e.render(),e.setTimer()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e.setTimer=function(){var e=4,i=window.setInterval(function(){return 0==e?(window.location.href=t.to("smart#index"),void(n.isEmpty(i)||clearInterval(i))):(r("#timerDiv").html(e+"秒后跳转到激活扫码页"),void e--)},1e3)},e}),define("smart/error-url-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活标签"),e.render()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}),define("smart/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7,s=(Template7,1),a=0,l=2;return e.run=function(){var e=this;e.setPageTitle("智能防伪扫码"),o.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),e.scanQrcode(),e.render(),r(".scan-button").attr("disabled","disabled"),r(".scan-button").text("正在调起扫码……")},e.bindEvents=function(){var e=this;r(".scan-button").click(function(){e.scanQrcode()})},e.scanQrcode=function(){var e=this;o.ready(function(){o.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(i){var o=i.resultStr;if(""==o||void 0==o||o.indexOf("http://smart.zhoundlee.com")<0)return n.toast({content:"该智能防伪二维码无效"}),!1;var c=r.parseUrlQuery(o);if(null!=c&&void 0!==c&&null!=c.uuid&&void 0!==c.uuid){if(c.uuid.indexOf("@")==-1)return n.toast({content:"该智能防伪二维码无效"}),!1;var c=c.uuid.split("@"),d=t.to("smart#enter/"+c[0]),u=t.to("smart#actived"),m=t.to("smart#error-url");r.ajax({method:"POST",url:t.to("smart/default/check-active"),data:{uuid:c[0]},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success==s?window.location.href=u:e.success==a?window.location.href=d:e.success==l?window.location.href=m:window.location.href=m},error:function(e){},complete:function(t){e.hideIndicator()}})}else n.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){r(".scan-button").removeAttr("disabled"),r(".scan-button").text("点击扫描标签")},1e3)})},e}),define("smart/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活结果"),e.render(),e.setTimer()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e.setTimer=function(){var e=4,i=window.setInterval(function(){return 0==e?(window.location.href=t.to("smart#index"),void(n.isEmpty(i)||clearInterval(i))):(r("#timerDiv").html(e+"秒后跳转到激活扫码页"),void e--)},1e3)},e}); | |
2 | 1 | \ No newline at end of file |
2 | +define("smart/actived-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活标签"),e.render()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}),define("smart-app",["mk7/app"],function(e){var t=Dom7,n=function(){var e=t(".ui-loading-block");0==e.length&&(t(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var e=document.getElementById("loader-inner"),t=document.createElement("p");t.className="notice",e&&(t.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',e.appendChild(t))},window.waitingTime))},i=!0;return e.name="smart",e.routes={index:function(){return i=!1,n(),e.runController("index")},"enter/:uuid":function(t){i=!1,n();var o={uuid:t};return e.runController("enter",o)},"*":function(){return i=!1,n(),e.runController("index")},actived:function(){return i=!1,n(),e.runController("actived")},error:function(){return i=!1,n(),e.runController("error")},success:function(){return i=!1,n(),e.runController("success")},"error-url":function(){return i=!1,n(),e.runController("error-url")}},e}),define("smart/enter-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin","mk7/uploadjs"],function(e,t,n,i,o,r){var e=new e,s=Dom7,a=(Template7,"smart/default/upload-img"),l="smart/default/upload-vedio",c="smart/default/submit",d=3,u=1,m="",f=!1;return e.run=function(){var e=this;e.setPageTitle("激活标签"),o.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),m=e.params.uuid,e.hideAllNonBaseMenuItem(window.$site),e.render(),e.loadAddress()},e.bindEvents=function(){var e=this;s("#upload-btn").change(function(e){if(""!=s(this).val()&&null!=s(this).val()){var t=e.currentTarget.files[0].name,i=e.currentTarget.files[0].size,o=t.lastIndexOf("."),l=t.substr(o+1);if("jpg"!=l&&"gif"!=l&&"png"!=l&&"jpeg"!=l&&"ico"!=l&&"bmp"!=l)return n.toast({content:"该文件不能作为商品图片",closeDelay:3e3}),!1;if(i>5242880)return n.toast({content:"图片大小不能超过5M",closeDelay:3e3}),!1;if(d==s("#image-list").find(".up-img").length)return n.toast({content:"最多只能上传三张商品图片",closeDelay:3e3}),!1;var c=s(this).parents("li");r.uploadFile({selector:"#upload-btn",url:a,processAppendTo:"#enter",success:function(e,t){try{if(e.success){var i=e.tmpUrl,o="";0==s("#image-list").find(".convert-img").length&&(o='<div class="convert-img">封面</div>'),s('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+i+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')">'+o+'</div><span class="del-img"></span></li>').insertBefore(c),d==s("#image-list").find(".up-img").length&&s(".upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(r){console.log(r),n.toast({content:"出错",closeDelay:5e3})}},error:function(e,t){n.toast({content:"文件上传失败",closeDelay:5e3})}})}}),s("#upload-vedio-btn").change(function(e){if(""!=s(this).val()&&null!=s(this).val()){var t=e.currentTarget.files[0].name,i=e.currentTarget.files[0].size,o=t.lastIndexOf(".");t.substr(o+1);if(u==s("#vedio-list").find(".up-vedio-img").length)return n.toast({content:"只能上传一个商品视频",closeDelay:3e3}),!1;if(i>10485760)return n.toast({content:"图片大小不能超过10M",closeDelay:3e3}),!1;var a=s(this).parents("li");r.uploadFile({selector:"#upload-vedio-btn",url:l,processAppendTo:"#enter",success:function(e,t){try{if(e.success){var i=e.tmpUrl,o="";0==s("#vedio-list").find(".convert-img").length&&(o='<div class="convert-img">封面</div>'),s('<li class="upload-vedio-li up-vedio-img"><div data="'+e.tmpFile+'" data-url="'+i+'" class="upload-vedio-item" style="background-image:url('+e.tmpMinUrl+')">'+o+'</div><span class="del-vedio-img"></span></li>').insertBefore(a),u==s("#vedio-list").find(".up-vedio-img").length&&s(".upload-vedio-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(r){console.log(r),n.toast({content:"出错",closeDelay:5e3})}},error:function(e,t){n.toast({content:"文件上传失败",closeDelay:5e3})}})}}),s("#enter").on("click",".del-img",function(e){s(this).parent().remove(),d>=s("#image-list").find(".up-img").length&&s(".upload-btn-li").show()}),s("#enter").on("click",".del-vedio-img",function(e){s(this).parent().remove(),u>=s("#vedio-list").find(".up-vedio-img").length&&s(".upload-vedio-btn-li").show()}),s("#enter").on("click","#dropdown-address",function(e){s(".address-input").val(s(this).html())}),s("#enter").on("click",".submit-btn",function(){if(n.isEmpty(m))return n.toast({content:"进入方式不对,请从新扫码激活",closeDelay:3e3}),!1;var i=s(".upload-vedio-item").attr("data"),o="";s(".upload-item").each(function(){var e=s(this).attr("data");n.isEmpty(e)||(o+=s(this).attr("data")+",")}),""!=o&&(o=o.substring(0,o.length-1));var r=s(".address-input").val(),a=s(".logistics_number").val(),l=s(".content-cls").val(),d=s(".phone-number").val(),u=s(".phone-number-header").val();if(!(n.isEmpty(i)&&n.isEmpty(o)&&n.isEmpty(r)&&n.isEmpty(a)&&n.isEmpty(l))){if(n.isEmpty(u))return n.toast({content:"请填写国家区号",closeDelay:3e3}),s(".phone-number-header").focus(),!1;if("86"==u&&!n.isMobile(d))return n.toast({content:"请填写正确手机号码",closeDelay:3e3}),s(".phone-number").focus(),!1}s(".submit-btn").attr("disabled","disabled"),s.ajax({method:"POST",url:c,data:{file_data:o,vedio_data:i,address:r,content:l,phone:d,logistics_number:a,phone_header:u,uuid:m},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success?(s(".submit-btn").removeAttr("disabled"),window.location.href=t.to("smart#success")):window.location.href=t.to("smart#error")},error:function(e){n.alert(e.responseText)},complete:function(t){s(".submit-btn").removeAttr("disabled"),e.hideIndicator()}})})},e.uploadImg=function(e){var t=this;o.ready(function(){o.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(n){n.localIds.length>0&&t.upload(n.localIds,e)}})})},e.upload=function(e,i){var r=this;return void 0==e[0]?"":void o.uploadImage({localId:e[0],isShowProgressTips:1,success:function(e){s.ajax({method:"POST",url:t.to("smart/default/update-serviceid"),data:{service_id:e.serverId},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(e){try{if(e.success){var t=e.img_path,o="";0==s("#image-list").find(".convert-img").length&&(o='<div class="convert-img">封面</div>'),s('<li class="upload-li up-img"><div data="'+e.img_path+'" data-url="'+t+'" class="upload-item" style="background-image:url('+e.show_path+')">'+o+'</div><span class="del-img"></span></li>').insertBefore(i),d==s("#image-list").find(".up-img").length&&s(".upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:3e3})}catch(r){n.toast({content:"出错",closeDelay:3e3})}},error:function(e){alert(e.responseText),n.toast({content:"提交出错,请联系系统管理员"+e.responseText})},complete:function(e){r.hideIndicator()}})},fail:function(e){r.app.alert(JSON.stringify(e))}})},e.loadAddress=function(){var e=this;s.ajax({method:"POST",url:t.to("smart/default/select-address"),data:{},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){try{e.success&&""!=e.address&&(f=!0,s("#dropdown-address").html(e.address),s(".address-input").focus(function(e){f&&s("#dropdown-address").show()}),s(".address-input").blur(function(e){f&&s("#dropdown-address").hide()}))}catch(t){}},error:function(e){},complete:function(t){e.hideIndicator()}})},e}),define("smart/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活结果"),e.render(),e.setTimer()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e.setTimer=function(){var e=4,i=window.setInterval(function(){return 0==e?(window.location.href=t.to("smart#index"),void(n.isEmpty(i)||clearInterval(i))):(r("#timerDiv").html(e+"秒后跳转到激活扫码页"),void e--)},1e3)},e}),define("smart/error-url-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活标签"),e.render()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}),define("smart/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7,s=(Template7,1),a=0,l=2;return e.run=function(){var e=this;e.setPageTitle("智能防伪扫码"),o.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),e.scanQrcode(),e.render(),r(".scan-button").attr("disabled","disabled"),r(".scan-button").text("正在调起扫码……")},e.bindEvents=function(){var e=this;r(".scan-button").click(function(){e.scanQrcode()})},e.scanQrcode=function(){var e=this;o.ready(function(){o.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(i){var o=i.resultStr;if(""==o||void 0==o||o.indexOf("http://smart.zhoundlee.com")<0)return n.toast({content:"该智能防伪二维码无效"}),!1;var c=r.parseUrlQuery(o);if(null!=c&&void 0!==c&&null!=c.uuid&&void 0!==c.uuid){var d=t.to("smart#enter/"+c.uuid),u=t.to("smart#actived"),m=t.to("smart#error-url");r.ajax({method:"POST",url:t.to("smart/default/check-active"),data:{uuid:c.uuid},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success==s?window.location.href=u:e.success==a?window.location.href=d:e.success==l?window.location.href=m:window.location.href=m},error:function(e){},complete:function(t){e.hideIndicator()}})}else n.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){r(".scan-button").removeAttr("disabled"),r(".scan-button").text("点击扫描标签")},1e3)})},e}),define("smart/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活结果"),e.render(),e.setTimer()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e.setTimer=function(){var e=4,i=window.setInterval(function(){return 0==e?(window.location.href=t.to("smart#index"),void(n.isEmpty(i)||clearInterval(i))):(r("#timerDiv").html(e+"秒后跳转到激活扫码页"),void e--)},1e3)},e}); | |
3 | 3 | \ No newline at end of file | ... | ... |
app-wx/web/src/js/check/index-controller.js
... | ... | @@ -59,25 +59,30 @@ define( |
59 | 59 | var resultArr = $$.parseUrlQuery(result); |
60 | 60 | //这个二维码必须传到后台去做验证才对, |
61 | 61 | if(resultArr != null && resultArr!==undefined && resultArr['uuid']!=null && resultArr['uuid']!==undefined) { |
62 | - if (resultArr['uuid'].indexOf("@") == -1) { | |
62 | + /*if (resultArr['uuid'].indexOf("@") == -1) { | |
63 | 63 | utils.toast({content:'该智能防伪二维码无效'}); |
64 | 64 | return false; |
65 | - } | |
65 | + }*/ | |
66 | 66 | //可以用字符或字符串分割 |
67 | - var resultArr=resultArr['uuid'].split('@'); | |
68 | - var redirectNoActivedUrl = url.to('check#warning/' + resultArr[0]); | |
69 | - var redirectHasActivedUrl = url.to('check#scan-count/' + resultArr[0] + '/' + SCAN_COUNT); | |
67 | + //var resultArr=resultArr['uuid'].split('@'); | |
68 | + //var redirectNoActivedUrl = url.to('check#warning/' + resultArr[0]); | |
69 | + //var redirectHasActivedUrl = url.to('check#scan-count/' + resultArr[0] + '/' + SCAN_COUNT); | |
70 | + | |
71 | + var resultArrUUID=resultArr['uuid']; | |
72 | + var redirectNoActivedUrl = url.to('check#warning/' + resultArrUUID); | |
73 | + var redirectHasActivedUrl = url.to('check#scan-count/' + resultArrUUID + '/' + SCAN_COUNT); | |
70 | 74 | $$.ajax({ |
71 | 75 | method : "POST", |
72 | 76 | url: url.to('check/default/check-active'), |
73 | - data : {uuid: resultArr[0]}, | |
77 | + //data : {uuid: resultArr[0]}, | |
78 | + data : {uuid: resultArrUUID}, | |
74 | 79 | dataType : "json", |
75 | 80 | beforeSend : function(){ |
76 | 81 | me.showIndicator(); |
77 | 82 | }, |
78 | 83 | success : function(res){ |
79 | 84 | SCAN_COUNT = res.scan_count; |
80 | - redirectHasActivedUrl = url.to('check#scan-count/' + resultArr[0] + '/' + SCAN_COUNT); | |
85 | + redirectHasActivedUrl = url.to('check#scan-count/' + resultArrUUID + '/' + SCAN_COUNT); | |
81 | 86 | if (res.success == HAS_ACTIVED) { |
82 | 87 | window.location.href = redirectHasActivedUrl; |
83 | 88 | } else if (res.success == NO_ACTIVED) { | ... | ... |
app-wx/web/src/js/smart/index-controller.js
... | ... | @@ -58,19 +58,21 @@ define( |
58 | 58 | var resultArr = $$.parseUrlQuery(result); |
59 | 59 | //这个二维码必须传到后台去做验证才对, |
60 | 60 | if(resultArr != null && resultArr!==undefined && resultArr['uuid']!=null && resultArr['uuid']!==undefined) { |
61 | - if (resultArr['uuid'].indexOf("@") == -1) { | |
61 | + /*if (resultArr['uuid'].indexOf("@") == -1) { | |
62 | 62 | utils.toast({content:'该智能防伪二维码无效'}); |
63 | 63 | return false; |
64 | - } | |
64 | + }*/ | |
65 | 65 | //可以用字符或字符串分割 |
66 | - var resultArr=resultArr['uuid'].split('@'); | |
67 | - var redirectNoActivedUrl = url.to('smart#enter/'+resultArr[0]); | |
66 | + //var resultArr=resultArr['uuid'].split('@'); | |
67 | + //var redirectNoActivedUrl = url.to('smart#enter/'+resultArr[0]); | |
68 | + var redirectNoActivedUrl = url.to('smart#enter/'+resultArr['uuid']); | |
68 | 69 | var redirectHasActivedUrl = url.to('smart#actived'); |
69 | 70 | var redirectErrorUrl = url.to('smart#error-url'); |
70 | 71 | $$.ajax({ |
71 | 72 | method : "POST", |
72 | 73 | url: url.to('smart/default/check-active'), |
73 | - data : {uuid: resultArr[0]}, | |
74 | + //data : {uuid: resultArr[0]}, | |
75 | + data : {uuid: resultArr['uuid']}, | |
74 | 76 | dataType : "json", |
75 | 77 | beforeSend : function(){ |
76 | 78 | me.showIndicator(); | ... | ... |
common/exts/wechat/PHPSDK.php
... | ... | @@ -793,7 +793,7 @@ class PHPSDK |
793 | 793 | public function getMedia($media_id,$version=0) |
794 | 794 | { |
795 | 795 | if (!$this->access_token && !$this->checkAuth()) return false; |
796 | - if($version==0){ | |
796 | + if($version==0 || $version==1){ | |
797 | 797 | $apipre=self::API_URL_PREFIX; |
798 | 798 | }else{ |
799 | 799 | $apipre=self::FILE_API_URL; |
... | ... | @@ -801,6 +801,8 @@ class PHPSDK |
801 | 801 | $result = Http::getImageStream($apipre.self::MEDIA_GET_URL.'access_token='.$this->access_token.'&media_id='.$media_id); |
802 | 802 | if ($result) |
803 | 803 | { |
804 | + //WxLog::init(); | |
805 | + //WxLog::DEBUG("请求路径:" . $apipre.self::MEDIA_GET_URL.'access_token='.$this->access_token.'&media_id='.$media_id . '结果:' .$result['body']); | |
804 | 806 | //if (is_string($result)) { |
805 | 807 | $json = json_decode($result['body'], true); |
806 | 808 | //$json = json_decode($result, true); | ... | ... |