public function deleteAction()
 {
     // 使用默认视图
     MyTool:
     simpleView();
     // 验证登录状态
     if (!MyTool::loginAuth($this)) {
         return $this->onExit(MyConst::STATUS_NOT_LOGIN, 'must login first');
     }
     $targetId = @intval($targetId);
     $uid = @intval(MyTool::getCookie($this, MyConst::COOKIE_UID));
     // 获取团队信息
     $team = TeamLogic::getTeam($targetId);
     if (empty($team)) {
         return MyTool::onExit($this, MyConst::STATUS_INVALID_TEAM, 'invalid team id');
     }
     if (TeamLogic::isOwner($uid, $targetId)) {
         return MyTool::onExit($this, MyConst::STATUS_ERROR, 'owner of team');
     }
     // 团队成员
     $member = MaTeamMember::getMember($targetId, $uid);
     if (empty($member)) {
         return MyTool::onExit($this, MyConst::STATUS_NOT_EXISTS, 'not a member of team');
     }
     // 删除成员
     try {
         if (true !== $member->delete()) {
             return MyTool::onExit($this, MyConst::STATUS_DB, 'delete team fail');
         }
     } catch (Exception $e) {
         return MyTool::onExit($this, MyConst::STATUS_ERROR, $e->getMessage());
     }
     // 返回
     MyTool::setVar($this, MyConst::FIELD_STATUS, MyConst::STATUS_OK);
     return true;
 }
 public function updateLeaderAction($teamId, $leaderId)
 {
     MyTool::simpleView($this);
     if (!MyTool::loginAuth($this)) {
         return $this->onError(MyConst::STATUS_NOT_LOGIN, 'must login first');
     }
     $teamId = @intval($teamId);
     $team = TeamLogic::getTeam($teamId);
     if (empty($team)) {
         return MyTool::onExit($this, MyConst::STATUS_INVALID_TEAM, 'unknown team id');
     }
     $uid = MyTool::getCookie($this, MyConst::COOKIE_UID);
     if ($team->owner != $uid) {
         return MyTool::onExit($this, MyConst::STATUS_NO_PERMISSION, 'no premission');
     }
     if (empty($leader)) {
         return MyTool::onExit($this, MyConst::STATUS_INVALID_PARAM, 'invalid input');
     }
     $leader = TeamLogic::getLeader($id);
     if (empty($leader)) {
         return MyTool::onExit($this, MyConst::STATUS_UNKNOWN_LEADER, 'unknown leader');
     }
     if ($leader->tid != $teamId) {
         return MyTool::onExit($this, MyConst::STATUS_NO_PERMISSION, 'no permission');
     }
     $body = $this->request->getJsonRawBody();
     if (empty($body)) {
         return MyTool::onExit($this, MyConst::STATUS_INVALID_PARAM, 'mal-json input data');
     }
     $leader2 = TeamLogic::convertJsonToLeader($body);
     if (empty($leader2)) {
         return MyTool::onExit($this, MyConst::STATUS_INVALID_PARAM, 'invalid input');
     }
     if (MyTool::eq($leader->name, $leader2->name)) {
         $leader->name = $leader2->name;
     }
     if (MyTool::eq($leader->pic, $leader2->pic)) {
         $leader->pic = $leader2->pic;
     }
     if (MyTool::eq($leader->role, $leader2->role)) {
         $leader->role = $leader2->role;
     }
     if (MyTool::eq($leader->intro, $leader2->intro)) {
         $leader->intro = $leader2->intro;
     }
     $leader->mtime = $leader2->ctime;
     try {
         if (true !== $leader->update()) {
             return MyTool::onExit($this, MyConst::STATUS_ERROR, "update team leader failed");
         }
     } catch (Exception $e) {
         return MyTool::onExit($this, MyConst::STATUS_ERROR, $e->getMessage());
     }
     MyTool::setVar($this, MyConst::FIELD_STATUS, MyConst::STATUS_OK);
     return true;
 }