Commit 407413ee3232ed9fdd9800baded6a409693cd765
1 parent
310f6425
Exists in
master
1.服务器上的临时文件保存到OSS后立即删除
2.去除旧版的阿里大于短信对接代码
Showing
51 changed files
with
50 additions
and
3162 deletions
Show diff stats
app-wx/modules/check/controllers/DefaultController.php
... | ... | @@ -159,6 +159,8 @@ class DefaultController extends BaseController |
159 | 159 | $user_id = $userId = $this->getUserId(); |
160 | 160 | $stat_path = ImageManager::getSmartCheckImgPath($user_id, $uuid); |
161 | 161 | ImageManager::add($saveFilePath, $stat_path); |
162 | + // 删除服务器文件 | |
163 | + @unlink($saveFilePath); | |
162 | 164 | |
163 | 165 | return $stat_path; |
164 | 166 | } | ... | ... |
app-wx/modules/smart/controllers/DefaultController.php
... | ... | @@ -2,17 +2,16 @@ |
2 | 2 | |
3 | 3 | namespace app\wx\modules\smart\controllers; |
4 | 4 | |
5 | -use domain\system\message\SmsMessage; | |
6 | 5 | use Yii; |
7 | -use common\exts\sms\SmsManager; | |
8 | 6 | use common\helpers\CheckActiveHelper; |
9 | 7 | use common\helpers\ImageManager; |
10 | 8 | use common\helpers\ImageUtils; |
11 | 9 | use common\helpers\WxHelper; |
10 | +use domain\smart\ScanRecords; | |
11 | +use domain\system\message\SmsMessage; | |
12 | 12 | use domain\smart\SellerInputRecord; |
13 | 13 | use domain\smart\SellerInputRecordRepository; |
14 | 14 | use domain\smart\UserAddressRepository; |
15 | -use yii\base\Exception; | |
16 | 15 | use stdClass; |
17 | 16 | |
18 | 17 | /** |
... | ... | @@ -112,8 +111,7 @@ class DefaultController extends BaseController |
112 | 111 | $productImagePath = $fileData; |
113 | 112 | } |
114 | 113 | // 保存图片到OSS |
115 | - $dir = Yii::getAlias('@app/wx') . "/web/tmp/"; | |
116 | - $img_path = $dir . $fileData; | |
114 | + $img_path = $fileData; | |
117 | 115 | |
118 | 116 | // 校验UUID是否有效 2 无效 0 有效未激活 1 有效已激活 |
119 | 117 | $checkResult = CheckActiveHelper::getAppActivate($uuid); |
... | ... | @@ -121,11 +119,15 @@ class DefaultController extends BaseController |
121 | 119 | if ($checkResult) { |
122 | 120 | //success:激活成功 fail:激活失败,无效标签 activated:已激活过 |
123 | 121 | if (isset($checkResult["status"]) && "success" == $checkResult["status"]) { |
122 | + // 记录扫码次数 | |
123 | + ScanRecords::updateCount($uuid); | |
124 | 124 | $activeResult = true; |
125 | 125 | } else if (isset($checkResult["status"]) && "fail" == $checkResult["status"]) { |
126 | 126 | $e->msg = '该二维码无效'; |
127 | 127 | return $this->renderJson($e); |
128 | 128 | } else if (isset($checkResult["status"]) && "activated" == $checkResult["status"]) { |
129 | + // 记录扫码次数 | |
130 | + ScanRecords::updateCount($uuid); | |
129 | 131 | $e->message = '该二维码已激活'; |
130 | 132 | return $this->renderJson($e); |
131 | 133 | } |
... | ... | @@ -138,7 +140,7 @@ class DefaultController extends BaseController |
138 | 140 | |
139 | 141 | $newPath = ImageManager::getSmartImgPath($userId, $suffix); |
140 | 142 | |
141 | - ImageManager::add($img_path, $newPath); | |
143 | + ImageManager::move($img_path, $newPath); | |
142 | 144 | |
143 | 145 | if ($suffix == "mp4") { |
144 | 146 | $productVedioPath = $newPath; |
... | ... | @@ -202,11 +204,18 @@ class DefaultController extends BaseController |
202 | 204 | $size = filesize($path . '/' . $filename); |
203 | 205 | $mbSize = round($size/(1024 * 1024), 2); |
204 | 206 | if ($mbSize > 2) { |
207 | + // 删除服务器文件 | |
208 | + @unlink($path . '/' . $filename); | |
205 | 209 | $e->message = '文件大小不能大于2M!'; |
206 | 210 | return $this->renderJson($e); |
207 | 211 | } |
208 | - $e->show_path = $tmpMinFile= $this->site->base_url.'/tmp/'.$filename; | |
209 | - $e->img_path = $filename; | |
212 | + | |
213 | + $ossPath = ImageManager::getTempImgPath("jpg"); | |
214 | + ImageManager::add($path . '/' . $filename, $ossPath); | |
215 | + // 删除服务器文件 | |
216 | + @unlink($path . '/' . $filename); | |
217 | + $e->show_path = ImageManager::getUrl($ossPath); | |
218 | + $e->img_path = $ossPath; | |
210 | 219 | $e->success = true; |
211 | 220 | $e->message = '上传成功'; |
212 | 221 | return $this->renderJson($e); | ... | ... |
app-wx/web/dist/js/check-app.js
1 | -define("check-app",["mk7/app"],function(n){var e=Dom7,t=function(){var n=e(".ui-loading-block");0==n.length&&(e(".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 n=document.getElementById("loader-inner"),e=document.createElement("p");e.className="notice",n&&(e.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',n.appendChild(e))},window.waitingTime))},o=!0;return n.name="check",n.routes={index:function(){return o=!1,t(),n.runController("index")},"*":function(){return o=!1,t(),n.runController("index")},"scan-count/:uuid/:scancount":function(e,i){return o=!1,t(),n.runController("scan-count",{uuid:e,scancount:i})},"warning/:uuid":function(e){return o=!1,t(),n.runController("warning",{uuid:e})},"submit/:uuid":function(e){return o=!1,t(),n.runController("submit",{uuid:e})},"error/:uuid":function(e){return o=!1,t(),n.runController("error",{uuid:e})},"success/:uuid":function(e){return o=!1,t(),n.runController("success",{uuid:e})},"info/:uuid/:number_code":function(e,i){return o=!1,t(),n.runController("info",{uuid:e,number_code:i})}},n}),define("check/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7;Template7;return n.run=function(){var n=this;n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},n}),define("check/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,1),a=0,u=2,s=0;return n.run=function(){var n=this;n.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"]}),n.scanQrcode(),n.render(),c(".scan-button").attr("disabled","disabled"),c(".scan-button").text("正在调起扫码……")},n.bindEvents=function(){var n=this;c(".scan-button").click(function(){n.scanQrcode()})},n.scanQrcode=function(){var n=this;i.ready(function(){i.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(o){var i=o.resultStr,d=c.parseUrlQuery(i);if(null!=d&&void 0!==d&&null!=d.uuid&&void 0!==d.uuid){var d=d.uuid.split("@"),l=e.to("smart#enter/"+d[0]),m=e.to("check#scan-count/"+d[0]+"/"+s),f=e.to("check#warning/"+d[0]);c.ajax({method:"POST",url:e.to("check/default/check-active"),data:{uuid:d[0]},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){s=n.scan_count,m=e.to("check#scan-count/"+d[0]+"/"+s),n.success==r?window.location.href=m:n.success==a?window.location.href=l:n.success==u?window.location.href=f:window.location.href=f},error:function(n){},complete:function(e){n.hideIndicator()}})}else t.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){c(".scan-button").removeAttr("disabled"),c(".scan-button").text("点击扫描标签")},1e3)})},n}),define("check/info-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7;Template7;return n.run=function(){var n=this;n.setPageTitle("隐私信息"),n.loadData(n.params.uuid,n.params.number_code)},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},n.loadData=function(n,o){var i=this;c.ajax({method:"POST",url:e.to("check/default/get-info"),data:{uuid:n,number_code:o},dataType:"json",beforeSend:function(){i.showIndicator()},success:function(n){try{n.success?i.render(n.data):t.toast({content:n.message,closeDelay:3e3})}catch(e){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){i.hideIndicator()}})},n}),define("check/scan-count-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,0),a="";return n.run=function(){var n=this;r=parseInt(n.params.scancount),a=n.params.uuid,n.setPageTitle("验证标签"),n.render(),c(".count-num").html(r)},n.bindEvents=function(){c(".scan-button").click(function(){""!=a&&void 0!=a?window.location.href=e.to("check#submit/"+a):window.location.href=e.to("check#index")})},n}),define("check/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,"");return n.run=function(){var n=this;r=n.params.uuid,n.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"]}),n.render()},n.bindEvents=function(){var n=this;c(".scan-image").click(function(){n.uploadImg(c(this))}),c(".scan-button").click(function(){var o=c(".scan-image").attr("data");return t.isEmpty(o)?(t.toast({content:"请拍照文件上传后再试!"}),!1):void c.ajax({method:"POST",url:e.to("check/default/check-actived"),data:{upload_file:o,uuid:r},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){try{n.success?window.location.href=e.to("check#success/"+r):window.location.href=e.to("check#error/"+r)}catch(o){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(e){n.hideIndicator()}})})},n.uploadImg=function(n){var e=this;i.ready(function(){i.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(t){t.localIds.length>0&&e.upload(t.localIds,n)}})})},n.upload=function(n,o){var a=this;return void 0==n[0]?"":void i.uploadImage({localId:n[0],isShowProgressTips:1,success:function(n){c.ajax({method:"POST",url:e.to("check/default/update-serviceid"),data:{service_id:n.serverId,uuid:r},dataType:"json",beforeSend:function(){a.showIndicator()},success:function(n){try{if(n.success){var e=n.img_path;o.attr("data",e),o.attr("src",n.show_path)}else t.toast({content:n.message,closeDelay:3e3})}catch(i){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){a.hideIndicator()}})},fail:function(n){a.app.alert(JSON.stringify(n))}})},n}),define("check/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,"");return n.run=function(){var n=this;r=n.params.uuid,n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){var n=this;c(".btn-submit").click(function(){var o=c(".input-num").val();return t.isEmpty(o)?(t.toast({content:"请填写提取码"}),c(".input-num").focus(),!1):t.isEmpty(r)?(t.toast({content:"缺少必要参数请退出重试"}),!1):void c.ajax({method:"POST",url:e.to("check/default/get-info"),data:{uuid:r,number_code:o},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){try{n.success?window.location.href=e.to("check#info/"+r+"/"+o):t.toast({content:n.message,closeDelay:3e3})}catch(i){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(e){n.hideIndicator()}})})},n}),define("check/warning-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,"");return n.run=function(){var n=this;r=n.params.uuid,n.setPageTitle("验证标签"),n.render()},n.bindEvents=function(){c(".scan-jump-button").click(function(){""!=r&&void 0!=r?window.location.href=e.to("smart#enter/"+r):window.location.href=e.to("check#index")})},n}); | |
2 | 1 | \ No newline at end of file |
2 | +define("check-app",["mk7/app"],function(n){var e=Dom7,t=function(){var n=e(".ui-loading-block");0==n.length&&(e(".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 n=document.getElementById("loader-inner"),e=document.createElement("p");e.className="notice",n&&(e.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',n.appendChild(e))},window.waitingTime))},o=!0;return n.name="check",n.routes={index:function(){return o=!1,t(),n.runController("index")},"*":function(){return o=!1,t(),n.runController("index")},"scan-count/:uuid/:scancount":function(e,i){return o=!1,t(),n.runController("scan-count",{uuid:e,scancount:i})},"warning/:uuid":function(e){return o=!1,t(),n.runController("warning",{uuid:e})},"submit/:uuid":function(e){return o=!1,t(),n.runController("submit",{uuid:e})},"error/:uuid":function(e){return o=!1,t(),n.runController("error",{uuid:e})},"success/:uuid":function(e){return o=!1,t(),n.runController("success",{uuid:e})},"info/:uuid/:number_code":function(e,i){return o=!1,t(),n.runController("info",{uuid:e,number_code:i})}},n}),define("check/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7;Template7;return n.run=function(){var n=this;n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},n}),define("check/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,1),a=0,u=2,s=0;return n.run=function(){var n=this;n.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"]}),n.scanQrcode(),n.render(),c(".scan-button").attr("disabled","disabled"),c(".scan-button").text("正在调起扫码……")},n.bindEvents=function(){var n=this;c(".scan-button").click(function(){n.scanQrcode()})},n.scanQrcode=function(){var n=this;i.ready(function(){i.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(o){var i=o.resultStr,d=c.parseUrlQuery(i);if(null!=d&&void 0!==d&&null!=d.uuid&&void 0!==d.uuid){if(d.uuid.indexOf("@")==-1)return t.toast({content:"该智能防伪二维码无效"}),!1;var d=d.uuid.split("@"),l=e.to("smart#enter/"+d[0]),m=e.to("check#scan-count/"+d[0]+"/"+s),f=e.to("check#warning/"+d[0]);c.ajax({method:"POST",url:e.to("check/default/check-active"),data:{uuid:d[0]},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){s=n.scan_count,m=e.to("check#scan-count/"+d[0]+"/"+s),n.success==r?window.location.href=m:n.success==a?window.location.href=l:n.success==u?window.location.href=f:window.location.href=f},error:function(n){},complete:function(e){n.hideIndicator()}})}else t.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){c(".scan-button").removeAttr("disabled"),c(".scan-button").text("点击扫描标签")},1e3)})},n}),define("check/info-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7;Template7;return n.run=function(){var n=this;n.setPageTitle("隐私信息"),n.loadData(n.params.uuid,n.params.number_code)},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},n.loadData=function(n,o){var i=this;c.ajax({method:"POST",url:e.to("check/default/get-info"),data:{uuid:n,number_code:o},dataType:"json",beforeSend:function(){i.showIndicator()},success:function(n){try{n.success?i.render(n.data):t.toast({content:n.message,closeDelay:3e3})}catch(e){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){i.hideIndicator()}})},n}),define("check/scan-count-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,0),a="";return n.run=function(){var n=this;r=parseInt(n.params.scancount),a=n.params.uuid,n.setPageTitle("验证标签"),n.render(),c(".count-num").html(r)},n.bindEvents=function(){c(".scan-button").click(function(){""!=a&&void 0!=a?window.location.href=e.to("check#submit/"+a):window.location.href=e.to("check#index")})},n}),define("check/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,"");return n.run=function(){var n=this;r=n.params.uuid,n.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"]}),n.render()},n.bindEvents=function(){var n=this;c(".scan-image").click(function(){n.uploadImg(c(this))}),c(".scan-button").click(function(){var o=c(".scan-image").attr("data");return t.isEmpty(o)?(t.toast({content:"请拍照文件上传后再试!"}),!1):void c.ajax({method:"POST",url:e.to("check/default/check-actived"),data:{upload_file:o,uuid:r},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){try{n.success?window.location.href=e.to("check#success/"+r):window.location.href=e.to("check#error/"+r)}catch(o){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(e){n.hideIndicator()}})})},n.uploadImg=function(n){var e=this;i.ready(function(){i.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(t){t.localIds.length>0&&e.upload(t.localIds,n)}})})},n.upload=function(n,o){var a=this;return void 0==n[0]?"":void i.uploadImage({localId:n[0],isShowProgressTips:1,success:function(n){c.ajax({method:"POST",url:e.to("check/default/update-serviceid"),data:{service_id:n.serverId,uuid:r},dataType:"json",beforeSend:function(){a.showIndicator()},success:function(n){try{if(n.success){var e=n.img_path;o.attr("data",e),o.attr("src",n.show_path)}else t.toast({content:n.message,closeDelay:3e3})}catch(i){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){a.hideIndicator()}})},fail:function(n){a.app.alert(JSON.stringify(n))}})},n}),define("check/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,"");return n.run=function(){var n=this;r=n.params.uuid,n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){var n=this;c(".btn-submit").click(function(){var o=c(".input-num").val();return t.isEmpty(o)?(t.toast({content:"请填写提取码"}),c(".input-num").focus(),!1):t.isEmpty(r)?(t.toast({content:"缺少必要参数请退出重试"}),!1):void c.ajax({method:"POST",url:e.to("check/default/get-info"),data:{uuid:r,number_code:o},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){try{n.success?window.location.href=e.to("check#info/"+r+"/"+o):t.toast({content:n.message,closeDelay:3e3})}catch(i){t.toast({content:"出错",closeDelay:3e3})}},error:function(n){t.toast({content:"提交出错,请联系系统管理员"})},complete:function(e){n.hideIndicator()}})})},n}),define("check/warning-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,e,t,o,i){var n=new n,c=Dom7,r=(Template7,"");return n.run=function(){var n=this;r=n.params.uuid,n.setPageTitle("验证标签"),n.render()},n.bindEvents=function(){c(".scan-jump-button").click(function(){""!=r&&void 0!=r?window.location.href=e.to("smart#enter/"+r):window.location.href=e.to("check#index")})},n}); | |
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-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/submit"),d=1,c="",l=!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"]}),c=e.params.uuid,e.hideAllNonBaseMenuItem(window.$site),e.render(),e.loadAddress()},e.bindEvents=function(){var e=this;s("#enter").on("click",".upload-btn-cls",function(){var t=s(this).parents("li");e.uploadImg(t)}),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",".up-img .upload-item",function(e){var t=s(this).attr("data-url");s("#img-mask").remove();var n='<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+t+'" /></div><div id="set-convert-btn" style="position: absolute;bottom: 0;width: 100%;color: #000;text-align: center;padding: 1rem 0;z-index: 2;background: rgba(255,255,255,0.5)">设置为封面</div></div>';s("#publish").append(n)}),s("#enter").on("click","#dropdown-address",function(e){s(".address-input").val(s(this).html())}),s("#enter").on("click","#set-convert-btn",function(e){var t=s(this).parent().find("img").attr("src");s("#publish .convert-img").remove(),s('div[data-url="'+t+'"]').append('<div class="convert-img">封面</div>'),s("#img-mask").remove()}),s("#enter").on("click","#img-mask, #img-mask img",function(e){s("#img-mask").remove()}),s("#enter").on("click",".submit-btn",function(){if(n.isEmpty(c))return n.toast({content:"进入方式不对,请从新扫码激活",closeDelay:3e3}),!1;var i=s(".upload-item").attr("data"),o=s(".address-input").val(),r=s(".content-cls").val(),d=s(".phone-number").val();return n.isEmpty(i)?(n.toast({content:"请选择商品图片或视频",closeDelay:3e3}),!1):n.isEmpty(o)?(n.toast({content:"请填写发货地址",closeDelay:3e3}),s(".address-input").focus(),!1):n.isEmpty(r)?(n.toast({content:"请填写商家留言",closeDelay:3e3}),s(".content-cls").focus(),!1):n.isMobile(d)?(s(".submit-btn").attr("disabled","disabled"),void s.ajax({method:"POST",url:a,data:{file_data:i,address:o,content:r,phone:d,uuid:c},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success?(s(".submit-btn").removeAttr("disabled"),n.toast({content:e.msg}),setTimeout(function(){redirectUrl=t.to("smart#index"),window.location.href=redirectUrl},2e3)):n.toast({content:e.msg})},error:function(e){n.alert(e.responseText)},complete:function(t){s(".submit-btn").removeAttr("disabled"),e.hideIndicator()}})):(n.toast({content:"请填写正确手机号码",closeDelay:3e3}),s(".phone-number").focus(),!1)})},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){n.toast({content:"提交出错,请联系系统管理员"})},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&&(l=!0,s("#dropdown-address").html(e.address),s(".address-input").focus(function(e){l&&s("#dropdown-address").show()}),s(".address-input").blur(function(e){l&&s("#dropdown-address").hide()}))}catch(t){}},error:function(e){},complete:function(t){e.hideIndicator()}})},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,d=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,c=r.parseUrlQuery(o);if(null!=c&&void 0!==c&&null!=c.uuid&&void 0!==c.uuid){var c=c.uuid.split("@"),l=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=l:e.success==d?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}); | |
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-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/submit"),d=1,c="",l=!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"]}),c=e.params.uuid,e.hideAllNonBaseMenuItem(window.$site),e.render(),e.loadAddress()},e.bindEvents=function(){var e=this;s("#enter").on("click",".upload-btn-cls",function(){var t=s(this).parents("li");e.uploadImg(t)}),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",".up-img .upload-item",function(e){var t=s(this).attr("data-url");s("#img-mask").remove();var n='<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+t+'" /></div><div id="set-convert-btn" style="position: absolute;bottom: 0;width: 100%;color: #000;text-align: center;padding: 1rem 0;z-index: 2;background: rgba(255,255,255,0.5)">设置为封面</div></div>';s("#publish").append(n)}),s("#enter").on("click","#dropdown-address",function(e){s(".address-input").val(s(this).html())}),s("#enter").on("click","#set-convert-btn",function(e){var t=s(this).parent().find("img").attr("src");s("#publish .convert-img").remove(),s('div[data-url="'+t+'"]').append('<div class="convert-img">封面</div>'),s("#img-mask").remove()}),s("#enter").on("click","#img-mask, #img-mask img",function(e){s("#img-mask").remove()}),s("#enter").on("click",".submit-btn",function(){if(n.isEmpty(c))return n.toast({content:"进入方式不对,请从新扫码激活",closeDelay:3e3}),!1;var i=s(".upload-item").attr("data"),o=s(".address-input").val(),r=s(".content-cls").val(),d=s(".phone-number").val();return n.isEmpty(i)?(n.toast({content:"请选择商品图片或视频",closeDelay:3e3}),!1):n.isEmpty(o)?(n.toast({content:"请填写发货地址",closeDelay:3e3}),s(".address-input").focus(),!1):n.isEmpty(r)?(n.toast({content:"请填写商家留言",closeDelay:3e3}),s(".content-cls").focus(),!1):n.isMobile(d)?(s(".submit-btn").attr("disabled","disabled"),void s.ajax({method:"POST",url:a,data:{file_data:i,address:o,content:r,phone:d,uuid:c},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success?(s(".submit-btn").removeAttr("disabled"),n.toast({content:e.msg}),setTimeout(function(){redirectUrl=t.to("smart#index"),window.location.href=redirectUrl},2e3)):n.toast({content:e.msg})},error:function(e){n.alert(e.responseText)},complete:function(t){s(".submit-btn").removeAttr("disabled"),e.hideIndicator()}})):(n.toast({content:"请填写正确手机号码",closeDelay:3e3}),s(".phone-number").focus(),!1)})},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&&(l=!0,s("#dropdown-address").html(e.address),s(".address-input").focus(function(e){l&&s("#dropdown-address").show()}),s(".address-input").blur(function(e){l&&s("#dropdown-address").hide()}))}catch(t){}},error:function(e){},complete:function(t){e.hideIndicator()}})},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,d=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,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("@"),l=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=l:e.success==d?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}); | |
3 | 3 | \ No newline at end of file | ... | ... |
app-wx/web/src/js/check/index-controller.js
... | ... | @@ -55,6 +55,10 @@ define( |
55 | 55 | var resultArr = $$.parseUrlQuery(result); |
56 | 56 | //这个二维码必须传到后台去做验证才对, |
57 | 57 | if(resultArr != null && resultArr!==undefined && resultArr['uuid']!=null && resultArr['uuid']!==undefined) { |
58 | + if (resultArr['uuid'].indexOf("@") == -1) { | |
59 | + utils.toast({content:'该智能防伪二维码无效'}); | |
60 | + return false; | |
61 | + } | |
58 | 62 | //可以用字符或字符串分割 |
59 | 63 | var resultArr=resultArr['uuid'].split('@'); |
60 | 64 | var redirectNoActivedUrl = url.to('smart#enter/' + resultArr[0]); | ... | ... |
app-wx/web/src/js/smart/enter-controller.js
... | ... | @@ -226,7 +226,8 @@ define( |
226 | 226 | } |
227 | 227 | }, |
228 | 228 | error : function(res){ |
229 | - utils.toast({content:"提交出错,请联系系统管理员"}); | |
229 | + alert(res.responseText); | |
230 | + utils.toast({content:"提交出错,请联系系统管理员" + res.responseText}); | |
230 | 231 | }, |
231 | 232 | complete : function(res){ |
232 | 233 | me.hideIndicator(); | ... | ... |
app-wx/web/src/js/smart/index-controller.js
... | ... | @@ -54,6 +54,10 @@ define( |
54 | 54 | var resultArr = $$.parseUrlQuery(result); |
55 | 55 | //这个二维码必须传到后台去做验证才对, |
56 | 56 | if(resultArr != null && resultArr!==undefined && resultArr['uuid']!=null && resultArr['uuid']!==undefined) { |
57 | + if (resultArr['uuid'].indexOf("@") == -1) { | |
58 | + utils.toast({content:'该智能防伪二维码无效'}); | |
59 | + return false; | |
60 | + } | |
57 | 61 | //可以用字符或字符串分割 |
58 | 62 | var resultArr=resultArr['uuid'].split('@'); |
59 | 63 | var redirectNoActivedUrl = url.to('smart#enter/'+resultArr[0]); | ... | ... |
common/exts/sms/SmsManager.php
... | ... | @@ -1,88 +0,0 @@ |
1 | -<?php | |
2 | -namespace common\exts\sms; | |
3 | - | |
4 | -use Yii; | |
5 | -use yii\base\Component; | |
6 | -use yii\base\InvalidConfigException; | |
7 | -/** | |
8 | - * 短信发送管理器(集成阿里云短信服务) | |
9 | - */ | |
10 | -if (!defined('SMS_ROOT')) { | |
11 | - define('SMS_ROOT', dirname(__FILE__) . '/'); | |
12 | -} | |
13 | - | |
14 | -class SmsManager extends Component | |
15 | -{ | |
16 | - public $smsKey; | |
17 | - public $smsSecret; | |
18 | - public $smsSignName; | |
19 | - private $aliSms; | |
20 | - private $req; | |
21 | - | |
22 | - public function init() | |
23 | - { | |
24 | - if($this->smsKey === null){ | |
25 | - throw new InvalidConfigException("smsKey 是必要参数"); | |
26 | - }elseif($this->smsSecret === null){ | |
27 | - throw new InvalidConfigException("smsSecret 是必要参数"); | |
28 | - }elseif($this->smsSignName === null){ | |
29 | - throw new InvalidConfigException("smsSignName 是必要参数"); | |
30 | - } | |
31 | - | |
32 | - require(SMS_ROOT.'aliyun/TopSdk.php'); | |
33 | - $this->aliSms = new \TopClient; | |
34 | - $this->aliSms->appkey = $this->smsKey; | |
35 | - $this->aliSms->secretKey = $this->smsSecret; | |
36 | - | |
37 | - $this->req = new \AlibabaAliqinFcSmsNumSendRequest; | |
38 | - $this->req->setSmsFreeSignName($this->smsSignName); | |
39 | - } | |
40 | - | |
41 | - /** | |
42 | - * 手机验证码 | |
43 | - * 模版内容: 验证码${code},您正在注册成为新用户,感谢您的支持! | |
44 | - * 申请说明: 用户注册验证码 | |
45 | - * 模版CODE: SMS_179880510 | |
46 | - * @param $phone | |
47 | - * @param $code | |
48 | - * @param $signName | |
49 | - * @return mixed | |
50 | - */ | |
51 | - public function sendRegCode($phone, $code, $signName = '周合立科技') | |
52 | - { | |
53 | - // 设置短信签名 | |
54 | - if (!empty($signName)) { | |
55 | - $this->req->setSmsFreeSignName($signName); | |
56 | - } | |
57 | - | |
58 | - $this->req->setSmsType("normal"); | |
59 | - $this->req->setSmsParam("{\"code\":\"".$code."\"}"); | |
60 | - $this->req->setRecNum($phone); | |
61 | - $this->req->setSmsTemplateCode("SMS_179880510"); | |
62 | - $result = $this->aliSms->execute($this->req); | |
63 | - var_dump($result); | |
64 | - return $result; | |
65 | - } | |
66 | - | |
67 | - /** | |
68 | - * 激活后给用户发送提取码 | |
69 | - * 模版内容: 模版CODE: SMS_180755775 | |
70 | - * 模版内容: 尊敬的用户,您的提取码为:${code},请勿泄漏于他人! | |
71 | - * @param $phone | |
72 | - * @return mixed | |
73 | - */ | |
74 | - public function sendGetCode($phone, $code, $signName = '周合立科技') | |
75 | - { | |
76 | - // 设置短信签名 | |
77 | - if (!empty($signName)) { | |
78 | - $this->req->setSmsFreeSignName($signName); | |
79 | - } | |
80 | - | |
81 | - $this->req->setSmsType("normal"); | |
82 | - $this->req->setSmsParam("{\"code\":\"".$code."\"}"); | |
83 | - $this->req->setRecNum($phone); | |
84 | - $this->req->setSmsTemplateCode("SMS_180755775"); | |
85 | - $result = $this->aliSms->execute($this->req); | |
86 | - return $result; | |
87 | - } | |
88 | -} | |
89 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/Autoloader.php
... | ... | @@ -1,55 +0,0 @@ |
1 | -<?php | |
2 | - | |
3 | -class Autoloader{ | |
4 | - | |
5 | - /** | |
6 | - * 类库自动加载,写死路径,确保不加载其他文件。 | |
7 | - * @param string $class 对象类名 | |
8 | - * @return void | |
9 | - */ | |
10 | - public static function autoload($class) { | |
11 | - $name = $class; | |
12 | - if(false !== strpos($name,'\\')){ | |
13 | - $name = strstr($class, '\\', true); | |
14 | - } | |
15 | - | |
16 | - $filename = TOP_AUTOLOADER_PATH."/top/".$name.".php"; | |
17 | - if(is_file($filename)) { | |
18 | - include $filename; | |
19 | - return; | |
20 | - } | |
21 | - | |
22 | - $filename = TOP_AUTOLOADER_PATH."/top/request/".$name.".php"; | |
23 | - if(is_file($filename)) { | |
24 | - include $filename; | |
25 | - return; | |
26 | - } | |
27 | - | |
28 | - $filename = TOP_AUTOLOADER_PATH."/top/domain/".$name.".php"; | |
29 | - if(is_file($filename)) { | |
30 | - include $filename; | |
31 | - return; | |
32 | - } | |
33 | - | |
34 | - $filename = TOP_AUTOLOADER_PATH."/aliyun/".$name.".php"; | |
35 | - if(is_file($filename)) { | |
36 | - include $filename; | |
37 | - return; | |
38 | - } | |
39 | - | |
40 | - $filename = TOP_AUTOLOADER_PATH."/aliyun/request/".$name.".php"; | |
41 | - if(is_file($filename)) { | |
42 | - include $filename; | |
43 | - return; | |
44 | - } | |
45 | - | |
46 | - $filename = TOP_AUTOLOADER_PATH."/aliyun/domain/".$name.".php"; | |
47 | - if(is_file($filename)) { | |
48 | - include $filename; | |
49 | - return; | |
50 | - } | |
51 | - } | |
52 | -} | |
53 | - | |
54 | -spl_autoload_register('Autoloader::autoload'); | |
55 | -?> | |
56 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/TopSdk.php
... | ... | @@ -1,40 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP SDK 入口文件 | |
4 | - * 请不要修改这个文件,除非你知道怎样修改以及怎样恢复 | |
5 | - * @author xuteng.xt | |
6 | - */ | |
7 | - | |
8 | -/** | |
9 | - * 定义常量开始 | |
10 | - * 在include("TopSdk.php")之前定义这些常量,不要直接修改本文件,以利于升级覆盖 | |
11 | - */ | |
12 | -/** | |
13 | - * SDK工作目录 | |
14 | - * 存放日志,TOP缓存数据 | |
15 | - */ | |
16 | -if (!defined("TOP_SDK_WORK_DIR")) | |
17 | -{ | |
18 | - define("TOP_SDK_WORK_DIR", "/tmp/"); | |
19 | -} | |
20 | - | |
21 | -/** | |
22 | - * 是否处于开发模式 | |
23 | - * 在你自己电脑上开发程序的时候千万不要设为false,以免缓存造成你的代码修改了不生效 | |
24 | - * 部署到生产环境正式运营后,如果性能压力大,可以把此常量设定为false,能提高运行速度(对应的代价就是你下次升级程序时要清一下缓存) | |
25 | - */ | |
26 | -if (!defined("TOP_SDK_DEV_MODE")) | |
27 | -{ | |
28 | - define("TOP_SDK_DEV_MODE", true); | |
29 | -} | |
30 | - | |
31 | -if (!defined("TOP_AUTOLOADER_PATH")) | |
32 | -{ | |
33 | - define("TOP_AUTOLOADER_PATH", dirname(__FILE__)); | |
34 | -} | |
35 | - | |
36 | -/** | |
37 | -* 注册autoLoader,此注册autoLoader只加载top文件 | |
38 | -* 不要删除,除非你自己加载文件。 | |
39 | -**/ | |
40 | -require("Autoloader.php"); | |
41 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/aliyun/AliyunClient.php
... | ... | @@ -1,255 +0,0 @@ |
1 | -<?php | |
2 | -class AliyunClient | |
3 | -{ | |
4 | - public $accessKeyId; | |
5 | - | |
6 | - public $accessKeySecret; | |
7 | - | |
8 | - public $serverUrl = "http://ecs.aliyuncs.com/"; | |
9 | - | |
10 | - public $format = "json"; | |
11 | - | |
12 | - public $connectTimeout = 3000;//3秒 | |
13 | - | |
14 | - public $readTimeout = 80000;//80秒 | |
15 | - | |
16 | - /** 是否打开入参check**/ | |
17 | - public $checkRequest = true; | |
18 | - | |
19 | - protected $signatureMethod = "HMAC-SHA1"; | |
20 | - | |
21 | - protected $signatureVersion = "1.0"; | |
22 | - | |
23 | - protected $dateTimeFormat = 'Y-m-d\TH:i:s\Z'; // ISO8601规范 | |
24 | - | |
25 | - protected $sdkVersion = "1.0"; | |
26 | - | |
27 | - public function execute($request) | |
28 | - { | |
29 | - if($this->checkRequest) { | |
30 | - try { | |
31 | - $request->check(); | |
32 | - } catch (Exception $e) { | |
33 | - $result->code = $e->getCode(); | |
34 | - $result->message = $e->getMessage(); | |
35 | - return $result; | |
36 | - } | |
37 | - } | |
38 | - //获取业务参数 | |
39 | - $apiParams = $request->getApiParas(); | |
40 | - //组装系统参数 | |
41 | - $apiParams["AccessKeyId"] = $this->accessKeyId; | |
42 | - $apiParams["Format"] = $this->format;// | |
43 | - $apiParams["SignatureMethod"] = $this->signatureMethod; | |
44 | - $apiParams["SignatureVersion"] = $this->signatureVersion; | |
45 | - $apiParams["SignatureNonce"] = uniqid(); | |
46 | - date_default_timezone_set("GMT"); | |
47 | - $apiParams["TimeStamp"] = date($this->dateTimeFormat); | |
48 | - $apiParams["partner_id"] = $this->sdkVersion; | |
49 | - | |
50 | - $apiNameArray = split("\.", $request->getApiMethodName()); | |
51 | - $apiParams["Action"] = $apiNameArray[3]; | |
52 | - $apiParams["Version"] = $apiNameArray[4]; | |
53 | - //签名 | |
54 | - $apiParams["Signature"] = $this->computeSignature($apiParams, $this->accessKeySecret); | |
55 | - | |
56 | - //系统参数放入GET请求串 | |
57 | - $requestUrl = rtrim($this->serverUrl,"/") . "/?"; | |
58 | - foreach ($apiParams as $apiParamKey => $apiParamValue) | |
59 | - { | |
60 | - $requestUrl .= "$apiParamKey=" . urlencode($apiParamValue) . "&"; | |
61 | - } | |
62 | - $requestUrl = substr($requestUrl, 0, -1); | |
63 | - //发起HTTP请求 | |
64 | - try | |
65 | - { | |
66 | - $resp = $this->curl($requestUrl, null); | |
67 | - } | |
68 | - catch (Exception $e) | |
69 | - { | |
70 | - $this->logCommunicationError($apiParams["Action"],$requestUrl,"HTTP_ERROR_" . $e->getCode(),$e->getMessage()); | |
71 | - if ("json" == $this->format) | |
72 | - { | |
73 | - return json_decode($e->getMessage()); | |
74 | - } | |
75 | - else if("xml" == $this->format) | |
76 | - { | |
77 | - return @simplexml_load_string($e->getMessage()); | |
78 | - } | |
79 | - } | |
80 | - | |
81 | - //解析API返回结果 | |
82 | - $respWellFormed = false; | |
83 | - if ("json" == $this->format) | |
84 | - { | |
85 | - $respObject = json_decode($resp); | |
86 | - if (null !== $respObject) | |
87 | - { | |
88 | - $respWellFormed = true; | |
89 | - } | |
90 | - } | |
91 | - else if("xml" == $this->format) | |
92 | - { | |
93 | - $respObject = @simplexml_load_string($resp); | |
94 | - if (false !== $respObject) | |
95 | - { | |
96 | - $respWellFormed = true; | |
97 | - } | |
98 | - } | |
99 | - | |
100 | - //返回的HTTP文本不是标准JSON或者XML,记下错误日志 | |
101 | - if (false === $respWellFormed) | |
102 | - { | |
103 | - $this->logCommunicationError($apiParams["Action"],$requestUrl,"HTTP_RESPONSE_NOT_WELL_FORMED",$resp); | |
104 | - $result->code = 0; | |
105 | - $result->message = "HTTP_RESPONSE_NOT_WELL_FORMED"; | |
106 | - return $result; | |
107 | - } | |
108 | - | |
109 | - //如果TOP返回了错误码,记录到业务错误日志中 | |
110 | - if (isset($respObject->code)) | |
111 | - { | |
112 | - $logger = new LtLogger; | |
113 | - $logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_biz_err_" . $this->appkey . "_" . date("Y-m-d") . ".log"; | |
114 | - $logger->log(array( | |
115 | - date("Y-m-d H:i:s"), | |
116 | - $resp | |
117 | - )); | |
118 | - } | |
119 | - return $respObject; | |
120 | - } | |
121 | - | |
122 | - public function exec($paramsArray) | |
123 | - { | |
124 | - if (!isset($paramsArray["Action"])) | |
125 | - { | |
126 | - trigger_error("No api name passed"); | |
127 | - } | |
128 | - $inflector = new LtInflector; | |
129 | - $inflector->conf["separator"] = "."; | |
130 | - $requestClassName = ucfirst($inflector->camelize(substr($paramsArray["Action"], 7))) . "Request"; | |
131 | - if (!class_exists($requestClassName)) | |
132 | - { | |
133 | - trigger_error("No such api: " . $paramsArray["Action"]); | |
134 | - } | |
135 | - | |
136 | - $req = new $requestClassName; | |
137 | - foreach($paramsArray as $paraKey => $paraValue) | |
138 | - { | |
139 | - $inflector->conf["separator"] = "_"; | |
140 | - $setterMethodName = $inflector->camelize($paraKey); | |
141 | - $inflector->conf["separator"] = "."; | |
142 | - $setterMethodName = "set" . $inflector->camelize($setterMethodName); | |
143 | - if (method_exists($req, $setterMethodName)) | |
144 | - { | |
145 | - $req->$setterMethodName($paraValue); | |
146 | - } | |
147 | - } | |
148 | - return $this->execute($req, $session); | |
149 | - } | |
150 | - | |
151 | - protected function percentEncode($str) | |
152 | - { | |
153 | - // 使用urlencode编码后,将"+","*","%7E"做替换即满足 API规定的编码规范 | |
154 | - $res = urlencode($str); | |
155 | - $res = preg_replace('/\+/', '%20', $res); | |
156 | - $res = preg_replace('/\*/', '%2A', $res); | |
157 | - $res = preg_replace('/%7E/', '~', $res); | |
158 | - return $res; | |
159 | - } | |
160 | - | |
161 | - protected function computeSignature($parameters, $accessKeySecret) | |
162 | - { | |
163 | - // 将参数Key按字典顺序排序 | |
164 | - ksort($parameters); | |
165 | - | |
166 | - // 生成规范化请求字符串 | |
167 | - $canonicalizedQueryString = ''; | |
168 | - foreach($parameters as $key => $value) | |
169 | - { | |
170 | - $canonicalizedQueryString .= '&' . $this->percentEncode($key) | |
171 | - . '=' . $this->percentEncode($value); | |
172 | - } | |
173 | - | |
174 | - // 生成用于计算签名的字符串 stringToSign | |
175 | - $stringToSign = 'GET&%2F&' . $this->percentencode(substr($canonicalizedQueryString, 1)); | |
176 | - | |
177 | - // 计算签名,注意accessKeySecret后面要加上字符'&' | |
178 | - $signature = base64_encode(hash_hmac('sha1', $stringToSign, $accessKeySecret . '&', true)); | |
179 | - return $signature; | |
180 | - } | |
181 | - | |
182 | - public function curl($url, $postFields = null) | |
183 | - { | |
184 | - $ch = curl_init(); | |
185 | - curl_setopt($ch, CURLOPT_URL, $url); | |
186 | - curl_setopt($ch, CURLOPT_FAILONERROR, false); | |
187 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
188 | - if ($this->readTimeout) { | |
189 | - curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout); | |
190 | - } | |
191 | - if ($this->connectTimeout) { | |
192 | - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout); | |
193 | - } | |
194 | - //https 请求 | |
195 | - if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) { | |
196 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
197 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | |
198 | - } | |
199 | - | |
200 | - if (is_array($postFields) && 0 < count($postFields)) | |
201 | - { | |
202 | - $postBodyString = ""; | |
203 | - $postMultipart = false; | |
204 | - foreach ($postFields as $k => $v) | |
205 | - { | |
206 | - if("@" != substr($v, 0, 1))//判断是不是文件上传 | |
207 | - { | |
208 | - $postBodyString .= "$k=" . urlencode($v) . "&"; | |
209 | - } | |
210 | - else//文件上传用multipart/form-data,否则用www-form-urlencoded | |
211 | - { | |
212 | - $postMultipart = true; | |
213 | - } | |
214 | - } | |
215 | - unset($k, $v); | |
216 | - curl_setopt($ch, CURLOPT_POST, true); | |
217 | - if ($postMultipart) | |
218 | - { | |
219 | - curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields); | |
220 | - } | |
221 | - else | |
222 | - { | |
223 | - curl_setopt($ch, CURLOPT_POSTFIELDS, substr($postBodyString,0,-1)); | |
224 | - } | |
225 | - } | |
226 | - $reponse = curl_exec($ch); | |
227 | - | |
228 | - if (curl_errno($ch)) | |
229 | - { | |
230 | - throw new Exception(curl_error($ch),0); | |
231 | - } | |
232 | - curl_close($ch); | |
233 | - return $reponse; | |
234 | - } | |
235 | - | |
236 | - protected function logCommunicationError($apiName, $requestUrl, $errorCode, $responseTxt) | |
237 | - { | |
238 | - $localIp = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI"; | |
239 | - $logger = new LtLogger; | |
240 | - $logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_comm_err_" . $this->accessKeyId . "_" . date("Y-m-d") . ".log"; | |
241 | - $logger->conf["separator"] = "^_^"; | |
242 | - $logData = array( | |
243 | - date("Y-m-d H:i:s"), | |
244 | - $apiName, | |
245 | - $this->accessKeyId, | |
246 | - $localIp, | |
247 | - PHP_OS, | |
248 | - $this->sdkVersion, | |
249 | - $requestUrl, | |
250 | - $errorCode, | |
251 | - str_replace("\n","",$responseTxt) | |
252 | - ); | |
253 | - $logger->log($logData); | |
254 | - } | |
255 | -} |
common/exts/sms/aliyun/fileTest.php
... | ... | @@ -1,26 +0,0 @@ |
1 | -<?php | |
2 | - include "TopSdk.php"; | |
3 | - date_default_timezone_set('Asia/Shanghai'); | |
4 | - | |
5 | - $c = new TopClient; | |
6 | - $c->appkey = '12497914'; | |
7 | - $c->secretKey = '4b0f28396e072d67fae169684613bcd1'; | |
8 | - // $req = new TradeVoucherUploadRequest; | |
9 | - // $req->setFileName("example"); | |
10 | - // $req->setFileData("@/Users/xt/Downloads/1.jpg"); | |
11 | - // $req->setSellerNick("奥利奥官方旗舰店"); | |
12 | - // $req->setBuyerNick("101NufynDYcbjf2cFQDd62j8M/mjtyz6RoxQ2OL1c0e/Bc="); | |
13 | - // var_dump($c->execute($req)); | |
14 | - | |
15 | - $req2 = new TradeVoucherUploadRequest; | |
16 | - $req2->setFileName("example"); | |
17 | - | |
18 | - $myPic = array( | |
19 | - 'type' => 'application/octet-stream', | |
20 | - 'content' => file_get_contents('/Users/xt/Downloads/1.jpg') | |
21 | - ); | |
22 | - $req2->setFileData($myPic); | |
23 | - $req2->setSellerNick("奥利奥官方旗舰店"); | |
24 | - $req2->setBuyerNick("101NufynDYcbjf2cFQDd62j8M/mjtyz6RoxQ2OL1c0e/Bc="); | |
25 | - var_dump($c->execute($req2)); | |
26 | -?> | |
27 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/test.php
... | ... | @@ -1,10 +0,0 @@ |
1 | -<?php | |
2 | - include "TopSdk.php"; | |
3 | - date_default_timezone_set('Asia/Shanghai'); | |
4 | - | |
5 | - $httpdns = new HttpdnsGetRequest; | |
6 | - $client = new ClusterTopClient("4272","0ebbcccfee18d7ad1aebc5b135ffa906"); | |
7 | - $client->gatewayUrl = "http://api.daily.taobao.net/router/rest"; | |
8 | - var_dump($client->execute($httpdns,"6100e23657fb0b2d0c78568e55a3031134be9a3a5d4b3a365753805")); | |
9 | - | |
10 | -?> | |
11 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/top/ApplicationVar.php
... | ... | @@ -1,47 +0,0 @@ |
1 | -<?php | |
2 | - | |
3 | -class ApplicationVar | |
4 | -{ | |
5 | - var $save_file; | |
6 | - var $application = null; | |
7 | - var $app_data = ''; | |
8 | - var $__writed = false; | |
9 | - | |
10 | - function __construct() | |
11 | - { | |
12 | - $this->save_file = __DIR__.'/httpdns.conf' ; | |
13 | - $this->application = array(); | |
14 | - } | |
15 | - | |
16 | - public function setValue($var_name,$var_value) | |
17 | - { | |
18 | - if (!is_string($var_name) || empty($var_name)) | |
19 | - return false; | |
20 | - | |
21 | - $this->application[$var_name] = $var_value; | |
22 | - } | |
23 | - | |
24 | - public function write(){ | |
25 | - $this->app_data = @serialize($this->application); | |
26 | - $this->__writeToFile(); | |
27 | - } | |
28 | - | |
29 | - public function getValue() | |
30 | - { | |
31 | - if (!is_file($this->save_file)) | |
32 | - $this->__writeToFile(); | |
33 | - return @unserialize(@file_get_contents($this->save_file)); | |
34 | - } | |
35 | - | |
36 | - function __writeToFile() | |
37 | - { | |
38 | - $fp = @fopen($this->save_file,"w"); | |
39 | - if(flock($fp , LOCK_EX | LOCK_NB)){ | |
40 | - @fwrite($fp,$this->app_data); | |
41 | - flock($fp , LOCK_UN); | |
42 | - } | |
43 | - @fclose($fp); | |
44 | - } | |
45 | -} | |
46 | - | |
47 | -?> | |
48 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/top/ClusterTopClient.php
... | ... | @@ -1,199 +0,0 @@ |
1 | -<?php | |
2 | -class ClusterTopClient extends TopClient { | |
3 | - | |
4 | - private static $dnsconfig; | |
5 | - private static $syncDate = 0; | |
6 | - private static $applicationVar ; | |
7 | - private static $cfgDuration = 10; | |
8 | - | |
9 | - public function __construct($appkey = "",$secretKey = ""){ | |
10 | - ClusterTopClient::$applicationVar = new ApplicationVar; | |
11 | - $this->appkey = $appkey; | |
12 | - $this->secretKey = $secretKey ; | |
13 | - $saveConfig = ClusterTopClient::$applicationVar->getValue(); | |
14 | - | |
15 | - if($saveConfig){ | |
16 | - $tmpConfig = $saveConfig['dnsconfig']; | |
17 | - ClusterTopClient::$dnsconfig = $this->object_to_array($tmpConfig); | |
18 | - unset($tmpConfig); | |
19 | - | |
20 | - ClusterTopClient::$syncDate = $saveConfig['syncDate']; | |
21 | - if(!ClusterTopClient::$syncDate) | |
22 | - ClusterTopClient::$syncDate = 0; | |
23 | - } | |
24 | - } | |
25 | - | |
26 | - public function __destruct(){ | |
27 | - if(ClusterTopClient::$dnsconfig && ClusterTopClient::$syncDate){ | |
28 | - ClusterTopClient::$applicationVar->setValue("dnsconfig",ClusterTopClient::$dnsconfig); | |
29 | - ClusterTopClient::$applicationVar->setValue("syncDate",ClusterTopClient::$syncDate); | |
30 | - ClusterTopClient::$applicationVar->write(); | |
31 | - } | |
32 | - } | |
33 | - | |
34 | - public function execute($request = null, $session = null,$bestUrl = null){ | |
35 | - $currentDate = date('U'); | |
36 | - $syncDuration = $this->getDnsConfigSyncDuration(); | |
37 | - $bestUrl = $this->getBestVipUrl($this->gatewayUrl,$request->getApiMethodName(),$session); | |
38 | - if($currentDate - ClusterTopClient::$syncDate > $syncDuration * 60){ | |
39 | - $httpdns = new HttpdnsGetRequest; | |
40 | - ClusterTopClient::$dnsconfig = json_decode(parent::execute($httpdns,null,$bestUrl)->result,true); | |
41 | - $syncDate = date('U'); | |
42 | - ClusterTopClient::$syncDate = $syncDate ; | |
43 | - } | |
44 | - return parent::execute($request,$session,$bestUrl); | |
45 | - } | |
46 | - | |
47 | - private function getDnsConfigSyncDuration(){ | |
48 | - if(ClusterTopClient::$cfgDuration){ | |
49 | - return ClusterTopClient::$cfgDuration; | |
50 | - } | |
51 | - if(!ClusterTopClient::$dnsconfig){ | |
52 | - return ClusterTopClient::$cfgDuration; | |
53 | - } | |
54 | - $config = json_encode(ClusterTopClient::$dnsconfig); | |
55 | - if(!$config){ | |
56 | - return ClusterTopClient::$cfgDuration; | |
57 | - } | |
58 | - $config = ClusterTopClient::$dnsconfig['config']; | |
59 | - $duration = $config['interval']; | |
60 | - ClusterTopClient::$cfgDuration = $duration; | |
61 | - | |
62 | - return ClusterTopClient::$cfgDuration; | |
63 | - } | |
64 | - | |
65 | - private function getBestVipUrl($url,$apiname = null,$session = null){ | |
66 | - $config = ClusterTopClient::$dnsconfig['config']; | |
67 | - $degrade = $config['degrade']; | |
68 | - if(strcmp($degrade,'true') == 0){ | |
69 | - return $url; | |
70 | - } | |
71 | - $currentEnv = $this->getEnvByApiName($apiname,$session); | |
72 | - $vip = $this->getVipByEnv($url,$currentEnv); | |
73 | - if($vip) | |
74 | - return $vip; | |
75 | - return $url; | |
76 | - } | |
77 | - | |
78 | - private function getVipByEnv($comUrl,$currentEnv){ | |
79 | - $urlSchema = parse_url($comUrl); | |
80 | - if(!$urlSchema) | |
81 | - return null; | |
82 | - if(!ClusterTopClient::$dnsconfig['env']) | |
83 | - return null; | |
84 | - | |
85 | - if(!array_key_exists($currentEnv,ClusterTopClient::$dnsconfig['env'])) | |
86 | - return null; | |
87 | - | |
88 | - $hostList = ClusterTopClient::$dnsconfig['env'][$currentEnv]; | |
89 | - if(!$hostList) | |
90 | - return null ; | |
91 | - | |
92 | - $vipList = null; | |
93 | - foreach ($hostList as $key => $value) { | |
94 | - if(strcmp($key,$urlSchema['host']) == 0 && strcmp($value['proto'],$urlSchema['scheme']) == 0){ | |
95 | - $vipList = $value; | |
96 | - break; | |
97 | - } | |
98 | - } | |
99 | - $vip = $this->getRandomWeightElement($vipList['vip']); | |
100 | - | |
101 | - if($vip){ | |
102 | - return $urlSchema['scheme']."://".$vip.$urlSchema['path']; | |
103 | - } | |
104 | - return null; | |
105 | - } | |
106 | - | |
107 | - private function getEnvByApiName($apiName,$session=""){ | |
108 | - $apiCfgArray = ClusterTopClient::$dnsconfig['api']; | |
109 | - if($apiCfgArray){ | |
110 | - if(array_key_exists($apiName,$apiCfgArray)){ | |
111 | - $apiCfg = $apiCfgArray[$apiName]; | |
112 | - if(array_key_exists('user',$apiCfg)){ | |
113 | - $userFlag = $apiCfg['user']; | |
114 | - $flag = $this->getUserFlag($session); | |
115 | - if($userFlag && $flag ){ | |
116 | - return $this->getEnvBySessionFlag($userFlag,$flag); | |
117 | - }else{ | |
118 | - return $this->getRandomWeightElement($apiCfg['rule']); | |
119 | - } | |
120 | - } | |
121 | - } | |
122 | - } | |
123 | - return $this->getDeafultEnv(); | |
124 | - } | |
125 | - | |
126 | - private function getUserFlag($session){ | |
127 | - if($session && strlen($session) > 5){ | |
128 | - if($session[0] == '6' || $session[0] == '7'){ | |
129 | - return $session[strlen($session) -1]; | |
130 | - }else if($session[0] == '5' || $session[0] == '8'){ | |
131 | - return $session[5]; | |
132 | - } | |
133 | - } | |
134 | - return null; | |
135 | - } | |
136 | - | |
137 | - private function getEnvBySessionFlag($targetConfig,$flag){ | |
138 | - if($flag){ | |
139 | - $userConf = ClusterTopClient::$dnsconfig['user']; | |
140 | - $cfgArry = $userConf[$targetConfig]; | |
141 | - foreach ($cfgArry as $key => $value) { | |
142 | - if(in_array($flag,$value)) | |
143 | - return $key; | |
144 | - } | |
145 | - }else{ | |
146 | - return null; | |
147 | - } | |
148 | - } | |
149 | - | |
150 | - private function getRandomWeightElement($elements){ | |
151 | - $totalWeight = 0; | |
152 | - if($elements){ | |
153 | - foreach ($elements as $ele) { | |
154 | - $weight = $this->getElementWeight($ele); | |
155 | - $r = $this->randomFloat() * ($weight + $totalWeight); | |
156 | - if($r >= $totalWeight){ | |
157 | - $selected = $ele; | |
158 | - } | |
159 | - $totalWeight += $weight; | |
160 | - } | |
161 | - if($selected){ | |
162 | - return $this->getElementValue($selected); | |
163 | - } | |
164 | - } | |
165 | - return null; | |
166 | - | |
167 | - } | |
168 | - | |
169 | - private function getElementWeight($ele){ | |
170 | - $params = explode('|', $ele); | |
171 | - return floatval($params[1]); | |
172 | - } | |
173 | - private function getElementValue($ele){ | |
174 | - $params = explode('|', $ele); | |
175 | - return $params[0]; | |
176 | - } | |
177 | - | |
178 | - private function getDeafultEnv(){ | |
179 | - return ClusterTopClient::$dnsconfig['config']['def_env']; | |
180 | - } | |
181 | - | |
182 | - private static function startsWith($haystack, $needle) { | |
183 | - return $needle === "" || strpos($haystack, $needle) === 0; | |
184 | - } | |
185 | - | |
186 | - private function object_to_array($obj) | |
187 | - { | |
188 | - $_arr= is_object($obj) ? get_object_vars($obj) : $obj; | |
189 | - foreach($_arr as $key=> $val) | |
190 | - { | |
191 | - $val= (is_array($val) || is_object($val))? $this->object_to_array($val) : $val; | |
192 | - $arr[$key] = $val; | |
193 | - } | |
194 | - return$arr; | |
195 | - } | |
196 | - | |
197 | - private function randomFloat($min = 0, $max = 1) { return $min + mt_rand() / mt_getrandmax() * ($max - $min); } | |
198 | -} | |
199 | -?> | |
200 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/top/HttpdnsGetRequest.php
... | ... | @@ -1,23 +0,0 @@ |
1 | -<?php | |
2 | - | |
3 | -class HttpdnsGetRequest | |
4 | -{ | |
5 | - private $apiParas = array(); | |
6 | - | |
7 | - public function getApiMethodName() | |
8 | - { | |
9 | - return "taobao.httpdns.get"; | |
10 | - } | |
11 | - | |
12 | - public function getApiParas() | |
13 | - { | |
14 | - return $this->apiParas; | |
15 | - } | |
16 | - | |
17 | - public function check(){} | |
18 | - | |
19 | - public function putOtherTextParam($key, $value) { | |
20 | - $this->apiParas[$key] = $value; | |
21 | - $this->$key = $value; | |
22 | - } | |
23 | -} |
common/exts/sms/aliyun/top/RequestCheckUtil.php
... | ... | @@ -1,107 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * API入参静态检查类 | |
4 | - * 可以对API的参数类型、长度、最大值等进行校验 | |
5 | - * | |
6 | - **/ | |
7 | -class RequestCheckUtil | |
8 | -{ | |
9 | - /** | |
10 | - * 校验字段 fieldName 的值$value非空 | |
11 | - * | |
12 | - **/ | |
13 | - public static function checkNotNull($value,$fieldName) { | |
14 | - | |
15 | - if(self::checkEmpty($value)){ | |
16 | - throw new Exception("client-check-error:Missing Required Arguments: " .$fieldName , 40); | |
17 | - } | |
18 | - } | |
19 | - | |
20 | - /** | |
21 | - * 检验字段fieldName的值value 的长度 | |
22 | - * | |
23 | - **/ | |
24 | - public static function checkMaxLength($value,$maxLength,$fieldName){ | |
25 | - if(!self::checkEmpty($value) && mb_strlen($value , "UTF-8") > $maxLength){ | |
26 | - throw new Exception("client-check-error:Invalid Arguments:the length of " .$fieldName . " can not be larger than " . $maxLength . "." , 41); | |
27 | - } | |
28 | - } | |
29 | - | |
30 | - /** | |
31 | - * 检验字段fieldName的值value的最大列表长度 | |
32 | - * | |
33 | - **/ | |
34 | - public static function checkMaxListSize($value,$maxSize,$fieldName) { | |
35 | - | |
36 | - if(self::checkEmpty($value)) | |
37 | - return ; | |
38 | - | |
39 | - $list=preg_split("/,/",$value); | |
40 | - if(count($list) > $maxSize){ | |
41 | - throw new Exception("client-check-error:Invalid Arguments:the listsize(the string split by \",\") of ". $fieldName . " must be less than " . $maxSize . " ." , 41); | |
42 | - } | |
43 | - } | |
44 | - | |
45 | - /** | |
46 | - * 检验字段fieldName的值value 的最大值 | |
47 | - * | |
48 | - **/ | |
49 | - public static function checkMaxValue($value,$maxValue,$fieldName){ | |
50 | - | |
51 | - if(self::checkEmpty($value)) | |
52 | - return ; | |
53 | - | |
54 | - self::checkNumeric($value,$fieldName); | |
55 | - | |
56 | - if($value > $maxValue){ | |
57 | - throw new Exception("client-check-error:Invalid Arguments:the value of " . $fieldName . " can not be larger than " . $maxValue ." ." , 41); | |
58 | - } | |
59 | - } | |
60 | - | |
61 | - /** | |
62 | - * 检验字段fieldName的值value 的最小值 | |
63 | - * | |
64 | - **/ | |
65 | - public static function checkMinValue($value,$minValue,$fieldName) { | |
66 | - | |
67 | - if(self::checkEmpty($value)) | |
68 | - return ; | |
69 | - | |
70 | - self::checkNumeric($value,$fieldName); | |
71 | - | |
72 | - if($value < $minValue){ | |
73 | - throw new Exception("client-check-error:Invalid Arguments:the value of " . $fieldName . " can not be less than " . $minValue . " ." , 41); | |
74 | - } | |
75 | - } | |
76 | - | |
77 | - /** | |
78 | - * 检验字段fieldName的值value是否是number | |
79 | - * | |
80 | - **/ | |
81 | - protected static function checkNumeric($value,$fieldName) { | |
82 | - if(!is_numeric($value)) | |
83 | - throw new Exception("client-check-error:Invalid Arguments:the value of " . $fieldName . " is not number : " . $value . " ." , 41); | |
84 | - } | |
85 | - | |
86 | - /** | |
87 | - * 校验$value是否非空 | |
88 | - * if not set ,return true; | |
89 | - * if is null , return true; | |
90 | - * | |
91 | - * | |
92 | - **/ | |
93 | - public static function checkEmpty($value) { | |
94 | - if(!isset($value)) | |
95 | - return true ; | |
96 | - if($value === null ) | |
97 | - return true; | |
98 | - if(is_array($value) && count($value) == 0) | |
99 | - return true; | |
100 | - if(is_string($value) &&trim($value) === "") | |
101 | - return true; | |
102 | - | |
103 | - return false; | |
104 | - } | |
105 | - | |
106 | -} | |
107 | -?> | |
108 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/top/ResultSet.php
common/exts/sms/aliyun/top/SpiUtils.php
... | ... | @@ -1,214 +0,0 @@ |
1 | -<?php | |
2 | -class SpiUtils{ | |
3 | - private static $top_sign_list = "HTTP_TOP_SIGN_LIST"; | |
4 | - private static $timestamp = "timestamp"; | |
5 | - private static $header_real_ip = array("X_Real_IP", "X_Forwarded_For", "Proxy_Client_IP", | |
6 | - "WL_Proxy_Client_IP", "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR"); | |
7 | - /** | |
8 | - * 校验SPI请求签名,适用于所有GET请求,及不包含文件参数的POST请求。 | |
9 | - * | |
10 | - * @param request 请求对象 | |
11 | - * @param secret app对应的secret | |
12 | - * @return true:校验通过;false:校验不通过 | |
13 | - */ | |
14 | - public static function checkSign4FormRequest($secret){ | |
15 | - return self::checkSign(null,null,$secret); | |
16 | - } | |
17 | - | |
18 | - /** | |
19 | - * 校验SPI请求签名,适用于请求体是xml/json等可用文本表示的POST请求。 | |
20 | - * | |
21 | - * @param request 请求对象 | |
22 | - * @param body 请求体的文本内容 | |
23 | - * @param secret app对应的secret | |
24 | - * @return true:校验通过;false:校验不通过 | |
25 | - */ | |
26 | - public static function checkSign4TextRequest($body,$secret){ | |
27 | - return self::checkSign(null,$body,$secret); | |
28 | - } | |
29 | - | |
30 | - /** | |
31 | - * 校验SPI请求签名,适用于带文件上传的POST请求。 | |
32 | - * | |
33 | - * @param request 请求对象 | |
34 | - * @param form 除了文件参数以外的所有普通文本参数的map集合 | |
35 | - * @param secret app对应的secret | |
36 | - * @return true:校验通过;false:校验不通过 | |
37 | - */ | |
38 | - public static function checkSign4FileRequest($form, $secret){ | |
39 | - return self::checkSign($form, null, $secret); | |
40 | - } | |
41 | - | |
42 | - private static function checkSign($form, $body, $secret) { | |
43 | - $params = array(); | |
44 | - // 1. 获取header参数 | |
45 | - $headerMap = self::getHeaderMap(); | |
46 | - foreach ($headerMap as $k => $v){ | |
47 | - $params[$k] = $v ; | |
48 | - } | |
49 | - | |
50 | - // 2. 获取url参数 | |
51 | - $queryMap = self::getQueryMap(); | |
52 | - foreach ($queryMap as $k => $v){ | |
53 | - $params[$k] = $v ; | |
54 | - } | |
55 | - | |
56 | - // 3. 获取form参数 | |
57 | - if ($form == null && $body == null) { | |
58 | - $formMap = self::getFormMap(); | |
59 | - foreach ($formMap as $k => $v){ | |
60 | - $params[$k] = $v ; | |
61 | - } | |
62 | - } else if ($form != null) { | |
63 | - foreach ($form as $k => $v){ | |
64 | - $params[$k] = $v ; | |
65 | - } | |
66 | - } | |
67 | - | |
68 | - if($body == null){ | |
69 | - $body = file_get_contents('php://input'); | |
70 | - } | |
71 | - | |
72 | - $remoteSign = $queryMap["sign"]; | |
73 | - $localSign = self::sign($params, $body, $secret); | |
74 | - if (strcmp($remoteSign, $localSign) == 0) { | |
75 | - return true; | |
76 | - } else { | |
77 | - $paramStr = self::getParamStrFromMap($params); | |
78 | - self::logCommunicationError($remoteSign,$localSign,$paramStr,$body); | |
79 | - return false; | |
80 | - } | |
81 | - } | |
82 | - | |
83 | - private static function getHeaderMap() { | |
84 | - $headerMap = array(); | |
85 | - $signList = $_SERVER['HTTP_TOP_SIGN_LIST']; // 只获取参与签名的头部字段 | |
86 | - $signList = trim($signList); | |
87 | - if (strlen($signList) > 0){ | |
88 | - $params = split(",", $signList); | |
89 | - foreach ($_SERVER as $k => $v){ | |
90 | - if (substr($k, 0, 5) == 'HTTP_'){ | |
91 | - foreach($params as $kk){ | |
92 | - $upperkey = strtoupper($kk); | |
93 | - if(self::endWith($k,$upperkey)){ | |
94 | - $headerMap[$kk] = $v; | |
95 | - } | |
96 | - } | |
97 | - } | |
98 | - } | |
99 | - } | |
100 | - return $headerMap; | |
101 | - } | |
102 | - | |
103 | - private static function getQueryMap(){ | |
104 | - $queryStr = $_SERVER["QUERY_STRING"]; | |
105 | - $resultArray = array(); | |
106 | - foreach (explode('&', $queryStr) as $pair) { | |
107 | - list($key, $value) = explode('=', $pair); | |
108 | - if (strpos($key, '.') !== false) { | |
109 | - list($subKey, $subVal) = explode('.', $key); | |
110 | - | |
111 | - if (preg_match('/(?P<name>\w+)\[(?P<index>\w+)\]/', $subKey, $matches)) { | |
112 | - $resultArray[$matches['name']][$matches['index']][$subVal] = $value; | |
113 | - } else { | |
114 | - $resultArray[$subKey][$subVal] = urldecode($value); | |
115 | - } | |
116 | - } else { | |
117 | - $resultArray[$key] = urldecode($value); | |
118 | - } | |
119 | - } | |
120 | - return $resultArray; | |
121 | - } | |
122 | - | |
123 | - private static function checkRemoteIp(){ | |
124 | - $remoteIp = $_SERVER["REMOTE_ADDR"]; | |
125 | - foreach ($header_real_ip as $k){ | |
126 | - $realIp = $_SERVER[$k]; | |
127 | - $realIp = trim($realIp); | |
128 | - if(strlen($realIp) > 0 && strcasecmp("unknown",$realIp)){ | |
129 | - $remoteIp = $realIp; | |
130 | - break; | |
131 | - } | |
132 | - } | |
133 | - return self::startsWith($remoteIp,"140.205.144.") || $this->startsWith($remoteIp,"40.205.145."); | |
134 | - } | |
135 | - | |
136 | - private static function getFormMap(){ | |
137 | - $resultArray = array(); | |
138 | - foreach($_POST as $key=>$v) { | |
139 | - $resultArray[$k] = $v ; | |
140 | - } | |
141 | - return $resultArray ; | |
142 | - } | |
143 | - | |
144 | - private static function startsWith($haystack, $needle) { | |
145 | - return $needle === "" || strpos($haystack, $needle) === 0; | |
146 | - } | |
147 | - | |
148 | - private static function endWith($haystack, $needle) { | |
149 | - $length = strlen($needle); | |
150 | - if($length == 0) | |
151 | - { | |
152 | - return true; | |
153 | - } | |
154 | - return (substr($haystack, -$length) === $needle); | |
155 | - } | |
156 | - | |
157 | - private static function checkTimestamp(){ | |
158 | - $ts = $_POST['timestamp']; | |
159 | - if($ts){ | |
160 | - $clientTimestamp = strtotime($ts); | |
161 | - $current = $_SERVER['REQUEST_TIME']; | |
162 | - return ($current - $clientTimestamp) <= 5*60*1000; | |
163 | - }else{ | |
164 | - return false; | |
165 | - } | |
166 | - } | |
167 | - | |
168 | - private static function getParamStrFromMap($params){ | |
169 | - ksort($params); | |
170 | - $stringToBeSigned = ""; | |
171 | - foreach ($params as $k => $v) | |
172 | - { | |
173 | - if(strcmp("sign", $k) != 0) | |
174 | - { | |
175 | - $stringToBeSigned .= "$k$v"; | |
176 | - } | |
177 | - } | |
178 | - unset($k, $v); | |
179 | - return $stringToBeSigned; | |
180 | - } | |
181 | - | |
182 | - private static function sign($params,$body,$secret){ | |
183 | - ksort($params); | |
184 | - | |
185 | - $stringToBeSigned = $secret; | |
186 | - $stringToBeSigned .= self::getParamStrFromMap($params); | |
187 | - | |
188 | - if($body) | |
189 | - $stringToBeSigned .= $body; | |
190 | - $stringToBeSigned .= $secret; | |
191 | - return strtoupper(md5($stringToBeSigned)); | |
192 | - } | |
193 | - | |
194 | - protected static function logCommunicationError($remoteSign, $localSign, $paramStr, $body) | |
195 | - { | |
196 | - $localIp = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI"; | |
197 | - $logger = new TopLogger; | |
198 | - $logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_comm_err_". date("Y-m-d") . ".log"; | |
199 | - $logger->conf["separator"] = "^_^"; | |
200 | - $logData = array( | |
201 | - "checkTopSign error" , | |
202 | - "remoteSign=".$remoteSign , | |
203 | - "localSign=".$localSign , | |
204 | - "paramStr=".$paramStr , | |
205 | - "body=".$body | |
206 | - ); | |
207 | - $logger->log($logData); | |
208 | - } | |
209 | - private static function clear_blank($str, $glue='') | |
210 | - { | |
211 | - $replace = array(" ", "\r", "\n", "\t"); return str_replace($replace, $glue, $str); | |
212 | - } | |
213 | -} | |
214 | -?> | |
215 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/top/TopClient.php
... | ... | @@ -1,375 +0,0 @@ |
1 | -<?php | |
2 | -class TopClient | |
3 | -{ | |
4 | - public $appkey; | |
5 | - | |
6 | - public $secretKey; | |
7 | - | |
8 | - public $gatewayUrl = "http://gw.api.taobao.com/router/rest"; | |
9 | - | |
10 | - public $format = "xml"; | |
11 | - | |
12 | - public $connectTimeout; | |
13 | - | |
14 | - public $readTimeout; | |
15 | - | |
16 | - /** 是否打开入参check**/ | |
17 | - public $checkRequest = true; | |
18 | - | |
19 | - protected $signMethod = "md5"; | |
20 | - | |
21 | - protected $apiVersion = "2.0"; | |
22 | - | |
23 | - protected $sdkVersion = "top-sdk-php-20151012"; | |
24 | - | |
25 | - public function __construct($appkey = "",$secretKey = ""){ | |
26 | - $this->appkey = $appkey; | |
27 | - $this->secretKey = $secretKey ; | |
28 | - } | |
29 | - | |
30 | - protected function generateSign($params) | |
31 | - { | |
32 | - ksort($params); | |
33 | - | |
34 | - $stringToBeSigned = $this->secretKey; | |
35 | - foreach ($params as $k => $v) | |
36 | - { | |
37 | - if(is_string($v) && "@" != substr($v, 0, 1)) | |
38 | - { | |
39 | - $stringToBeSigned .= "$k$v"; | |
40 | - } | |
41 | - } | |
42 | - unset($k, $v); | |
43 | - $stringToBeSigned .= $this->secretKey; | |
44 | - | |
45 | - return strtoupper(md5($stringToBeSigned)); | |
46 | - } | |
47 | - | |
48 | - public function curl($url, $postFields = null) | |
49 | - { | |
50 | - $ch = curl_init(); | |
51 | - curl_setopt($ch, CURLOPT_URL, $url); | |
52 | - curl_setopt($ch, CURLOPT_FAILONERROR, false); | |
53 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
54 | - if ($this->readTimeout) { | |
55 | - curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout); | |
56 | - } | |
57 | - if ($this->connectTimeout) { | |
58 | - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout); | |
59 | - } | |
60 | - curl_setopt ( $ch, CURLOPT_USERAGENT, "top-sdk-php" ); | |
61 | - //https 请求 | |
62 | - if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) { | |
63 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
64 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | |
65 | - } | |
66 | - | |
67 | - if (is_array($postFields) && 0 < count($postFields)) | |
68 | - { | |
69 | - $postBodyString = ""; | |
70 | - $postMultipart = false; | |
71 | - foreach ($postFields as $k => $v) | |
72 | - { | |
73 | - if(!is_string($v)) | |
74 | - continue ; | |
75 | - | |
76 | - if("@" != substr($v, 0, 1))//判断是不是文件上传 | |
77 | - { | |
78 | - $postBodyString .= "$k=" . urlencode($v) . "&"; | |
79 | - } | |
80 | - else//文件上传用multipart/form-data,否则用www-form-urlencoded | |
81 | - { | |
82 | - $postMultipart = true; | |
83 | - if(class_exists('\CURLFile')){ | |
84 | - $postFields[$k] = new \CURLFile(substr($v, 1)); | |
85 | - } | |
86 | - } | |
87 | - } | |
88 | - unset($k, $v); | |
89 | - curl_setopt($ch, CURLOPT_POST, true); | |
90 | - if ($postMultipart) | |
91 | - { | |
92 | - if (class_exists('\CURLFile')) { | |
93 | - curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); | |
94 | - } else { | |
95 | - if (defined('CURLOPT_SAFE_UPLOAD')) { | |
96 | - curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false); | |
97 | - } | |
98 | - } | |
99 | - curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields); | |
100 | - } | |
101 | - else | |
102 | - { | |
103 | - $header = array("content-type: application/x-www-form-urlencoded; charset=UTF-8"); | |
104 | - curl_setopt($ch,CURLOPT_HTTPHEADER,$header); | |
105 | - curl_setopt($ch, CURLOPT_POSTFIELDS, substr($postBodyString,0,-1)); | |
106 | - } | |
107 | - } | |
108 | - $reponse = curl_exec($ch); | |
109 | - | |
110 | - if (curl_errno($ch)) | |
111 | - { | |
112 | - throw new Exception(curl_error($ch),0); | |
113 | - } | |
114 | - else | |
115 | - { | |
116 | - $httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); | |
117 | - if (200 !== $httpStatusCode) | |
118 | - { | |
119 | - throw new Exception($reponse,$httpStatusCode); | |
120 | - } | |
121 | - } | |
122 | - curl_close($ch); | |
123 | - return $reponse; | |
124 | - } | |
125 | - public function curl_with_memory_file($url, $postFields = null, $fileFields = null) | |
126 | - { | |
127 | - $ch = curl_init(); | |
128 | - curl_setopt($ch, CURLOPT_URL, $url); | |
129 | - curl_setopt($ch, CURLOPT_FAILONERROR, false); | |
130 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
131 | - if ($this->readTimeout) { | |
132 | - curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout); | |
133 | - } | |
134 | - if ($this->connectTimeout) { | |
135 | - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout); | |
136 | - } | |
137 | - curl_setopt ( $ch, CURLOPT_USERAGENT, "top-sdk-php" ); | |
138 | - //https 请求 | |
139 | - if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) { | |
140 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
141 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | |
142 | - } | |
143 | - //生成分隔符 | |
144 | - $delimiter = '-------------' . uniqid(); | |
145 | - //先将post的普通数据生成主体字符串 | |
146 | - $data = ''; | |
147 | - if($postFields != null){ | |
148 | - foreach ($postFields as $name => $content) { | |
149 | - $data .= "--" . $delimiter . "\r\n"; | |
150 | - $data .= 'Content-Disposition: form-data; name="' . $name . '"'; | |
151 | - //multipart/form-data 不需要urlencode,参见 http:stackoverflow.com/questions/6603928/should-i-url-encode-post-data | |
152 | - $data .= "\r\n\r\n" . $content . "\r\n"; | |
153 | - } | |
154 | - unset($name,$content); | |
155 | - } | |
156 | - | |
157 | - //将上传的文件生成主体字符串 | |
158 | - if($fileFields != null){ | |
159 | - foreach ($fileFields as $name => $file) { | |
160 | - $data .= "--" . $delimiter . "\r\n"; | |
161 | - $data .= 'Content-Disposition: form-data; name="' . $name . '"; filename="' . $file['name'] . "\" \r\n"; | |
162 | - $data .= 'Content-Type: ' . $file['type'] . "\r\n\r\n";//多了个文档类型 | |
163 | - | |
164 | - $data .= $file['content'] . "\r\n"; | |
165 | - } | |
166 | - unset($name,$file); | |
167 | - } | |
168 | - //主体结束的分隔符 | |
169 | - $data .= "--" . $delimiter . "--"; | |
170 | - | |
171 | - curl_setopt($ch, CURLOPT_POST, true); | |
172 | - curl_setopt($ch, CURLOPT_HTTPHEADER , array( | |
173 | - 'Content-Type: multipart/form-data; boundary=' . $delimiter, | |
174 | - 'Content-Length: ' . strlen($data)) | |
175 | - ); | |
176 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
177 | - curl_setopt($ch, CURLOPT_POSTFIELDS, $data); | |
178 | - | |
179 | - $reponse = curl_exec($ch); | |
180 | - unset($data); | |
181 | - | |
182 | - if (curl_errno($ch)) | |
183 | - { | |
184 | - throw new Exception(curl_error($ch),0); | |
185 | - } | |
186 | - else | |
187 | - { | |
188 | - $httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); | |
189 | - if (200 !== $httpStatusCode) | |
190 | - { | |
191 | - throw new Exception($reponse,$httpStatusCode); | |
192 | - } | |
193 | - } | |
194 | - curl_close($ch); | |
195 | - return $reponse; | |
196 | - } | |
197 | - | |
198 | - protected function logCommunicationError($apiName, $requestUrl, $errorCode, $responseTxt) | |
199 | - { | |
200 | - $localIp = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI"; | |
201 | - $logger = new TopLogger; | |
202 | - $logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_comm_err_" . $this->appkey . "_" . date("Y-m-d") . ".log"; | |
203 | - $logger->conf["separator"] = "^_^"; | |
204 | - $logData = array( | |
205 | - date("Y-m-d H:i:s"), | |
206 | - $apiName, | |
207 | - $this->appkey, | |
208 | - $localIp, | |
209 | - PHP_OS, | |
210 | - $this->sdkVersion, | |
211 | - $requestUrl, | |
212 | - $errorCode, | |
213 | - str_replace("\n","",$responseTxt) | |
214 | - ); | |
215 | - $logger->log($logData); | |
216 | - } | |
217 | - | |
218 | - public function execute($request, $session = null,$bestUrl = null) | |
219 | - { | |
220 | - $result = new ResultSet(); | |
221 | - if($this->checkRequest) { | |
222 | - try { | |
223 | - $request->check(); | |
224 | - } catch (Exception $e) { | |
225 | - | |
226 | - $result->code = $e->getCode(); | |
227 | - $result->msg = $e->getMessage(); | |
228 | - return $result; | |
229 | - } | |
230 | - } | |
231 | - //组装系统参数 | |
232 | - $sysParams["app_key"] = $this->appkey; | |
233 | - $sysParams["v"] = $this->apiVersion; | |
234 | - $sysParams["format"] = $this->format; | |
235 | - $sysParams["sign_method"] = $this->signMethod; | |
236 | - $sysParams["method"] = $request->getApiMethodName(); | |
237 | - $sysParams["timestamp"] = date("Y-m-d H:i:s"); | |
238 | - if (null != $session) | |
239 | - { | |
240 | - $sysParams["session"] = $session; | |
241 | - } | |
242 | - $apiParams = array(); | |
243 | - //获取业务参数 | |
244 | - $apiParams = $request->getApiParas(); | |
245 | - | |
246 | - | |
247 | - //系统参数放入GET请求串 | |
248 | - if($bestUrl){ | |
249 | - $requestUrl = $bestUrl."?"; | |
250 | - $sysParams["partner_id"] = $this->getClusterTag(); | |
251 | - }else{ | |
252 | - $requestUrl = $this->gatewayUrl."?"; | |
253 | - $sysParams["partner_id"] = $this->sdkVersion; | |
254 | - } | |
255 | - //签名 | |
256 | - $sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams)); | |
257 | - | |
258 | - foreach ($sysParams as $sysParamKey => $sysParamValue) | |
259 | - { | |
260 | - // if(strcmp($sysParamKey,"timestamp") != 0) | |
261 | - $requestUrl .= "$sysParamKey=" . urlencode($sysParamValue) . "&"; | |
262 | - } | |
263 | - | |
264 | - $fileFields = array(); | |
265 | - foreach ($apiParams as $key => $value) { | |
266 | - if(is_array($value) && array_key_exists('type',$value) && array_key_exists('content',$value) ){ | |
267 | - $value['name'] = $key; | |
268 | - $fileFields[$key] = $value; | |
269 | - unset($apiParams[$key]); | |
270 | - } | |
271 | - } | |
272 | - | |
273 | - // $requestUrl .= "timestamp=" . urlencode($sysParams["timestamp"]) . "&"; | |
274 | - $requestUrl = substr($requestUrl, 0, -1); | |
275 | - | |
276 | - //发起HTTP请求 | |
277 | - try | |
278 | - { | |
279 | - if(count($fileFields) > 0){ | |
280 | - $resp = $this->curl_with_memory_file($requestUrl, $apiParams, $fileFields); | |
281 | - }else{ | |
282 | - $resp = $this->curl($requestUrl, $apiParams); | |
283 | - } | |
284 | - } | |
285 | - catch (Exception $e) | |
286 | - { | |
287 | - $this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_ERROR_" . $e->getCode(),$e->getMessage()); | |
288 | - $result->code = $e->getCode(); | |
289 | - $result->msg = $e->getMessage(); | |
290 | - return $result; | |
291 | - } | |
292 | - | |
293 | - unset($apiParams); | |
294 | - unset($fileFields); | |
295 | - //解析TOP返回结果 | |
296 | - $respWellFormed = false; | |
297 | - if ("json" == $this->format) | |
298 | - { | |
299 | - $respObject = json_decode($resp); | |
300 | - if (null !== $respObject) | |
301 | - { | |
302 | - $respWellFormed = true; | |
303 | - foreach ($respObject as $propKey => $propValue) | |
304 | - { | |
305 | - $respObject = $propValue; | |
306 | - } | |
307 | - } | |
308 | - } | |
309 | - else if("xml" == $this->format) | |
310 | - { | |
311 | - $respObject = @simplexml_load_string($resp); | |
312 | - if (false !== $respObject) | |
313 | - { | |
314 | - $respWellFormed = true; | |
315 | - } | |
316 | - } | |
317 | - | |
318 | - //返回的HTTP文本不是标准JSON或者XML,记下错误日志 | |
319 | - if (false === $respWellFormed) | |
320 | - { | |
321 | - $this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_RESPONSE_NOT_WELL_FORMED",$resp); | |
322 | - $result->code = 0; | |
323 | - $result->msg = "HTTP_RESPONSE_NOT_WELL_FORMED"; | |
324 | - return $result; | |
325 | - } | |
326 | - | |
327 | - //如果TOP返回了错误码,记录到业务错误日志中 | |
328 | - if (isset($respObject->code)) | |
329 | - { | |
330 | - $logger = new TopLogger; | |
331 | - $logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_biz_err_" . $this->appkey . "_" . date("Y-m-d") . ".log"; | |
332 | - $logger->log(array( | |
333 | - date("Y-m-d H:i:s"), | |
334 | - $resp | |
335 | - )); | |
336 | - } | |
337 | - return $respObject; | |
338 | - } | |
339 | - | |
340 | - public function exec($paramsArray) | |
341 | - { | |
342 | - if (!isset($paramsArray["method"])) | |
343 | - { | |
344 | - trigger_error("No api name passed"); | |
345 | - } | |
346 | - $inflector = new LtInflector; | |
347 | - $inflector->conf["separator"] = "."; | |
348 | - $requestClassName = ucfirst($inflector->camelize(substr($paramsArray["method"], 7))) . "Request"; | |
349 | - if (!class_exists($requestClassName)) | |
350 | - { | |
351 | - trigger_error("No such api: " . $paramsArray["method"]); | |
352 | - } | |
353 | - | |
354 | - $session = isset($paramsArray["session"]) ? $paramsArray["session"] : null; | |
355 | - | |
356 | - $req = new $requestClassName; | |
357 | - foreach($paramsArray as $paraKey => $paraValue) | |
358 | - { | |
359 | - $inflector->conf["separator"] = "_"; | |
360 | - $setterMethodName = $inflector->camelize($paraKey); | |
361 | - $inflector->conf["separator"] = "."; | |
362 | - $setterMethodName = "set" . $inflector->camelize($setterMethodName); | |
363 | - if (method_exists($req, $setterMethodName)) | |
364 | - { | |
365 | - $req->$setterMethodName($paraValue); | |
366 | - } | |
367 | - } | |
368 | - return $this->execute($req, $session); | |
369 | - } | |
370 | - | |
371 | - private function getClusterTag() | |
372 | - { | |
373 | - return substr($this->sdkVersion,0,11)."-cluster".substr($this->sdkVersion,11); | |
374 | - } | |
375 | -} |
common/exts/sms/aliyun/top/TopLogger.php
... | ... | @@ -1,43 +0,0 @@ |
1 | -<?php | |
2 | -class TopLogger | |
3 | -{ | |
4 | - public $conf = array( | |
5 | - "separator" => "\t", | |
6 | - "log_file" => "" | |
7 | - ); | |
8 | - | |
9 | - private $fileHandle; | |
10 | - | |
11 | - protected function getFileHandle() | |
12 | - { | |
13 | - if (null === $this->fileHandle) | |
14 | - { | |
15 | - if (empty($this->conf["log_file"])) | |
16 | - { | |
17 | - trigger_error("no log file spcified."); | |
18 | - } | |
19 | - $logDir = dirname($this->conf["log_file"]); | |
20 | - if (!is_dir($logDir)) | |
21 | - { | |
22 | - mkdir($logDir, 0777, true); | |
23 | - } | |
24 | - $this->fileHandle = fopen($this->conf["log_file"], "a"); | |
25 | - } | |
26 | - return $this->fileHandle; | |
27 | - } | |
28 | - | |
29 | - public function log($logData) | |
30 | - { | |
31 | - if ("" == $logData || array() == $logData) | |
32 | - { | |
33 | - return false; | |
34 | - } | |
35 | - if (is_array($logData)) | |
36 | - { | |
37 | - $logData = implode($this->conf["separator"], $logData); | |
38 | - } | |
39 | - $logData = $logData. "\n"; | |
40 | - fwrite($this->getFileHandle(), $logData); | |
41 | - } | |
42 | -} | |
43 | -?> | |
44 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/top/domain/Area.php
... | ... | @@ -1,35 +0,0 @@ |
1 | -<?php | |
2 | - | |
3 | -/** | |
4 | - * 地址区域结构 | |
5 | - * @author auto create | |
6 | - */ | |
7 | -class Area | |
8 | -{ | |
9 | - | |
10 | - /** | |
11 | - * 标准行政区域代码.参考:http://www.stats.gov.cn/tjbz/xzqhdm/t20120105_402777427.htm | |
12 | - **/ | |
13 | - public $id; | |
14 | - | |
15 | - /** | |
16 | - * 地域名称.如北京市,杭州市,西湖区,每一个area_id 都代表了一个具体的地区. | |
17 | - **/ | |
18 | - public $name; | |
19 | - | |
20 | - /** | |
21 | - * 父节点区域标识.如北京市的area_id是110100,朝阳区是北京市的一个区,所以朝阳区的parent_id就是北京市的area_id. | |
22 | - **/ | |
23 | - public $parent_id; | |
24 | - | |
25 | - /** | |
26 | - * 区域类型.area区域 1:country/国家;2:province/省/自治区/直辖市;3:city/地区(省下面的地级市);4:district/县/市(县级市)/区;abroad:海外. 比如北京市的area_type = 2,朝阳区是北京市的一个区,所以朝阳区的area_type = 4. | |
27 | - **/ | |
28 | - public $type; | |
29 | - | |
30 | - /** | |
31 | - * 具体一个地区的邮编 | |
32 | - **/ | |
33 | - public $zip; | |
34 | -} | |
35 | -?> | |
36 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/top/domain/BizResult.php
... | ... | @@ -1,30 +0,0 @@ |
1 | -<?php | |
2 | - | |
3 | -/** | |
4 | - * 返回结果对象 | |
5 | - * @author auto create | |
6 | - */ | |
7 | -class BizResult | |
8 | -{ | |
9 | - | |
10 | - /** | |
11 | - * 错误码 | |
12 | - **/ | |
13 | - public $err_code; | |
14 | - | |
15 | - /** | |
16 | - * 返回结果 | |
17 | - **/ | |
18 | - public $model; | |
19 | - | |
20 | - /** | |
21 | - * 返回信息描述 | |
22 | - **/ | |
23 | - public $msg; | |
24 | - | |
25 | - /** | |
26 | - * true表示成功,false表示失败 | |
27 | - **/ | |
28 | - public $success; | |
29 | -} | |
30 | -?> | |
31 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/top/domain/FcPartnerSmsDetailDto.php
... | ... | @@ -1,50 +0,0 @@ |
1 | -<?php | |
2 | - | |
3 | -/** | |
4 | - * 1 | |
5 | - * @author auto create | |
6 | - */ | |
7 | -class FcPartnerSmsDetailDto | |
8 | -{ | |
9 | - | |
10 | - /** | |
11 | - * 公共回传参数 | |
12 | - **/ | |
13 | - public $extend; | |
14 | - | |
15 | - /** | |
16 | - * 短信接收号码 | |
17 | - **/ | |
18 | - public $rec_num; | |
19 | - | |
20 | - /** | |
21 | - * 短信错误码 | |
22 | - **/ | |
23 | - public $result_code; | |
24 | - | |
25 | - /** | |
26 | - * 模板编码 | |
27 | - **/ | |
28 | - public $sms_code; | |
29 | - | |
30 | - /** | |
31 | - * 短信发送内容 | |
32 | - **/ | |
33 | - public $sms_content; | |
34 | - | |
35 | - /** | |
36 | - * 短信接收时间 | |
37 | - **/ | |
38 | - public $sms_receiver_time; | |
39 | - | |
40 | - /** | |
41 | - * 短信发送时间 | |
42 | - **/ | |
43 | - public $sms_send_time; | |
44 | - | |
45 | - /** | |
46 | - * 发送状态 1:等待回执,2:发送失败,3:发送成功 | |
47 | - **/ | |
48 | - public $sms_status; | |
49 | -} | |
50 | -?> | |
51 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/top/domain/KfcSearchResult.php
... | ... | @@ -1,29 +0,0 @@ |
1 | -<?php | |
2 | - | |
3 | -/** | |
4 | - * KFC 关键词过滤匹配结果 | |
5 | - * @author auto create | |
6 | - */ | |
7 | -class KfcSearchResult | |
8 | -{ | |
9 | - | |
10 | - /** | |
11 | - * 过滤后的文本: | |
12 | -当匹配到B等级的词时,文本中的关键词被替换为*号,content即为关键词替换后的文本; | |
13 | -其他情况,content始终为null | |
14 | - **/ | |
15 | - public $content; | |
16 | - | |
17 | - /** | |
18 | - * 匹配到的关键词的等级,值为null,或为A、B、C、D。 | |
19 | -当匹配不到关键词时,值为null,否则值为A、B、C、D中的一个。 | |
20 | -A、B、C、D等级按严重程度从高至低排列。 | |
21 | - **/ | |
22 | - public $level; | |
23 | - | |
24 | - /** | |
25 | - * 是否匹配到关键词,匹配到则为true. | |
26 | - **/ | |
27 | - public $matched; | |
28 | -} | |
29 | -?> | |
30 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/top/domain/Result.php
... | ... | @@ -1,30 +0,0 @@ |
1 | -<?php | |
2 | - | |
3 | -/** | |
4 | - * 无 | |
5 | - * @author auto create | |
6 | - */ | |
7 | -class Result | |
8 | -{ | |
9 | - | |
10 | - /** | |
11 | - * 错误码 | |
12 | - **/ | |
13 | - public $code; | |
14 | - | |
15 | - /** | |
16 | - * 无 | |
17 | - **/ | |
18 | - public $model; | |
19 | - | |
20 | - /** | |
21 | - * 原因 | |
22 | - **/ | |
23 | - public $msg; | |
24 | - | |
25 | - /** | |
26 | - * 结果 | |
27 | - **/ | |
28 | - public $success; | |
29 | -} | |
30 | -?> | |
31 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/top/domain/Subtask.php
... | ... | @@ -1,25 +0,0 @@ |
1 | -<?php | |
2 | - | |
3 | -/** | |
4 | - * 批量异步任务的子任务结果 | |
5 | - * @author auto create | |
6 | - */ | |
7 | -class Subtask | |
8 | -{ | |
9 | - | |
10 | - /** | |
11 | - * 标记子任务是否成功。为true表示子任务成功,用户可以按照正确执行的结果格式解析sub_task_result。为false表示子任务失败了,用户需要按照失败的结果格式解析sub_task_result(里面只有sub_code和sub_msg) | |
12 | - **/ | |
13 | - public $is_success; | |
14 | - | |
15 | - /** | |
16 | - * 子任务的有效请求参数,以json格式进行key:value的组合 | |
17 | - **/ | |
18 | - public $sub_task_request; | |
19 | - | |
20 | - /** | |
21 | - * 子任务返回的结果,以json格式进行key:value组合,可以和单个api请求结果解析复用。以获取交易订单详情为例:子任务执行成功返回的结果格式为:{“trade”:{"tid":123456,"seller_nick":"淘宝卖家"}};子任务执行失败结果格式为{"sub_code":"isv.trade-not-exist","sub_msg":"交易订单不存在"} | |
22 | - **/ | |
23 | - public $sub_task_result; | |
24 | -} | |
25 | -?> | |
26 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/top/domain/Task.php
... | ... | @@ -1,52 +0,0 @@ |
1 | -<?php | |
2 | - | |
3 | -/** | |
4 | - * 批量异步任务结果 | |
5 | - * @author auto create | |
6 | - */ | |
7 | -class Task | |
8 | -{ | |
9 | - | |
10 | - /** | |
11 | - * 下载文件的MD5校验码,通过此校验码可以检查下载的文件是否是完整的。 | |
12 | - **/ | |
13 | - public $check_code; | |
14 | - | |
15 | - /** | |
16 | - * 任务创建时间 | |
17 | - **/ | |
18 | - public $created; | |
19 | - | |
20 | - /** | |
21 | - * 大任务结果下载地址。当创建的认任务是大数据量的任务时,获取结果会返回此字段,同时subtasks列表会为空。 | |
22 | -通过这个地址可以下载到结果的结构体,格式同普通任务下载的一样。 | |
23 | -每次获取到的地址只能下载一次。下载的文件加上后缀名.zip打开。 | |
24 | - **/ | |
25 | - public $download_url; | |
26 | - | |
27 | - /** | |
28 | - * 此任务是由哪个api产生的 | |
29 | - **/ | |
30 | - public $method; | |
31 | - | |
32 | - /** | |
33 | - * 定时类型任务的执行时间点 | |
34 | - **/ | |
35 | - public $schedule; | |
36 | - | |
37 | - /** | |
38 | - * 异步任务处理状态。new(还未开始处理),doing(处理中),done(处理结束)。 | |
39 | - **/ | |
40 | - public $status; | |
41 | - | |
42 | - /** | |
43 | - * 子任务处理结果,如果任务还没有处理完,返回的结果列表为空。如果任务处理完毕,返回子任务结果列表 | |
44 | - **/ | |
45 | - public $subtasks; | |
46 | - | |
47 | - /** | |
48 | - * 异步任务id。创建异步任务时返回的任务id号 | |
49 | - **/ | |
50 | - public $task_id; | |
51 | -} | |
52 | -?> | |
53 | 0 | \ No newline at end of file |
common/exts/sms/aliyun/top/request/AlibabaAliqinFcFlowChargeProvinceRequest.php
... | ... | @@ -1,98 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: alibaba.aliqin.fc.flow.charge.province request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.03.30 | |
7 | - */ | |
8 | -class AlibabaAliqinFcFlowChargeProvinceRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 需要充值的流量 | |
12 | - **/ | |
13 | - private $grade; | |
14 | - | |
15 | - /** | |
16 | - * 唯一流水号 | |
17 | - **/ | |
18 | - private $outRechargeId; | |
19 | - | |
20 | - /** | |
21 | - * 手机号 | |
22 | - **/ | |
23 | - private $phoneNum; | |
24 | - | |
25 | - /** | |
26 | - * 充值原因 | |
27 | - **/ | |
28 | - private $reason; | |
29 | - | |
30 | - private $apiParas = array(); | |
31 | - | |
32 | - public function setGrade($grade) | |
33 | - { | |
34 | - $this->grade = $grade; | |
35 | - $this->apiParas["grade"] = $grade; | |
36 | - } | |
37 | - | |
38 | - public function getGrade() | |
39 | - { | |
40 | - return $this->grade; | |
41 | - } | |
42 | - | |
43 | - public function setOutRechargeId($outRechargeId) | |
44 | - { | |
45 | - $this->outRechargeId = $outRechargeId; | |
46 | - $this->apiParas["out_recharge_id"] = $outRechargeId; | |
47 | - } | |
48 | - | |
49 | - public function getOutRechargeId() | |
50 | - { | |
51 | - return $this->outRechargeId; | |
52 | - } | |
53 | - | |
54 | - public function setPhoneNum($phoneNum) | |
55 | - { | |
56 | - $this->phoneNum = $phoneNum; | |
57 | - $this->apiParas["phone_num"] = $phoneNum; | |
58 | - } | |
59 | - | |
60 | - public function getPhoneNum() | |
61 | - { | |
62 | - return $this->phoneNum; | |
63 | - } | |
64 | - | |
65 | - public function setReason($reason) | |
66 | - { | |
67 | - $this->reason = $reason; | |
68 | - $this->apiParas["reason"] = $reason; | |
69 | - } | |
70 | - | |
71 | - public function getReason() | |
72 | - { | |
73 | - return $this->reason; | |
74 | - } | |
75 | - | |
76 | - public function getApiMethodName() | |
77 | - { | |
78 | - return "alibaba.aliqin.fc.flow.charge.province"; | |
79 | - } | |
80 | - | |
81 | - public function getApiParas() | |
82 | - { | |
83 | - return $this->apiParas; | |
84 | - } | |
85 | - | |
86 | - public function check() | |
87 | - { | |
88 | - | |
89 | - RequestCheckUtil::checkNotNull($this->grade,"grade"); | |
90 | - RequestCheckUtil::checkNotNull($this->outRechargeId,"outRechargeId"); | |
91 | - RequestCheckUtil::checkNotNull($this->phoneNum,"phoneNum"); | |
92 | - } | |
93 | - | |
94 | - public function putOtherTextParam($key, $value) { | |
95 | - $this->apiParas[$key] = $value; | |
96 | - $this->$key = $value; | |
97 | - } | |
98 | -} |
common/exts/sms/aliyun/top/request/AlibabaAliqinFcFlowChargeRequest.php
... | ... | @@ -1,98 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: alibaba.aliqin.fc.flow.charge request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.03.30 | |
7 | - */ | |
8 | -class AlibabaAliqinFcFlowChargeRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 需要充值的流量 | |
12 | - **/ | |
13 | - private $grade; | |
14 | - | |
15 | - /** | |
16 | - * 唯一流水号 | |
17 | - **/ | |
18 | - private $outRechargeId; | |
19 | - | |
20 | - /** | |
21 | - * 手机号 | |
22 | - **/ | |
23 | - private $phoneNum; | |
24 | - | |
25 | - /** | |
26 | - * 充值原因 | |
27 | - **/ | |
28 | - private $reason; | |
29 | - | |
30 | - private $apiParas = array(); | |
31 | - | |
32 | - public function setGrade($grade) | |
33 | - { | |
34 | - $this->grade = $grade; | |
35 | - $this->apiParas["grade"] = $grade; | |
36 | - } | |
37 | - | |
38 | - public function getGrade() | |
39 | - { | |
40 | - return $this->grade; | |
41 | - } | |
42 | - | |
43 | - public function setOutRechargeId($outRechargeId) | |
44 | - { | |
45 | - $this->outRechargeId = $outRechargeId; | |
46 | - $this->apiParas["out_recharge_id"] = $outRechargeId; | |
47 | - } | |
48 | - | |
49 | - public function getOutRechargeId() | |
50 | - { | |
51 | - return $this->outRechargeId; | |
52 | - } | |
53 | - | |
54 | - public function setPhoneNum($phoneNum) | |
55 | - { | |
56 | - $this->phoneNum = $phoneNum; | |
57 | - $this->apiParas["phone_num"] = $phoneNum; | |
58 | - } | |
59 | - | |
60 | - public function getPhoneNum() | |
61 | - { | |
62 | - return $this->phoneNum; | |
63 | - } | |
64 | - | |
65 | - public function setReason($reason) | |
66 | - { | |
67 | - $this->reason = $reason; | |
68 | - $this->apiParas["reason"] = $reason; | |
69 | - } | |
70 | - | |
71 | - public function getReason() | |
72 | - { | |
73 | - return $this->reason; | |
74 | - } | |
75 | - | |
76 | - public function getApiMethodName() | |
77 | - { | |
78 | - return "alibaba.aliqin.fc.flow.charge"; | |
79 | - } | |
80 | - | |
81 | - public function getApiParas() | |
82 | - { | |
83 | - return $this->apiParas; | |
84 | - } | |
85 | - | |
86 | - public function check() | |
87 | - { | |
88 | - | |
89 | - RequestCheckUtil::checkNotNull($this->grade,"grade"); | |
90 | - RequestCheckUtil::checkNotNull($this->outRechargeId,"outRechargeId"); | |
91 | - RequestCheckUtil::checkNotNull($this->phoneNum,"phoneNum"); | |
92 | - } | |
93 | - | |
94 | - public function putOtherTextParam($key, $value) { | |
95 | - $this->apiParas[$key] = $value; | |
96 | - $this->$key = $value; | |
97 | - } | |
98 | -} |
common/exts/sms/aliyun/top/request/AlibabaAliqinFcFlowGradeRequest.php
... | ... | @@ -1,32 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: alibaba.aliqin.fc.flow.grade request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.03.30 | |
7 | - */ | |
8 | -class AlibabaAliqinFcFlowGradeRequest | |
9 | -{ | |
10 | - | |
11 | - private $apiParas = array(); | |
12 | - | |
13 | - public function getApiMethodName() | |
14 | - { | |
15 | - return "alibaba.aliqin.fc.flow.grade"; | |
16 | - } | |
17 | - | |
18 | - public function getApiParas() | |
19 | - { | |
20 | - return $this->apiParas; | |
21 | - } | |
22 | - | |
23 | - public function check() | |
24 | - { | |
25 | - | |
26 | - } | |
27 | - | |
28 | - public function putOtherTextParam($key, $value) { | |
29 | - $this->apiParas[$key] = $value; | |
30 | - $this->$key = $value; | |
31 | - } | |
32 | -} |
common/exts/sms/aliyun/top/request/AlibabaAliqinFcFlowQueryRequest.php
... | ... | @@ -1,47 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: alibaba.aliqin.fc.flow.query request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.03.30 | |
7 | - */ | |
8 | -class AlibabaAliqinFcFlowQueryRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 唯一流水号 | |
12 | - **/ | |
13 | - private $outId; | |
14 | - | |
15 | - private $apiParas = array(); | |
16 | - | |
17 | - public function setOutId($outId) | |
18 | - { | |
19 | - $this->outId = $outId; | |
20 | - $this->apiParas["out_id"] = $outId; | |
21 | - } | |
22 | - | |
23 | - public function getOutId() | |
24 | - { | |
25 | - return $this->outId; | |
26 | - } | |
27 | - | |
28 | - public function getApiMethodName() | |
29 | - { | |
30 | - return "alibaba.aliqin.fc.flow.query"; | |
31 | - } | |
32 | - | |
33 | - public function getApiParas() | |
34 | - { | |
35 | - return $this->apiParas; | |
36 | - } | |
37 | - | |
38 | - public function check() | |
39 | - { | |
40 | - | |
41 | - } | |
42 | - | |
43 | - public function putOtherTextParam($key, $value) { | |
44 | - $this->apiParas[$key] = $value; | |
45 | - $this->$key = $value; | |
46 | - } | |
47 | -} |
common/exts/sms/aliyun/top/request/AlibabaAliqinFcSmsNumQueryRequest.php
... | ... | @@ -1,115 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: alibaba.aliqin.fc.sms.num.query request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.03.01 | |
7 | - */ | |
8 | -class AlibabaAliqinFcSmsNumQueryRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 短信发送流水 | |
12 | - **/ | |
13 | - private $bizId; | |
14 | - | |
15 | - /** | |
16 | - * 分页参数,页码 | |
17 | - **/ | |
18 | - private $currentPage; | |
19 | - | |
20 | - /** | |
21 | - * 分页参数,每页数量。最大值50 | |
22 | - **/ | |
23 | - private $pageSize; | |
24 | - | |
25 | - /** | |
26 | - * 短信发送日期,支持近30天记录查询,格式yyyyMMdd | |
27 | - **/ | |
28 | - private $queryDate; | |
29 | - | |
30 | - /** | |
31 | - * 短信接收号码 | |
32 | - **/ | |
33 | - private $recNum; | |
34 | - | |
35 | - private $apiParas = array(); | |
36 | - | |
37 | - public function setBizId($bizId) | |
38 | - { | |
39 | - $this->bizId = $bizId; | |
40 | - $this->apiParas["biz_id"] = $bizId; | |
41 | - } | |
42 | - | |
43 | - public function getBizId() | |
44 | - { | |
45 | - return $this->bizId; | |
46 | - } | |
47 | - | |
48 | - public function setCurrentPage($currentPage) | |
49 | - { | |
50 | - $this->currentPage = $currentPage; | |
51 | - $this->apiParas["current_page"] = $currentPage; | |
52 | - } | |
53 | - | |
54 | - public function getCurrentPage() | |
55 | - { | |
56 | - return $this->currentPage; | |
57 | - } | |
58 | - | |
59 | - public function setPageSize($pageSize) | |
60 | - { | |
61 | - $this->pageSize = $pageSize; | |
62 | - $this->apiParas["page_size"] = $pageSize; | |
63 | - } | |
64 | - | |
65 | - public function getPageSize() | |
66 | - { | |
67 | - return $this->pageSize; | |
68 | - } | |
69 | - | |
70 | - public function setQueryDate($queryDate) | |
71 | - { | |
72 | - $this->queryDate = $queryDate; | |
73 | - $this->apiParas["query_date"] = $queryDate; | |
74 | - } | |
75 | - | |
76 | - public function getQueryDate() | |
77 | - { | |
78 | - return $this->queryDate; | |
79 | - } | |
80 | - | |
81 | - public function setRecNum($recNum) | |
82 | - { | |
83 | - $this->recNum = $recNum; | |
84 | - $this->apiParas["rec_num"] = $recNum; | |
85 | - } | |
86 | - | |
87 | - public function getRecNum() | |
88 | - { | |
89 | - return $this->recNum; | |
90 | - } | |
91 | - | |
92 | - public function getApiMethodName() | |
93 | - { | |
94 | - return "alibaba.aliqin.fc.sms.num.query"; | |
95 | - } | |
96 | - | |
97 | - public function getApiParas() | |
98 | - { | |
99 | - return $this->apiParas; | |
100 | - } | |
101 | - | |
102 | - public function check() | |
103 | - { | |
104 | - | |
105 | - RequestCheckUtil::checkNotNull($this->currentPage,"currentPage"); | |
106 | - RequestCheckUtil::checkNotNull($this->pageSize,"pageSize"); | |
107 | - RequestCheckUtil::checkNotNull($this->queryDate,"queryDate"); | |
108 | - RequestCheckUtil::checkNotNull($this->recNum,"recNum"); | |
109 | - } | |
110 | - | |
111 | - public function putOtherTextParam($key, $value) { | |
112 | - $this->apiParas[$key] = $value; | |
113 | - $this->$key = $value; | |
114 | - } | |
115 | -} |
common/exts/sms/aliyun/top/request/AlibabaAliqinFcSmsNumSendRequest.php
... | ... | @@ -1,131 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: alibaba.aliqin.fc.sms.num.send request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.05.24 | |
7 | - */ | |
8 | -class AlibabaAliqinFcSmsNumSendRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 公共回传参数,在“消息返回”中会透传回该参数;举例:用户可以传入自己下级的会员ID,在消息返回时,该会员ID会包含在内,用户可以根据该会员ID识别是哪位会员使用了你的应用 | |
12 | - **/ | |
13 | - private $extend; | |
14 | - | |
15 | - /** | |
16 | - * 短信接收号码。支持单个或多个手机号码,传入号码为11位手机号码,不能加0或+86。群发短信需传入多个号码,以英文逗号分隔,一次调用最多传入200个号码。示例:18600000000,13911111111,13322222222 | |
17 | - **/ | |
18 | - private $recNum; | |
19 | - | |
20 | - /** | |
21 | - * 短信签名,传入的短信签名必须是在阿里大鱼“管理中心-短信签名管理”中的可用签名。如“阿里大鱼”已在短信签名管理中通过审核,则可传入”阿里大鱼“(传参时去掉引号)作为短信签名。短信效果示例:【阿里大鱼】欢迎使用阿里大鱼服务。 | |
22 | - **/ | |
23 | - private $smsFreeSignName; | |
24 | - | |
25 | - /** | |
26 | - * 短信模板变量,传参规则{"key":"value"},key的名字须和申请模板中的变量名一致,多个变量之间以逗号隔开。示例:针对模板“验证码${code},您正在进行${product}身份验证,打死不要告诉别人哦!”,传参时需传入{"code":"1234","product":"alidayu"} | |
27 | - **/ | |
28 | - private $smsParam; | |
29 | - | |
30 | - /** | |
31 | - * 短信模板ID,传入的模板必须是在阿里大鱼“管理中心-短信模板管理”中的可用模板。示例:SMS_585014 | |
32 | - **/ | |
33 | - private $smsTemplateCode; | |
34 | - | |
35 | - /** | |
36 | - * 短信类型,传入值请填写normal | |
37 | - **/ | |
38 | - private $smsType; | |
39 | - | |
40 | - private $apiParas = array(); | |
41 | - | |
42 | - public function setExtend($extend) | |
43 | - { | |
44 | - $this->extend = $extend; | |
45 | - $this->apiParas["extend"] = $extend; | |
46 | - } | |
47 | - | |
48 | - public function getExtend() | |
49 | - { | |
50 | - return $this->extend; | |
51 | - } | |
52 | - | |
53 | - public function setRecNum($recNum) | |
54 | - { | |
55 | - $this->recNum = $recNum; | |
56 | - $this->apiParas["rec_num"] = $recNum; | |
57 | - } | |
58 | - | |
59 | - public function getRecNum() | |
60 | - { | |
61 | - return $this->recNum; | |
62 | - } | |
63 | - | |
64 | - public function setSmsFreeSignName($smsFreeSignName) | |
65 | - { | |
66 | - $this->smsFreeSignName = $smsFreeSignName; | |
67 | - $this->apiParas["sms_free_sign_name"] = $smsFreeSignName; | |
68 | - } | |
69 | - | |
70 | - public function getSmsFreeSignName() | |
71 | - { | |
72 | - return $this->smsFreeSignName; | |
73 | - } | |
74 | - | |
75 | - public function setSmsParam($smsParam) | |
76 | - { | |
77 | - $this->smsParam = $smsParam; | |
78 | - $this->apiParas["sms_param"] = $smsParam; | |
79 | - } | |
80 | - | |
81 | - public function getSmsParam() | |
82 | - { | |
83 | - return $this->smsParam; | |
84 | - } | |
85 | - | |
86 | - public function setSmsTemplateCode($smsTemplateCode) | |
87 | - { | |
88 | - $this->smsTemplateCode = $smsTemplateCode; | |
89 | - $this->apiParas["sms_template_code"] = $smsTemplateCode; | |
90 | - } | |
91 | - | |
92 | - public function getSmsTemplateCode() | |
93 | - { | |
94 | - return $this->smsTemplateCode; | |
95 | - } | |
96 | - | |
97 | - public function setSmsType($smsType) | |
98 | - { | |
99 | - $this->smsType = $smsType; | |
100 | - $this->apiParas["sms_type"] = $smsType; | |
101 | - } | |
102 | - | |
103 | - public function getSmsType() | |
104 | - { | |
105 | - return $this->smsType; | |
106 | - } | |
107 | - | |
108 | - public function getApiMethodName() | |
109 | - { | |
110 | - return "alibaba.aliqin.fc.sms.num.send"; | |
111 | - } | |
112 | - | |
113 | - public function getApiParas() | |
114 | - { | |
115 | - return $this->apiParas; | |
116 | - } | |
117 | - | |
118 | - public function check() | |
119 | - { | |
120 | - | |
121 | - RequestCheckUtil::checkNotNull($this->recNum,"recNum"); | |
122 | - RequestCheckUtil::checkNotNull($this->smsFreeSignName,"smsFreeSignName"); | |
123 | - RequestCheckUtil::checkNotNull($this->smsTemplateCode,"smsTemplateCode"); | |
124 | - RequestCheckUtil::checkNotNull($this->smsType,"smsType"); | |
125 | - } | |
126 | - | |
127 | - public function putOtherTextParam($key, $value) { | |
128 | - $this->apiParas[$key] = $value; | |
129 | - $this->$key = $value; | |
130 | - } | |
131 | -} |
common/exts/sms/aliyun/top/request/AlibabaAliqinFcTtsNumSinglecallRequest.php
... | ... | @@ -1,114 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: alibaba.aliqin.fc.tts.num.singlecall request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.05.24 | |
7 | - */ | |
8 | -class AlibabaAliqinFcTtsNumSinglecallRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 被叫号码,支持国内手机号与固话号码,格式如下057188773344,13911112222,4001112222,95500 | |
12 | - **/ | |
13 | - private $calledNum; | |
14 | - | |
15 | - /** | |
16 | - * 被叫号显,传入的显示号码必须是阿里大鱼“管理中心-号码管理”中申请或购买的号码 | |
17 | - **/ | |
18 | - private $calledShowNum; | |
19 | - | |
20 | - /** | |
21 | - * 公共回传参数,在“消息返回”中会透传回该参数;举例:用户可以传入自己下级的会员ID,在消息返回时,该会员ID会包含在内,用户可以根据该会员ID识别是哪位会员使用了你的应用 | |
22 | - **/ | |
23 | - private $extend; | |
24 | - | |
25 | - /** | |
26 | - * TTS模板ID,传入的模板必须是在阿里大鱼“管理中心-语音TTS模板管理”中的可用模板 | |
27 | - **/ | |
28 | - private $ttsCode; | |
29 | - | |
30 | - /** | |
31 | - * 文本转语音(TTS)模板变量,传参规则{"key":"value"},key的名字须和TTS模板中的变量名一致,多个变量之间以逗号隔开,示例:{"name":"xiaoming","code":"1234"} | |
32 | - **/ | |
33 | - private $ttsParam; | |
34 | - | |
35 | - private $apiParas = array(); | |
36 | - | |
37 | - public function setCalledNum($calledNum) | |
38 | - { | |
39 | - $this->calledNum = $calledNum; | |
40 | - $this->apiParas["called_num"] = $calledNum; | |
41 | - } | |
42 | - | |
43 | - public function getCalledNum() | |
44 | - { | |
45 | - return $this->calledNum; | |
46 | - } | |
47 | - | |
48 | - public function setCalledShowNum($calledShowNum) | |
49 | - { | |
50 | - $this->calledShowNum = $calledShowNum; | |
51 | - $this->apiParas["called_show_num"] = $calledShowNum; | |
52 | - } | |
53 | - | |
54 | - public function getCalledShowNum() | |
55 | - { | |
56 | - return $this->calledShowNum; | |
57 | - } | |
58 | - | |
59 | - public function setExtend($extend) | |
60 | - { | |
61 | - $this->extend = $extend; | |
62 | - $this->apiParas["extend"] = $extend; | |
63 | - } | |
64 | - | |
65 | - public function getExtend() | |
66 | - { | |
67 | - return $this->extend; | |
68 | - } | |
69 | - | |
70 | - public function setTtsCode($ttsCode) | |
71 | - { | |
72 | - $this->ttsCode = $ttsCode; | |
73 | - $this->apiParas["tts_code"] = $ttsCode; | |
74 | - } | |
75 | - | |
76 | - public function getTtsCode() | |
77 | - { | |
78 | - return $this->ttsCode; | |
79 | - } | |
80 | - | |
81 | - public function setTtsParam($ttsParam) | |
82 | - { | |
83 | - $this->ttsParam = $ttsParam; | |
84 | - $this->apiParas["tts_param"] = $ttsParam; | |
85 | - } | |
86 | - | |
87 | - public function getTtsParam() | |
88 | - { | |
89 | - return $this->ttsParam; | |
90 | - } | |
91 | - | |
92 | - public function getApiMethodName() | |
93 | - { | |
94 | - return "alibaba.aliqin.fc.tts.num.singlecall"; | |
95 | - } | |
96 | - | |
97 | - public function getApiParas() | |
98 | - { | |
99 | - return $this->apiParas; | |
100 | - } | |
101 | - | |
102 | - public function check() | |
103 | - { | |
104 | - | |
105 | - RequestCheckUtil::checkNotNull($this->calledNum,"calledNum"); | |
106 | - RequestCheckUtil::checkNotNull($this->calledShowNum,"calledShowNum"); | |
107 | - RequestCheckUtil::checkNotNull($this->ttsCode,"ttsCode"); | |
108 | - } | |
109 | - | |
110 | - public function putOtherTextParam($key, $value) { | |
111 | - $this->apiParas[$key] = $value; | |
112 | - $this->$key = $value; | |
113 | - } | |
114 | -} |
common/exts/sms/aliyun/top/request/AlibabaAliqinFcVoiceNumDoublecallRequest.php
... | ... | @@ -1,131 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: alibaba.aliqin.fc.voice.num.doublecall request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.03.06 | |
7 | - */ | |
8 | -class AlibabaAliqinFcVoiceNumDoublecallRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 被叫号码,支持国内手机号与固话号码,格式如下057188773344,13911112222,4001112222,95500 | |
12 | - **/ | |
13 | - private $calledNum; | |
14 | - | |
15 | - /** | |
16 | - * 被叫号码侧的号码显示,传入的显示号码可以是阿里大鱼“管理中心-号码管理”中申请通过的号码。显示号码格式如下057188773344,4001112222,95500。显示号码也可以为主叫号码。 | |
17 | - **/ | |
18 | - private $calledShowNum; | |
19 | - | |
20 | - /** | |
21 | - * 主叫号码,支持国内手机号与固话号码,格式如下057188773344,13911112222,4001112222,95500 | |
22 | - **/ | |
23 | - private $callerNum; | |
24 | - | |
25 | - /** | |
26 | - * 主叫号码侧的号码显示,传入的显示号码必须是阿里大鱼“管理中心-号码管理”中申请通过的号码。显示号码格式如下057188773344,4001112222,95500 | |
27 | - **/ | |
28 | - private $callerShowNum; | |
29 | - | |
30 | - /** | |
31 | - * 公共回传参数,在“消息返回”中会透传回该参数;举例:用户可以传入自己下级的会员ID,在消息返回时,该会员ID会包含在内,用户可以根据该会员ID识别是哪位会员使用了你的应用 | |
32 | - **/ | |
33 | - private $extend; | |
34 | - | |
35 | - /** | |
36 | - * 通话超时时长,如接通后到达120秒时,通话会因为超时自动挂断。若无需设置超时时长,可不传。 | |
37 | - **/ | |
38 | - private $sessionTimeOut; | |
39 | - | |
40 | - private $apiParas = array(); | |
41 | - | |
42 | - public function setCalledNum($calledNum) | |
43 | - { | |
44 | - $this->calledNum = $calledNum; | |
45 | - $this->apiParas["called_num"] = $calledNum; | |
46 | - } | |
47 | - | |
48 | - public function getCalledNum() | |
49 | - { | |
50 | - return $this->calledNum; | |
51 | - } | |
52 | - | |
53 | - public function setCalledShowNum($calledShowNum) | |
54 | - { | |
55 | - $this->calledShowNum = $calledShowNum; | |
56 | - $this->apiParas["called_show_num"] = $calledShowNum; | |
57 | - } | |
58 | - | |
59 | - public function getCalledShowNum() | |
60 | - { | |
61 | - return $this->calledShowNum; | |
62 | - } | |
63 | - | |
64 | - public function setCallerNum($callerNum) | |
65 | - { | |
66 | - $this->callerNum = $callerNum; | |
67 | - $this->apiParas["caller_num"] = $callerNum; | |
68 | - } | |
69 | - | |
70 | - public function getCallerNum() | |
71 | - { | |
72 | - return $this->callerNum; | |
73 | - } | |
74 | - | |
75 | - public function setCallerShowNum($callerShowNum) | |
76 | - { | |
77 | - $this->callerShowNum = $callerShowNum; | |
78 | - $this->apiParas["caller_show_num"] = $callerShowNum; | |
79 | - } | |
80 | - | |
81 | - public function getCallerShowNum() | |
82 | - { | |
83 | - return $this->callerShowNum; | |
84 | - } | |
85 | - | |
86 | - public function setExtend($extend) | |
87 | - { | |
88 | - $this->extend = $extend; | |
89 | - $this->apiParas["extend"] = $extend; | |
90 | - } | |
91 | - | |
92 | - public function getExtend() | |
93 | - { | |
94 | - return $this->extend; | |
95 | - } | |
96 | - | |
97 | - public function setSessionTimeOut($sessionTimeOut) | |
98 | - { | |
99 | - $this->sessionTimeOut = $sessionTimeOut; | |
100 | - $this->apiParas["session_time_out"] = $sessionTimeOut; | |
101 | - } | |
102 | - | |
103 | - public function getSessionTimeOut() | |
104 | - { | |
105 | - return $this->sessionTimeOut; | |
106 | - } | |
107 | - | |
108 | - public function getApiMethodName() | |
109 | - { | |
110 | - return "alibaba.aliqin.fc.voice.num.doublecall"; | |
111 | - } | |
112 | - | |
113 | - public function getApiParas() | |
114 | - { | |
115 | - return $this->apiParas; | |
116 | - } | |
117 | - | |
118 | - public function check() | |
119 | - { | |
120 | - | |
121 | - RequestCheckUtil::checkNotNull($this->calledNum,"calledNum"); | |
122 | - RequestCheckUtil::checkNotNull($this->calledShowNum,"calledShowNum"); | |
123 | - RequestCheckUtil::checkNotNull($this->callerNum,"callerNum"); | |
124 | - RequestCheckUtil::checkNotNull($this->callerShowNum,"callerShowNum"); | |
125 | - } | |
126 | - | |
127 | - public function putOtherTextParam($key, $value) { | |
128 | - $this->apiParas[$key] = $value; | |
129 | - $this->$key = $value; | |
130 | - } | |
131 | -} |
common/exts/sms/aliyun/top/request/AlibabaAliqinFcVoiceNumSinglecallRequest.php
... | ... | @@ -1,98 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: alibaba.aliqin.fc.voice.num.singlecall request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.03.01 | |
7 | - */ | |
8 | -class AlibabaAliqinFcVoiceNumSinglecallRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 被叫号码,支持国内手机号与固话号码,格式如下057188773344,13911112222,4001112222,95500 | |
12 | - **/ | |
13 | - private $calledNum; | |
14 | - | |
15 | - /** | |
16 | - * 被叫号显,传入的显示号码必须是阿里大鱼“管理中心-号码管理”中申请通过的号码 | |
17 | - **/ | |
18 | - private $calledShowNum; | |
19 | - | |
20 | - /** | |
21 | - * 公共回传参数,在“消息返回”中会透传回该参数;举例:用户可以传入自己下级的会员ID,在消息返回时,该会员ID会包含在内,用户可以根据该会员ID识别是哪位会员使用了你的应用 | |
22 | - **/ | |
23 | - private $extend; | |
24 | - | |
25 | - /** | |
26 | - * 语音文件ID,传入的语音文件必须是在阿里大鱼“管理中心-语音文件管理”中的可用语音文件 | |
27 | - **/ | |
28 | - private $voiceCode; | |
29 | - | |
30 | - private $apiParas = array(); | |
31 | - | |
32 | - public function setCalledNum($calledNum) | |
33 | - { | |
34 | - $this->calledNum = $calledNum; | |
35 | - $this->apiParas["called_num"] = $calledNum; | |
36 | - } | |
37 | - | |
38 | - public function getCalledNum() | |
39 | - { | |
40 | - return $this->calledNum; | |
41 | - } | |
42 | - | |
43 | - public function setCalledShowNum($calledShowNum) | |
44 | - { | |
45 | - $this->calledShowNum = $calledShowNum; | |
46 | - $this->apiParas["called_show_num"] = $calledShowNum; | |
47 | - } | |
48 | - | |
49 | - public function getCalledShowNum() | |
50 | - { | |
51 | - return $this->calledShowNum; | |
52 | - } | |
53 | - | |
54 | - public function setExtend($extend) | |
55 | - { | |
56 | - $this->extend = $extend; | |
57 | - $this->apiParas["extend"] = $extend; | |
58 | - } | |
59 | - | |
60 | - public function getExtend() | |
61 | - { | |
62 | - return $this->extend; | |
63 | - } | |
64 | - | |
65 | - public function setVoiceCode($voiceCode) | |
66 | - { | |
67 | - $this->voiceCode = $voiceCode; | |
68 | - $this->apiParas["voice_code"] = $voiceCode; | |
69 | - } | |
70 | - | |
71 | - public function getVoiceCode() | |
72 | - { | |
73 | - return $this->voiceCode; | |
74 | - } | |
75 | - | |
76 | - public function getApiMethodName() | |
77 | - { | |
78 | - return "alibaba.aliqin.fc.voice.num.singlecall"; | |
79 | - } | |
80 | - | |
81 | - public function getApiParas() | |
82 | - { | |
83 | - return $this->apiParas; | |
84 | - } | |
85 | - | |
86 | - public function check() | |
87 | - { | |
88 | - | |
89 | - RequestCheckUtil::checkNotNull($this->calledNum,"calledNum"); | |
90 | - RequestCheckUtil::checkNotNull($this->calledShowNum,"calledShowNum"); | |
91 | - RequestCheckUtil::checkNotNull($this->voiceCode,"voiceCode"); | |
92 | - } | |
93 | - | |
94 | - public function putOtherTextParam($key, $value) { | |
95 | - $this->apiParas[$key] = $value; | |
96 | - $this->$key = $value; | |
97 | - } | |
98 | -} |
common/exts/sms/aliyun/top/request/AppipGetRequest.php
... | ... | @@ -1,32 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: taobao.appip.get request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2014.11.26 | |
7 | - */ | |
8 | -class AppipGetRequest | |
9 | -{ | |
10 | - | |
11 | - private $apiParas = array(); | |
12 | - | |
13 | - public function getApiMethodName() | |
14 | - { | |
15 | - return "taobao.appip.get"; | |
16 | - } | |
17 | - | |
18 | - public function getApiParas() | |
19 | - { | |
20 | - return $this->apiParas; | |
21 | - } | |
22 | - | |
23 | - public function check() | |
24 | - { | |
25 | - | |
26 | - } | |
27 | - | |
28 | - public function putOtherTextParam($key, $value) { | |
29 | - $this->apiParas[$key] = $value; | |
30 | - $this->$key = $value; | |
31 | - } | |
32 | -} |
common/exts/sms/aliyun/top/request/AreasGetRequest.php
... | ... | @@ -1,48 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: taobao.areas.get request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.04.13 | |
7 | - */ | |
8 | -class AreasGetRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 需返回的字段列表.可选值:Area 结构中的所有字段;多个字段之间用","分隔.如:id,type,name,parent_id,zip. | |
12 | - **/ | |
13 | - private $fields; | |
14 | - | |
15 | - private $apiParas = array(); | |
16 | - | |
17 | - public function setFields($fields) | |
18 | - { | |
19 | - $this->fields = $fields; | |
20 | - $this->apiParas["fields"] = $fields; | |
21 | - } | |
22 | - | |
23 | - public function getFields() | |
24 | - { | |
25 | - return $this->fields; | |
26 | - } | |
27 | - | |
28 | - public function getApiMethodName() | |
29 | - { | |
30 | - return "taobao.areas.get"; | |
31 | - } | |
32 | - | |
33 | - public function getApiParas() | |
34 | - { | |
35 | - return $this->apiParas; | |
36 | - } | |
37 | - | |
38 | - public function check() | |
39 | - { | |
40 | - | |
41 | - RequestCheckUtil::checkNotNull($this->fields,"fields"); | |
42 | - } | |
43 | - | |
44 | - public function putOtherTextParam($key, $value) { | |
45 | - $this->apiParas[$key] = $value; | |
46 | - $this->$key = $value; | |
47 | - } | |
48 | -} |
common/exts/sms/aliyun/top/request/HttpdnsGetRequest.php
... | ... | @@ -1,32 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: taobao.httpdns.get request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.03.24 | |
7 | - */ | |
8 | -class HttpdnsGetRequest | |
9 | -{ | |
10 | - | |
11 | - private $apiParas = array(); | |
12 | - | |
13 | - public function getApiMethodName() | |
14 | - { | |
15 | - return "taobao.httpdns.get"; | |
16 | - } | |
17 | - | |
18 | - public function getApiParas() | |
19 | - { | |
20 | - return $this->apiParas; | |
21 | - } | |
22 | - | |
23 | - public function check() | |
24 | - { | |
25 | - | |
26 | - } | |
27 | - | |
28 | - public function putOtherTextParam($key, $value) { | |
29 | - $this->apiParas[$key] = $value; | |
30 | - $this->$key = $value; | |
31 | - } | |
32 | -} |
common/exts/sms/aliyun/top/request/KfcKeywordSearchRequest.php
... | ... | @@ -1,85 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: taobao.kfc.keyword.search request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.03.19 | |
7 | - */ | |
8 | -class KfcKeywordSearchRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 应用点,分为一级应用点、二级应用点。其中一级应用点通常是指某一个系统或产品,比如淘宝的商品应用(taobao_auction);二级应用点,是指一级应用点下的具体的分类,比如商品标题(title)、商品描述(content)。不同的二级应用可以设置不同关键词。 | |
12 | - | |
13 | -这里的apply参数是由一级应用点与二级应用点合起来的字符(一级应用点+"."+二级应用点),如taobao_auction.title。 | |
14 | - | |
15 | - | |
16 | -通常apply参数是不需要传递的。如有特殊需求(比如特殊的过滤需求,需要自己维护一套自己词库),需传递此参数。 | |
17 | - **/ | |
18 | - private $apply; | |
19 | - | |
20 | - /** | |
21 | - * 需要过滤的文本信息 | |
22 | - **/ | |
23 | - private $content; | |
24 | - | |
25 | - /** | |
26 | - * 发布信息的淘宝会员名,可以不传 | |
27 | - **/ | |
28 | - private $nick; | |
29 | - | |
30 | - private $apiParas = array(); | |
31 | - | |
32 | - public function setApply($apply) | |
33 | - { | |
34 | - $this->apply = $apply; | |
35 | - $this->apiParas["apply"] = $apply; | |
36 | - } | |
37 | - | |
38 | - public function getApply() | |
39 | - { | |
40 | - return $this->apply; | |
41 | - } | |
42 | - | |
43 | - public function setContent($content) | |
44 | - { | |
45 | - $this->content = $content; | |
46 | - $this->apiParas["content"] = $content; | |
47 | - } | |
48 | - | |
49 | - public function getContent() | |
50 | - { | |
51 | - return $this->content; | |
52 | - } | |
53 | - | |
54 | - public function setNick($nick) | |
55 | - { | |
56 | - $this->nick = $nick; | |
57 | - $this->apiParas["nick"] = $nick; | |
58 | - } | |
59 | - | |
60 | - public function getNick() | |
61 | - { | |
62 | - return $this->nick; | |
63 | - } | |
64 | - | |
65 | - public function getApiMethodName() | |
66 | - { | |
67 | - return "taobao.kfc.keyword.search"; | |
68 | - } | |
69 | - | |
70 | - public function getApiParas() | |
71 | - { | |
72 | - return $this->apiParas; | |
73 | - } | |
74 | - | |
75 | - public function check() | |
76 | - { | |
77 | - | |
78 | - RequestCheckUtil::checkNotNull($this->content,"content"); | |
79 | - } | |
80 | - | |
81 | - public function putOtherTextParam($key, $value) { | |
82 | - $this->apiParas[$key] = $value; | |
83 | - $this->$key = $value; | |
84 | - } | |
85 | -} |
common/exts/sms/aliyun/top/request/TimeGetRequest.php
... | ... | @@ -1,32 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: taobao.time.get request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.03.28 | |
7 | - */ | |
8 | -class TimeGetRequest | |
9 | -{ | |
10 | - | |
11 | - private $apiParas = array(); | |
12 | - | |
13 | - public function getApiMethodName() | |
14 | - { | |
15 | - return "taobao.time.get"; | |
16 | - } | |
17 | - | |
18 | - public function getApiParas() | |
19 | - { | |
20 | - return $this->apiParas; | |
21 | - } | |
22 | - | |
23 | - public function check() | |
24 | - { | |
25 | - | |
26 | - } | |
27 | - | |
28 | - public function putOtherTextParam($key, $value) { | |
29 | - $this->apiParas[$key] = $value; | |
30 | - $this->$key = $value; | |
31 | - } | |
32 | -} |
common/exts/sms/aliyun/top/request/TopAuthTokenCreateRequest.php
... | ... | @@ -1,64 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: taobao.top.auth.token.create request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.04.15 | |
7 | - */ | |
8 | -class TopAuthTokenCreateRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 授权code,grantType==authorization_code 时需要 | |
12 | - **/ | |
13 | - private $code; | |
14 | - | |
15 | - /** | |
16 | - * 与生成code的uuid配对 | |
17 | - **/ | |
18 | - private $uuid; | |
19 | - | |
20 | - private $apiParas = array(); | |
21 | - | |
22 | - public function setCode($code) | |
23 | - { | |
24 | - $this->code = $code; | |
25 | - $this->apiParas["code"] = $code; | |
26 | - } | |
27 | - | |
28 | - public function getCode() | |
29 | - { | |
30 | - return $this->code; | |
31 | - } | |
32 | - | |
33 | - public function setUuid($uuid) | |
34 | - { | |
35 | - $this->uuid = $uuid; | |
36 | - $this->apiParas["uuid"] = $uuid; | |
37 | - } | |
38 | - | |
39 | - public function getUuid() | |
40 | - { | |
41 | - return $this->uuid; | |
42 | - } | |
43 | - | |
44 | - public function getApiMethodName() | |
45 | - { | |
46 | - return "taobao.top.auth.token.create"; | |
47 | - } | |
48 | - | |
49 | - public function getApiParas() | |
50 | - { | |
51 | - return $this->apiParas; | |
52 | - } | |
53 | - | |
54 | - public function check() | |
55 | - { | |
56 | - | |
57 | - RequestCheckUtil::checkNotNull($this->code,"code"); | |
58 | - } | |
59 | - | |
60 | - public function putOtherTextParam($key, $value) { | |
61 | - $this->apiParas[$key] = $value; | |
62 | - $this->$key = $value; | |
63 | - } | |
64 | -} |
common/exts/sms/aliyun/top/request/TopAuthTokenRefreshRequest.php
... | ... | @@ -1,48 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: taobao.top.auth.token.refresh request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2015.08.20 | |
7 | - */ | |
8 | -class TopAuthTokenRefreshRequest | |
9 | -{ | |
10 | - /** | |
11 | - * grantType==refresh_token 时需要 | |
12 | - **/ | |
13 | - private $refreshToken; | |
14 | - | |
15 | - private $apiParas = array(); | |
16 | - | |
17 | - public function setRefreshToken($refreshToken) | |
18 | - { | |
19 | - $this->refreshToken = $refreshToken; | |
20 | - $this->apiParas["refresh_token"] = $refreshToken; | |
21 | - } | |
22 | - | |
23 | - public function getRefreshToken() | |
24 | - { | |
25 | - return $this->refreshToken; | |
26 | - } | |
27 | - | |
28 | - public function getApiMethodName() | |
29 | - { | |
30 | - return "taobao.top.auth.token.refresh"; | |
31 | - } | |
32 | - | |
33 | - public function getApiParas() | |
34 | - { | |
35 | - return $this->apiParas; | |
36 | - } | |
37 | - | |
38 | - public function check() | |
39 | - { | |
40 | - | |
41 | - RequestCheckUtil::checkNotNull($this->refreshToken,"refreshToken"); | |
42 | - } | |
43 | - | |
44 | - public function putOtherTextParam($key, $value) { | |
45 | - $this->apiParas[$key] = $value; | |
46 | - $this->$key = $value; | |
47 | - } | |
48 | -} |
common/exts/sms/aliyun/top/request/TopIpoutGetRequest.php
... | ... | @@ -1,32 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: taobao.top.ipout.get request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2015.09.07 | |
7 | - */ | |
8 | -class TopIpoutGetRequest | |
9 | -{ | |
10 | - | |
11 | - private $apiParas = array(); | |
12 | - | |
13 | - public function getApiMethodName() | |
14 | - { | |
15 | - return "taobao.top.ipout.get"; | |
16 | - } | |
17 | - | |
18 | - public function getApiParas() | |
19 | - { | |
20 | - return $this->apiParas; | |
21 | - } | |
22 | - | |
23 | - public function check() | |
24 | - { | |
25 | - | |
26 | - } | |
27 | - | |
28 | - public function putOtherTextParam($key, $value) { | |
29 | - $this->apiParas[$key] = $value; | |
30 | - $this->$key = $value; | |
31 | - } | |
32 | -} |
common/exts/sms/aliyun/top/request/TopSecretGetRequest.php
... | ... | @@ -1,64 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: taobao.top.secret.get request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2016.04.06 | |
7 | - */ | |
8 | -class TopSecretGetRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 伪随机数 | |
12 | - **/ | |
13 | - private $randomNum; | |
14 | - | |
15 | - /** | |
16 | - * 秘钥版本号 | |
17 | - **/ | |
18 | - private $secretVersion; | |
19 | - | |
20 | - private $apiParas = array(); | |
21 | - | |
22 | - public function setRandomNum($randomNum) | |
23 | - { | |
24 | - $this->randomNum = $randomNum; | |
25 | - $this->apiParas["random_num"] = $randomNum; | |
26 | - } | |
27 | - | |
28 | - public function getRandomNum() | |
29 | - { | |
30 | - return $this->randomNum; | |
31 | - } | |
32 | - | |
33 | - public function setSecretVersion($secretVersion) | |
34 | - { | |
35 | - $this->secretVersion = $secretVersion; | |
36 | - $this->apiParas["secret_version"] = $secretVersion; | |
37 | - } | |
38 | - | |
39 | - public function getSecretVersion() | |
40 | - { | |
41 | - return $this->secretVersion; | |
42 | - } | |
43 | - | |
44 | - public function getApiMethodName() | |
45 | - { | |
46 | - return "taobao.top.secret.get"; | |
47 | - } | |
48 | - | |
49 | - public function getApiParas() | |
50 | - { | |
51 | - return $this->apiParas; | |
52 | - } | |
53 | - | |
54 | - public function check() | |
55 | - { | |
56 | - | |
57 | - RequestCheckUtil::checkNotNull($this->randomNum,"randomNum"); | |
58 | - } | |
59 | - | |
60 | - public function putOtherTextParam($key, $value) { | |
61 | - $this->apiParas[$key] = $value; | |
62 | - $this->$key = $value; | |
63 | - } | |
64 | -} |
common/exts/sms/aliyun/top/request/TopatsResultGetRequest.php
... | ... | @@ -1,48 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: taobao.topats.result.get request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2014.04.11 | |
7 | - */ | |
8 | -class TopatsResultGetRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 任务id号,创建任务时返回的task_id | |
12 | - **/ | |
13 | - private $taskId; | |
14 | - | |
15 | - private $apiParas = array(); | |
16 | - | |
17 | - public function setTaskId($taskId) | |
18 | - { | |
19 | - $this->taskId = $taskId; | |
20 | - $this->apiParas["task_id"] = $taskId; | |
21 | - } | |
22 | - | |
23 | - public function getTaskId() | |
24 | - { | |
25 | - return $this->taskId; | |
26 | - } | |
27 | - | |
28 | - public function getApiMethodName() | |
29 | - { | |
30 | - return "taobao.topats.result.get"; | |
31 | - } | |
32 | - | |
33 | - public function getApiParas() | |
34 | - { | |
35 | - return $this->apiParas; | |
36 | - } | |
37 | - | |
38 | - public function check() | |
39 | - { | |
40 | - | |
41 | - RequestCheckUtil::checkNotNull($this->taskId,"taskId"); | |
42 | - } | |
43 | - | |
44 | - public function putOtherTextParam($key, $value) { | |
45 | - $this->apiParas[$key] = $value; | |
46 | - $this->$key = $value; | |
47 | - } | |
48 | -} |
common/exts/sms/aliyun/top/request/TopatsTaskDeleteRequest.php
... | ... | @@ -1,48 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * TOP API: taobao.topats.task.delete request | |
4 | - * | |
5 | - * @author auto create | |
6 | - * @since 1.0, 2014.03.27 | |
7 | - */ | |
8 | -class TopatsTaskDeleteRequest | |
9 | -{ | |
10 | - /** | |
11 | - * 需要取消的任务ID | |
12 | - **/ | |
13 | - private $taskId; | |
14 | - | |
15 | - private $apiParas = array(); | |
16 | - | |
17 | - public function setTaskId($taskId) | |
18 | - { | |
19 | - $this->taskId = $taskId; | |
20 | - $this->apiParas["task_id"] = $taskId; | |
21 | - } | |
22 | - | |
23 | - public function getTaskId() | |
24 | - { | |
25 | - return $this->taskId; | |
26 | - } | |
27 | - | |
28 | - public function getApiMethodName() | |
29 | - { | |
30 | - return "taobao.topats.task.delete"; | |
31 | - } | |
32 | - | |
33 | - public function getApiParas() | |
34 | - { | |
35 | - return $this->apiParas; | |
36 | - } | |
37 | - | |
38 | - public function check() | |
39 | - { | |
40 | - | |
41 | - RequestCheckUtil::checkNotNull($this->taskId,"taskId"); | |
42 | - } | |
43 | - | |
44 | - public function putOtherTextParam($key, $value) { | |
45 | - $this->apiParas[$key] = $value; | |
46 | - $this->$key = $value; | |
47 | - } | |
48 | -} |
common/helpers/ImageManager.php
domain/smart/models/ScanRecords.php
domain/smart/models/SellerInputRecord.php