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


PHP Converter::convertModelToArray方法代码示例

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


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

示例1: actionGetCurrentQuestion

 public function actionGetCurrentQuestion()
 {
     $customer_id = $this->getParam('customer_id');
     $flag = $this->getParam('flag');
     $current_id = array();
     if ($flag == 'today') {
         $current_id = 2;
     } else {
         $current_id = 1;
     }
     $question = Converter::convertModelToArray(HiQuestion::model()->findByPk($current_id));
     $answers = Converter::convertModelToArray(HiQuestionAnswer::model()->with('customer')->findAllByAttributes(array('customer_id' => $customer_id, 'question_id' => $current_id)));
     if ($flag == 'today') {
         $question['has_answered'] = 0;
         $year = date('Y');
         foreach ($answers as $k => $v) {
             if (strpos('date' . $v['insert_date'], $year)) {
                 $question['has_answered'] = 1;
             }
         }
     } else {
         $question['has_answered'] = 1;
     }
     $question['answers'] = $answers;
     EchoUtility::echoMsgTF($question, '获取问题', $question);
 }
开发者ID:Veaer,项目名称:StoryAppendDemo-Server,代码行数:26,代码来源:QuestionController.php

示例2: actionGetArticleById

 public function actionGetArticleById()
 {
     $article_id = $this->getParam('article_id');
     $customer_id = $this->getParam('customer_id');
     $article = Converter::convertModelToArray(HiPushArticle::model()->with('sections')->findByPk($article_id));
     $c = new CDbCriteria();
     $c->addCondition("article_ids LIKE '%\"" . (int) $article_id . "\"%' and customer_id = " . $customer_id);
     $article['is_favourite'] = HiPushArticleFavourite::model()->count($c);
     EchoUtility::echoMsgTF(1, '获取文章', $article);
 }
开发者ID:Veaer,项目名称:StoryAppendDemo-Server,代码行数:10,代码来源:PushArticleController.php

示例3: actionGetHomeData

 public function actionGetHomeData()
 {
     $result = array();
     $story_c = new CDbCriteria();
     $story_c->addCondition('follow_count != 0');
     $story_c->order = 'follow_count DESC';
     $stories = Converter::convertModelToArray(HiStory::model()->with('customer')->findAll($story_c));
     $result['story'] = $stories[0];
     $article = Converter::convertModelToArray(HiPushArticle::model()->findByPk(Yii::app()->time_service->getIndex()));
     $result['article'] = $article;
     $question = Converter::convertModelToArray(HiQuestion::model()->findByPk(2));
     $question['cover_image'] = 'http://77fkpo.com5.z0.glb.clouddn.com/603b2cffffeb7c5c950a4c9517e8ee9e.jpg';
     $result['question'] = $question;
     $book = Converter::convertModelToArray(HiBook::model()->with('customer')->findByPk(1));
     $result['book'] = $book;
     EchoUtility::echoMsgTF(true, '获取首页数据', $result);
 }
开发者ID:Veaer,项目名称:StoryAppendDemo-Server,代码行数:17,代码来源:HomeController.php

示例4: actionAddComment

 public function actionAddComment()
 {
     $section_id = $this->getParam('section_id');
     $story_id = $this->getParam('story_id');
     $customer_id = $this->getParam('customer_id');
     $content = $this->getParam('content');
     $orig_customer_id = $this->getParam('orig_customer_id');
     $newComment = new HiStoryComment();
     $newComment['customer_id'] = $customer_id;
     if (isset($section_id)) {
         $newComment['section_id'] = $section_id;
     }
     if (isset($story_id)) {
         $newComment['story_id'] = $story_id;
     }
     $newComment['orig_customer_id'] = $orig_customer_id;
     $newComment['content'] = $content;
     $newComment['insert_time'] = date('Y-m-d H:i:s', time());
     $newComment->insert();
     $comment = Converter::convertModelToArray(HiStoryComment::model()->with('customer')->findByPk($newComment->getPrimaryKey()));
     EchoUtility::echoMsgTF(1, '插入评论', $comment);
 }
开发者ID:Veaer,项目名称:StoryAppendDemo-Server,代码行数:22,代码来源:StoryCommentController.php

示例5: actionGetBookDetail

 public function actionGetBookDetail()
 {
     $book_id = $this->getParam('book_id');
     $book = Converter::convertModelToArray(HiBook::model()->with('customer')->findByPk($book_id));
     EchoUtility::echoMsgTF(1, '获取书籍', $book);
 }
开发者ID:Veaer,项目名称:StoryAppendDemo-Server,代码行数:6,代码来源:BookController.php

示例6: actionOverdueProducts

 public function actionOverdueProducts()
 {
     //取所有上架商品
     $c = new CDbCriteria();
     $c->select = 'product_id';
     $c->addCondition('status = 3');
     $products = HtProduct::model()->findAll($c);
     $products = Converter::convertModelToArray($products);
     $need_sendmail_products = array();
     //取价格计划即将到期或已经过期的商品
     if (is_array($products) && count($products) > 0) {
         foreach ($products as $product) {
             $plans = HtProductPricePlan::model()->findAll('product_id=' . $product['product_id']);
             $plans = Converter::convertModelToArray($plans);
             if (is_array($plans) && count($plans) > 0) {
                 if ($plans[0]['valid_region'] == 0) {
                     //整个区间
                     $date_rule = HtProductDateRule::model()->findByPk($product['product_id']);
                     if ($date_rule) {
                         $to_date = strtotime($date_rule['to_date']);
                         $today = strtotime(date('Y-m-d', time()));
                         if (($to_date - $today) / 86400 <= 15) {
                             $need_sendmail_products[$product['product_id']] = $date_rule['to_date'];
                         }
                     }
                 } else {
                     $to_dates = array();
                     foreach ($plans as $plan) {
                         $to_dates[] = $plan['to_date'];
                     }
                     array_multisort($to_dates, SORT_DESC, $plans);
                     $to_date = strtotime($plans[0]['to_date']);
                     $today = strtotime(date('Y-m-d', time()));
                     if (($to_date - $today) / 86400 <= 15) {
                         $need_sendmail_products[$product['product_id']] = $plans[0]['to_date'];
                     }
                 }
             }
         }
     }
     //发送邮件给供应商负责人
     if (count($need_sendmail_products) > 0) {
         $mail_list = array();
         foreach ($need_sendmail_products as $n => $m) {
             $product_manager = HtProductManager::model()->find('product_id = ' . $n);
             if ($product_manager['manager_name']) {
                 $mail_list[$product_manager['manager_name']][] = "产品ID:{$n},售卖截止时间为{$m},点击<a href='http://backend.hitour.cc/admin/product/edit?product_id=" . $n . "#/editProductPrice'>编辑</a>产品价格体系";
             }
         }
         if (count($mail_list) > 0) {
             foreach ($mail_list as $k => $v) {
                 Mail::sendToOP($k, '售卖即将过期或已过期商品', implode('<br>', $v), 1, '');
             }
         }
     }
 }
开发者ID:Veaer,项目名称:StoryAppendDemo-Server,代码行数:56,代码来源:CheckCommand.php

示例7: actionGetMyComment

 public function actionGetMyComment()
 {
     $orig_customer_id = $this->getParam("customer_id");
     $c = new CDbCriteria();
     $c->addCondition('sc.orig_customer_id = ' . $orig_customer_id);
     $c->group = 'sc.story_id';
     $comments = Converter::convertModelToArray(HiStoryComment::model()->with('story', 'customer')->findAll($c));
     EchoUtility::echoMsgTF(true, '获取评论', $comments);
 }
开发者ID:Veaer,项目名称:StoryAppendDemo-Server,代码行数:9,代码来源:AccountController.php

示例8: actionGetOrderOut

 public function actionGetOrderOut($order_id, $method = '')
 {
     $sql = 'SELECT * FROM ht_order WHERE order_id="' . $order_id . '"';
     $order = Yii::app()->db->createCommand($sql)->queryRow();
     if (empty($order)) {
         echo "Not found order[" . $order_id . "]\n\n";
     } else {
         $order_product = HtOrderProduct::model()->with('product.description')->findByAttributes(array('order_id' => $order_id));
         $order_product = Converter::convertModelToArray($order_product);
         $order['product_id'] = $order_product['product_id'];
         $order['supplier_id'] = $order_product['product']['supplier_id'];
         $out_order_id = PayUtility::genOutTradeNo($order, $order['payment_method']);
         echo 'Order[' . $order_id . '] out_order_id is [' . $out_order_id . ']' . "\n\n";
     }
 }
开发者ID:Veaer,项目名称:StoryAppendDemo-Server,代码行数:15,代码来源:TestCommand.php

示例9: actionGetStoryList

 public function actionGetStoryList()
 {
     $start = $this->getParam('start');
     $num = $this->getParam('num');
     $c = new CDbCriteria();
     $c->offset = $start;
     $c->limit = $num;
     $stories = Converter::convertModelToArray(HiStory::model()->with('customer')->findAll($c));
     $result = array();
     if (count($stories) < $num) {
         $result['has_more'] = false;
     } else {
         $result['has_more'] = true;
     }
     $result['story_list'] = $stories;
     $result['success'] = true;
     EchoUtility::echoMsgTF(1, '获取段子列表', $result);
 }
开发者ID:Veaer,项目名称:StoryAppendDemo-Server,代码行数:18,代码来源:StoryController.php


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