Browse Source

编辑链接时可修改图标或上传新图标

pull/117/head
wmgang@qq.com 2 years ago
parent
commit
76f9e06f69
  1. 5
      class/Api.php
  2. 5
      controller/api.php
  3. 14
      templates/admin/edit_link.php

5
class/Api.php

@ -608,7 +608,7 @@ class Api { @@ -608,7 +608,7 @@ class Api {
/**
* name:修改链接
*/
public function edit_link($token,$id,$fid,$title,$url,$description = '',$weight = 0,$property = 0,$url_standby = ''){
public function edit_link($token,$id,$fid,$title,$url,$description = '',$weight = 0,$property = 0,$url_standby = '',$font_icon = ''){
$this->auth($token);
$fid = intval($fid);
//检测链接是否合法
@ -634,7 +634,8 @@ class Api { @@ -634,7 +634,8 @@ class Api {
'description' => htmlspecialchars($description,ENT_QUOTES),
'up_time' => time(),
'weight' => $weight,
'property' => $property
'property' => $property,
'font_icon' => $font_icon
];
//插入数据库
$re = $this->db->update('on_links',$data,[ 'id' => $id]);

5
controller/api.php

@ -129,8 +129,9 @@ function edit_link($api){ @@ -129,8 +129,9 @@ function edit_link($api){
$description = empty($_POST['description']) ? '' : $_POST['description'];
$weight = empty($_POST['weight']) ? 0 : intval($_POST['weight']);
$property = empty($_POST['property']) ? 0 : 1;
$api->edit_link($token,$id,$fid,$title,$url,$description,$weight,$property,$url_standby);
$font_icon = empty($_POST['font_icon']) ? '' : $_POST['font_icon'];
$api->edit_link($token,$id,$fid,$title,$url,$description,$weight,$property,$url_standby,$font_icon);
}

14
templates/admin/edit_link.php

@ -38,6 +38,20 @@ @@ -38,6 +38,20 @@
</div>
<!-- 备用链接END -->
<div class="layui-form-item">
<label class="layui-form-label">图标</label>
<div class="layui-input-block">
<button type="button" id = "iconUpload" name="iconUpload" class="layui-btn"><i class="layui-icon">&#xe67c;</i>上传图标</button>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图标链接</label>
<div class="layui-input-block">
<input type="url" id = "font_icon" value = "<?php echo $link['font_icon']; ?>" name="font_icon" placeholder="请输入图标链接,如果没有,请留空" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">链接名称</label>
<div class="layui-input-block">

Loading…
Cancel
Save