本文整理汇总了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;
}
示例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'];
}