chore: 重写初始提交(清空历史,整理后全量提交)

This commit is contained in:
ywxapp
2026-08-16 16:54:14 +08:00
commit 6c1a106bc1
1808 changed files with 238144 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use ywxapp\model\BaseModel;
class WxchatAppVersion extends BaseModel
{
protected function getOptions(): array
{
return [
'strict' => true,
'name' => 'wxchat_app_versions',
'autoWriteTimestamp' => 0,
'createTime' => 'create_at',
'updateTime' => 'update_at',
];
}
/**
* 获取最新版本
* @param string $platform 平台: android/ios/harmony
* @return AppVersion|null
*/
public static function getLatestVersion(string $platform)
{
return self::where('platform', $platform)
->where('status', 1)
->order('version_code', 'desc')
->find();
}
/**
* 获取指定版本
* @param string $platform 平台
* @param int $versionCode 版本号
* @return AppVersion|null
*/
public static function getVersion(string $platform, int $versionCode)
{
return self::where('platform', $platform)
->where('version_code', $versionCode)
->where('status', 1)
->find();
}
/**
* 获取所有可用版本
* @param string $platform 平台
* @return array
*/
public static function getAllVersions(string $platform): array
{
return self::where('platform', $platform)
->where('status', 1)
->order('version_code', 'desc')
->select()
->toArray();
}
}
+44
View File
@@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use ywxapp\model\BaseModel;
use ywxapp\model\MemberUser as UserModel;
class WxchatMomentCommentLike extends BaseModel
{
protected function getOptions(): array
{
return [
'strict' => true,
'name' => 'wxchat_moment_comment_likes',
'autoWriteTimestamp' => 0,
'createTime' => 'create_at',
];
}
// 关联:评论
public function comment()
{
return $this->belongsTo(MomentComment::class, 'cid');
}
// 关联:用户
public function user()
{
return $this->belongsTo(UserModel::class, 'uid');
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
/**
* WxchatFamily 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class WxchatFamily extends Model
{
protected $name = 'wxchat_families';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = false;
}
+25
View File
@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
/**
* WxchatFamilyMember 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class WxchatFamilyMember extends Model
{
protected $name = 'wxchat_family_members';
protected $autoWriteTimestamp = false;
}
+44
View File
@@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use ywxapp\model\BaseModel;
use ywxapp\model\MemberUser as UserModel;
class WxchatFollow extends BaseModel
{
protected function getOptions(): array
{
return [
'strict' => true,
'name' => 'wxchat_follow',
'autoWriteTimestamp' => 0,
'createTime' => 'create_at',
'updateTime' => 'update_at',
];
}
// 关联:关注者
public function follower()
{
return $this->belongsTo(UserModel::class, 'uid');
}
// 关联:被关注者
public function following()
{
return $this->belongsTo(UserModel::class, 'fid');
}
}
+31
View File
@@ -0,0 +1,31 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
use ywxapp\model\MemberUser;
class WxchatFriend extends Model
{
protected $name = 'wxchat_friend';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = false;
// 关联用户
public function user()
{
return $this->belongsTo(MemberUser::class, 'fid', 'uid');
}
}
//php think addon:model wxchat@WxchatMessageRecall
+27
View File
@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
/**
* WxchatGift 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class WxchatGift extends Model
{
protected $name = 'wxchat_gifts';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = 'update_at';
}
+27
View File
@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
/**
* WxchatGiftRecord 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class WxchatGiftRecord extends Model
{
protected $name = 'wxchat_gift_records';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = false;
}
+33
View File
@@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
use ywxapp\model\MemberUser;
class WxchatGroup extends Model
{
protected $name = 'wxchat_groups';
// 关联成员
public function members()
{
return $this->belongsToMany(MemberUser::class, 'group_members', 'user_id', 'group_id');
}
// 关联创建者
public function creator()
{
return $this->belongsTo(MemberUser::class, 'creator_id');
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
use ywxapp\model\MemberUser;
class WxchatGroupMember extends Model
{
protected $name = 'wxchat_group_members';
// 关联用户
public function user()
{
return $this->belongsTo(MemberUser::class, 'user_id');
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use ywxapp\model\BaseModel;
class WxchatHashtag extends BaseModel
{
protected function getOptions(): array
{
return [
'strict' => true,
'name' => 'wxchat_hashtags',
'autoWriteTimestamp' => 0,
'createTime' => 'create_at',
'updateTime' => 'update_at',
];
}
// 关联:使用该标签的动态
public function momoents()
{
return $this->belongsToMany(WxchatMoment::class, WxchatMomentHashtag::class, 'mid', 'hid');
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use ywxapp\model\BaseModel;
class WxchatIntimacy extends BaseModel
{
// 设置表名(think-orm 4.0name 不带前缀,自动拼 wxapp_
protected $name = 'wxchat_intimacy';
}
+27
View File
@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
/**
* WxchatLotteryPrize 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class WxchatLotteryPrize extends Model
{
protected $name = 'wxchat_lottery_prizes';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = 'update_at';
}
@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
/**
* WxchatLotteryRecord 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class WxchatLotteryRecord extends Model
{
protected $name = 'wxchat_lottery_records';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = false;
}
+38
View File
@@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
use ywxapp\model\MemberUser;
class WxchatMessage extends Model
{
protected $name = 'wxchat_messages';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = false;
// 关联发送者
public function sender()
{
return $this->belongsTo(MemberUser::class, 'sender_id');
}
// 关联撤回记录
public function recall()
{
return $this->hasOne(MessageRecall::class, 'message_id');
}
}
@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
class WxchatMessageRecall extends Model
{
// 遗留完整表名(无 wxapp_ 前缀,须用 $table 显式声明,不能用 $name
protected $table = 'wxchat_message_recalls';
// 关联消息
public function message()
{
return $this->belongsTo(WxchatMessage::class, 'message_id');
}
}
+118
View File
@@ -0,0 +1,118 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use ywxapp\model\BaseModel;
use ywxapp\model\MemberUser as UserModel;
class WxchatMoment extends BaseModel
{
// 遗留完整表名(无 wxapp_ 前缀,须用 $table 显式声明,不能用 $name
protected $table = 'dynamics';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = 'update_at';
// 关联:发布用户
public function user()
{
return $this->belongsTo(UserModel::class, 'uid');
}
// 关联:媒体文件
public function media()
{
return $this->hasMany(WxchatMomentMedia::class, 'mid');
}
// 关联:评论
public function comments()
{
return $this->hasMany(WxchatMomentComment::class, 'mid');
}
// 关联:点赞用户
public function likeUsers()
{
return $this->belongsToMany(UserModel::class, WxchatMomentLike::class, 'uid', 'mid');
}
// 关联:收藏用户
public function collectUsers()
{
return $this->belongsToMany(UserModel::class, WxchatMomentCollect::class, 'uid', 'mid');
}
// 关联:话题标签
public function hashtags()
{
return $this->belongsToMany(WxchatMomentHashtag::class, WxchatMomentHashtagAb::class, 'hid', 'mid');
}
// 获取动态列表(带分页)
public static function getList($page = 1, $limit = 20, $userId = 0)
{
$query = self::with([
'member' =>
function($query) {
$query->field('id,username,nickname,avatar');
},
'media' =>
function($query) {
$query->field('id,dynamic_id,type,url,thumbnail_url')
->order('sort_order', 'asc')
->limit(9); // 最多显示9张
}
])->where('status', 1)
->order('create_at', 'desc');
$total = $query->count();
$moments = $query->page($page, $limit)->select();
// 格式化数据
$formattedDynamics = [];
foreach ($moments as $moment) {
$formattedDynamic = $moment->toArray();
// 添加互动状态
if ($userId) {
$formattedDynamic['liked'] = WxchatMomentLike::where('mid', $moment->id)
->where('uid', $userId)
->exists();
$formattedDynamic['collected'] = WxchatMomentCollect::where('mid', $moment->id)
->where('uid', $userId)
->exists();
} else {
$formattedDynamic['liked'] = false;
$formattedDynamic['collected'] = false;
}
$formattedDynamics[] = $formattedDynamic;
}
return [
'list' => $formattedDynamics,
'total' => $total,
'pages' => ceil($total / $limit)
];
}
}
@@ -0,0 +1,43 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use ywxapp\model\BaseModel;
use ywxapp\model\MemberUser as UserModel;
class WxchatMomentCollect extends BaseModel
{
protected function getOptions(): array
{
return [
'strict' => true,
'name' => 'wxchat_moment_collects',
'autoWriteTimestamp' => 0,
'createTime' => 'create_at',
'updateTime' => false,
];
}
// 关联:动态
public function moment()
{
return $this->belongsTo(Moment::class, 'mid');
}
// 关联:用户
public function user()
{
return $this->belongsTo(UserModel::class, 'uid');
}
}
@@ -0,0 +1,75 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use ywxapp\model\BaseModel;
use ywxapp\model\MemberUser as UserModel;
class WxchatMomentComment extends BaseModel
{
protected function getOptions(): array
{
return [
'strict' => true,
'name' => 'wxchat_moment_comments',
'autoWriteTimestamp' => 0,
'createTime' => 'create_at',
'updateTime' => 'update_at'
];
}
// 关联:所属动态
public function moment()
{
return $this->belongsTo(Moment::class, 'mid');
}
// 关联:评论用户
public function user()
{
return $this->belongsTo(UserModel::class, 'uid');
}
// 关联:被回复用户
public function replyToUser()
{
return $this->belongsTo(UserModel::class, 'rid');
}
// 关联:父评论
public function parent()
{
return $this->belongsTo(WxchatMomentComment::class, 'pid');
}
// 关联:子评论(回复)
public function replies()
{
return $this->hasMany(WxchatMomentComment::class, 'pid')
->where('status', 1)
->order('created_at', 'asc');
}
// 关联:点赞用户
public function likeUsers()
{
return $this->belongsToMany(UserModel::class, WxchatMomentLike::class, 'uid', 'cid');
}
}
+44
View File
@@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use ywxapp\model\BaseModel;
use ywxapp\model\MemberUser as UserModel;
class WxchatMomentLike extends BaseModel
{
protected function getOptions(): array
{
return [
'strict' => true,
'name' => 'wxchat_moment_likes',
'autoWriteTimestamp' => 0,
'createTime' => 'create_at',
'updateTime' => false,
];
}
// 关联:动态
public function moment()
{
return $this->belongsTo(Moment::class, 'mid');
}
// 关联:用户
public function user()
{
return $this->belongsTo(UserModel::class, 'uid');
}
}
+37
View File
@@ -0,0 +1,37 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use ywxapp\model\BaseModel;
class WxchatMomentMedia extends BaseModel
{
protected function getOptions(): array
{
return [
'strict' => true,
'name' => 'wxchat_moment_medias',
'autoWriteTimestamp' => 0,
'createTime' => 'create_at',
'updateTime' => false,
];
}
// 关联:所属动态
public function moment()
{
return $this->belongsTo(Moment::class, 'mid');
}
}
+30
View File
@@ -0,0 +1,30 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use ywxapp\model\BaseModel;
class WxchatMomentShare extends BaseModel
{
protected function getOptions(): array
{
return [
'strict' => true,
'name' => 'wxchat_moment_share',
'autoWriteTimestamp' => 0,
'createTime' => 'create_at',
];
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
/**
* WxchatRealnameAuth 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class WxchatRealnameAuth extends Model
{
protected $name = 'wxchat_realname_auth';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = 'update_at';
}
+27
View File
@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
/**
* WxchatRoom 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class WxchatRoom extends Model
{
protected $name = 'wxchat_rooms';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = false;
}
+25
View File
@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
/**
* WxchatRoomMember 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class WxchatRoomMember extends Model
{
protected $name = 'wxchat_room_members';
protected $autoWriteTimestamp = false;
}
+27
View File
@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
/**
* WxchatRoomMic 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class WxchatRoomMic extends Model
{
protected $name = 'wxchat_room_mics';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = false;
}
+27
View File
@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
/**
* WxchatTask 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class WxchatTask extends Model
{
protected $name = 'wxchat_tasks';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = false;
}
+27
View File
@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
/**
* WxchatTaskRecord 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class WxchatTaskRecord extends Model
{
protected $name = 'wxchat_task_records';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = 'update_at';
}
+57
View File
@@ -0,0 +1,57 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use think\Model;
class WxchatUnreadCount extends Model
{
protected $name = 'wxchat_unread_counts';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_at';
protected $updateTime = 'update_at';
/**
* 增加未读计数(存在则累加,不存在则新建)
*/
public static function increment($userId, $contactType, $contactId, $step = 1)
{
$row = self::where('user_id', $userId)
->where('contact_type', $contactType)
->where('contact_id', $contactId)
->find();
if ($row) {
$row->unread_count = (int) $row->unread_count + $step;
$row->save();
} else {
$m = new self();
$m->user_id = $userId;
$m->contact_type = $contactType;
$m->contact_id = $contactId;
$m->unread_count = $step;
$m->save();
}
return true;
}
/**
* 清零未读计数
*/
public static function reset($userId, $contactType, $contactId)
{
return self::where('user_id', $userId)
->where('contact_type', $contactType)
->where('contact_id', $contactId)
->update(['unread_count' => 0]);
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\model;
use ywxapp\model\BaseModel;
class WxchatViewHistory extends BaseModel
{
protected function getOptions(): array
{
return [
'strict' => true,
'name' => 'wxchat_view_history',
'createTime' => 'create_at',
'updateTime' => 'update_at',
];
}
// 关联:动态
public function moment()
{
return $this->belongsTo(WxchatMoment::class, 'mid');
}
// 关联:用户
public function user()
{
return $this->belongsTo(\ywxapp\model\MemberUser::class, 'uid');
}
}