Files
CKB-Interface/application/store/model/CompanyAccountModel.php
2026-03-24 10:39:16 +08:00

54 lines
1.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\store\model;
use think\Model;
/**
* 用户模型(门店端)
* 使用 ck_users 表typeId=2 表示门店端用户
* Class CompanyAccountModel
* @package app\store\model
*/
class CompanyAccountModel extends Model
{
// 设置表名(门店端使用 users 表)
protected $name = 'users';
// 设置主键
protected $pk = 'id';
// 自动时间戳
protected $autoWriteTimestamp = false;
/**
* 根据公司ID获取账号
* @param int $companyId 公司ID
* @return array|null
*/
public static function getByCompanyId($companyId)
{
return self::where('companyId', $companyId)
->where('typeId', 2) // 门店端固定为2
->where('deleteTime', 0)
->find();
}
/**
* 根据账号或手机号查找用户
* @param string $account 账号或手机号
* @return array|null
*/
public static function getByAccountOrPhone($account)
{
return self::where(function($query) use ($account) {
$query->where('account', $account)
->whereOr('phone', $account);
})
->where('typeId', 2) // 门店端固定为2
->where('deleteTime', 0)
->find();
}
}