Files
huangjingfen/pro_v3.5.1/app/services/store/UserStoreUserServices.php
panchengyong c1e74d8e68 chore(php): 统一 ScottPan 文件头与注释域名替换
- 按 docs/renew-code-comment.md 将 PHP 文件头改为带边框的 Author 注释\n- 注释中的 crmeb.com 替换为 uj345.cn(代码字符串中的外链未改)\n- 新增 docs/renew-code-comment.md 说明

Made-with: Cursor
2026-03-29 11:22:58 +08:00

80 lines
2.2 KiB
PHP

<?php
// +----------------------------------------------------------------------
// | Author: ScottPan Team
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\services\store;
use app\dao\store\UserStoreUserDao;
use app\services\BaseServices;
use think\annotation\Inject;
/**
* Class UserStoreUserServices
* @package app\services\store
* @mixin UserStoreUserDao
*/
class UserStoreUserServices extends BaseServices
{
/**
* @var UserStoreUserDao
*/
#[Inject]
protected UserStoreUserDao $dao;
/**
* 自定义简单查询总数
* @param array $where
* @return int
*/
public function getCount(array $where): int
{
return $this->dao->getCount($where);
}
/**
* 复杂条件搜索列表
* @param array $where
* @param string $field
* @return array
*/
public function getWhereUserList(array $where, string $field): array
{
[$page, $limit] = $this->getPageValue();
$order_string = '';
$order_arr = ['asc', 'desc'];
if (isset($where['now_money']) && in_array($where['now_money'], $order_arr)) {
$order_string = 'now_money ' . $where['now_money'];
}
$list = $this->dao->getListByModel($where, $field, $order_string, $page, $limit);
$count = $this->dao->getCountByWhere($where);
return [$list, $count];
}
/**
* 门店搜索用户
* @param array $data
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function storeSearch(array $data)
{
$where = [];
if ($data['field_key']) {
$where['u.' . $data['field_key']] = $data['keyword'];
} else {
$where['u.uid|u.phone'] = $data['keyword'];
}
$fields = 'u.*,w.country,w.province,w.city,w.sex,w.unionid,w.openid,w.user_type as w_user_type,w.groupid,w.tagid_list,w.subscribe,w.subscribe_time';
$list = $this->dao->getList($where, $fields);
$count = $this->dao->getCount($where);
return compact('list', 'count');
}
}