quanwei
2 days ago 04102f7237efefa744090ed7c25f7b5d0807b679
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
<?php
 
namespace app\common\model\agent;
use app\agent\model\Agent;
use app\common\model\BaseModel;
 
/**
 * 登录日志模型
 */
class LoginLog extends BaseModel
{
    protected $name = 'dlagent_login_log';
    protected $pk = 'login_log_id';
 
    /**
     * 新增登录日志
     */
    public static function add($username, $ip, $result){
        $model = new self();
        $model->save([
            'username' => $username,
            'ip' => $ip,
            'result' => $result,
            'agent_id' => self::$agent_id
        ]);
    }
    /**
     * 与代理商关联
     * @return \think\model\relation\BelongsTo
     */
    public function agent()
    {
     
        return $this->hasOne(Agent::class, 'agent_id', 'agent_id');
     
    }
}