表情管理-后台接口提交
This commit is contained in:
@@ -169,4 +169,59 @@ class RoomEmoji extends adminApi
|
|||||||
return V(1,"成功", $emoji_type);
|
return V(1,"成功", $emoji_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//表情类型添加
|
||||||
|
function add_emoji_type(){
|
||||||
|
$type_name = input('type_name', '', 'trim');
|
||||||
|
if (!$type_name) {
|
||||||
|
return V(0, '请输入表情类型名称');
|
||||||
|
}
|
||||||
|
$data = [
|
||||||
|
'type_name' => $type_name,
|
||||||
|
'sort' => 0,
|
||||||
|
'status' => 1,
|
||||||
|
'createtime' => time(),
|
||||||
|
];
|
||||||
|
$res = Db::name($this->table_type)->insert($data);
|
||||||
|
if ($res) {
|
||||||
|
return V(1, '添加成功');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//表情类型修改
|
||||||
|
function edit_emoji_type(){
|
||||||
|
$id = input('id', 0, 'intval');
|
||||||
|
$type_name = input('type_name', '', 'trim');
|
||||||
|
$sort = input('sort', 0, 'intval');
|
||||||
|
$status = input('status', 1, 'intval');
|
||||||
|
if (!$id) {
|
||||||
|
return V(0, '请选择要修改的表情类型');
|
||||||
|
}
|
||||||
|
if($type_name){
|
||||||
|
$data['type_name'] = $type_name;
|
||||||
|
}
|
||||||
|
if($sort){
|
||||||
|
$data['sort'] = $sort;
|
||||||
|
}
|
||||||
|
if($status){
|
||||||
|
$data['status'] = $status;
|
||||||
|
}
|
||||||
|
$res = Db::name($this->table_type)->where('id',$id)->update($data);
|
||||||
|
if ($res) {
|
||||||
|
return V(1, '修改成功');
|
||||||
|
}
|
||||||
|
return V(0, '修改失败');
|
||||||
|
}
|
||||||
|
//表情类型删除
|
||||||
|
function del_emoji_type(){
|
||||||
|
$id = input('id', 0, 'intval');
|
||||||
|
if (!$id) {
|
||||||
|
return V(0, '请选择要删除的表情类型');
|
||||||
|
}
|
||||||
|
$res = Db::name($this->table_type)->where('id',$id)->update(
|
||||||
|
['deletetime' => time()]
|
||||||
|
);
|
||||||
|
if ($res) {
|
||||||
|
return V(1, '删除成功');
|
||||||
|
}
|
||||||
|
return V(0, '删除失败');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user