72 lines
1.4 KiB
PHP
72 lines
1.4 KiB
PHP
<?php
|
|
namespace app\admin\controller;
|
|
use app\common\controller\Admin;
|
|
use think\Request;
|
|
use think\Loader;
|
|
use think\Cache;
|
|
|
|
/**
|
|
* 抖音链接配置
|
|
*/
|
|
class Tiktokurl extends Admin{
|
|
|
|
public function _initialize(){
|
|
parent::_initialize();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$res=M('tiktok_url')->order('tid desc,sort asc')->paginate(100);
|
|
$page = $res->render();
|
|
$this->assign('res', $res);
|
|
$this->assign('page', $page);
|
|
$this->setMeta('抖音链接配置');
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
//添加数据
|
|
public function add(){
|
|
$data = input('post.');
|
|
|
|
$is = M('tiktok_url')->where('tid',$data['tid'])->where('tag',$data['tag'])->find();
|
|
if($is){
|
|
return 3;
|
|
}
|
|
$arr = array(
|
|
'tid'=>$data['tid'],
|
|
'url'=>$data['url'],
|
|
'tag'=>$data['tag'],
|
|
'sort'=>$data['sort']
|
|
);
|
|
$res = M('tiktok_url')->insert($arr);
|
|
if($res){
|
|
return 1;
|
|
}else{
|
|
return 2;
|
|
}
|
|
}
|
|
|
|
public function up(){
|
|
$data = input('post.');
|
|
$res = M('tiktok_url')->where('id',$data['id'])->update(['type'=>$data['type']]);
|
|
if($res){
|
|
exit(json_encode(array('status'=>1,'reg'=>'成功')));
|
|
}else{
|
|
exit(json_encode(array('status'=>2,'reg'=>'没有值修改')));
|
|
}
|
|
}
|
|
|
|
//删除
|
|
public function del(){
|
|
$id = input('id');
|
|
$res= M('tiktok_url')->where('id',$id)->delete();
|
|
if($res){
|
|
return 1;
|
|
}else{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|