public function verify() { $res = array(); $res['Success'] = false; if ($this->Action > 1) { //不通过,删除操作 $hours = new Hours(); $hours->Id = $this->Id; $result = $hours->delete(); if ($result > 0) { $res['Success'] = true; $res['Message'] = "删除成功"; } else { $res['Message'] = "删除失败"; } } else { //通过,计入项目总工时 $hours = new Hours(); $hours->Id = $this->Id; $hours->Ratio = $this->Ratio; $hours->Hours2 = $this->Hours2; $result = $hours->update(); if ($result > 0) { //审核成功 $project = new Project(); $project->setValue($this->ProjectId); $project->Hours = $project->Hours + $hours->Hours2; $project->update(); $res['Success'] = true; $res['Message'] = "审核通过"; $res['NewId'] = $this->Id; } else { $res['Success'] = false; $res['Message'] = "审核失败"; } } echo json_encode($res); exit; }
public function effect() { $res = array(); $project = new Project(); $project->setValue($this->ProjectId); if ($project->Url != $this->Url) { //生产二维码 $project->Url = $this->Url; $destination_folder = date("Y") . "/"; //上传文件路径 $filenamenew = uniqid(date("Ymd"), true) . '.png'; $destination = $destination_folder . $filenamenew; $stor = new Storage(); if (!empty($project->QrCode)) { $stor->delete(FILE_DOMAIN, $project->QrCode); } $project->QrCode = $destination; $url = urlencode($project->Url); $qrcode = URL_WEBSITE . '/basic/handles/qrcode.php?Url=' . $url; $f = new Fetchurl(); $imageData = $f->fetch($qrcode); $stor->write(FILE_DOMAIN, $project->QrCode, $imageData); } $project->Pv = $this->Pv; $project->Uv = $this->Uv; $project->Fans = $this->Fans; $project->Summary = $this->Summary; $project->Laud = $this->Laud; //print_r($project); $result = $project->update(); if ($result > 0) { $res['Success'] = true; $res['Message'] = "更新成功"; //发送部门老大emailt通知 } else { $res['Success'] = false; $res['Message'] = "没有更新任何数据"; } echo json_encode($res); exit; }