Beispiel #1
0
 public function test_Update()
 {
     $demo = new Demo();
     $demo->key = "Test";
     $demo->value = "Testing here!";
     $this->assertTrue($demo->create());
     $this->assertTrue($demo->update(array("value" => "Testing here! Look away!")));
     $this->assertEquals($demo->value, "Testing here! Look away!");
 }
Beispiel #2
0
 public function verify()
 {
     $res = array();
     $res['Success'] = false;
     if ($this->Action > 1) {
         //不通过,删除操作
         $obj = new Demo();
         $obj->Id = $this->Id;
         $result = $obj->delete();
         if ($result > 0) {
             $res['Success'] = true;
             $res['Message'] = "删除成功";
         } else {
             $res['Message'] = "删除失败";
         }
     } else {
         //通过,计入项目总工时
         $obj = new Demo();
         $obj->Id = $this->Id;
         $obj->Ratio = $this->Ratio;
         $obj->Hours2 = $this->Hours2;
         $result = $obj->update();
         if ($result > 0) {
             $res['Success'] = true;
             $res['Message'] = "审核通过";
             $res['NewId'] = $this->Id;
         } else {
             $res['Success'] = false;
             $res['Message'] = "审核失败";
         }
     }
     echo json_encode($res);
     exit;
 }