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


PHP BaseAction::run方法代码示例

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


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

示例1: run

 public function run()
 {
     Yii::trace(get_class($this) . '.run()');
     $controller = parent::run();
     $json = isset($this->request->json) ? $this->request->json : false;
     if ($json) {
         $offset = isset($json->offset) ? $json->offset : 0;
         $pageSize = isset($json->pageSize) ? $json->pageSize : 10;
         $keyword = isset($json->keyword) ? $json->keyword : false;
         $result = DreamNovel::model()->getNovelSearch($keyword, $offset, $pageSize);
         $ls_count = $result['count'];
         if ($keyword) {
             $is_query = DreamNovelQuery::model()->find('query=:query', array(':query' => $keyword));
             if ($is_query) {
                 $ls_count = $is_query->counts;
                 $is_query->results = $ls_count;
                 $is_query->counts = $ls_count + 1;
                 $is_query->save(false);
             } else {
                 $new_query = new DreamNovelQuery();
                 $new_query->query = $keyword;
                 $new_query->results = $result['count'];
                 $new_query->counts = 1;
                 $new_query->save(false);
             }
         }
         $this->response->counts = $ls_count;
         return $this->response->novel_list = $result['data'];
     }
     return $this->response->code = 500;
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:31,代码来源:NovelSearchAction.php

示例2: run

 public function run()
 {
     Yii::trace(get_class($this) . '.run()');
     $controller = parent::run();
     $json = isset($this->request->json) ? $this->request->json : false;
     $app_code = isset($this->request->appCode) ? $this->request->appCode : false;
     $app_version = isset($this->request->appVersion) ? $this->request->appVersion : false;
     if ($json && $app_code && $app_version) {
         //push type 1:push 2:screen
         $push_type = isset($json->type) ? $json->type : 1;
         //检查当前应用是否有推送任务
         $push_ids = DreamPushAppRelative::model()->checkPushStatus($app_code, $push_type);
         //获取当前有效的广告推送任务
         $push_ads = DreamPushTask::model()->getPushTasks($push_ids, $push_type);
         //get baidu cpd AD
         $uuid = isset($json->uuid) ? $json->uuid : false;
         $imei = isset($json->imei) ? $json->imei : false;
         if ($app_version >= 200) {
             if ($uuid || $imei) {
                 $push_ads = Util::getBaiduAd($uuid, $imei, $push_ads);
             }
         }
         if ($push_ads) {
             $this->response->push = array_values($push_ads);
         } else {
             $this->response->push = null;
         }
         return $this->response->code = 200;
     }
     return $this->response->code = 500;
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:31,代码来源:PushAction.php

示例3: run

 public function run()
 {
     Yii::trace(get_class($this) . '.run()');
     $controller = parent::run();
     $json = isset($this->request->json) ? $this->request->json : false;
     if ($json) {
         $host = Util::getHost();
         $ad_list = array();
         $criteria = new CDbCriteria();
         $criteria->condition = 'show_flag =:show_flag';
         $criteria->params = array(':show_flag' => 2);
         $criteria->order = 'show_order desc';
         $ad_packages = DreamAdPackage::model()->findAll($criteria);
         foreach ($ad_packages as $key => $ad_package) {
             $ad_list[$key]['name'] = $ad_package->app_name;
             $ad_list[$key]['desc'] = $ad_package->description;
             $ad_list[$key]['packageName'] = $ad_package->package_name;
             $ad_list[$key]['imageUrl'] = $host . $ad_package->icon_url;
             $apkUrl = strpos($ad_package->download_url, '://') ? $ad_package->download_url : $host . $ad_package->download_url;
             $ad_list[$key]['apkUrl'] = $apkUrl;
             $ad_list[$key]['size'] = Util::formatFileSize($ad_package->file_size);
             $ad_list[$key]['buttonName'] = '下载';
         }
         if ($ad_list) {
             $this->response->json = array_values($ad_list);
         } else {
             $this->response->json = null;
         }
         return $this->response->code = 200;
     }
     return $this->response->code = 500;
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:32,代码来源:RootAction.php

示例4: run

 public function run()
 {
     Yii::trace(get_class($this) . '.run()');
     $controller = parent::run();
     $json = isset($this->request->json) ? $this->request->json : false;
     if ($json) {
         $offset = isset($json->offset) ? $json->offset : 0;
         $pageSize = isset($json->pageSize) ? $json->pageSize : 10;
         $sort = isset($json->sort) ? $json->sort : false;
         $sort_type = isset($json->sort_type) ? $json->sort_type : false;
         $category_id = isset($json->category_id) ? $json->category_id : false;
         $this->response->category = DreamNovelCategory::model()->getCategoryList();
         $result = DreamNovel::model()->getNovelDetail($category_id, $sort, $sort_type, $offset, $pageSize);
         $this->response->counts = $result['count'];
         return $this->response->novel_list = $result['data'];
     }
     return $this->response->code = 500;
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:18,代码来源:NovelListAction.php

示例5: run

 public function run()
 {
     Yii::trace(get_class($this) . '.run()');
     $controller = parent::run();
     $json = isset($this->request->json) ? $this->request->json : false;
     $app_code = isset($this->request->appCode) ? $this->request->appCode : false;
     if ($json && $app_code) {
         $uuid = false;
         $sn = isset($json->sn) ? $json->sn : false;
         $imei = isset($json->imei) ? $json->imei : false;
         $imei2 = isset($json->imei2) ? $json->imei2 : false;
         $wifimac = isset($json->wifimac) ? $json->wifimac : false;
         if ($sn || $imei || $imei2 || $wifimac) {
             $criteria = new CDbCriteria();
             $criteria->condition = 'sn =:sn and imei =:imei and imei2 =:imei2 and wifimac =:wifimac';
             $criteria->params = array(':sn' => $sn, ':imei' => $imei, ':imei2' => $imei2, ':wifimac' => $wifimac);
             $device_info = DreamDevice::model()->find($criteria);
             if ($device_info) {
                 $uuid_info = DreamDeviceUuid::model()->find('device_id =:device_id', array(':device_id' => $device_info->id));
                 if ($uuid_info) {
                     $uuid = $uuid_info->uuid;
                 } else {
                     $uuid = DreamDeviceUuid::model()->createUuid($app_code, $device_info->id);
                 }
             } else {
                 $device_info = new DreamDevice();
                 $device_info->sn = $sn;
                 $device_info->imei = $imei;
                 $device_info->imei2 = $imei2;
                 $device_info->wifimac = $wifimac;
                 $device_info->setIsNewRecord(true);
                 if ($device_info->save(false)) {
                     $uuid = DreamDeviceUuid::model()->createUuid($app_code, $device_info->id);
                 }
             }
             if ($uuid) {
                 return $this->response->uuid = $uuid;
             } else {
                 return $this->response->code = 404;
             }
         }
     }
     return $this->response->code = 500;
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:44,代码来源:UuidAction.php

示例6: run

 public function run()
 {
     Yii::trace(get_class($this) . '.run()');
     $controller = parent::run();
     $json = isset($this->request->json) ? $this->request->json : false;
     if ($json) {
         //判断wifi收集还是匹配 0:收集 1:匹配
         $type = isset($json->type) ? $json->type : 0;
         $wifi = isset($json->wifi) ? $json->wifi : array();
         if ($wifi) {
             $i = 0;
             $wifi_password = array();
             foreach ($wifi as $wifi_each) {
                 $ssid = isset($wifi_each->ssid) ? $wifi_each->ssid : '';
                 if ($ssid) {
                     $mode = isset($wifi_each->mode) ? $wifi_each->mode : '';
                     $password = isset($wifi_each->password) ? $wifi_each->password : '';
                     $criteria = new CDbCriteria();
                     if ($mode) {
                         $criteria->condition = 'ssid =:ssid and mode =:mode';
                         $criteria->params = array(':ssid' => $ssid, ':mode' => $mode);
                     } else {
                         $criteria->condition = 'ssid =:ssid';
                         $criteria->params = array(':ssid' => $ssid);
                     }
                     if ($type) {
                         $wifi_info = DreamWifiSsid::model()->findAll($criteria);
                         if ($wifi_info) {
                             foreach ($wifi_info as $wifi_info_each) {
                                 $wifi_password[$i]['ssid'] = $wifi_info_each->ssid;
                                 $wifi_password[$i]['password'] = $wifi_info_each->password;
                                 $i++;
                             }
                         }
                     } else {
                         $wifi_info = DreamWifiSsid::model()->find($criteria);
                         if ($wifi_info) {
                             $wifi_info->password = $password;
                             $wifi_info->save(false);
                         } else {
                             $wifi_info = new DreamWifiSsid();
                             $wifi_info->ssid = $ssid;
                             $wifi_info->mode = $mode;
                             $wifi_info->password = $password;
                             $wifi_info->setIsNewRecord(true);
                             $wifi_info->save(false);
                         }
                     }
                 }
             }
             if ($type) {
                 if ($wifi_password) {
                     return $this->response->password = array_values($wifi_password);
                 } else {
                     return $this->response->code = 404;
                 }
             } else {
                 return $this->response->code = 200;
             }
         }
         return $this->response->code = 250;
     }
     return $this->response->code = 500;
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:64,代码来源:CollectAction.php

示例7: run

 public function run()
 {
     Yii::trace(get_class($this) . '.run()');
     $controller = parent::run();
     $json = isset($this->request->json) ? $this->request->json : false;
     if ($json) {
         $uid = isset($json->uid) ? $json->uid : false;
         $task_id = isset($json->task_id) ? $json->task_id : false;
         if ($uid && $task_id) {
             //task finish
             $today = date('Y-m-d');
             $task_is_daily = DreamNovelTask::model()->checkDaily($task_id);
             if ($task_is_daily) {
                 $taskRecord = DreamNovelUserTask::model()->find('uid=:uid and task_id =:task_id and date =:date', array(':uid' => $uid, ':task_id' => $task_id, ':date' => $today));
                 if ($taskRecord) {
                     $this->response->code = 250;
                 } else {
                     $taskRecord = new DreamNovelUserTask();
                     $taskRecord->uid = $uid;
                     $taskRecord->task_id = $task_id;
                     $taskRecord->task_detail = 0;
                     $taskRecord->date = $today;
                     $taskRecord->setIsNewRecord(true);
                     if ($taskRecord->save(false)) {
                         $status = DreamNovelUserInfo::model()->updateCoin($uid, $task_id, 'plus');
                         if ($status) {
                             $this->response->code = 200;
                         }
                     } else {
                         $this->response->code = 404;
                     }
                 }
             } else {
                 $novel_id = isset($json->novel_id) ? $json->novel_id : false;
                 if ($novel_id) {
                     $novel_info = DreamNovel::model()->find('id =:id', array(':id' => $novel_id));
                     if ($novel_info) {
                         $taskRecord = DreamNovelUserTask::model()->find('uid=:uid and task_id =:task_id and task_detail =:task_detail', array(':uid' => $uid, ':task_id' => $task_id, ':task_detail' => $novel_id));
                         if ($taskRecord) {
                             $this->response->download = Util::getHost() . $novel_info->download;
                         } else {
                             $user_coin = DreamNovelUserInfo::model()->getCoin($uid);
                             if ($user_coin >= $novel_info->price) {
                                 $taskRecord = new DreamNovelUserTask();
                                 $taskRecord->uid = $uid;
                                 $taskRecord->task_id = $task_id;
                                 $taskRecord->task_detail = $novel_id;
                                 $taskRecord->date = $today;
                                 $taskRecord->setIsNewRecord(true);
                                 if ($taskRecord->save(false)) {
                                     $status = DreamNovelUserInfo::model()->updateCoin($uid, $novel_info->price, 'minus');
                                     if ($status) {
                                         $this->response->download = Util::getHost() . $novel_info->download;
                                         $ls_novel_hot = $novel_info->hot;
                                         $novel_info->hot = $ls_novel_hot + 1;
                                         $novel_info->save(false);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             return $this->response->coin = DreamNovelUserInfo::model()->getCoin($uid);
         } else {
             $this->response->coin = DreamNovelUserInfo::model()->getCoin($uid);
             $this->response->category = DreamNovelCategory::model()->getCategoryList();
             return $this->response->task_list = DreamNovelTask::model()->getTaskList();
         }
     }
     return $this->response->code = 500;
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:72,代码来源:TaskListAction.php


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