新版数智员工

This commit is contained in:
wong
2026-03-24 10:39:16 +08:00
parent 1853934d85
commit 7fb61b77a4
123 changed files with 38491 additions and 1018 deletions

View File

@@ -0,0 +1,53 @@
<?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();
}
}