12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- declare (strict_types=1);
- namespace app\services\store;
- use app\dao\store\UserStoreUserDao;
- use app\services\BaseServices;
- class UserStoreUserServices extends BaseServices
- {
-
- public function __construct(UserStoreUserDao $dao)
- {
- $this->dao = $dao;
- }
-
- public function getCount(array $where): int
- {
- return $this->dao->getCount($where);
- }
-
- 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];
- }
-
- 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');
- }
- }
|