/** * function description * * @param * @return void */ public function execute($request) { /*$total = 90; $page = 8; $size = 10; $pager = new Util_Pager($total, $page, $size, "?page=%d&activeId=19"); $offset = $pager->getOffset(); $pager->setTotal($total); echo $pager->renderNav();*/ $model = new Sp_Account_Attendee(); $activeId = $request->activeId; $header = $model->GetTableHeaderByActiveId($activeId); if (false == $header) { $showHeader = $this->headers; } else { $showHeader = $this->getShowHeader($header); $showHeader = $model->getColumnFormArr($showHeader, 'title', 'field'); } $columns = array_keys($showHeader); array_push($columns, 'id'); $columns[] = 'status'; $columns[] = 'checkStatus'; $dataProvide = $model->AttendeeList($activeId, $columns); if ($request->format == 'json') { $arrary = array(); return $array; } else { /*$user = Sp_Account_User::current(); $user = Sp_Account_User::load($user->id);*/ $aid = $request->activeId; if (!is_numeric($aid)) { $this->show404(); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (empty($active)) { $this->show404(); } $view = new Sp_View(); $view->assign('active', $active); $view->assign('data', $dataProvide[1]); $view->assign('page', $dataProvide[0]); $view->assign('header', $showHeader); $view->assign('headerSet', json_encode($header)); $view->assign('activeId', $activeId); $view->assign('uploadInfo', $uploadInfo); $view->display("attendee/index.html"); } }
/** * function description * * @param * @return void */ public function execute($request) { $id = $request->id; if (empty($id)) { header("Location: " . SP_URL_HOME); exit; } $data = Sp_Account_Attendee::getAttendeeBySn($id); if (empty($data)) { header("Location: " . SP_URL_HOME); exit; } if ($request->type == 'code') { include LIB_ROOT . 'third/phpqrcode/qrlib.php'; $errorCorrectionLevel = "L"; $matrixPointSize = "6"; QRcode::png($id, false, $errorCorrectionLevel, $matrixPointSize); } else { $active = Sp_Active_Active::getActiveById($data['activeId']); if (empty($active)) { $this->show404(); } $data['sn'] = $this->formatSn($data['signId']); $view = new Sp_View(); $view->assign('data', $data); $view->assign('active', $active); $view->display("attendee/code.html"); } }
/** * @name 导入参会人名单 */ function importParticipants_cb($job) { global $log; $log->log(PHP_EOL . '-----------------------------'); $arg = $job->workload(); $invest_info = json_decode($arg, true); $log->log('接收参数'); if (!is_array($invest_info)) { $log->log("importParticipants 数据错误 " . json_encode($arg)); return false; } $log->log($invest_info); $log->log('处理开始'); $data = getExcelData($invest_info['fileDir']); if (is_array($data) && count($data) > 0) { $log->log('处理成功'); foreach ($data as $val) { $val['fromId'] = -1; $val['activeId'] = $invest_info['activeId']; $val['applyTime'] = time(); Sp_Account_Attendee::add($val); //Da_Wrapper::insert()->table("sp.huitong.ht_apply_data")->data($val)->execute(); } $log->log('插入成功'); } else { $log->log('处理失败'); } return TRUE; }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $activeId = $_POST['activeId']; unset($_POST['activeId']); $data = $this->dataFormat($_POST, $activeId); $model = new Sp_Account_Attendee(); if ($model->setTableHeader($data)) { $return = array('status' => 1, 'msg' => '表头设置成功'); } else { $return = array('status' => 0, 'msg' => '表头设置失败'); } return $return; } else { $view = new Sp_View(); $view->display("active/index.html"); } }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $id = $request->id; $aid = $request->aid; if (!is_numeric($id) || !is_numeric($aid)) { return array('status' => '-1', 'msg' => '参数错误'); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (is_array($active) && count($active) > 1) { $at = Sp_Account_Attendee::getAttendeeById($id); if ($at['activeId'] == $aid && $at['status'] == 0 && ($at['checkStatus'] == 0 || $at['checkStatus'] == 1)) { $row = Sp_Sendmsg::getSmsByPhone($at['phone'], 'attendee'); if (is_array($row) && count($row) < 3) { $nowDate = date("Y-m-d", time()); $msgDate = date("Y-m-d", $row['crttime']); if ($nowDate == $msgDate) { return array('status' => '-126', 'msg' => '该电子票已在当天发送过,不能重复发送。', 'data' => $shortArr); } } $code = $this->getSignIdCode($at); if (false == $code) { return array('status' => '-1', 'msg' => '生成电子票失败'); } $url = SP_URL_HOME . "attendee/code/" . $code . ".html"; $shortArr = Util_ShortUrl::shortSina($url); if ($shortArr === FALSE) { return array('status' => '-1', 'msg' => '生成电子票失败'); } else { $content = $at['name'] . "你好:你已报名成功" . $active['title'] . ",会议时间:" . date("Y-m-d H:i", $active['activit_start']) . " ~ " . date("Y-m-d H:i", $active['activit_start']) . ",会议地点:" . $active['address'] . "。您的电子票为" . $shortArr['url_short'] . ",签到码为" . $code . ",请保留此短信至会议结束。"; $sms = array(); $sms['username'] = $at['phone']; $sms['content'] = $content; $sms['type'] = 'attendee'; $sms['user_id'] = $user->id; Sp_Sendmsg::send($sms); if ($at['checkStatus'] == 0) { Sp_Account_Attendee::success($id); } return array('status' => '0', 'msg' => '发送成功'); } } else { return array('status' => '-1', 'msg' => '数据有误'); } } else { return array('status' => '-1', 'msg' => '数据有误'); } } }
/** * function description * * @param * @return void */ public function execute($request) { header("Content-type:text/html;charset=utf-8"); if ($request->format == 'json') { if (isset($_POST["_huitong_user"])) { $cookie_user = urldecode($_POST['_huitong_user']); $user = Sp_Account_User::parseStored($cookie_user); $activeId = $request->activeId; if (!is_numeric($user['id']) || $user['id'] < 1 || !is_numeric($activeId) || $activeId < 1) { $jsonParam = array('code' => '500', 'message' => '上传错误'); echo json_encode($jsonParam); exit; } $arrary = array(); $up = new Util_Upload(array('savepath' => UPLOAD_ROOT . 'attendee', 'subdirpattern' => 'Y/m/d', 'israndname' => true, 'allowtype' => array('xls', 'xlsx'), 'maxsize' => 5120000)); $up->uploadFile('file'); // input's name property $msg = $up->getErrorMsg(); $jsonParam = array(); if (empty($msg)) { $filename = $up->getUploadFileName(); if (is_readable($filename) == false) { $jsonParam = array('code' => '500', 'message' => '文件不可读'); echo json_encode($jsonParam); exit; } @chmod($filename, 0777); $data = array('userId' => $user['id'], 'fileDir' => $filename); $data['activeId'] = $activeId; $lastid = Sp_Account_Attendee::uploadLog($data); if ($lastid) { if (class_exists('GearmanClient')) { $client_active = MQClient::factory('participants'); $client_active->send('importParticipants', $data, false); } } $jsonParam = array('code' => '200', 'message' => 'ok', 'url' => '', 'time' => time()); } else { $jsonParam = array('code' => '500', 'message' => $msg); } echo json_encode($jsonParam); } else { $jsonParam = array('code' => '500', 'message' => '错误访问'); echo json_encode($jsonParam); } } }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $id = $request->id; $aid = $request->aid; if (!is_numeric($id) || !is_numeric($aid)) { return array('status' => '-1', 'msg' => '参数错误'); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (is_array($active) && count($active) > 1) { $at = Sp_Account_Attendee::getAttendeeById($id); if ($at['activeId'] == $aid && $at['checkStatus'] == 0) { $rs = Sp_Account_Attendee::refuse($id); return array('status' => '0', 'msg' => '拒绝成功'); } else { return array('status' => '-1', 'msg' => '数据有误'); } } else { return array('status' => '-1', 'msg' => '数据有误'); } } }
<?php /* * editor by carten */ define('ROOT_PATH', __DIR__ . '/../../../'); include_once ROOT_PATH . 'config/init.php'; //file_put_contents('1111.txt', $_POST); $request = Request::current(); $data = $request->data; file_put_contents("/sproot/logs/1111.txt", $data); $dataArr = json_decode($data); $model = new Sp_Account_Attendee(); $i = 0; foreach ($dataArr as $value) { $signIn[$i] = intval($value['id']); $i++; } $model->signAndDelete($signIn, 1); $jsonParam = array("code" => "200", "msg" => "上传成功"); header('Content-type: application/json;charset=utf-8'); echo json_encode($jsonParam);
return $data; } function check($activeId, $UId) { if (false == $activeId || false == $UId) { return false; } if (false == is_numeric($activeId) || false == is_numeric($UId)) { return false; } return true; } $jsonParam = array(); $request = Request::current(); $activeId = $request->activeId; $UId = $request->uid; $pageSize = $request->pageSize; $page = $request->page; if (check($activeId, $UId)) { $model = new Sp_Account_Attendee($UId); if (false == $model) { $jsonParam = array("code" => "201", "msg" => "请求参数错误"); } else { $dataProvide = $model->getAttendeeListForApi($activeId, $pageSize, $page); $jsonParam = array("code" => "200", "msg" => "", "count" => $dataProvide[0], "data" => $dataProvide[1]); } } else { $jsonParam = array("code" => "201", "msg" => "请求参数错误"); } header('Content-type: application/json;charset=utf-8'); echo json_encode($jsonParam);
public function insert($data) { $data['applyTime'] = time(); $data['firstChater'] = Sp_Dictionary::getFirstCharter($data['name']); try { $id = Sp_Account_Attendee::add($data); } catch (PDOException $e) { $id = false; } return $id < 1 ? false : $id; }
$request = Request::current(); $signNo = $request->signNo; $activeId = $request->active_Id; file_put_contents("/sproot/logs/1111_sign_line.txt", "signNo:" . $signNo . ",activeId:" . $activeId); $patternMobile = Sp_Dictionary::getOtherOption("patternMobile"); if (preg_match($patternMobile, $signNo)) { $where = array("phone" => $signNo, "activeId" => $activeId); } else { $where = array("signId" => $signNo); } $signId = Da_Wrapper::select()->table("sp.huitong.ht_apply_data")->columns('Id,status')->where($where)->getRow(); if (!$signId['Id']) { $jsonParam = array("code" => "204", "msg" => "签到码不存在"); } else { if (1 == $signId['status']) { $jsonParam = array("code" => "205", "msg" => "签到码已使用"); } else { if (-1 == $signId['status']) { $jsonParam = array("code" => "206", "msg" => "签到码无效"); } else { if (0 == $signId['status']) { $model = new Sp_Account_Attendee(); if ($model->signAndDelete(array($signId["Id"]), 1)) { $jsonParam = array("code" => "200", "msg" => "恭喜您,签到成功"); } } } } } header('Content-type: application/json;charset=utf-8'); echo json_encode($jsonParam);
public function attendeeDelete($data) { if (!is_array($data)) { $data = explode(",", $data); } $Model = new Sp_Account_Attendee(); $return = $Model->signAndDelete($data, -1); if ($return) { return array("status" => 1, "msg" => "删除成功"); } return array("status" => 0, "msg" => "删除失败"); }