|
|
@@ -13,6 +13,7 @@ declare (strict_types=1);
|
|
|
namespace app\api\model;
|
|
|
|
|
|
use app\api\validate\user\Info as ValidateInfo;
|
|
|
+use app\common\model\UnlockUser;
|
|
|
use think\facade\Cache;
|
|
|
use app\api\service\User as UserService;
|
|
|
use app\api\model\UserOauth as UserOauthModel;
|
|
|
@@ -49,8 +50,9 @@ class User extends UserModel
|
|
|
public function getList(array $param = [], int $listRows = 15)
|
|
|
{
|
|
|
// 整理查询参数
|
|
|
- $params = array_merge($param, ['status' => 1]);
|
|
|
- // 获取商品列表
|
|
|
+ $params = array_merge($param, ['status' => 1,'is_delete'=>0]);
|
|
|
+
|
|
|
+ // 获取列表
|
|
|
$list = parent::getList($params, $listRows);
|
|
|
if ($list->isEmpty()) {
|
|
|
return $list;
|
|
|
@@ -61,16 +63,16 @@ class User extends UserModel
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取专业同类学校列表
|
|
|
+ * 获取生源学校用户列表
|
|
|
* @param array $param 查询条件
|
|
|
* @param int $listRows 分页数量
|
|
|
* @return mixed|\think\model\Collection|\think\Paginator
|
|
|
* @throws \think\db\exception\DbException
|
|
|
*/
|
|
|
- public function getSpecialityList(int $specialityId, array $param = [], int $listRows = 15)
|
|
|
+ public function getSourceSchoolUserList(array $param = [], int $listRows = 15)
|
|
|
{
|
|
|
// 整理查询参数
|
|
|
- $params = array_merge($param, ['status' => 1,'is_delete'=>0]);
|
|
|
+ $params = array_merge($param, ['status' => 1,'is_delete'=>0,'ui.status'=>1,'user_type'=>1]);
|
|
|
// 获取商品列表
|
|
|
$list = parent::getList($params, $listRows);
|
|
|
if ($list->isEmpty()) {
|
|
|
@@ -78,7 +80,7 @@ class User extends UserModel
|
|
|
}
|
|
|
|
|
|
// 整理列表数据并返回
|
|
|
- return $this->setListDataFromApi($list);
|
|
|
+ return $this->setListDataFromApi($list, $params);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -86,11 +88,21 @@ class User extends UserModel
|
|
|
* @param $info
|
|
|
* @return mixed
|
|
|
*/
|
|
|
- private function setListDataFromApi($info)
|
|
|
+ private function setListDataFromApi($list, $params = [])
|
|
|
{
|
|
|
- return $this->setListData($info, function ($data){
|
|
|
+ // 是否验证和统计解锁用户
|
|
|
+ $checkType = isset($params['check_type'])? $params['check_type'] : 0;
|
|
|
+ $userId = isset($params['user_id'])? $params['user_id'] : 0;
|
|
|
+ $schoolId = isset($params['school_id'])? $params['school_id'] : 0;
|
|
|
+ $list = $this->setListData($list, function ($data) use($checkType, $userId, $schoolId){
|
|
|
$data['avatar'] = isset($data['avatar'])? $data['avatar'] : [];
|
|
|
unset($data['avatar']);
|
|
|
+ $data['is_locked'] = 2;
|
|
|
+
|
|
|
+ // 是否验证已被解锁
|
|
|
+ if($checkType == 1){
|
|
|
+ $data['is_locked'] = (int)UnlockUser::checkUserByUser($data['user_id'], $userId, $schoolId);
|
|
|
+ }
|
|
|
|
|
|
// 整理数据 api模块
|
|
|
$this->setDataFromApi($data);
|
|
|
@@ -99,6 +111,16 @@ class User extends UserModel
|
|
|
$hidden = ['user_type','user_login','home_bg','update_time','grade_id','platform','status','country','province','city','address','address_id','balance','points','last_login_time','pay_money','expend_money','last_login_time'];
|
|
|
$this->hidden(array_merge($this->hidden, $hidden));
|
|
|
});
|
|
|
+
|
|
|
+ $list = $list? $list->toArray() : [];
|
|
|
+
|
|
|
+ if($checkType == 1 && $userId>0 && isset($list['total'])){
|
|
|
+ $list['locked_num'] = (int)UnlockUser::getCountByUser($userId, $schoolId);
|
|
|
+ $list['lock_num'] = max(0,$list['total']-$list['locked_num']);
|
|
|
+ }
|
|
|
+
|
|
|
+ asort($list);
|
|
|
+ return $list;
|
|
|
}
|
|
|
|
|
|
/**
|