User.php
1.2 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
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2020/4/28
* Time: 17:20
*/
namespace app\index\model;
use think\Model;
class User extends Model
{
public function findData($where){
$data = $this->where($where)->find();
if(!empty($data)){
//判断是否为会员
$is_vip = '2';
if(!empty($data['vip_passtime'])){
if($data['vip_passtime'] > time()){
$is_vip = "1";
}
}
$is_svip = '2';
if(!empty($data['svip_passtime'])){
if($data['svip_passtime'] > time()){
$is_svip = "1";
}
}
$data['is_vip'] = $is_vip;
$data['is_svip'] = $is_svip;
}
return $data;
}
public function updateData($where,$data){
$result = $this->where($where)->update($data);
return $result;
}
public function insertData($data){
$result = $this->insertGetId($data);
return $result;
}
public function selectData($where){
$where['status'] = ['eq',"normal"];
$data = $this->where($where)->select();
return $data;
}
}