Example #1
0
 /**
  * ajax预约
  * @return string
  */
 public function actionCall()
 {
     if (Yii::$app->getRequest()->isAjax) {
         $params = Yii::$app->getRequest()->get();
         if ($params) {
             $model = new Call();
             $result = $model->call($params);
             echo Json::encode(['result' => $result, 'msg' => '']);
         }
         Yii::$app->end();
     } else {
         //异常
     }
 }
Example #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Call::find()->alive();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'customer_id' => $this->customer_id, 'deleted' => $this->deleted, 'is_send' => $this->is_send, 'is_view' => $this->is_view, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'contact', $this->contact])->andFilterWhere(['like', 'call_note', $this->call_note]);
     return $dataProvider;
 }
Example #3
0
 /**
  * Finds the Call model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Call the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Call::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #4
0
                                        <?php 
}
?>
                                        </ul>
                                    </li>
                                    <li class="footer">
                                   		<?php 
echo Html::a('查看所有订单', ['/order/info/index']);
?>
                                    </li>
                                </ul>
                            </li>
                            
                            <!-- 预约通知 -->
                            <?php 
$orderCalls = Call::find()->where(['is_view' => Call::STATUS_NO])->orderBy('created_at DESC')->all();
?>
                            <li class="notifications-menu">
                                <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
                                    <i class="fa fa-comment-o"></i>
                                    <span class="label label-warning"><?php 
echo count($orderCalls);
?>
</span>
                                </a>
                                <ul class="dropdown-menu">
                                    <li class="header"><?php 
echo $orderCalls ? '您有新预约' : '没有预约';
?>
</li>
                                    <li>