update biface local
This commit is contained in:
@@ -7,44 +7,64 @@ use Yii;
|
||||
/**
|
||||
* This is the model class for table "capture_logs".
|
||||
*
|
||||
* @property int $ID
|
||||
* @property int $Time
|
||||
* @property string $Image
|
||||
* @property int $Status
|
||||
* @property string $Remark
|
||||
* @property int $id
|
||||
* @property int $time
|
||||
* @property string $image
|
||||
* @property int $status
|
||||
* @property string $remark
|
||||
*/
|
||||
class CaptureLogs extends \yii\db\ActiveRecord
|
||||
{
|
||||
class CaptureLogs extends \yii\db\ActiveRecord {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
public static function tableName() {
|
||||
return 'capture_logs';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
public function rules() {
|
||||
return [
|
||||
[['Time', 'Status'], 'integer'],
|
||||
[['Image', 'Remark'], 'string'],
|
||||
[['time', 'status'], 'integer'],
|
||||
[['image', 'remark'], 'string'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
public function attributeLabels() {
|
||||
return [
|
||||
'ID' => 'ID',
|
||||
'Time' => 'Time',
|
||||
'Image' => 'Image',
|
||||
'Status' => 'Status',
|
||||
'Remark' => 'Remark',
|
||||
'id' => 'ID',
|
||||
'time' => 'Time',
|
||||
'image' => 'Image',
|
||||
'status' => 'Status',
|
||||
'remark' => 'Remark',
|
||||
];
|
||||
}
|
||||
|
||||
public function create($data) {
|
||||
$r = $this->load([
|
||||
'time' => $data['Time'],
|
||||
'image' => $data["Image"],
|
||||
'status' => 0,
|
||||
'remark' => ''
|
||||
], '');
|
||||
if ($r) {
|
||||
try {
|
||||
$this->save();
|
||||
return $this->id;
|
||||
} catch (\Exception $ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static $statusArray = [
|
||||
0 => "Unknown",
|
||||
1 => "List management"
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ class CaptureLogsSearch extends CaptureLogs
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['ID', 'Time', 'Status'], 'integer'],
|
||||
[['Image', 'Remark'], 'safe'],
|
||||
[['id', 'time', 'status'], 'integer'],
|
||||
[['image', 'remark'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -59,13 +59,13 @@ class CaptureLogsSearch extends CaptureLogs
|
||||
|
||||
// grid filtering conditions
|
||||
$query->andFilterWhere([
|
||||
'ID' => $this->ID,
|
||||
'Time' => $this->Time,
|
||||
'Status' => $this->Status,
|
||||
'id' => $this->id,
|
||||
'time' => $this->time,
|
||||
'status' => $this->status,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'Image', $this->Image])
|
||||
->andFilterWhere(['like', 'Remark', $this->Remark]);
|
||||
$query->andFilterWhere(['like', 'image', $this->image])
|
||||
->andFilterWhere(['like', 'remark', $this->remark]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
82
models/ListManagement.php
Normal file
82
models/ListManagement.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* This is the model class for table "list_management".
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $type
|
||||
* @property string $name
|
||||
* @property string $image
|
||||
* @property string $gender
|
||||
* @property int $birthday
|
||||
* @property string $telephone
|
||||
* @property string $address
|
||||
* @property int $time
|
||||
*/
|
||||
class ListManagement extends \yii\db\ActiveRecord {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function tableName() {
|
||||
return 'list_management';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules() {
|
||||
return [
|
||||
[['type', 'name', 'gender', 'telephone', 'address', 'image'], 'string'],
|
||||
[['birthday', 'time'], 'integer'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function attributeLabels() {
|
||||
return [
|
||||
'id' => 'ID',
|
||||
'type' => 'Type',
|
||||
'name' => 'Name',
|
||||
'image' => 'Registration Image',
|
||||
'gender' => 'Gender',
|
||||
'birthday' => 'Birthday',
|
||||
'telephone' => 'Telephone',
|
||||
'address' => 'Address',
|
||||
'time' => 'Registration time'
|
||||
];
|
||||
}
|
||||
|
||||
public function create($data) {
|
||||
$r = $this->load([
|
||||
'type' => $data['type'],
|
||||
'name' => $data['name'],
|
||||
'image' => $data['image'],
|
||||
'gender' => $data['gender'],
|
||||
'birthday' => $data['birthday'] === "" ? 0 : date_format(date_create_from_format('d/m/Y', $data['birthday']), 'U'),
|
||||
'telephone' => $data['telephone'],
|
||||
'address' => $data['address'],
|
||||
'time' => time()
|
||||
], '');
|
||||
if ($r) {
|
||||
try {
|
||||
$this->save();
|
||||
return $this->id;
|
||||
} catch (\Exception $ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static $typeArray = [
|
||||
"wl" => "Whitelist",
|
||||
"bl" => "Blacklist"
|
||||
];
|
||||
|
||||
}
|
||||
72
models/ListManagementSearch.php
Normal file
72
models/ListManagementSearch.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use app\models\ListManagement;
|
||||
|
||||
/**
|
||||
* ListMamagementSearch represents the model behind the search form of `app\models\ListManagement`.
|
||||
*/
|
||||
class ListManagementSearch extends ListManagement {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules() {
|
||||
return [
|
||||
[['id', 'birthday'], 'integer'],
|
||||
[['type', 'name', 'gender', 'telephone', 'address'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function scenarios() {
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params) {
|
||||
$query = ListManagement::find();
|
||||
|
||||
// add conditions that should always apply here
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
]);
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
// grid filtering conditions
|
||||
$query->andFilterWhere([
|
||||
'id' => $this->id,
|
||||
'birthday' => $this->birthday,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'type', $this->type])
|
||||
->andFilterWhere(['like', 'name', $this->name])
|
||||
->andFilterWhere(['like', 'gender', $this->gender])
|
||||
->andFilterWhere(['like', 'telephone', $this->telephone])
|
||||
->andFilterWhere(['like', 'address', $this->address]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user