public function EditAction()
 {
     $introduce = I('introduce', '', 'string');
     $datetime = I('datetime', '', 'string');
     $startSignUpDateTime = I('startSignUpDateTime', '', 'string');
     $stopSignUpDateTime = I('stopSignUpDateTime', '', 'string');
     $stopDateTime = I('stopSignUpDateTime', '', 'string');
     $votePerDay = I('votePerDay', 0, 'intval');
     $shareUrl = I('shareUrl', '', 'string');
     $afterShareUrl = I('afterShareUrl', '', 'string');
     $shareTitle = I('shareTitle', '', 'string');
     $shareDesc = I('shareDesc', '', 'string');
     $shareImageUrl = I('shareImageUrl', '', 'string');
     // 检查参数
     if ($introduce == '' || $datetime == '' || $startSignUpDateTime == '' || $stopSignUpDateTime == '' || $stopDateTime == '' || $votePerDay == '' || $shareUrl == '' || $afterShareUrl == '' || $shareTitle == '' || $shareDesc == '' || $shareImageUrl == '') {
         return $this->error('错误的参数');
     }
     $data = array('introduce' => $introduce, 'datetime' => $datetime, 'startSignUpDateTime' => $startSignUpDateTime, 'stopSignUpDateTime' => $stopSignUpDateTime, 'stopDateTime' => $stopDateTime, 'votePerDay' => $votePerDay, 'shareUrl' => $shareUrl, 'afterShareUrl' => $afterShareUrl, 'shareTitle' => $shareTitle, 'shareDesc' => $shareDesc, 'shareImageUrl' => $shareImageUrl);
     // 执行修改
     $model = new WeVoteConfigModel();
     $result = $model->where('id = ' . $this->mActionId)->save($data);
     if ($result !== false) {
         return $this->success('修改成功');
     } else {
         return $this->error('修改失败');
     }
 }
 public function AddAction()
 {
     // 获取参数
     $introduce = I('introduce', '', 'string');
     $datetime = I('datetime', '', 'string');
     $startSignUpDateTime = I('startSignUpDateTime', '', 'string');
     $stopSignUpDateTime = I('stopSignUpDateTime', '', 'string');
     $stopDateTime = I('stopDateTime', '', 'string');
     $votePerDay = I('votePerDay', '', 'string');
     $shareUrl = I('shareUrl', '', 'string');
     $afterShareUrl = I('afterShareUrl', '', 'string');
     $shareTitle = I('shareTitle', '', 'string');
     $shareDesc = I('shareDesc', '', 'string');
     $shareImageUrl = I('shareImageUrl', '', 'string');
     // 检查参数
     if ($introduce == '' || $datetime == '' || $startSignUpDateTime == '' || $stopSignUpDateTime == '' || $stopDateTime == '' || $votePerDay == '' || $shareUrl == '' || $afterShareUrl == '' || $shareTitle == '' || $shareDesc == '' || $shareImageUrl == '') {
         return $this->error('错误的参数');
     }
     $data = array('introduce' => $introduce, 'datetime' => $datetime, 'startSignUpDateTime' => $startSignUpDateTime, 'stopSignUpDateTime' => $stopSignUpDateTime, 'stopDateTime' => $stopDateTime, 'votePerDay' => $votePerDay, 'shareUrl' => $shareUrl, 'afterShareUrl' => $afterShareUrl, 'shareTitle' => $shareTitle, 'shareDesc' => $shareDesc, 'shareImageUrl' => $shareImageUrl);
     // 执行添加
     $model = new WeVoteConfigModel();
     $result = $model->data($data)->add();
     if ($result !== false) {
         return $this->success('添加成功', addons_url('WeVote:/WeVote/Config'));
     } else {
         return $this->error('添加失败');
     }
 }
 private function CheckVoteDateTime($actionId)
 {
     $model = new WeVoteConfigModel();
     $data = $model->where('id = ' . $actionId)->find();
     if ($data === FALSE || !$data) {
         return 'fail';
     }
     $stopSignUpDateTime = strtotime($data['stopSignUpDateTime']);
     $stopDateTime = strtotime($data['stopDateTime']);
     $time = time();
     if ($time < $stopSignUpDateTime) {
         return 'nonStart';
     } else {
         if ($time > $stopDateTime) {
             return 'over';
         } else {
             return 'ok';
         }
     }
 }