public function ajax_put_recycle() { R('Admin/yz'); C('LAYOUT_ON', false); $record_id = I('post.record_id'); if ($record_id) { $Record = D("Record"); $record_info = $Record->FindRecord($record_id); if ($record_info[0]) { $Admin = D('Admin'); $domain_conf = json_decode($Admin->getConf("domain_info_{$record_info[1]['first_domain']}"), true); $Dnspod = new \Org\Util\Dnspod($domain_conf); $Dnspod->dns_recycle(array($record_id)); if ($Dnspod->result['status']['code'] != 1) { $this->ajaxReturn(array(0, "DNSPOD回收域名失败,原因:" . $Dnspod->result['status']['message']), 'json'); } else { $result = $Record->RecycleRecord(array($record_id)); if ($result[0][0]) { $this->ajaxReturn(array(1, $record_id), 'json'); } else { $this->ajaxReturn(array(0, $result[0][1]), 'json'); } } } else { $this->ajaxReturn(array(0, "域名不存在"), 'json'); } } else { $this->ajaxReturn(array(0, "未获取记录ID"), 'json'); } }
public function ajax_get_domainid() { R('Admin/yz'); $domain_conf['first_domain'] = I('post.first_domain'); $domain_conf['token_id'] = I('post.token_id'); $domain_conf['token'] = I('post.token'); $Dnspod = new \Org\Util\Dnspod($domain_conf); $Dnspod->dns_getinfo($domain_conf['first_domain']); $result = $Dnspod->result; if ($result['status']['code'] == "1") { $result = array(1, $result['domain']['id']); } else { $result = array(0, $result['status']['message']); } $this->ajaxReturn($result, 'json'); }
public function deletemyrecord() { $record_id = I("post.id"); $UserInfo = isLogin(); $record = D('Record'); $conf = D('Admin'); $record_info = $record->FindRecord($record_id, $UserInfo['id']); if (!$record_info[0]) { die('这个域名不是你的'); } else { $conf_domain_info = json_decode($conf->getConf('domain_info_' . $record_info[1]['first_domain']), true); $d = new \Org\Util\Dnspod($conf_domain_info); $d->record_id = $record_id; $d->dns_delete(); $re = $d->result; if ($re['status']['code'] != '1') { die("错误!" . $re['status']['message']); } else { $record->DeleteRecord($record_id, $UserInfo['id']); die("1"); } } }