小程序用户改用门店登录

This commit is contained in:
liu
2026-08-20 13:46:04 +08:00
parent 6d9f02d831
commit c1d490134e
251 changed files with 689 additions and 2727 deletions
+8 -8
View File
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* 通知模型(小程序端消息:订单 / 价格变更 / 系统;user_id=0 为全员广播)
* 通知模型(小程序端消息:订单 / 价格变更 / 系统;store_id=0 为全员广播)
*/
class NoticeModel extends Model
{
@@ -22,14 +22,14 @@ class NoticeModel extends Model
/** 已读 */
public const READ = 1;
/** 全员广播时的 user_id 约定值 */
public const BROADCAST_USER_ID = 0;
/** 全员广播时的 store_id 约定值 */
public const BROADCAST_STORE_ID = 0;
protected $table = 'notice';
protected $primaryKey = 'id';
protected $fillable = [
'user_id',
'store_id',
'type',
'title',
'content',
@@ -41,15 +41,15 @@ class NoticeModel extends Model
protected $casts = [
'data' => 'array',
'is_read' => 'integer',
'user_id' => 'integer',
'store_id' => 'integer',
'read_at' => 'datetime',
];
/**
* 接收用户(user_id=0 表示全员广播,无对应用户
* 接收门店(store_id=0 表示全员广播,无对应门店
*/
public function user(): BelongsTo
public function store(): BelongsTo
{
return $this->belongsTo(UserModel::class, 'user_id', 'id');
return $this->belongsTo(StoreModel::class, 'store_id', 'id');
}
}