更换model目录

This commit is contained in:
cano
2024-03-04 04:28:48 +08:00
parent f4f61a5f4c
commit bebbee4184
29 changed files with 90 additions and 146 deletions

View File

@ -2,8 +2,6 @@
namespace App\Cache\Base;
use App\Models\Follow\FollowModel;
//用户缓存用户基础信息等于数据表primary_key为主键
abstract class TableBaseCache extends BaseCache
{

View File

@ -2,7 +2,7 @@
namespace App\Cache\Struct;
use App\Cache\Base\StructBaseCache;
use App\Models\Customer\CustomerUserExtendModel;
use App\Models\Api\Customer\CustomerUserExtendModel;
//用户缓存用户基础信息结构自己组装不完全等于数据表primary_key为主键
class StructUserCommonCacheUid extends StructBaseCache

View File

@ -2,7 +2,7 @@
namespace App\Cache\Table;
use App\Cache\Base\TableBaseCache;
use App\Models\Customer\CustomerUserModel;
use App\Models\Api\Customer\CustomerUserModel;
//用户缓存用户基础信息结构自己组装不完全等于数据表uid为主键
class TableCustomerUserCache extends TableBaseCache

View File

@ -2,7 +2,7 @@
namespace App\Console\Commands;
use App\Models\Customer\CustomerUserExtendModel;
use App\Models\Api\Customer\CustomerUserExtendModel;
use Illuminate\Console\Command;
class DailyCheckUserActiveStatus extends Command

View File

@ -6,7 +6,7 @@ use App\Const\Im;
use App\Const\VrCode;
use App\Exceptions\AppException;
use App\Http\Controllers\Base\CustomerBaseController;
use App\Models\Customer\CustomerUserModel;
use App\Models\Api\Customer\CustomerUserModel;
use App\Service\AuthService;
use App\Service\ImService;
use App\Service\VrCodeService;

View File

@ -5,8 +5,7 @@ namespace App\Http\Controllers\Follow;
use App\Exceptions\ModelException;
use App\Http\Controllers\Base\BaseController;
use App\Models\Follow\FollowHistoryModel;
use App\Models\Follow\FollowModel;
use App\Models\Api\Follow\FollowModel;
use App\Service\AuthService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

View File

@ -4,8 +4,6 @@
namespace App\Http\Controllers\Post;
use App\Http\Controllers\Base\BaseController;
use App\Models\Post\PostModel;
use App\Models\Post\PostPushBoxModel;
use App\Service\AuthService;
class PostController extends BaseController
@ -29,11 +27,11 @@ class PostController extends BaseController
'content',
'media',
]);
if (!in_array($aParams['type'], [PostModel::TYPE_POST, PostModel::TYPE_REPOST])) return $this->error('type params error');
if (!in_array($aParams['type'], [\App\Models\Api\Post\PostModel::TYPE_POST, \App\Models\Api\Post\PostModel::TYPE_REPOST])) return $this->error('type params error');
$oAuthService = new AuthService();
$aUser = $oAuthService->getCurrentUser();
$oFollowModel = new PostModel();
$oFollowModel = new \App\Models\Api\Post\PostModel();
$aParams['uid'] = $aUser['id'];
$oFollowModel->addBatchPost([$aParams]);
@ -49,7 +47,7 @@ class PostController extends BaseController
]);
$oAuthService = new AuthService();
$aUser = $oAuthService->getCurrentUser();
$oPostModel = new PostPushBoxModel();
$oPostModel = new \App\Models\Api\Post\PostPushBoxModel();
$aPostList = $oPostModel->getPushBoxList($aUser['id'],$aParams['lastId']??0,$aParams['limit']??15);
return $this->success($aPostList);

View File

@ -4,7 +4,7 @@ namespace App\Http\Controllers\Sms;
use App\Const\VrCode;
use App\Exceptions\AppException;
use App\Http\Controllers\Base\CustomerBaseController;
use App\Models\Customer\CustomerUserModel;
use App\Models\Api\Customer\CustomerUserModel;
use App\Service\AuthService;
use App\Service\VrCodeService;
use Illuminate\Support\Facades\Validator;

View File

@ -3,11 +3,10 @@
namespace App\Http\Middleware;
use App\Const\Responses;
use App\Models\Customer\CustomerUserModel;
use App\Models\Api\Customer\CustomerUserModel;
use App\Service\AuthService;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Symfony\Component\HttpFoundation\Response;
class AuthMiddleware

View File

@ -3,9 +3,8 @@
namespace App\Jobs;
use App\Exceptions\ModelException;
use App\Models\Post\PostPushBoxModel;
use App\Models\Api\Post\PostPushBoxModel;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;

View File

@ -2,9 +2,8 @@
namespace App\Jobs;
use App\Models\Customer\CustomerUserExtendModel;
use App\Models\Api\Customer\CustomerUserExtendModel;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;

View File

@ -0,0 +1,9 @@
<?php
namespace App\Models\Api\Base;
use App\Models\Base\BaseModel;
class ApiBaseModel extends BaseModel {
}

View File

@ -1,11 +1,10 @@
<?php
namespace App\Models\Comment;
namespace App\Models\Api\Comment;
use App\Exceptions\ModelException;
use App\Models\Base\BaseModel;
use App\Models\Api\Base\ApiBaseModel;
use Illuminate\Database\Eloquent\SoftDeletes;
class PostCommentModel extends BaseModel
class PostCommentModel extends ApiBaseModel
{
use SoftDeletes;
protected $table = 'customer_post_comment';

View File

@ -1,14 +1,11 @@
<?php
namespace App\Models\Customer;
namespace App\Models\Api\Customer;
use App\Cache\Table\TableCustomerUserCache;
use App\Models\Base\CustomerBaseModel;
use Illuminate\Database\Eloquent\Casts\Attribute;
use App\Models\Api\Base\ApiBaseModel;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Hash;
class CustomerChangeInfoLogModel extends CustomerBaseModel
class CustomerChangeInfoLogModel extends ApiBaseModel
{
protected $table = 'customer_change_info_log';
protected $primaryKey = 'id';

View File

@ -0,0 +1,19 @@
<?php
namespace App\Models\Api\Customer;
use App\Models\Api\Base\ApiBaseModel;
class CustomerLoginHistoryModel extends ApiBaseModel
{
protected $table = 'customer_login_history';
protected $primaryKey = 'id';
protected $fillable = [
'id',
'status',
'uid',
'device',
'created_at',
];
}

View File

@ -1,19 +1,18 @@
<?php
namespace App\Models\Customer;
namespace App\Models\Api\Customer;
use App\Const\Queue;
use App\Exceptions\ModelException;
use App\Jobs\UserActiveStatusQueue;
use App\Models\Base\CustomerBaseModel;
use App\Models\Post\PostPushBoxModel;
use App\Models\WebSocket\CustomerWsHistoryModel;
use App\Models\Api\Post\PostPushBoxModel;
use App\Models\Api\WebSocket\ApiWsHistoryModel;
use App\Models\Api\Base\ApiBaseModel;
use App\Structs\QueueUserActiveStatusStruct;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class CustomerUserExtendModel extends CustomerBaseModel
class CustomerUserExtendModel extends ApiBaseModel
{
protected $table = 'customer_user_extend';
@ -94,7 +93,7 @@ class CustomerUserExtendModel extends CustomerBaseModel
{
if (empty($date)) $date = Carbon::yesterday()->toDateString();
$oCustomerWsHistoryModel = new CustomerWsHistoryModel();
$oCustomerWsHistoryModel = new ApiWsHistoryModel();
$aActiveUserIdList = $oCustomerWsHistoryModel->getActiveUserIdList($date); //三日内活跃用户
if (empty($aActiveUserIdList)) return;
$oCustomerChangeInfoLogModel = new CustomerChangeInfoLogModel();
@ -140,7 +139,7 @@ class CustomerUserExtendModel extends CustomerBaseModel
{
try{
Db::beginTransaction();
$oCustomerWsHistoryModel = new CustomerWsHistoryModel();
$oCustomerWsHistoryModel = new ApiWsHistoryModel();
$aActiveUserId = $oCustomerWsHistoryModel->findActiveUserId($uid, Carbon::yesterday()->toDateString()); //三日内活跃用户
if(empty($aActiveUserId)) return;
$oCustomerUserExtendModel = $this->newQuery()->where('uid', $uid)->first(['uid','is_active']);

View File

@ -1,14 +1,14 @@
<?php
namespace App\Models\Customer;
namespace App\Models\Api\Customer;
use App\Cache\Table\TableCustomerUserCache;
use App\Models\Base\CustomerBaseModel;
use App\Models\Api\Base\ApiBaseModel;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Hash;
class CustomerUserModel extends CustomerBaseModel
class CustomerUserModel extends ApiBaseModel
{
protected $table = 'customer_users';
protected $primaryKey = 'id';

View File

@ -1,10 +1,10 @@
<?php
namespace App\Models\Follow;
namespace App\Models\Api\Follow;
use App\Exceptions\ModelException;
use App\Models\Base\BaseModel;
use App\Models\Api\Base\ApiBaseModel;
class FollowHistoryModel extends BaseModel
class FollowHistoryModel extends ApiBaseModel
{
protected $table = 'customer_follow_history';
protected $primaryKey = 'id';

View File

@ -1,13 +1,13 @@
<?php
namespace App\Models\Follow;
namespace App\Models\Api\Follow;
use App\Exceptions\ModelException;
use App\Models\Base\BaseModel;
use App\Models\Customer\CustomerUserExtendModel;
use App\Models\Api\Base\ApiBaseModel;
use App\Models\Api\Customer\CustomerUserExtendModel;
use Illuminate\Support\Facades\DB;
class FollowModel extends BaseModel
class FollowModel extends ApiBaseModel
{
protected $table = 'customer_follow';
protected $primaryKey = 'id';

View File

@ -1,10 +1,10 @@
<?php
namespace App\Models\Post;
namespace App\Models\Api\Post;
use App\Exceptions\ModelException;
use App\Models\Base\BaseModel;
use App\Models\Api\Base\ApiBaseModel;
class PostHistoryModel extends BaseModel
class PostHistoryModel extends ApiBaseModel
{
protected $table = 'customer_post_history';
protected $primaryKey = 'id';

View File

@ -1,15 +1,15 @@
<?php
namespace App\Models\Post;
namespace App\Models\Api\Post;
use App\Exceptions\ModelException;
use App\Models\Base\BaseModel;
use App\Models\Post\Structs\PostParamsStruct;
use App\Models\Api\Base\ApiBaseModel;
use App\Models\Api\Post\Structs\PostParamsStruct;
use App\Tools\Tools;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\SoftDeletes;
class PostModel extends BaseModel
class PostModel extends ApiBaseModel
{
//软删除
use SoftDeletes;

View File

@ -1,20 +1,20 @@
<?php
namespace App\Models\Post;
namespace App\Models\Api\Post;
use App\Exceptions\ModelException;
use App\Jobs\AddPostQueue;
use App\Models\Base\BaseModel;
use App\Models\Comment\PostCommentModel;
use App\Models\Customer\CustomerUserExtendModel;
use App\Models\Follow\FollowModel;
use App\Models\Post\Structs\PostParamsStruct;
use App\Models\Api\Base\ApiBaseModel;
use App\Models\Api\Comment\PostCommentModel;
use App\Models\Api\Customer\CustomerUserExtendModel;
use App\Models\Api\Follow\FollowModel;
use App\Models\Api\Post\Structs\PostParamsStruct;
use App\Structs\QueueAddPostStruct;
use App\Tools\CollectOffsetLimit;
use App\Tools\Tools;
use Illuminate\Database\Eloquent\Casts\Attribute;
class PostPushBoxModel extends BaseModel
class PostPushBoxModel extends ApiBaseModel
{
protected $table = 'customer_post_push_box';

View File

@ -1,5 +1,5 @@
<?php
namespace App\Models\Post\Structs;
namespace App\Models\Api\Post\Structs;
class PostParamsStruct{
const REPOST_ORG_USER_ID = 'repostOrgUserId';
const REPOST_ORG_USERNAME = 'repostOrgUsername';

View File

@ -1,15 +1,12 @@
<?php
namespace App\Models\WebSocket;
namespace App\Models\Api\WebSocket;
use App\Cache\Table\TableCustomerUserCache;
use App\Models\Base\CustomerBaseModel;
use Illuminate\Database\Eloquent\Casts\Attribute;
use App\Models\Api\Base\ApiBaseModel;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
class CustomerWsHistoryModel extends CustomerBaseModel
class ApiWsHistoryModel extends ApiBaseModel
{
protected $table = 'customer_ws_history';
protected $primaryKey = 'id';

View File

@ -2,9 +2,7 @@
namespace App\Models\Base;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Hash;
class BaseModel extends Model
{

View File

@ -1,7 +0,0 @@
<?php
namespace App\Models\Base;
class CustomerBaseModel extends BaseModel {
}

View File

@ -1,23 +0,0 @@
<?php
namespace App\Models\Customer;
use App\Cache\Table\TableCustomerUserCache;
use App\Models\Base\CustomerBaseModel;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Hash;
class CustomerLoginHistoryModel extends CustomerBaseModel
{
protected $table = 'customer_login_history';
protected $primaryKey = 'id';
protected $fillable = [
'id',
'status',
'uid',
'device',
'created_at',
];
}

View File

@ -1,45 +0,0 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}

View File

@ -0,0 +1,9 @@
<?php
namespace App\Models\Wallet\Base;
use App\Models\Base\BaseModel;
class WalletBaseModel extends BaseModel {
}