添加:用户信息 添加用户是否为兑换点负责人信息

This commit is contained in:
wuhui_zzw 2024-01-15 15:24:40 +08:00
parent 92016d05e5
commit 7de1d315dd
2 changed files with 22 additions and 2 deletions

View File

@ -76,6 +76,21 @@ class ExchangePickupPointRepository extends BaseRepository{
->findOrEmpty()
->toArray();
}
/**
* Common: 用户是否存在有效的兑换站点
* Author: wu-hui
* Time: 2024/01/15 15:19
* @param $uid
* @return int
*/
public function userIsStaff($uid):int{
$count = $this->dao->getSearch([])
->where('is_show', 1)
->where('find_in_set(' . $uid . ',`uid_list`)')
->count();
return $count > 0 ? 1 : 0;
}

View File

@ -6,9 +6,11 @@
namespace app\controller\api;
use app\common\model\user\ExchangePickupPoint;
use app\common\repositories\store\order\StoreOrderRepository;
use app\common\repositories\store\order\StoreRefundOrderRepository;
use app\common\repositories\system\notice\SystemNoticeConfigRepository;
use app\common\repositories\user\ExchangePickupPointRepository;
use app\common\repositories\user\UserRepository;
use app\common\repositories\user\UserSignRepository;
use app\common\repositories\wechat\RoutineQrcodeRepository;
@ -157,6 +159,9 @@ class Auth extends BaseController
Cache::set($key,true, new \DateTime($day.' 23:59:59'));
}
}
// 用户是否为兑换站点管理员
$data['is_exchange_saff'] = app()->make(ExchangePickupPointRepository::class)->userIsStaff($user->uid);
return app('json')->success($data);
}
@ -225,7 +230,7 @@ class Auth extends BaseController
*/
public function mpAuth()
{
list($code, $post_cache_key) = $this->request->params([
[$code, $post_cache_key] = $this->request->params([
'code',
'cache_key',
], true);
@ -504,7 +509,7 @@ class Auth extends BaseController
if (count($tks) != 3) {
throw new ValidateException('Wrong number of segments');
}
list($headb64, $bodyb64, $cryptob64) = $tks;
[$headb64, $bodyb64, $cryptob64] = $tks;
if (null === ($payload = JWT::jsonDecode(JWT::urlsafeB64Decode($bodyb64)))) {
throw new ValidateException('Invalid header encoding');
}