order(['id'=>'desc'])->json(['error_info'],true)->select()->toArray(); return $lists; } /** * @notes 新增key * @param $params * @return true * @author ljj * @date 2024/11/5 下午2:05 */ public function add($params) { MapKey::create([ 'key' => $params['key'], 'type' => $params['type'] ]); return true; } /** * @notes 详情 * @param $id * @return array * @author ljj * @date 2024/11/5 下午2:07 */ public function detail($id) { $result = MapKey::where('id',$id)->json(['error_info'],true)->findOrEmpty()->toArray(); return $result; } /** * @notes 编辑 * @param $params * @return true * @author ljj * @date 2024/11/5 下午2:20 */ public function edit($params) { $mapKey = MapKey::findOrEmpty($params['id']); $mapKey->key = $params['key']; $mapKey->type = $params['type']; $mapKey->status = $mapKey->status == MapKeyEnum::STATUS_ABNORMAL ? MapKeyEnum::STATUS_WAIT : $mapKey->status; $mapKey->save(); //删除缓存 Cache::delete('TENCENT_MAP_KEY'); return true; } /** * @notes 删除 * @param $id * @return bool * @author ljj * @date 2024/11/5 下午2:21 */ public function del($id) { return MapKey::destroy($id); } }