本文整理汇总了PHP中Service::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::model方法的具体用法?PHP Service::model怎么用?PHP Service::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$id = Yii::app()->request->getParam('id');
$name = Yii::app()->request->getParam('name');
$email = Yii::app()->request->getParam('email');
$phone = Yii::app()->request->getParam('phone');
$website = Yii::app()->request->getParam('website');
$logo = Yii::app()->request->getParam('logo');
$background = Yii::app()->request->getParam('background');
$location = Yii::app()->request->getParam('location');
$hub = Yii::app()->request->getParam('hub');
$service = Yii::app()->request->getParam('service');
$facebook = Yii::app()->request->getParam('facebook');
$linkedin = Yii::app()->request->getParam('linkedin');
$introduction = Yii::app()->request->getParam('content');
$data = array('name' => $name, 'email' => $email, 'phone' => $phone, 'website' => $website, 'logo' => $logo, 'background' => $background, 'location' => $location, 'hubId' => $hub, 'serviceid' => $service, 'facebookid' => $facebook, 'linkedinid' => $linkedin, 'introduction' => $introduction);
$proxy = new BCompany();
$dp = new BHub();
$dc = Service::model()->findAll('status!=0');
if (Yii::app()->request->isAjaxRequest) {
$result = $proxy->updateCompany($data, $id);
echo CJSON::encode($result);
} else {
$result = $proxy->getCompanyInfo($id);
$hub = $dp->getHubList($start, 10);
if ($result['code'] == 200) {
$this->controller->render('edit', array('data' => $result['data'], 'hub' => $hub['data'], 'service' => $dc));
} else {
throw new CHttpException($result['code'], $result['message']);
}
}
}
示例2: getOrganName
public static function getOrganName()
{
$organName = Yii::app()->user->getState('organName');
if ($organName) {
return $organName;
}
//先获取角色身份(生产商/经销商/修理厂)
$organName = "";
// $userid = Yii::app()->user->id;
$userid = Commonmodel::getOrganID();
$model = self::getIdentity($userid);
if ($model['identity'] == 1) {
$organ = MakeOrgan::model()->find('userID=:userid', array(':userid' => $userid));
$organName = $organ['name'];
} else {
if ($model['identity'] == 2) {
$organ = Dealer::model()->find('userID=:userid', array(':userid' => $userid));
$organName = $organ['organName'];
} else {
if ($model['identity'] == 3) {
$organ = Service::model()->find('userId=:userid', array(':userid' => $userid));
$organName = $organ['serviceName'];
}
}
}
Yii::app()->user->setState('organName', $organName);
return $organName;
}
示例3: loadModel
public function loadModel($id)
{
if (($model = Service::model()->findByPk($id)) === null) {
throw new CHttpException(404, 'Страница не найдена');
}
return $model;
}
示例4: run
public function run()
{
$start = Yii::app()->request->getParam('start');
$dp = new BHub();
$dc = Service::model()->findAll('status!=0');
$hub = $dp->getHubList($start, 10);
$this->controller->render('edit', array('hub' => $hub['data'], 'service' => $dc));
}
示例5: actionUpdate
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
$model = $this->loadModel($id);
$this->_operate($model, 'update');
$listGames = Games::model()->findAll();
$listService = Service::model()->findAll();
$this->render('update', array('model' => $model, 'listGames' => $listGames, 'listService' => $listService));
}
示例6: actionShow
public function actionShow($alias)
{
$model = Service::model()->published()->with(array('slides' => array('scopes' => 'published', 'order' => 'slides.sort ASC')))->findByAlias($alias);
if (!$model) {
throw new CHttpException(404);
}
$this->render('show', array('model' => $model));
}
示例7: run
public function run()
{
$models = Service::model()->published()->findAll(array('order' => 't.sort ASC'));
if (empty($models)) {
return;
}
$this->render($this->view, array('models' => $models));
}
示例8: getAvailableServices
public static function getAvailableServices()
{
$services = Service::model()->findAll("type <> '{ServiceHelper::TYPE_SMALL_BUSINESS}'");
$result = array(null => 'Отсутствует');
foreach ($services as $service) {
$result[$service->id] = $service->title;
}
return $result;
}
示例9: actionSave
public function actionSave()
{
$services = Service::model()->findAllByAttributes(['status' => 0]);
foreach ($services as $service) {
$traffic = new Traffic();
$traffic->attributes = ['uid' => $service->uid, 'email' => $service->email, 'date' => date('Y-m-d', strtotime('yesterday')), 'traffic' => $service->used];
$traffic->save();
}
echo "Success";
}
示例10: traffic
public function traffic()
{
$traffic = Service::model()->sum('traffic');
$serv1 = Service::model()->findByPk(1);
$serv2 = Service::model()->findByPk(2);
$traffic -= $serv1->traffic + $serv2->traffic;
$used = Service::model()->sum('left');
$left = $traffic - $used;
$this->response(200, 'success', [['name' => '收益', 'value' => ['总额' => round($traffic / 100 / 1024 * 0.8, 2), '销售' => round($used / 100 / 1024 * 0.8, 2), '库存' => round($left / 100 / 1024 * 0.8, 2)]], ['name' => '已使用', 'value' => $used / 100], ['name' => '未使用', 'value' => $left / 100]]);
}
示例11: run
public function run($id)
{
$community = new CCommunity();
$result = $community->getCompanyListByService($id);
$title = Service::model()->findByAttributes(array('id' => $id))->name;
$this->controller->pageTitle = $title;
if ($result['code'] == 200) {
$this->controller->bodyCss = 'whitecolor';
$this->controller->render('servicescompany', array('list' => $result['data']));
}
}
示例12: actionDetail
public function actionDetail($alias)
{
$model = $this->loadModelByPKID($alias);
$this->pageTitle = 'List of Service with type: ' . $model->s_name;
$models = Service::model()->findAll('s_service_type_id = :s_service_type_id and s_store_id = :s_store_id', array(':s_service_type_id' => $model->pk_s_id, ':s_store_id' => $model->s_store_id));
if (Yii::app()->request->isAjaxRequest) {
$this->renderPartial($this->view . 'detail', array('model' => $model, 'models' => $models));
} else {
$this->render($this->view . 'detail', array('model' => $model, 'models' => $models));
}
}
示例13: getAvailableServices
public static function getAvailableServices()
{
$criteria = new CDbCriteria();
$criteria->addCondition("type <> '{ServiceHelper::TYPE_SMALL_BUSINESS}'");
$criteria->order = 'title ASC';
$services = Service::model()->findAll($criteria);
$res = array(null => 'Отсутствует');
foreach ($services as $service) {
$res[$service->id] = $service->title;
}
return $res;
}
示例14: actionIndex
public function actionIndex($alias = '')
{
// Загружаем страницу "Услуги"
Yii::import("application.modules.page.models.Page");
$page = Page::model()->with(array('slides' => array('scopes' => 'published')))->findByPath("services");
// Список услуг
$criteria = new CDbCriteria();
$criteria->order = 't.sort ASC';
$models = Service::model()->published()->findAll($criteria);
// Вывод в шаблон
$this->render('index', array('models' => $models, 'page' => $page));
}
示例15: run
public function run()
{
$query = $this->request->getQuery('Service', []);
$model = Service::model();
$model->attributes = $query;
$condition = $this->createSearchCriteria($query);
$pager = new CPagination($model->count($condition));
$pager->setPageSize(20);
$condition['offset'] = $pager->getOffset();
$condition['limit'] = $pager->getLimit();
$condition['order'] = 'status asc, uid asc';
$data = $model->findAll($condition);
$this->render('pac', ['data' => new RedArrayDataProvider($data), 'pager' => $pager, 'model' => $model]);
}