Commit a53605fa by 杨树贤

供应商账号加密

parent fc6c76a7
......@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Filter\SupplierAccountFilter;
use App\Http\Services\LogService;
use App\Http\Services\SupplierAccountService;
use App\Http\Transformers\SupplierLogTransformer;
use App\Http\Validators\SupplierAccountValidator;
......@@ -131,4 +132,16 @@ class SupplierAccountApiController extends Controller
}
$this->response(-1, '禁用失败', $result);
}
public function GetSupplierAccount($request)
{
$id = $request->input('id');
$type = $request->input('type');
$account = SupplierAccountModel::where('id', $id)->first()->toArray();
$logService = new LogService();
$temp = ($type == 'mobile') ? '账号' : '密码';
$content = $request->user->name . ' 查看了供应商账号的' . $temp;
$logService->AddLog($account['supplier_id'], LogModel::VIEW_OPERATE, '查看供应商基本资料', $content);
$this->response(0, 'ok', $account);
}
}
......@@ -19,6 +19,11 @@ class SupplierAccountTransformer
$item['type_name'] = array_get(config('field.SupplierAccountType'), $item['a_type']);
$item['create_time'] = $item['create_time'] ? date('Y-m-d H:i:s', $item['create_time']) : '';
$item['update_time'] = $item['update_time'] ? date('Y-m-d H:i:s', $item['update_time']) : '';
if (!empty($item['mobile'])) {
$item['mobile'] = substr($item['mobile'], 0, 3) . '****' . substr($item['mobile'], 7);
}
$replace = str_pad('*', strlen($item['password_raw']), '*');
$item['password_raw'] = str_replace($item['password_raw'], $replace , $item['password_raw']);
}
unset($item);
......
......@@ -15,9 +15,17 @@
{type: 'radio'},
{field: 'id', title: 'ID', align: 'center', width: 80},
{
field: 'mobile', title: '账号', align: 'center', width: 170
field: 'mobile', title: '账号', align: 'center', width: 170,
templet: function (data) {
return '<span>' + data.mobile + '</span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="mobile" id="' + data.id + '">查看</span>'
}
},
{
field: 'password_raw', title: '密码', align: 'center', width: 170,
templet: function (data) {
return '<span>' + data.password_raw + '</span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="password_raw" id="' + data.id + '">查看</span>'
}
},
{field: 'password_raw', title: '密码', align: 'center', width: 170},
{
field: 'supplier_code', title: '供应商编码', align: 'center', width: 120
},
......@@ -145,5 +153,29 @@
location.reload();
});
$(document).on('click', '.viewAccount', function () {
let id = $(this).attr('id');
let type = $(this).attr('type');
let resp = ajax('/api/supplier_account/GetSupplierAccount', {id: id, type: type});
if (!resp) {
layer.msg('网络连接失败', {'icon': 5});
return false;
}
if (resp.err_code === 0) {
switch (type) {
case 'mobile':
$(this).prev().text(resp.data.mobile);
break;
case 'password_raw':
$(this).prev().text(resp.data.password_raw);
break;
}
console.log(resp);
} else {
layer.msg(resp.err_msg, {'icon': 5});
return false;
}
});
});
</script>
\ No newline at end of file
......@@ -149,7 +149,6 @@
});
}
//删除
$(document).on('click', '.viewContact', function () {
let contactId = $(this).attr('contact_id');
let type = $(this).attr('type');
......
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