123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- namespace crmeb\repositories;
- use app\admin\model\system\SystemAttachment;
- use app\models\user\User;
- use app\models\user\UserAddress;
- use app\models\user\UserToken;
- use crmeb\exceptions\AuthException;
- use think\db\exception\ModelNotFoundException;
- use think\db\exception\DataNotFoundException;
- use think\exception\DbException;
- class UserRepository
- {
-
- public static function adminAddMoney($user, $money)
- {
- }
-
- public static function adminSubMoney($user, $money)
- {
- }
-
- public static function adminAddIntegral($user, $integral)
- {
- }
-
- public static function adminSubIntegral($user, $integral)
- {
- }
-
- public static function parseToken($token): array
- {
- if (!$token || !$tokenData = UserToken::where('token', $token)->find())
- throw new AuthException('请登录', 410000);
- try {
- [$user, $type] = User::parseToken($token);
- } catch (\Throwable $e) {
- $tokenData->delete();
- throw new AuthException('登录已过期,请重新登录', 410001);
- }
- if (!$user || $user->uid != $tokenData->uid) {
- $tokenData->delete();
- throw new AuthException('登录状态有误,请重新登录', 410002);
- }
- $tokenData->type = $type;
- return compact('user', 'tokenData');
- }
-
- public static function storeProductOrderCreateEbApi($order,$group)
- {
- if(!UserAddress::be(['is_default'=>1,'uid'=>$order['uid']])) UserAddress::setDefaultAddress($group['addressId'],$order['uid']);
- }
- }
|