当前位置: 首页>>代码示例>>PHP>>正文


PHP UserQuery::model方法代码示例

本文整理汇总了PHP中UserQuery::model方法的典型用法代码示例。如果您正苦于以下问题:PHP UserQuery::model方法的具体用法?PHP UserQuery::model怎么用?PHP UserQuery::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserQuery的用法示例。


在下文中一共展示了UserQuery::model方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getQueryConditionById

 public static function getQueryConditionById($queryId)
 {
     $resultInfo = array();
     $queryInfo = UserQuery::model()->findByPk($queryId);
     if ($queryInfo == null) {
         $resultInfo['status'] = CommonService::$ApiResult['FAIL'];
         $resultInfo['detail']['id'] = 'query not existed';
         return $resultInfo;
     } else {
         $userAccessableProductIdArr = Yii::app()->user->getState('visit_product_id');
         if (!in_array($queryInfo['product_id'], $userAccessableProductIdArr)) {
             $resultInfo['status'] = CommonService::$ApiResult['FAIL'];
             $resultInfo['detail']['id'] = 'has not visit right';
             return $resultInfo;
         }
     }
     $parsedQueryInfo = array();
     $parsedQueryInfo['product_id'] = $queryInfo['product_id'];
     $parsedQueryInfo['query_type'] = $queryInfo['query_type'];
     $parsedQueryInfo['title'] = $queryInfo['title'];
     $searchArr['leftParenthesesName'] = unserialize($queryInfo->left_parentheses);
     $searchArr['field'] = unserialize($queryInfo->fieldlist);
     $searchArr['operator'] = unserialize($queryInfo->operatorlist);
     $searchArr['value'] = unserialize($queryInfo->valuelist);
     $searchArr['rightParenthesesName'] = unserialize($queryInfo->right_parentheses);
     $searchArr['andor'] = unserialize($queryInfo->andorlist);
     $returnArr = array();
     $fieldCount = count($searchArr['field']);
     $keyArr = array('leftParenthesesName', 'field', 'operator', 'value', 'rightParenthesesName', 'andor');
     for ($i = 0; $i < $fieldCount; $i++) {
         $rowArr = array();
         foreach ($keyArr as $key) {
             $rowArr[$key] = $searchArr[$key][$i];
         }
         $returnArr[] = $rowArr;
     }
     $parsedQueryInfo['search_condition'] = $returnArr;
     $resultInfo['status'] = CommonService::$ApiResult['SUCCESS'];
     $resultInfo['detail'] = $parsedQueryInfo;
     return $resultInfo;
 }
开发者ID:mjrao,项目名称:BugFree,代码行数:41,代码来源:UserQueryService.php

示例2: actionDeleteTemplateOrQuery

 public function actionDeleteTemplateOrQuery()
 {
     $id = $_GET['id'];
     $type = $_GET['type'];
     if ('template' == $type) {
         $tmpInfo = UserTemplate::model()->findByAttributes(array('id' => $id, 'created_by' => Yii::app()->user->id));
     } elseif ('query' == $type) {
         $tmpInfo = UserQuery::model()->findByAttributes(array('id' => $id, 'created_by' => Yii::app()->user->id));
     }
     if ($tmpInfo !== null) {
         $tmpInfo->delete();
     }
     echo CommonService::$ApiResult['SUCCESS'];
 }
开发者ID:riccoyu,项目名称:BugFree,代码行数:14,代码来源:SearchController.php


注:本文中的UserQuery::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。