优化ctms-api语法、修复已知BUG;
主要修复ctms-api、dacms对PHP新版本的支持问题
This commit is contained in:
Executable
+151
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/* @var $this yii\web\View */
|
||||
|
||||
use yii\helpers\Url;
|
||||
|
||||
global $_FM;
|
||||
global $_HI;
|
||||
$username = Yii::$app->user->identity->username;
|
||||
$cert = fmFunc_cert_exist($username);
|
||||
$_FM['apiCert'] = $cert ? $cert : array();
|
||||
$errorCode = 0;
|
||||
|
||||
if ($errorCode > 0) {
|
||||
die (json_encode(array('errorcode' => $errorCode, 'msg' => Yii::t('errorcode', $errorCode))));
|
||||
}
|
||||
|
||||
//错误代码集合
|
||||
$errorcodes = require(Yii::getAlias('@common') . '/messages/zh-CN/errorcode.php');
|
||||
foreach ($errorcodes as $k => $v) {
|
||||
$_k = substr($k, 0, 6);
|
||||
if ($_k !== '453004') {
|
||||
unset($errorcodes[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
$accessKeyId = isset($_FM['apiCert']['aliDySms']['accessKeyId']) ? $_FM['apiCert']['aliDySms']['accessKeyId'] : '';
|
||||
$accessKeySecret = isset($_FM['apiCert']['aliDySms']['accessKeySecret']) ? $_FM['apiCert']['aliDySms']['accessKeySecret'] : '';
|
||||
$sign = isset($_FM['apiCert']['aliDySms']['code']) ? $_FM['apiCert']['aliDySms']['code'] : '';
|
||||
|
||||
$postUrl = Url::to(['alimsg/send', 'appid' => $username]);
|
||||
if (isset($_GET['post']) && $_GET['post'] == 1) {
|
||||
$postUrl = Url::to(['alimsg/send', 'appid' => $username, 'post' => 1]);
|
||||
}
|
||||
?>
|
||||
|
||||
<div class='container' style='margin-top:50px;'>
|
||||
<p>
|
||||
<h3 style="text-align: center;">阿里大鱼短信【转发】接口演示</h3></p>
|
||||
<form class="form-horizontal" action="<?php echo $postUrl; ?>" method="post">
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-2 control-label">手机号</label>
|
||||
<div class="col-sm-10">
|
||||
<?php if (isset($_GET['post']) && $_GET['post'] == 1) { ?>
|
||||
<input type="phone" name="phone" class="form-control" id="phone" required="required" value=""
|
||||
placeholder="请输入手机号"/>
|
||||
<?php } else { ?>
|
||||
<textarea type="text" name="phone" class="form-control" id="phone" required="required"
|
||||
placeholder="请输入手机号,多个手机号时用英文(,)分开;"/></textarea>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="accessKeyId" class="col-sm-2 control-label">accessKeyId</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="accessKeyId" class="form-control" id="accessKeyId" required="required"
|
||||
value="<?php echo $accessKeyId; ?>" placeholder="输入在阿里云短信获取的accessKeyId"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="accessKeySecret" class="col-sm-2 control-label">accessKeySecret</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="accessKeySecret" class="form-control" id="accessKeySecret" required="required"
|
||||
value="<?php echo $accessKeySecret; ?>" placeholder="输入在阿里云短信获取的accessKeySecret"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sign" class="col-sm-2 control-label">短信签名</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="sign" class="form-control" id="sign" required="required"
|
||||
value="<?php echo $sign; ?>" placeholder="填写所申请的短信签名"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tmpl" class="col-sm-2 control-label">短信模板</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="tmpl" class="form-control" id="tmpl" required="required"
|
||||
placeholder="填写所申请的短信模板"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-2 control-label">短信内容</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea type="text" name="content" class="form-control" id="content" required="required"
|
||||
placeholder="输入要发送的内容;格式:短信变量码[code],对应的替换内容;(变量及替换值之前用逗号分隔开,每行一组)"/>code1,替换值1<?php echo "\r\n"; ?>
|
||||
code2,替换值2</textarea>
|
||||
<span class="help-block">阿里大鱼”登陆确认验证码“模板(SMS_116695054)的变量为'code'。这里建议您使用该模板,上述文本框中输入 <code>code,1234</code> 即可</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button type="submit" class="btn btn-success">发送</button>
|
||||
<button type="reset" class="btn btn-danger">重新填写</button>
|
||||
<a class="btn btn-default" href="<?php echo Url::to(['alimsg/index', 'post' => 1]) ?>" target="_self">以POST接口形式测试</a>
|
||||
<a class="btn btn-default" href="<?php echo Url::toRoute('alimsg/index') ?>"
|
||||
target="_self">仅本地演示</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
|
||||
<h1 style="text-align: center;">接口使用简易说明</h1>
|
||||
<span class="form-control">注:本处主要说明本API的基础规则及一些常用的接口使用方法,更多细节可参考我们的实际使用案例(我们基于<a
|
||||
href="http://s.we7.cc/index.php?c=home&a=author&do=index&uid=662" target="_blank">微擎</a>开发的嗨旅行应用、小程序管理模块等。)</span>
|
||||
<p>
|
||||
<ol>
|
||||
<li>
|
||||
<kbd>单发方式</kbd>:支持向一个手机号发送短信,通常用于发送验证码等情景;或向一组手机发送相同短信,通常用于发送通知等情景<br>
|
||||
<code>准备数据:</code>手机号(数组形式)、短信内容(数组形式,键为短信模板中的code,键值为要code对应的替换内容)、阿里大鱼短信账号对应的accessKeyId与accessKeySecret及短信签名sign、所使用的短信模板tmpl、阿里大鱼接口的额外配置项(如果有)、接口连接TOKEN(登陆本接口系统后返回的accesstoken)<br>
|
||||
<code>接口地址:</code> <?php echo Url::to(['alimsg/post'], TRUE); ?>
|
||||
<pre>数据示范————
|
||||
array('phone'=>array('18608981880'),
|
||||
'content'=>array('code'=>'123456'),
|
||||
'config'=>array(
|
||||
'accessKeyId'=>'XXXXXXXXXXXXXXX',
|
||||
'accessKeySecret'=>'XXXXXXXXXXX',
|
||||
'sign'=>'Hiluker'
|
||||
),
|
||||
'option'=>array(),
|
||||
'tmpl'=>'SMS_123456789',
|
||||
'accesstoken'=>'XXXXXXXXXXXXXXX',
|
||||
);
|
||||
</pre>
|
||||
<code>数据返回:</code> JSON字符串,解码后得到结果数组。根据结果数组中的errorcode来表示短信发送是否成功。转接接口有一定的延时,因此我们会做短信发送记录并根据情况进行记录。<br>
|
||||
<pre>
|
||||
$return['errorcode']:结果状态码,正常情况下为0
|
||||
$return['msg']:返回的消息(接口报错时会使用到,消息中会将阿里大鱼接口的返回提示一并显示)
|
||||
$return['data']:用户侧应获得的数据(实际上即是接口请求时POST的数据)
|
||||
$return['timeused']:接口耗时
|
||||
$return['total']:接口调用统计总记录数
|
||||
$return['bytes']:本次返回数据的字节长度统计
|
||||
$return['sms_left']:剩余可用短信条数
|
||||
</pre>
|
||||
<br>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<kbd>群发方式</kbd>:暂不开放<br>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<kbd>错误代码</kbd>:(客户侧可直接将接口站返回的结果打印出来查看,以下仅列出服务侧程序正确运行情况下返回的错误及提示;其他情况可直接打印结果进行查看)<br>
|
||||
<textarea class="form-control"><?php foreach ($errorcodes as $k => $v) {
|
||||
echo '"' . $k . '" : ' . $v . ";\r\n";
|
||||
}
|
||||
?>
|
||||
</textarea>
|
||||
<br>
|
||||
</li>
|
||||
</ol>
|
||||
</p>
|
||||
</div>
|
||||
Executable
+267
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
/* @var $this yii\web\View */
|
||||
|
||||
use yii\helpers\Url;
|
||||
|
||||
global $_GPC;
|
||||
global $_FM;
|
||||
$username = Yii::$app->user->identity->username;
|
||||
$cert = fmFunc_cert_exist($username);
|
||||
$_FM['apiCert'] = $cert ? $cert : array();
|
||||
$errorCode = 0;
|
||||
|
||||
if ($errorCode > 0) {
|
||||
die (json_encode(array('errorcode' => $errorCode, 'msg' => Yii::t('errorcode', $errorCode))));
|
||||
}
|
||||
$statusSite = [
|
||||
'-1' => '禁止',
|
||||
'0' => '只读访问',
|
||||
'1' => '正常',
|
||||
];
|
||||
|
||||
//接口统计
|
||||
$stat = fmFunc_stat_get($username);
|
||||
|
||||
//错误代码集合
|
||||
$errorcodes = require(Yii::getAlias('@common') . '/messages/zh-CN/errorcode.php');
|
||||
|
||||
?>
|
||||
<h1>我的Api接口</h1>
|
||||
|
||||
<p>
|
||||
<ol>
|
||||
<li>
|
||||
<kbd>授权域名</kbd>:
|
||||
<?php foreach ($_FM['apiCert']['suDomain'] as $v) { ?>
|
||||
<code><?php echo $v; ?></code>;
|
||||
<?php } ?>
|
||||
</li>
|
||||
<li>
|
||||
<kbd>IP白名单</kbd>:
|
||||
<?php foreach ($_FM['apiCert']['suIp'] as $v) { ?>
|
||||
<code><?php echo $v; ?></code>;
|
||||
<?php } ?>
|
||||
</li>
|
||||
<li>
|
||||
<kbd>接口标识</kbd>:
|
||||
<code><?php echo $_FM['apiCert']['api']; ?></code>;
|
||||
</li>
|
||||
<li>
|
||||
<kbd>授权码</kbd>:
|
||||
<code><?php echo $_FM['apiCert']['code']; ?></code>;
|
||||
</li>
|
||||
<li>
|
||||
<kbd>站点名称</kbd>:
|
||||
<code><?php echo $_FM['apiCert']['siteName']; ?></code>;
|
||||
</li>
|
||||
<li>
|
||||
<kbd>站点ID</kbd>:
|
||||
<code><?php echo $_FM['apiCert']['siteId']; ?></code>;
|
||||
</li>
|
||||
<li>
|
||||
<kbd>站点状态</kbd>:
|
||||
<code><?php echo $statusSite[$_FM['apiCert']['status']]; ?></code>;
|
||||
</li>
|
||||
<li>
|
||||
<kbd>备注</kbd>:
|
||||
<code><?php echo $_FM['apiCert']['remark']; ?></code>;
|
||||
</li>
|
||||
</ol>
|
||||
</p>
|
||||
|
||||
<h1>接口统计</h1>
|
||||
|
||||
<p>
|
||||
<ol>
|
||||
<li>
|
||||
<kbd>存入次数</kbd>:
|
||||
<code><?php echo $stat['intimes']; ?>次</code>;
|
||||
</li>
|
||||
<li>
|
||||
<kbd>取出次数</kbd>:
|
||||
<code><?php echo $stat['outtimes']; ?>次</code>;
|
||||
</li>
|
||||
<li>
|
||||
<kbd>累计存入数据</kbd>:
|
||||
<code><?php echo $stat['inbytes']; ?>字节</code>;
|
||||
</li>
|
||||
<li>
|
||||
<kbd>累计取出数据</kbd>:
|
||||
<code><?php echo $stat['outbytes']; ?>字节</code>;
|
||||
</li>
|
||||
</ol>
|
||||
</p>
|
||||
<hr>
|
||||
<h1 style="text-align: center;">接口使用简易说明</h1>
|
||||
<span class="form-control">注:本处主要说明本API的基础规则及一些常用的接口使用方法,更多细节可参考我们的实际使用案例(我们基于<a
|
||||
href="http://s.we7.cc/index.php?c=home&a=author&do=index&uid=662" target="_blank">微擎</a>开发的嗨旅行应用、小程序管理模块等。)</span>
|
||||
<p>
|
||||
<ol>
|
||||
<li>
|
||||
<kbd>接口登陆</kbd>:<br>
|
||||
<code>登陆地址:</code> https://api.hiluker.com/index.php?r=oss/login&api=<?php echo $_SERVER['HTTP_HOST']; ?>
|
||||
<br>
|
||||
<code>附加表单:</code> 登陆数据以附加url转码后的字符串拼接到登陆地址中
|
||||
<pre>
|
||||
$loginurl = https://api.hiluker.com/index.php?r=oss/login&api='.$_SERVER['HTTP_HOST'];
|
||||
$post = array(
|
||||
'LoginForm[username]' => 您的用户名,
|
||||
'LoginForm[password]' => 您的密码,
|
||||
'LoginForm[rememberMe]' => 1
|
||||
);
|
||||
foreach($post as $k => $v){
|
||||
$loginurl .= '&'.urlencode($k).'='.urlencode($v);
|
||||
}
|
||||
</pre>
|
||||
<code>成功返回:</code>
|
||||
登陆成功后,系统会返回一个accesstoken,通过json_decode解码即可。(随后所有的接口通讯都需要附加该accesstoken,所以建议您对该值进行存储,可以减少不必要的登陆连接)<br>
|
||||
<textarea class="form-control">注:(1)”api=“后面的域名请更换为您自己的服务器域名(我们会对域名及IP来路进行合法性校验,不在白名单中的连接将无法登陆);(2)如果需要刷新accesstoken,可在登陆地址后附加'&refreshToken=1'参数。(3)如果有必要,您还可以将登陆成功的cookie记录下来,以便后用。</textarea>
|
||||
<br>
|
||||
</li>
|
||||
<li>
|
||||
<kbd>接口规范</kbd>:<br>
|
||||
<code>数据分类</code> 主要分为POST数据与GET数据两类,其中部分限制约定数据必须从GET数据中取得,原则上POST进来的可以是任意类型、任意大小、任意长度的数据<br>
|
||||
<code>会直接被过滤掉的POST数据:</code>这些数据会在传入时即被系统会自动过滤,不作任何保存操作
|
||||
<pre>['id','siteid','createtime','updatetime','update_at'];</pre>
|
||||
|
||||
<code>只允许GET方式的数据:</code>这些数据与您的接口权限也有关联,在接口权限中有直接设定的,以设定好的数据为主
|
||||
<pre>['uniacid','platid','shopid'];</pre>
|
||||
<textarea class="form-control">注:(1)uniacid:针对微擎多公众号机制系统的标识,每个uniacid代表一个独立的后台用户;其他系统也可借鉴该方式,通过绑定不同的接口账号,实现近似多用户的功能;(2)platid:平台id,通常单个接口账号不会用到,且一般情况下,该值直接在账号注册/授权之初由系统直接规定好;(3)shopid:适用于后台用户拥有多门店/多店铺的场景;未进行配置时,默认为0;</textarea>
|
||||
<br>
|
||||
|
||||
<code>SQL排序命令辅助sql_orders:</code>传入方式为数组,键值顺序决定排列先后,每个元素本身也是一个数组,由排序字段及排序方式构成。DESC倒序,ASC升序
|
||||
<pre>
|
||||
$post['sql_orders']=array(
|
||||
"键"=>array(排序字段=》排序方式),
|
||||
"1"=>array(”displayorder“=>"desc"),
|
||||
"2"=>array(”id“=>"asc"),
|
||||
……
|
||||
);
|
||||
</pre>
|
||||
<code>SQL截断命令辅助sql_limits:</code>传入方式为数组,数组内为起始位置、结束位置两个参数
|
||||
<pre>
|
||||
$post['sql_limits']=array(
|
||||
'start' => ($pindex-1)*$psize,
|
||||
'end' => $psize,
|
||||
);
|
||||
</pre>
|
||||
<code>SQL搜索命令辅助searching:</code>传入方式为searching数组,内可包含<code>['status','deleted','keyword','filter','plat']</code>键
|
||||
<pre>
|
||||
$post['searching']=array(
|
||||
'status' => '', //指定状态(数据是否启用)(0,1)(默认1)
|
||||
'deleted' => '', //指定状态(数据是否删除)(0,1)(默认0)
|
||||
'keyword' => '', //指定要匹配的关键词(模糊检索,用以匹配标题项)
|
||||
'filter' => array(要匹配的字段=》字段值) //用于设定数据过滤条件,并行条件(AND),精确匹配;支持多组(数组集,要匹配的字段=》字段值)($col=>$val),字段值可以是文本字符串(单一值)或二维数组(一个字段多种取值的情况)
|
||||
'plat' => '', //指定跨平台搜索
|
||||
);
|
||||
</pre>
|
||||
<code>注:SQL搜索命令辅助searching内如果还传入了其他参数,将由系统统一过滤整理,用作模糊匹配的可选条件(OR)</code>
|
||||
<br>
|
||||
</li>
|
||||
<li>
|
||||
<kbd>错误代码</kbd>:(客户侧可直接将接口站返回的结果打印出来查看,以下仅列出服务侧程序正确运行情况下返回的错误及提示;其他情况可直接打印结果进行查看)<br>
|
||||
<textarea class="form-control"><?php foreach ($errorcodes as $k => $v) {
|
||||
echo '"' . $k . '" : ' . $v . ";\r\n";
|
||||
}
|
||||
?>
|
||||
</textarea>
|
||||
<br>
|
||||
</li>
|
||||
<li>
|
||||
<kbd>标准接口</kbd>:<br>
|
||||
<code>数据归类:</code> 本站接口数据划分为三个层级——<code>model</code>(模型数据)=><code>instance</code>(实例数据)=><code>content</code>(内容数据)<br>
|
||||
<code>存取动作:</code> 数据操作共三种——<code>get</code>(取数据列表)=><code>detail</code>(取某组数据详情)=><code>save</code>(保存数据)<br>
|
||||
<code>参数约定:</code> (1) 控制器动作参数ac,<small>action的简写</small>,对应数据的层级归类,如
|
||||
model或house或room。传入方式:<code>GET(仅支持GET方法)</code>; (2) 控制器动作附加细分操作参数op,<small>operation的简写</small>,对应相应数据的操作,如
|
||||
index或unused或deleted或all等。传入方式:<code>GET(仅支持GET方法)</code>;
|
||||
<pre>通常情况下,ac参数均只需用model或instance或content即可;部分接口模型(如realty房产模型)可能略有不同</pre>
|
||||
<pre>op参数说明:'index': 取未删除、可用状态的数据;'unused': 取未删除、不可用状态的数据;'deleted':取已删除数据; 'all':取未删除数据; </pre>
|
||||
<code>返回结果:</code>
|
||||
<pre>
|
||||
对于get类的动作,返回数组,数组结构如下(仅为参考,实际可打印结果核实)
|
||||
$return['errorcode'] = $errorCode; //正常情况下为0
|
||||
$return['msg'] = Yii::t('errorcode',$errorCode); //返回的消息(接口报错时会使用到)
|
||||
$return['data'] = isset($record) ? $record : ''; //用户侧应获得的数据
|
||||
$return['timeused'] = getMillisecond() - $START_TIME; //接口耗时
|
||||
$return['total'] = isset($count) ? $count : 1;//总记录数
|
||||
$return['bytes'] = strlen(json_encode($return['data']));//长度字节统计
|
||||
</pre>
|
||||
<pre>
|
||||
对于detail类的动作,返回数组,结构如下:
|
||||
$return['errorcode'] = $errorCode;
|
||||
$return['msg'] = Yii::t('errorcode',$errorCode);
|
||||
$return['data'] = isset($record) ? $record : '';
|
||||
$return['timeused'] = getMillisecond() - $START_TIME;
|
||||
$return['bytes'] = strlen(json_encode($return['data']));//长度字节统计
|
||||
</pre>
|
||||
<pre>
|
||||
对于save类的动作,返回数组,结构如下:
|
||||
$return['errorcode'] = $errorCode;
|
||||
$return['msg'] = Yii::t('errorcode',$errorCode);
|
||||
$return['data'] = isset($record) ? $record : '';
|
||||
$return['timeused'] = getMillisecond() - $START_TIME;
|
||||
$return['bytes'] = strlen(json_encode($return['data']));//长度字节统计
|
||||
</pre>
|
||||
<br>
|
||||
</li>
|
||||
<li>
|
||||
<kbd>接口示范</kbd>:(以房产模型为例)<br>
|
||||
<code>使用模型:</code> realty<br>
|
||||
<code>所取数据:</code> 客户侧指定的房产模型的下的楼盘实例(house)列表<br>
|
||||
<code>基础接口:</code> https://api.hiluker.com/index.php?r=<code>realty</code>/<code>get</code><br>
|
||||
<ol>
|
||||
<li>
|
||||
<code>构建身份验证GET参数</code>:
|
||||
<pre>
|
||||
$getData = array();
|
||||
$urlcondition1 = ’‘; //要附加到基础接口地址上的GET参数组
|
||||
$getData['appid'] = $server['username']; //接口用户名
|
||||
$getData['sceret'] = $server['code']; //接口密码
|
||||
$getData['accesstoken'] = $AccessToken; //接口TOKEN
|
||||
foreach($getData as $k => $v){
|
||||
$urlcondition1 .= '&'. urlencode($k).'='. urlencode($v);
|
||||
}
|
||||
</pre>
|
||||
</li>
|
||||
<li>
|
||||
<code>构建动作、操作等GET参数</code>:
|
||||
<pre>
|
||||
$getData = array();
|
||||
$urlcondition2 = ’‘; //要附加到基础接口地址上的GET参数组
|
||||
$getData['platid'] = '';
|
||||
$getData['uniacid'] = '';
|
||||
$getData['shopid'] = '';
|
||||
$getData['ac'] = 'house';
|
||||
$getData['op'] = 'all';
|
||||
foreach($getData as $k => $v){
|
||||
$urlcondition2 .= '&'. urlencode($k).'='. urlencode($v);
|
||||
}
|
||||
</pre>
|
||||
</li>
|
||||
<li>
|
||||
<code>构建查询/筛选等POST参数</code>:
|
||||
<pre>
|
||||
$postData = array();
|
||||
$postData['s_sn'] = $s_sn;
|
||||
$postData['searching']['deleted'] = ''; //1或0;可选项,1为仅取用已删除数据
|
||||
$postData['searching']['keyword'] = "; //可选项,关键词
|
||||
$postData['searching']['status'] = ''; //1或0;可选项,1为仅取用已生效中的数据
|
||||
$postData['searching']['plat'] = ''; //可选项,跨平台时使用
|
||||
$postData['sql_limits'] = array(
|
||||
'start' => 起始页位置,
|
||||
'end' => 结束页位置,
|
||||
);
|
||||
//处理POST数据
|
||||
foreach($postData as $k => &$v){
|
||||
$v = json_encode($v); //(POST的数据各键值需是string文本类型)
|
||||
}
|
||||
</pre>
|
||||
</li>
|
||||
<li>
|
||||
拼接网址,POST数据<code>发送请求</code>
|
||||
</li>
|
||||
</ol>
|
||||
<br>
|
||||
</li>
|
||||
</ol>
|
||||
</p>
|
||||
Executable
+88
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/* @var $this \yii\web\View */
|
||||
/* @var $content string */
|
||||
|
||||
//use yii\helpers\Html;
|
||||
use yii\bootstrap5\Html;
|
||||
use yii\bootstrap5\Nav;
|
||||
use yii\bootstrap5\NavBar;
|
||||
|
||||
//use yii\widgets\Breadcrumbs;
|
||||
use yii\bootstrap5\Breadcrumbs;
|
||||
use frontend\assets\AppAsset;
|
||||
use common\widgets\Alert;
|
||||
|
||||
AppAsset::register($this);
|
||||
?>
|
||||
<?php $this->beginPage() ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= Yii::$app->language ?>">
|
||||
<head>
|
||||
<meta charset="<?= Yii::$app->charset ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<?= Html::csrfMetaTags() ?>
|
||||
<title><?= Html::encode($this->title) ?></title>
|
||||
<?php $this->head() ?>
|
||||
</head>
|
||||
<body>
|
||||
<?php $this->beginBody() ?>
|
||||
|
||||
<div class="wrap">
|
||||
<?php
|
||||
NavBar::begin([
|
||||
'brandLabel' => Yii::t('frontend', 'Site Name'),
|
||||
'brandUrl' => Yii::$app->homeUrl,
|
||||
'options' => [
|
||||
'class' => 'navbar-inverse navbar-fixed-top',
|
||||
],
|
||||
]);
|
||||
$menuItems = [
|
||||
['label' => Yii::t('frontend', 'Home'), 'url' => ['/site/index']],
|
||||
//['label' => Yii::t('frontend','About'), 'url' => ['/site/about']],
|
||||
['label' => Yii::t('frontend', 'Contact'), 'url' => ['/site/contact']],
|
||||
];
|
||||
if (Yii::$app->user->isGuest) {
|
||||
$menuItems[] = ['label' => Yii::t('frontend', 'Sign Up'), 'url' => ['/site/signup']];
|
||||
$menuItems[] = ['label' => Yii::t('frontend', 'Login'), 'url' => ['/site/login']];
|
||||
} else {
|
||||
$menuItems[] = ['label' => Yii::t('frontend', 'Ali SMS'), 'url' => ['/alimsg/index']];
|
||||
$menuItems[] = ['label' => Yii::t('frontend', 'Api'), 'url' => ['/api/index', 'appid' => Yii::$app->user->identity->username]];
|
||||
$menuItems[] = '<li>'
|
||||
. Html::beginForm(['/site/logout'], 'post')
|
||||
. Html::submitButton(
|
||||
Yii::t('frontend', 'Logout') . ' (' . Yii::$app->user->identity->username . ')',
|
||||
['class' => 'btn btn-link logout']
|
||||
)
|
||||
. Html::endForm()
|
||||
. '</li>';
|
||||
}
|
||||
echo Nav::widget([
|
||||
'options' => ['class' => 'navbar-nav navbar-right'],
|
||||
'items' => $menuItems,
|
||||
]);
|
||||
NavBar::end();
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<?= Breadcrumbs::widget([
|
||||
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
|
||||
]) ?>
|
||||
<?= Alert::widget() ?>
|
||||
<?= $content ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="pull-left">© <?= Yii::t('frontend', 'English Company Name') ?> <?= date('Y') ?>
|
||||
Version: <?= HI_VERSION; ?></p>
|
||||
|
||||
<p class="pull-right"><?= Yii::t('frontend', 'Full Company Name') ?></p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<?php $this->endBody() ?>
|
||||
</body>
|
||||
</html>
|
||||
<?php $this->endPage() ?>
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
?>
|
||||
<div class="container" style="padding-top: 5%;">
|
||||
<div class="alert alert-<?php if (isset($message['class'])) {
|
||||
echo $message['class'];
|
||||
} else {
|
||||
echo "info";
|
||||
} ?> alert-dismissible fade in" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<h3 style="text-align: center;text-align: -webkit-center;"><?php if (isset($message['title'])) {
|
||||
echo $message['title'];
|
||||
} else {
|
||||
echo "系统提示";
|
||||
} ?></h3>
|
||||
<div><?php echo $message['content']; ?></div>
|
||||
</div>
|
||||
<div style="text-align: center;text-align: -webkit-center;">
|
||||
<?php foreach ($message['button'] as $btn) { ?>
|
||||
<a class="<?php echo $btn['class']; ?>" style="margin-right:15px;"
|
||||
href="<?php echo $btn['link']; ?>"><?php echo $btn['title']; ?></a>
|
||||
<?php } ?>
|
||||
<a class="btn btn-default" style="margin-right:15px;" href="javascript:void(0)"
|
||||
onclick="history.back();">返回</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container" style="margin-top:2%;text-align: center;color:#ccc;font-weight:200;">
|
||||
如果使用过程中发现有任何问题,请及时反馈给技术人员。
|
||||
</div>
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
/* @var $this yii\web\View */
|
||||
print_r($AccessToken);
|
||||
?>
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/* @var $this yii\web\View */
|
||||
?>
|
||||
<h1>setting/index</h1>
|
||||
|
||||
<p>
|
||||
You may change the content of this page by modifying
|
||||
the file <code><?= __FILE__; ?></code>.
|
||||
</p>
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
$this->title = 'About';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="site-about">
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>This is the About page. You may modify the following file to customize its content:</p>
|
||||
|
||||
<code><?= __FILE__ ?></code>
|
||||
</div>
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $form yii\bootstrap\ActiveForm */
|
||||
|
||||
/* @var $model \frontend\models\ContactForm */
|
||||
|
||||
use yii\bootstrap5\Html;
|
||||
use yii\bootstrap5\ActiveForm;
|
||||
use yii\captcha\Captcha;
|
||||
|
||||
$this->title = Yii::t('frontend', 'Contact');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="site-contact">
|
||||
<div class="row">
|
||||
<div class="col-lg-5">
|
||||
<p>
|
||||
<?= Html::encode(Yii::t('frontend', 'Page:Contact Tips')) ?>
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
|
||||
<?= $form->field($model, 'name')->textInput(['autofocus' => TRUE]) ?>
|
||||
<?= $form->field($model, 'email') ?>
|
||||
<?= $form->field($model, 'subject') ?>
|
||||
<?= $form->field($model, 'body')->textarea(['rows' => 6]) ?>
|
||||
<?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
|
||||
'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
|
||||
]) ?>
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('frontend', 'Submit'), ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?>
|
||||
</div>
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-7">
|
||||
<div class="jumbotron" style="background-color:#eee;">
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid clearfix">
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="thumbnail">
|
||||
<img alt="300x200" src="http://public.hiluker.com/hiluker/qrcode-hiluker.jpg"/>
|
||||
<div class="caption" contenteditable="true">
|
||||
<p>
|
||||
hiluker
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="thumbnail">
|
||||
<img alt="300x200" src="http://public.hiluker.com/luker_fm2.jpg"/>
|
||||
<div class="caption" contenteditable="true">
|
||||
<p>
|
||||
fm453
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<p>
|
||||
QQ:393213759
|
||||
<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=393213759&site=qq&menu=yes">
|
||||
<img border="0" src="http://wpa.qq.com/pa?p=2:393213759:51" alt="点击联系作者(方少)"
|
||||
title="点击联系作者(方少)"/>
|
||||
</a>
|
||||
QQ:1280880631
|
||||
<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=393213759&site=qq&menu=yes">
|
||||
<img border="0" src="http://wpa.qq.com/pa?p=2:1280880631:51" alt="点击联系工作室"
|
||||
title="点击联系作者团队"/>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<style>
|
||||
.thumbnail {
|
||||
text-overflow: clip;
|
||||
}
|
||||
</style>
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $name string */
|
||||
/* @var $message string */
|
||||
|
||||
/* @var $exception Exception */
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
$this->title = $name;
|
||||
?>
|
||||
<div class="site-error">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<div class="alert alert-danger">
|
||||
<?= nl2br(Html::encode($message)) ?>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The above error occurred while the Web server was processing your request.
|
||||
</p>
|
||||
<p>
|
||||
Please contact us if you think this is a server error. Thank you.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
|
||||
$this->title = Yii::t('frontend', 'Site Name');
|
||||
$modules = Yii::$app->params['dataModules'];
|
||||
?>
|
||||
<div class="site-index">
|
||||
|
||||
<div class="jumbotron">
|
||||
<h1>欢迎您!</h1>
|
||||
|
||||
<p class="lead">接口服务不断开放中,欢迎合作洽谈!</p>
|
||||
|
||||
<p><a class="btn btn-lg btn-success" href="">已开放API</a></p>
|
||||
<p style="text-align: left;">
|
||||
|
||||
<?php foreach ($modules as $k => $v) { ?>
|
||||
<button class="btn btn-lg btn-default" style="margin-top: 15px;margin-bottom: 15px;"
|
||||
title="<?php echo $k; ?>"><?php echo $v; ?></button>
|
||||
<?php } ?>
|
||||
|
||||
<button class="btn btn-lg btn-default" style="margin-top: 15px;margin-bottom: 15px;" title="">……</button>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $form yii\bootstrap5\ActiveForm */
|
||||
|
||||
/* @var $model \common\models\LoginForm */
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\bootstrap5\ActiveForm;
|
||||
|
||||
$this->title = Yii::t('frontend', 'Login');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="site-login">
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-5">
|
||||
<?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
|
||||
|
||||
<?= $form->field($model, 'username')->textInput(['autofocus' => TRUE]) ?>
|
||||
|
||||
<?= $form->field($model, 'password')->passwordInput() ?>
|
||||
|
||||
<?= $form->field($model, 'rememberMe')->checkbox() ?>
|
||||
|
||||
<div style="color:#999;margin:1em 0">
|
||||
如果您忘记了登陆密码,可点击这里申请 <?= Html::a('重设密码', ['site/request-password-reset']) ?>.
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('frontend', 'Login'), ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
|
||||
$this->title = Yii::t('frontend', 'Site Name');
|
||||
$message = Yii::t('frontend', 'The site is now offline. Please view later…');
|
||||
|
||||
?>
|
||||
<div class="alert alert-warning">
|
||||
<?php echo $message; ?>
|
||||
</div>
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $form yii\bootstrap5\ActiveForm */
|
||||
|
||||
/* @var $model \frontend\models\PasswordResetRequestForm */
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\bootstrap5\ActiveForm;
|
||||
|
||||
$this->title = '申请修改密码';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="site-request-password-reset">
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>请填写您注册时用的邮箱,系统将密码重置链接发送至您的邮箱.</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-5">
|
||||
<?php $form = ActiveForm::begin(['id' => 'request-password-reset-form']); ?>
|
||||
|
||||
<?= $form->field($model, 'email')->textInput(['autofocus' => TRUE]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('发送', ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $form yii\bootstrap5\ActiveForm */
|
||||
|
||||
/* @var $model \frontend\models\ResetPasswordForm */
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\bootstrap5\ActiveForm;
|
||||
|
||||
$this->title = 'Reset password';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="site-reset-password">
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>设置新的密码:</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-5">
|
||||
<?php $form = ActiveForm::begin(['id' => 'reset-password-form']); ?>
|
||||
|
||||
<?= $form->field($model, 'password')->passwordInput(['autofocus' => TRUE]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Save', ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $form yii\bootstrap5\ActiveForm */
|
||||
|
||||
/* @var $model \frontend\models\SignupForm */
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\bootstrap5\ActiveForm;
|
||||
|
||||
$this->title = '注册';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="site-signup">
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>请提供以下信息进行注册:</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-5">
|
||||
<?php $form = ActiveForm::begin(['id' => 'form-signup']); ?>
|
||||
|
||||
<?= $form->field($model, 'username')->textInput(['autofocus' => TRUE]) ?>
|
||||
|
||||
<?= $form->field($model, 'email') ?>
|
||||
|
||||
<?= $form->field($model, 'password')->passwordInput() ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('frontend', 'Signup'), ['class' => 'btn btn-primary', 'name' => 'signup-button']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user