Commit 0d02bb7a authored by xiabin's avatar xiabin

添加逻辑

parent e725d4b9
......@@ -4,5 +4,9 @@ return [
'supportEmail' => 'support@example.com',
'user.passwordResetTokenExpire' => 3600,
'captchaId' => '4d6ad870bf63a30be3d22c92925b04ca',
'privateKey' => 'a2ca5e5139d1f43ac4e1cd248f3e52e4'
'privateKey' => 'a2ca5e5139d1f43ac4e1cd248f3e52e4',
'msg.host' => 'http://120.55.242.177/OpenPlatform/OpenApi',
'msg.ac' => '1001@800123450001',
'msg.authkey' => '0E9AEFC25E6A4816E7832755BC5CCA61',
'msg.cgid' => '222'
];
<?php
/**
* Created by PhpStorm.
* User: xiabin
* Date: 2016/9/26
* Time: 下午6:18
*/
namespace common\libs;
use Yii;
use \GuzzleHttp\Client;
use yii\log\Logger;
/**
* Class Message
* @package common\libs
*/
class Message
{
public $hosts;
public $query;
public $httpClient;
public function __construct()
{
$params = Yii::$app->params;
$this->hosts = $params['msg.host'];
$this->query = [
'action' => 'sendOnce',
'ac' => $params['msg.ac'],
'authkey' => $params['msg.authkey'],
'cgid' => $params['msg.cgid'],
];
$this->httpClient = new Client();
}
/**
* @param $telephones
* @param $content
* @return mixed|\Psr\Http\Message\ResponseInterface
* @throws \Exception
*/
public function send($telephones, $content)
{
if (is_array($telephones)) {
$telephones = implode(',', $telephones);
}
$this->query['m'] = $telephones;
$this->query['c'] = $content;
try {
$response = $this->httpClient->request('GET', $this->hosts, [
'query' => $this->query
]);
} catch (ClientException $e) {
$response = $e->getResponse();
} catch (\Exception $e) {
throw $e;
Yii::getLogger()->log($e, Logger::LEVEL_ERROR, 'Message');
}
$return = new \SimpleXMLElement($response->getBody()->getContents());
if ((int)$return['result'] !== 1) {
Yii::getLogger()->log($return['result'], Logger::LEVEL_ERROR, 'Message');
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: xiabin
* Date: 2016/9/26
* Time: 下午6:18
*/
namespace common\libs;
class SendMsg
{
public function sendMsg($telephones,$content){
if(is_array($telephones)){
$telephones = implode(',',$telephones);
}
}
}
\ No newline at end of file
<?php
return [
'adminEmail' => 'admin@example.com',
'adminEmail' => 'admin@example.com'
];
......@@ -9,6 +9,7 @@
namespace frontend\controllers;
use common\libs\Message;
use common\libs\Test;
use common\models\User;
use yii\filters\AccessControl;
......@@ -39,8 +40,8 @@ class UserCenterController extends Controller
public function actionTest()
{
$test = new Test();
$test->index();
$message = new Message();
$result = $message->send('15395081586','xiabin');
}
public function actionIndex()
......
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 50 50"><path fill="#444" d="M15.563 40.836a.997.997 0 0 0 1.414 0l15-15a1 1 0 0 0 0-1.414l-15-15a1 1 0 0 0-1.414 1.414L29.856 25.13 15.563 39.42a1 1 0 0 0 0 1.414z"/></svg>
.main-container {
width: auto;
}
span.indent {
color: #ccc;
}
ul.trace {
font-size: 12px;
color: #999;
margin: 2px 0 0 0;
padding: 0;
list-style: none;
white-space: normal;
}
#db-panel-detailed-grid table tbody tr td {
position: relative;
}
.db-explain {
position: absolute;
bottom: 4px;
right: 4px;
font-size: 10px;
}
.db-explain-text {
display: none;
margin: 10px 0 0px 0;
font-size: 13px;
width: 100%;
word-break: break-all;
}
#db-explain-all {
position: absolute;
bottom: 0;
right: 0;
font-size: 12px;
margin-right: 15px;
}
ul.assets {
margin: 2px 0 0 0;
padding: 0;
list-style: none;
white-space: normal;
}
.callout {
margin: 0 0 10px 0;
padding: 5px;
border: solid 1px #eee;
border-radius: 3px;
}
.callout-important {
background-color: rgba(185, 74, 72, 0.2);
border-color: rgba(185, 74, 72, 0.4);
}
.callout-success {
background-color: rgba(70, 136, 71, 0.2);
border-color: rgba(70, 136, 71, 0.4);
}
.callout-info {
background-color: rgba(58, 135, 173, 0.2);
border-color: rgba(58, 135, 173, 0.4);
}
.list-group .glyphicon {
float: right;
}
td, th {
white-space: pre-wrap;
word-wrap: break-word;
}
.request-table td {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
word-break: break-all;
}
.request-table tr > th:first-child {
width: 25%;
}
.config-php-info-table td.v {
word-break: break-all;
}
.not-set {
color: #c55;
font-style: italic;
}
.detail-grid-view th {
white-space: nowrap;
}
/* add sorting icons to gridview sort links */
a.asc:after, a.desc:after {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: normal;
line-height: 1;
padding-left: 5px;
}
a.asc:after {
content: /*"\e113"*/ "\e151";
}
a.desc:after {
content: /*"\e114"*/ "\e152";
}
.sort-numerical a.asc:after {
content: "\e153";
}
.sort-numerical a.desc:after {
content: "\e154";
}
.sort-ordinal a.asc:after {
content: "\e155";
}
.sort-ordinal a.desc:after {
content: "\e156";
}
.mail-sorter {
margin-top: 7px;
}
.mail-sorter li {
list-style: none;
float: left;
width: 12%;
font-weight: bold;
}
.nowrap {
white-space: nowrap;
}
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 50 50"><path fill="#444" d="M39.642 9.722a1.01 1.01 0 0 0-.382-.077H28.103a1 1 0 0 0 0 2h8.743L21.7 26.79a1 1 0 0 0 1.414 1.415L38.26 13.06v8.743a1 1 0 0 0 2 0V10.646a1.005 1.005 0 0 0-.618-.924z"/><path d="M39.26 27.985a1 1 0 0 0-1 1v10.66h-28v-28h10.683a1 1 0 0 0 0-2H9.26a1 1 0 0 0-1 1v30a1 1 0 0 0 1 1h30a1 1 0 0 0 1-1v-11.66a1 1 0 0 0-1-1z"/></svg>
#yii-debug-toolbar-logo {
position: fixed;
right: 31px;
bottom: 4px;
}
.yii-debug-toolbar {
font: 11px Verdana, Arial, sans-serif;
text-align: left;
width: 96px;
height: 42px;
transition: width .3s ease;
z-index: 1000000;
}
.yii-debug-toolbar_active {
width: 100%;
height: auto;
}
.yii-debug-toolbar_position_top {
margin: 0 0 20px 0;
width: 100%;
}
.yii-debug-toolbar_position_bottom {
position: fixed;
right: 0;
bottom: 0;
margin: 0;
}
.yii-debug-toolbar__bar {
position: relative;
padding: 0;
font: 11px Verdana, Arial, sans-serif;
text-align: left;
height: 40px;
overflow: hidden;
background: rgb(255, 255, 255);
background: -moz-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(247, 247, 247) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(247, 247, 247) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgb(255, 255, 255) 0%, rgb(247, 247, 247) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f7f7f7', GradientType=0); /* IE6-9 */
border: 1px solid rgba(0, 0, 0, 0.11);
/* ensure debug toolbar text is displayed ltr even on rtl pages */
direction: ltr;
}
.yii-debug-toolbar__bar:after {
content: '';
display: table;
clear: both;
}
.yii-debug-toolbar__view {
height: 0;
overflow: hidden;
background: white;
transition: height .3s ease;
}
.yii-debug-toolbar__view iframe {
margin: 0;
padding: 0;
padding-top: 10px;
height: 100%;
width: 100%;
border: 0;
}
.yii-debug-toolbar_iframe_active .yii-debug-toolbar__view {
height: 100%;
}
.yii-debug-toolbar__block {
float: left;
margin: 0;
border-right: 1px solid rgba(0, 0, 0, 0.11);
padding: 4px 8px;
line-height: 32px;
white-space: nowrap;
}
.yii-debug-toolbar__block_active {
background: rgb(247, 247, 247); /* Old browsers */
background: -moz-linear-gradient(top, rgb(247, 247, 247) 0%, rgb(224, 224, 224) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgb(247, 247, 247) 0%, rgb(224, 224, 224) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgb(247, 247, 247) 0%, rgb(224, 224, 224) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7f7f7', endColorstr='#e0e0e0', GradientType=0); /* IE6-9 */
}
.yii-debug-toolbar__block a {
display: inline-block;
text-decoration: none;
color: black;
}
.yii-debug-toolbar__block img {
vertical-align: middle;
}
.yii-debug-toolbar__label {
display: inline-block;
padding: 2px 4px;
font-size: 12px;
font-weight: normal;
line-height: 14px;
white-space: nowrap;
vertical-align: baseline;
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
background-color: #999999;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.yii-debug-toolbar__label:empty {
display: none;
}
a.yii-debug-toolbar__label:hover,
a.yii-debug-toolbar__label:focus {
color: #ffffff;
text-decoration: none;
cursor: pointer;
}
.yii-debug-toolbar__label_important {
background-color: #b94a48;
}
.yii-debug-toolbar__label_important[href] {
background-color: #953b39;
}
.yii-debug-toolbar__label_warning,
.yii-debug-toolbar__badge_warning {
background-color: #f89406;
}
.yii-debug-toolbar__label_warning[href] {
background-color: #c67605;
}
.yii-debug-toolbar__label_success {
background-color: #468847;
}
.yii-debug-toolbar__label_success[href] {
background-color: #356635;
}
.yii-debug-toolbar__label_info {
background-color: #3a87ad;
}
.yii-debug-toolbar__label_info[href] {
background-color: #2d6987;
}
.yii-debug-toolbar__label_inverse,
.yii-debug-toolbar__badge_inverse {
background-color: #333333;
}
.yii-debug-toolbar__label_inverse[href],
.yii-debug-toolbar__badge_inverse[href] {
background-color: #1a1a1a;
}
.yii-debug-toolbar__title {
background: rgb(247, 247, 247); /* Old browsers */
background: -moz-linear-gradient(top, rgb(247, 247, 247) 0%, rgb(224, 224, 224) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgb(247, 247, 247) 0%, rgb(224, 224, 224) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgb(247, 247, 247) 0%, rgb(224, 224, 224) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7f7f7', endColorstr='#e0e0e0', GradientType=0); /* IE6-9 */
}
.yii-debug-toolbar__toggle,
.yii-debug-toolbar__external {
cursor: pointer;
position: absolute;
width: 30px;
height: 30px;
font-size: 25px;
font-weight: 100;
line-height: 28px;
color: #ffffff;
text-align: center;
opacity: 0.5;
filter: alpha(opacity=50);
transition: opacity .3s ease;
}
.yii-debug-toolbar__toggle:hover,
.yii-debug-toolbar__toggle:focus,
.yii-debug-toolbar__external:hover,
.yii-debug-toolbar__external:focus {
color: #ffffff;
text-decoration: none;
opacity: 0.9;
filter: alpha(opacity=90);
}
.yii-debug-toolbar__toggle-icon,
.yii-debug-toolbar__external-icon {
display: inline-block;
background-position: 50% 50%;
background-repeat: no-repeat;
}
.yii-debug-toolbar__toggle {
right: 10px;
top: 4px;
}
.yii-debug-toolbar__toggle-icon {
padding: 7px 0;
width: 10px;
height: 16px;
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNSIgaGVpZ2h0PSIxNSIgdmlld0JveD0iMCAwIDUwIDUwIj48cGF0aCBmaWxsPSIjNDQ0IiBkPSJNMTUuNTYzIDQwLjgzNmEuOTk3Ljk5NyAwIDAgMCAxLjQxNCAwbDE1LTE1YTEgMSAwIDAgMCAwLTEuNDE0bC0xNS0xNWExIDEgMCAwIDAtMS40MTQgMS40MTRMMjkuODU2IDI1LjEzIDE1LjU2MyAzOS40MmExIDEgMCAwIDAgMCAxLjQxNHoiLz48L3N2Zz4=');
transition: -webkit-transform .3s ease-out;
transition: transform .3s ease-out;
}
.yii-debug-toolbar_active .yii-debug-toolbar__toggle-icon {
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
}
.yii-debug-toolbar_iframe_active .yii-debug-toolbar__toggle-icon {
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
.yii-debug-toolbar__external {
display: none;
right: 50px;
top: 4px;
}
.yii-debug-toolbar_iframe_active .yii-debug-toolbar__external {
display: block;
}
.yii-debug-toolbar__external-icon {
padding: 8px 0;
width: 14px;
height: 14px;
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNSIgaGVpZ2h0PSIxNSIgdmlld0JveD0iMCAwIDUwIDUwIj48cGF0aCBmaWxsPSIjNDQ0IiBkPSJNMzkuNjQyIDkuNzIyYTEuMDEgMS4wMSAwIDAgMC0uMzgyLS4wNzdIMjguMTAzYTEgMSAwIDAgMCAwIDJoOC43NDNMMjEuNyAyNi43OWExIDEgMCAwIDAgMS40MTQgMS40MTVMMzguMjYgMTMuMDZ2OC43NDNhMSAxIDAgMCAwIDIgMFYxMC42NDZhMS4wMDUgMS4wMDUgMCAwIDAtLjYxOC0uOTI0eiIvPjxwYXRoIGQ9Ik0zOS4yNiAyNy45ODVhMSAxIDAgMCAwLTEgMXYxMC42NmgtMjh2LTI4aDEwLjY4M2ExIDEgMCAwIDAgMC0ySDkuMjZhMSAxIDAgMCAwLTEgMXYzMGExIDEgMCAwIDAgMSAxaDMwYTEgMSAwIDAgMCAxLTF2LTExLjY2YTEgMSAwIDAgMC0xLTF6Ii8+PC9zdmc+');
}
(function () {
'use strict';
var findToolbar = function () {
return document.querySelector('#yii-debug-toolbar');
},
ajax = function (url, settings) {
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
settings = settings || {};
xhr.open(settings.method || 'GET', url, true);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.setRequestHeader('Accept', 'text/html');
xhr.onreadystatechange = function (state) {
if (xhr.readyState === 4) {
if (xhr.status === 200 && settings.success) {
settings.success(xhr);
} else if (xhr.status != 200 && settings.error) {
settings.error(xhr);
}
}
};
xhr.send(settings.data || '');
},
url,
div,
toolbarEl = findToolbar(),
barSelector = '.yii-debug-toolbar__bar',
viewSelector = '.yii-debug-toolbar__view',
blockSelector = '.yii-debug-toolbar__block',
toggleSelector = '.yii-debug-toolbar__toggle',
externalSelector = '.yii-debug-toolbar__external',
CACHE_KEY = 'yii-debug-toolbar',
ACTIVE_STATE = 'active',
activeClass = 'yii-debug-toolbar_active',
iframeActiveClass = 'yii-debug-toolbar_iframe_active',
titleClass = 'yii-debug-toolbar__title',
blockClass = 'yii-debug-toolbar__block',
blockActiveClass = 'yii-debug-toolbar__block_active';
if (toolbarEl) {
url = toolbarEl.getAttribute('data-url');
ajax(url, {
success: function (xhr) {
div = document.createElement('div');
div.innerHTML = xhr.responseText;
toolbarEl.parentNode.replaceChild(div, toolbarEl);
showToolbar(findToolbar());
},
error: function (xhr) {
toolbarEl.innerHTML = xhr.responseText;
}
});
}
function showToolbar(toolbarEl) {
var barEl = toolbarEl.querySelector(barSelector),
viewEl = toolbarEl.querySelector(viewSelector),
toggleEl = toolbarEl.querySelector(toggleSelector),
externalEl = toolbarEl.querySelector(externalSelector),
blockEls = barEl.querySelectorAll(blockSelector),
iframeEl = viewEl.querySelector('iframe'),
iframeHeight = function () {
return (window.innerHeight * 0.7) + 'px';
},
isIframeActive = function () {
return toolbarEl.classList.contains(iframeActiveClass);
},
showIframe = function (href) {
toolbarEl.classList.add(iframeActiveClass);
iframeEl.src = externalEl.href = href;
viewEl.style.height = iframeHeight();
},
hideIframe = function () {
toolbarEl.classList.remove(iframeActiveClass);
removeActiveBlocksCls();
externalEl.href = '#';
viewEl.style.height = '';
},
removeActiveBlocksCls = function () {
[].forEach.call(blockEls, function (el) {
el.classList.remove(blockActiveClass);
});
},
toggleToolbarClass = function (className) {
if (toolbarEl.classList.contains(className)) {
toolbarEl.classList.remove(className);
} else {
toolbarEl.classList.add(className);
}
},
toggleStorageState = function (key, value) {
if (window.localStorage) {
var item = localStorage.getItem(key);
if (item) {
localStorage.removeItem(key);
} else {
localStorage.setItem(key, value);
}
}
},
restoreStorageState = function (key) {
if (window.localStorage) {
return localStorage.getItem(key);
}
},
togglePosition = function () {
if (isIframeActive()) {
hideIframe();
} else {
toggleToolbarClass(activeClass);
toggleStorageState(CACHE_KEY, ACTIVE_STATE);
}
};
toolbarEl.style.display = 'block';
if (restoreStorageState(CACHE_KEY) == ACTIVE_STATE) {
toolbarEl.classList.add(activeClass);
}
window.onresize = function () {
if (toolbarEl.classList.contains(iframeActiveClass)) {
viewEl.style.height = iframeHeight();
}
};
barEl.onclick = function (e) {
var target = e.target,
block = findAncestor(target, blockClass);
if (block && !block.classList.contains(titleClass)) {
while (target !== this) {
if (target.href) {
removeActiveBlocksCls();
block.classList.add(blockActiveClass);
showIframe(target.href);
}
target = target.parentNode;
}
e.preventDefault();
}
};
toggleEl.onclick = togglePosition;
}
function findAncestor(el, cls) {
while ((el = el.parentElement) && !el.classList.contains(cls));
return el;
}
})();
webpackJsonp([0],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ },
/* 1 */
/***/ function(module, exports) {
/**
* Created by xiabin on 2016/9/26.
*/
/***/ }
]);
\ No newline at end of file
webpackJsonp([1],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(2);
/***/ },
/* 1 */,
/* 2 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function($) {/**
* Created by xiabin on 2016/9/26.
*/
var handlerEmbed = function (captchaObj) {
$("#signup-button").click(function (e) {
var validate = captchaObj.getValidate();
if (!validate) {
$("#notice")[0].className = "show";
setTimeout(function () {
$("#notice")[0].className = "hide";
}, 2000);
e.preventDefault();
}
});
// 将验证码加到id为captcha的元素里,同时会有三个input的值:geetest_challenge, geetest_validate, geetest_seccode
captchaObj.appendTo("#embed-captcha");
captchaObj.onReady(function () {
$("#wait")[0].className = "hide";
});
// 更多接口参考:http://www.geetest.com/install/sections/idx-client-sdk.html
};
$.ajax({
// 获取id,challenge,success(是否启用failback)
url: ("http://dev.zuiketang.com/") + "site/start-captcha?type=pc&t=" + (new Date()).getTime(), // 加随机数防止缓存
type: "get",
dataType: "json",
success: function (data) {
// 使用initGeetest接口
// 参数1:配置参数
// 参数2:回调,回调的第一个参数验证码对象,之后可以使用它做appendTo之类的事件
initGeetest({
gt: data.gt,
challenge: data.challenge,
product: "embed", // 产品形式,包括:float,embed,popup。注意只对PC版验证码有效
offline: !data.success // 表示用户后台检测极验服务器是否宕机,一般不需要关注
// 更多配置参数请参见:http://www.geetest.com/install/sections/idx-client-sdk.html#config
}, handlerEmbed);
}
});
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)))
/***/ }
]);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment