- 按 docs/renew-code-comment.md 将 PHP 文件头改为带边框的 Author 注释\n- 注释中的 crmeb.com 替换为 uj345.cn(代码字符串中的外链未改)\n- 新增 docs/renew-code-comment.md 说明 Made-with: Cursor
80 lines
2.2 KiB
PHP
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');
|
|
}
|
|
}
|