Commit 9b9e843d by 朱继来

添加操作记录

parent b6df2819
...@@ -146,3 +146,40 @@ ...@@ -146,3 +146,40 @@
return $token; return $token;
} }
/**
* 获取客户端IP地址
* @param integer $type 返回类型 0 返回IP地址 1 返回IPV4地址数字
* @param boolean $adv 是否进行高级模式获取(有可能被伪装)
* @return mixed
*/
function get_client_ip($type = 0, $adv = false)
{
$type = $type ? 1 : 0;
static $ip = null;
if (null !== $ip) {
return $ip[$type];
}
if ($adv) {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$pos = array_search('unknown', $arr);
if (false !== $pos) {
unset($arr[$pos]);
}
$ip = trim($arr[0]);
} elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (isset($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
}
} elseif (isset($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
}
// IP地址合法验证
$long = sprintf("%u", ip2long($ip));
$ip = $long ? array($ip, $long) : array('0.0.0.0', 0);
return $ip[$type];
}
...@@ -72,6 +72,8 @@ Route::group(['middleware' => 'web'], function () { ...@@ -72,6 +72,8 @@ Route::group(['middleware' => 'web'], function () {
Route::match(['get', 'post'], '/express_set', 'OrderController@expressSet'); Route::match(['get', 'post'], '/express_set', 'OrderController@expressSet');
Route::post('/ajaxDownloadContract', 'OrderController@ajaxDownloadContract');
}); });
// 不需要登陆态 // 不需要登陆态
......
...@@ -145,6 +145,29 @@ ...@@ -145,6 +145,29 @@
} }
}) })
// 下载合同
$('.download-contract').click(function(){
var order_id = $(this).data('id');
$.ajax({
url: '/ajaxDownloadContract',
type: 'post',
data: {order_id:order_id},
dataType: 'json',
success: function(resp) {
if (resp.errcode != 0) {
layer.msg(resp.msg);
return false;
}
location.href = resp.data;
},
error: function(err) {
console.log(err)
}
})
})
// 切换类型时,清空输入框内容 // 切换类型时,清空输入框内容
$('.dropdown-menu>li').click(function(){ $('.dropdown-menu>li').click(function(){
var val = $(this).data('val'); // 当前值 var val = $(this).data('val'); // 当前值
......
...@@ -558,7 +558,7 @@ ...@@ -558,7 +558,7 @@
@endif @endif
<!-- 二期处理 --> <!-- 二期处理 -->
<!-- <p>操作记录</p> <p>操作记录</p>
<div class="tabs-box"> <div class="tabs-box">
<table class="table table-bordered table-hover log"> <table class="table table-bordered table-hover log">
<thead> <thead>
...@@ -569,21 +569,20 @@ ...@@ -569,21 +569,20 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<php>$logs = json_decode($detail['operate_log'], true)</php> @if (!empty($actionLog))
<empty name="logs"> @foreach ($actionLog as $v)
<tr><td colspan="20">没有操作记录</td></tr> <tr>
<else/> <td>{{date('Y-m-d H:i:s', $v->create_time)}}</td>
<foreach name="logs" item="v"> <td>{{App\Http\Controllers\getOperatorName($v->operator_id, $v->operator_type)}}</td>
<tr> <td>{{$v->event}}</td>
<td><p class="time">{$v.time|date="Y-m-d H:i:s", ###}</p></td> </tr>
<td><p class="uname">{$v.user}</p></td> @endforeach
<td><p class="log">{$v.extra}</p></td> @else
</tr> <tr><td colspan="3">无操作记录</td></tr>
</foreach> @endif
</empty>
</tbody> </tbody>
</table> </table>
</div> --> </div>
</div> </div>
<script> <script>
......
...@@ -278,14 +278,11 @@ ...@@ -278,14 +278,11 @@
@endif @endif
<?php <?php
$apiUrl = Config('website.api_domain');
$k1 = time();
$k2 = md5(md5($k1).'fh6y5t4rr351d2c3bryi');
$downLoadUrl = $apiUrl.'contract/pdfinfo?id='.$v['order_id'].'&k1='.$k1.'&k2='.$k2;
?> ?>
@if (in_array('download_contract', $userPerms)) @if (in_array('download_contract', $userPerms))
<a class="btn btn-info" href="{{$downLoadUrl}}">下载合同</a> <a class="btn btn-info download-contract" data-id="{{$v['order_id']}}" href="javascript:;">下载合同</a>
@endif @endif
</div> </div>
</td> </td>
......
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 sign in to comment