當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。