Repository navigation
Expand file tree
/
Copy pathPassportPasswordTokenTable.php
More file actions
72 lines (65 loc) · 2.13 KB
/
Copy pathPassportPasswordTokenTable.php
File metadata and controls
72 lines (65 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* Created by PhpStorm.
* User: zhangjun
* Date: 24/08/2018
* Time: 11:21 AM
*/
class PassportPasswordTokenTable extends BaseTable
{
private $table = "passportPasswordToken";
private $columns = [
"id",
"loginName",
"token",
"timeReg"
];
private $selectColumns;
public function init()
{
$this->selectColumns = implode(",", $this->columns);
}
public function insertCodeInfo($codeInfo)
{
return $this->insertData($this->table, $codeInfo, $this->columns);
}
public function updateCodeInfo($where, $data)
{
return $this->updateInfo($this->table, $where, $data, $this->columns);
}
public function delCodeInfoByLoginName($loginName)
{
$tag = __CLASS__."_".__FUNCTION__;
$startTime = microtime(true);
try{
$sql = "delete from $this->table where loginName=:loginName";
$prepare = $this->db->prepare($sql);
$this->handlePrepareError($tag, $prepare);
$prepare->bindValue(":loginName", $loginName);
$prepare->execute();
$this->ctx->Wpf_Logger->writeSqlLog($tag, $sql, $loginName, $startTime);
return true;
} catch (Exception $ex) {
$this->ctx->Wpf_Logger->error($tag, "error_msg=" . $ex->getMessage());
return false;
}
}
public function getCodeInfoByLoginName($loginName)
{
$tag = __CLASS__ . "-" . __FILE__;
$startTime = microtime(true);
try {
$sql = "select $this->selectColumns from $this->table where loginName=:loginName";
$prepare = $this->db->prepare($sql);
$this->handlePrepareError($tag, $prepare);
$prepare->bindValue(":loginName", $loginName);
$prepare->execute();
$codeInfo = $prepare->fetch(\PDO::FETCH_ASSOC);
$this->ctx->Wpf_Logger->writeSqlLog($tag, $sql, $loginName, $startTime);
return $codeInfo;
} catch (Exception $ex) {
$this->ctx->Wpf_Logger->error($tag, "error_msg=" . $ex->getMessage());
return false;
}
}
}