/** * load文件并给与权限判断 */ protected static function loadList($p_where = null, $p_order = null, $p_pageIndex = null, $p_pageSize = null, &$p_countThis = null, $isDetail = false) { $tmpResult = parent::loadList($p_where, $p_order, $p_pageIndex, $p_pageSize, $p_countThis, $isDetail); if (is_array($tmpResult) && array_key_exists('errorCode', $tmpResult)) { return $tmpResult; } switch ($auth = static::getAuthIfUserCanDoIt(Utility::getCurrentUserID(), $isDetail ? 'detail' : 'list', $tmpResult)) { case 'admin': //有管理权限 //有管理权限 case 'self': //作者 break; case 'normal': //正常用户 //正常用户 case 'draft': //未激活 //未激活 case 'pending': //待审禁言 //待审禁言 case 'disabled': //封号 //封号 case 'visitor': //游客 return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作'); break; case 'empty': //空 return Utility::getArrayForResults(RUNTIME_CODE_ERROR_DATA_EMPTY, '不存在对应数据'); break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作'); break; } PersonModel::$authViewDisabled = static::$authViewDisabledList[$auth]; return $tmpResult; }
/** * 注销登录 * @return [type] [description] */ public static function actionLogOut() { DeviceController::setDeviceWithUser(Utility::getHeaderValue('Devicetoken'), null); if (Utility::getCurrentUserID() <= 0) { return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '君未登录兮,谈何注销哈。'); } return Utility::getArrayForResults(RUNTIME_CODE_OK, '您已成功退出登录。'); }
public function getLocalNextAction() { $nextActions = JOB_STATUS::getNextAction(Utility::getCurrentUserID(), $this); $cancelActions = array(); foreach ($nextActions as $orderAction) { $strOfOrderStatus = JOB_STATUS::getStrOfStatus($orderAction); $strOfOrderStatus['nextaction'] = $strOfOrderStatus['status']; unset($strOfOrderStatus['status']); unset($strOfOrderStatus['statusStr']); unset($strOfOrderStatus['statusDescription']); if ($orderAction == JOB_STATUS::DRAFT) { $cancelActions[] = $strOfOrderStatus; } else { $nextActions[] = $strOfOrderStatus; } } return array('cancelActions' => $cancelActions, 'nextActions' => $nextActions); }
public static function actionList() { $p_where['status'] = STATUS_NORMAL; //默认列表页只筛选STATUS_NORMAL状态的数据 //根据权限不同,支持的筛选功能也可以不同 switch ($auther = static::getAuthIfUserCanDoIt(Utility::getCurrentUserID(), 'list')) { case 'admin': //有管理权限 $p_where['status'] = W2HttpRequest::getRequestInt('status'); //管理员可以筛选状态' $p_where['userID'] = W2HttpRequest::getRequestInt('uid'); //管理员可以筛选用户ID' break; case 'self': //作者 $p_where['userID'] = Utility::getCurrentUserID(); break; case 'normal': //正常用户 //正常用户 case 'draft': //未激活 //未激活 case 'pending': //待审禁言 //待审禁言 case 'disabled': //封号 //封号 case 'visitor': //游客 break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作'); break; } $_order = W2HttpRequest::getRequestString('order', false, ''); switch (strtolower($_order)) { case 'id': case 'userid': //发布用户ID //发布用户ID case 'status': //0: 不存在 1: 正常 2: 草稿 3:待审 //0: 不存在 1: 正常 2: 草稿 3:待审 case 'createtime': //创建时间 //创建时间 case 'modifytime': //修改时间 $p_order = $_order; break; case '': case 'default': $p_order = 'id'; break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_PARAM, '请使用可选的排序方案。'); break; } $p_countThis = -1; return static::aList($p_where, $p_order, $p_pageIndex = null, $p_pageSize = null, $p_countThis, $isDetail = false); }
public static function actionList() { $status = W2HttpRequest::getRequestInt('status'); $p_where = array(); switch ($auther = static::getAuthIfUserCanDoIt(Utility::getCurrentUserID(), 'list')) { case 'admin': //有管理权限 $p_where['bossID'] = W2HttpRequest::getRequestInt('userid'); $p_where['status'] = W2HttpRequest::getRequestInt('status', null, true, false, STATUS_NORMAL); //管理员可以筛选数据状态 break; case 'self': //作者 //作者 case 'normal': //正常用户 $p_where['bossID'] = Utility::getCurrentUserID(); if ($status == 0) { $p_where['status'] = STATUS_NORMAL; } else { $p_where['status'] = W2HttpRequest::getRequestInt('status', null, true, false, STATUS_NORMAL); //用户可以筛选数据状态 } break; case 'draft': //未激活 //未激活 case 'pending': //待审禁言 //待审禁言 case 'disabled': //封号 //封号 case 'visitor': //游客 break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作'); break; } $_order = W2HttpRequest::getRequestString('order', false, ''); switch (strtolower($_order)) { case 'id': case 'userid': //用户ID //用户ID case 'bossid': //技能名称 认证后不可更改 //技能名称 认证后不可更改 case 'missionid': //技能认证日期 //技能认证日期 case 'countdays': //认证机构 //认证机构 case 'status': //认证状态 0未认证 1已认证 2认证失败 $p_order = $_order; break; case '': case 'default': $p_order = 'id'; break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_PARAM, '请使用可选的排序方案。'); break; } $p_countThis = -1; return static::aList($p_where, $p_order, $p_pageIndex = null, $p_pageSize = null, $p_countThis, $isDetail = false); }
public static function actionList() { switch ($auther = static::getAuthIfUserCanDoIt(Utility::getCurrentUserID(), 'list')) { case 'admin': //有管理权限 if (Utility::getCurrentUserID('uid') != null) { $p_where['userid'] = W2HttpRequest::getRequestInt('uid'); } //管理员可以筛选用户 if (W2HttpRequest::getRequestInt('jobareaid') != null) { $p_where['jobareaid'] = W2HttpRequest::getRequestInt('jobareaid'); } //管理员可以筛选地区 if (W2HttpRequest::getRequestString('jobstartdate') != null) { $p_where['jobstartdate >= \'%s\''] = W2HttpRequest::getRequestString('jobstartdate'); } //管理员可以筛选开始时间 if (W2HttpRequest::getRequestString('jobenddate') != null) { $p_where['jobenddate <= \'%s\''] = W2HttpRequest::getRequestString('jobenddate'); } //管理员可以筛选结束时间 break; case 'self': //作者 //作者 case 'normal': //正常用户 $p_where['userID'] = Utility::getCurrentUserID('userid'); case 'draft': //未激活 //未激活 case 'pending': //待审禁言 //待审禁言 case 'disabled': //封号 //封号 case 'visitor': //游客 break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作'); break; } $_order = W2HttpRequest::getRequestString('order', false, ''); switch (strtolower($_order)) { case 'id': case 'userid': //用户ID //用户ID case 'jobAreaID': //地区ID //地区ID case 'jobStartDate': //开始时间 //开始时间 case 'jobEndDate': //结束时间 $p_order = $_order; break; case '': case 'default': $p_order = 'id'; break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_PARAM, '请使用可选的排序方案。'); break; } $p_countThis = -1; return static::aList($p_where, $p_order, $p_pageIndex = null, $p_pageSize = null, $p_countThis, $isDetail = false); }
/** * [getCurrentUserModel description] * @return UserModel 用户 */ public static function getCurrentUserModel() { $_clsHandler = USERHANDLER_NAME; $tmpModel = $_clsHandler::loadModelById(Utility::getCurrentUserID()); return $tmpModel; }
public static function actionList1() { $p_where = array(); $p_where['status'] = STATUS_NORMAL; //根据权限不同,支持的筛选功能也可以不同 switch ($auther = static::getAuthIfUserCanDoIt(Utility::getCurrentUserID(), 'list')) { case 'admin': //有管理权限 $p_where['status'] = W2HttpRequest::getRequestInt('status'); //管理员可以筛选状态 //管理员可以筛选状态 case 'self': //作者 //作者 case 'normal': //正常用户 $fid = W2HttpRequest::getRequestInt('fid'); if (empty($fid)) { $p_where['fID'] = 0; } else { $p_where['fID'] = $fid; } $p_where['majorname like \'%%%s%%\''] = W2HttpRequest::getRequestString('majorname'); case 'draft': //未激活 //未激活 case 'pending': //待审禁言 //待审禁言 case 'disabled': //封号 //封号 case 'visitor': //游客 break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作'); break; } $a = MajorHandler::getList($p_where, $content = array()); var_dump($a); // $p_countThis = -1; // return static::aList($p_where,$p_order = null,$p_pageIndex=null,$p_pageSize=null,$p_countThis,$isDetail = false); }
public static function actionList() { $p_where = array(); $p_where['status'] = STATUS_NORMAL; //根据权限不同,支持的筛选功能也可以不同 switch ($auther = static::getAuthIfUserCanDoIt(Utility::getCurrentUserID(), 'list')) { case 'admin': //有管理权限 $p_where['status'] = W2HttpRequest::getRequestInt('status'); //管理员可以筛选状态 //管理员可以筛选状态 case 'self': //作者 //作者 case 'normal': //正常用户 $p_where['areaId'] = W2HttpRequest::getRequestInt('areaId'); //用户可以筛选地区 $p_where['schoolName like \'%%%s%%\''] = W2HttpRequest::getRequestString('schoolName'); //用户可以筛选学校 $p_where['jiben'] = W2HttpRequest::getRequestString('jiben'); //用户可以筛选本科类别 //用户可以筛选本科类别 case 'draft': //未激活 //未激活 case 'pending': //待审禁言 //待审禁言 case 'disabled': //封号 //封号 case 'visitor': //游客 break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作'); break; } $p_countThis = -1; return static::aList($p_where, $p_order = null, $p_pageIndex = null, $p_pageSize = null, $p_countThis, $isDetail = false); }
public static function actionEvaluationList() { $p_where = array(); $p_where['status'] = STATUS_NORMAL; //默认列表页只筛选STATUS_NORMAL状态的数据 $p_where['missionStatus'] = 31; //0: 不存在 11: 接受报名并已预付款 21: 确认完成并付款 31:已评价 $p_where['qualityRate'] = W2HttpRequest::getRequestInt('qualityrate'); //服务质量评分 $p_where['manneryRate'] = W2HttpRequest::getRequestInt('manneryrate'); //服务态度评分 $p_where['speedRate'] = W2HttpRequest::getRequestInt('speedrate'); //服务速度评分 $p_where['commentContent'] = W2HttpRequest::getRequestString('commentcontent', false); //评语留言 $p_where['createTime >= \'%s\''] = W2HttpRequest::getRequestDateTime('createtimestart'); //创建时间 $p_where['createTime < \'%s\''] = W2HttpRequest::getRequestDateTime('createtimeend'); //创建时间 $p_where['modifyTime >= \'%s\''] = W2HttpRequest::getRequestDateTime('modifytimestart'); //修改时间 $p_where['modifyTime < \'%s\''] = W2HttpRequest::getRequestDateTime('modifytimeend'); //修改时间 switch ($auther = static::getAuthIfUserCanDoIt(Utility::getCurrentUserID(), 'list')) { case 'admin': //有管理权限 $p_where['userID'] = W2HttpRequest::getRequestInt('userid'); //管理员可以筛选用户ID $p_where['id in (%s)'] = W2HttpRequest::getRequestArrayString('ids', false, true); $p_where['id'] = W2HttpRequest::getRequestInt('id'); $p_where['jobID'] = W2HttpRequest::getRequestInt('jobid'); //任务ID $p_where['status'] = W2HttpRequest::getRequestInt('status', null, true, false, STATUS_NORMAL); //管理员可以筛选数据状态 $p_where['missionStatus'] = W2HttpRequest::getRequestInt('missionstatus'); //0: 不存在 11: 接受报名并已预付款 21: 确认完成并付款 31:已评价 //0: 不存在 11: 接受报名并已预付款 21: 确认完成并付款 31:已评价 case 'self': //作者 //作者 case 'normal': //正常用户 if ($auther == 'normal') { $p_where['userID'] = Utility::getCurrentUserID(); //普通用户,默认只能筛选自己名下数据。 } case 'draft': //未激活 //未激活 case 'pending': //待审禁言 //待审禁言 case 'disabled': //封号 //封号 case 'visitor': //游客 break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作'); break; } $_order = W2HttpRequest::getRequestString('order', false, ''); switch (strtolower($_order)) { case 'id': case 'userid': //用户ID //用户ID case 'jobid': //任务ID //任务ID case 'bossid': //雇主ID //雇主ID case 'qualityrate': //服务质量评分 //服务质量评分 case 'manneryrate': //服务态度评分 //服务态度评分 case 'speedrate': //服务速度评分 //服务速度评分 case 'commentcontent': //评语留言 //评语留言 case 'createtime': //创建时间 //创建时间 case 'modifytime': //修改时间 $p_order = $_order; break; case '': case 'default': $p_order = 'id'; break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_PARAM, '请使用可选的排序方案。'); break; } $p_countThis = 1; return static::aList($p_where, $p_order, $p_pageIndex = null, $p_pageSize = null, $p_countThis, $isDetail = false); }
public static function actionPushMessage() { $results = array(); switch ($auth = static::getAuthIfUserCanDoIt(Utility::getCurrentUserID(), 'push', null)) { case 'admin': //有管理权限 $title = W2HttpRequest::getRequestString('title', false); $content = W2HttpRequest::getRequestString('content', false); $type = W2HttpRequest::getRequestInt('type', 5, false, 1, 1); //1单人 2所有人 3所有安卓 4所有ios $customtype = W2HttpRequest::getRequestInt('customtype'); $customvalue = W2HttpRequest::getRequestString('customvalue'); $deployStatus = W2HttpRequest::getRequestInt('deploystatus', 2, false, 1, 2); W2PUSH::$DEPLOY_STATUS = $deployStatus; if ($content == '') { return Utility::getArrayForResults(RUNTIME_CODE_ERROR_PARAM, '请输入正确的推送内容'); } // $tag_name = 't'.date('G'); $tag_name = null; switch ($type) { case 1: //1单人 $userID = W2HttpRequest::getRequestInt('userid'); $telephone = W2HttpRequest::getRequestTelephone('telephone', false); if ($userID != null) { $results = array_merge($results, DeviceController::pushMessageToUser($userID, $title, $content, $customtype, $customvalue, $tag_name)); } else { if ($telephone != null) { $results = array_merge($results, DeviceController::pushMessageToTelephone($telephone, $title, $content, $customtype, $customvalue, $tag_name)); } else { return Utility::getArrayForResults(RUNTIME_CODE_ERROR_PARAM, '请输入正确的userid 或 telephone'); } } break; case 2: //2所有人 //2所有人 case 3: //3所有安卓 $push_type = 2; // 2部分人(*常用) $results[] = W2PUSH::pushMessage($push_type, $device_type = 3, $title, $content, $customtype, $customvalue, null, $tag_name); if ($type == 3) { break; } case 4: //4所有ios $push_type = 2; // 2部分人(*常用) $results[] = W2PUSH::pushMessage($push_type, $device_type = 4, $title, $content, $customtype, $customvalue, null, $tag_name); break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_PARAM, '请输入正确的推送类型'); break; } break; case 'self': //作者 //作者 case 'normal': //正常用户 //正常用户 case 'draft': //未激活 //未激活 case 'pending': //待审禁言 //待审禁言 case 'disabled': //封号 //封号 case 'visitor': //游客 //游客 default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作'); break; } $success_amount_total = 0; foreach ($results as $ret) { if (array_key_exists('result', $ret) && array_key_exists('response_params', $ret['result']) && array_key_exists('success_amount', $ret['result']['response_params'])) { $success_amount_total += $ret['result']['response_params']['success_amount']; } } return Utility::getArrayForResults(RUNTIME_CODE_OK, '', $results, array('success_amount_total' => $success_amount_total)); }