/** * 用户取消绑定顶级域名,当执行操作并且在comdomain中存在数据时将数据复制到m_comdomain中,并标记删除 -7,并在gc_comdomain中标记为-7 代表已删除 * 如果在comdomain中不存在数据,则直接更新mdomain的状态为-7 * 全部的操作都从supid来走,尽量不接受用户提交的信息! * @param integer $supid 供应商id * @return array(fmart) */ public function unBindDomain($supid) { if (!isset($supid) || $supid <= 0) { return $this->outputData('', '400', '参数错误'); } $conditions = 'supid=:supid: and state in (1,2)'; $result = Domain::findFirst(array('conditions' => $conditions, 'bind' => array('supid' => intval($supid)))); //查询数据,并标记开始删除 if ($result) { $result->state = -7; if (!$result->save()) { return $this->outputData('', '400', '解绑失败'); } //准备要转移的数据 $data = array(); $data['supid'] = $result->supid; $data['domain'] = $result->domain; $data['recordno'] = $result->recordno; $data['name'] = '用户'; $data['state'] = -7; $data['checktime'] = time(); $data['checkdesc'] = '用户在后台自行删除,转移到这里进行记录'; //不论在m表中有没有该用户的未审核信息,直接更新状态为-7,用户主动删除 $mdomain = new MDomain(); if (!$mdomain->save($data)) { return $this->outputData('', '400', '解绑失败'); } } //调用结果批量更新,此操作返回的结果永远是 true ...未知原因 $success = $this->di->getShared('gccominfo')->update("m_comdomain", array("state"), array("-7"), "supid={$supid} and state=0"); return $this->outputData('解绑成功'); }
/** * 审核操作! * 如果通过了,标记m表中的状态为1, 并把数据更新到gc表中 * 如果拒审了,只更新m表 * @param integer $id [<description>] * @return */ public function check($id, $state, $name, $checkdesc = '', $msg = false) { if ($id < 1 || !in_array($state, array(1, -1))) { return $this->outputData('', '401', '数据校检失败'); } $data = MDomain::findFirst(array('conditions' => 'id=:id:', 'bind' => array('id' => $id))); if (!$data) { return $this->outputData('', '402', '信息不存在'); } if (!isset($data->state) || $data->state != 0) { return $this->outputData('', '403', '已被审核'); } //审核通过操作 if ($state == 1) { $data->state = $state; $data->checkdesc = '审核成功'; $data->name = $name; $data->checktime = time(); //更新完状态之后,将信息保存或更新到正常表中 if ($data->save()) { //判断域名表中是否存在,存在则更新,不存在则新增 $findData = Domain::findFirst(array('conditions' => 'supid=:supid: and state=1', 'bind' => array('supid' => $data->supid))); if ($findData) { $findData->domain = $data->domain; $findData->recordno = $data->recordno; $res = $findData->save(); } else { $domainService = new Domain(); $domainService->supid = $data->supid; $domainService->domain = $data->domain; $domainService->recordno = $data->recordno; $domainService->state = $data->state; $res = $domainService->save(); } if ($res) { //审核通过 发送站内信 $msgData['supid'] = $data->supid; $msgData['subject'] = '独立域名通过审核'; $msgData['message'] = $msg; $request = array('service' => 'Gcsupplier\\Services\\Msg', 'method' => 'addMsg', 'args' => array($msgData)); $this->di['local']->call($request); return $this->outputData('操作成功'); } return $this->outputData('操作失败'); } //审核失败操作 } else { $data->state = $state; $data->checkdesc = $checkdesc; $data->name = $name; $data->checktime = time(); $res = $data->save(); if ($res) { //拒审 发送站内信 $msgData['supid'] = $data->supid; $msgData['subject'] = '独立域名被拒审'; $msgData['message'] = $msg; $request = array('service' => 'Gcsupplier\\Services\\Msg', 'method' => 'addMsg', 'args' => array($msgData)); $this->di['local']->call($request); return $this->outputData('操作成功'); } return $this->outputData('操作失败'); } }