You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.2 KiB
55 lines
1.2 KiB
<?php
|
|
|
|
namespace app;
|
|
|
|
use think\Model;
|
|
|
|
class BaseLogic extends Model
|
|
{
|
|
|
|
protected $mid;
|
|
protected $userAgent; //客户端 weixin--微信公众号 mp_weixin--微信小程序 mp_qq--QQ小程序 app--APP
|
|
protected $userId; //用户ID
|
|
protected $openid; //用户平台ID
|
|
|
|
/**
|
|
* 构造函数
|
|
* @date 2020-07-27
|
|
*/
|
|
public function __construct(array $data = [])
|
|
{
|
|
if (isset($data['uid'])) {
|
|
$this->mid = $data['uid'];
|
|
} else {
|
|
if (defined('UID')) {
|
|
$this->mid = UID;
|
|
}
|
|
}
|
|
|
|
if (isset($data['user_agent'])) {
|
|
$this->userAgent = $data['user_agent'];
|
|
} else {
|
|
if (defined('USER_AGENT')) {
|
|
$this->userAgent = USER_AGENT;
|
|
}
|
|
}
|
|
|
|
if (isset($data['user_id'])) {
|
|
$this->userId = $data['user_id'];
|
|
} else {
|
|
if (defined('USER_ID')) {
|
|
$this->userId = USER_ID;
|
|
}
|
|
}
|
|
|
|
if (isset($data['openid'])) {
|
|
$this->openid = $data['openid'];
|
|
} else {
|
|
if (defined('OPENID')) {
|
|
$this->openid = OPENID;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|