public function actionTeaminfo() { $request = Yii::$app->request; if ($request->isAjax) { $time = $request->get('time') ? $request->get('time') : date('Y-m-d'); $type = $request->get('type') ? 'MessageType=' . $request->get('type') : '1=1'; $query = ZhiboModel::find(); $where = ['and', $type, 'DATE_FORMAT(Time,"%Y-%m-%d")="' . $time . '"', ['or', 'MatchInfoID <> ""', 'BaskMatchInfoID <> ""']]; //分页 $data_2['total'] = $query->where($where)->asArray()->count(); $page = $this->_checkPage($data_2['total']); $field = ['ID', 'Time', 'Name', 'MessageType', 'MatchInfoID', 'BaskMatchInfoID']; $data_2['rows'] = $query->select($field)->where($where)->offset($page['offset'])->limit($page['limit'])->asArray()->all(); return json_encode($data_2); } }
public function getzhibo() { return $this->hasOne(ZhiboModel::className(), ['id' => 'zhi_id']); }