抽离获取返补已满但是未读状态的数量方法

This commit is contained in:
wangxiaowei 2024-08-07 17:18:32 +08:00
parent 0eba6f0024
commit 7ff1cc41f1
2 changed files with 11 additions and 5 deletions

@ -880,4 +880,13 @@ class BillionsLogic extends Logic
return $result;
}
// 获取返补已满但是未读状态的数量
public static function getUnreadCount($user_id)
{
$where[] = ['user_id', '=', $user_id];
$where[] = ['state', '>', 0];
$where[] = ['is_read', '=', 0];
return Billions::where($where)->count();
}
}

@ -22,7 +22,7 @@ use app\common\server\WeChatServer;
use EasyWeChat\Factory;
use EasyWeChat\Kernel\Exceptions\Exception;
use think\facade\Db;
use app\common\model\billions\Billions;
use app\api\logic\BillionsLogic;
class UserLogic extends Logic
{
@ -102,10 +102,7 @@ class UserLogic extends Logic
$procurement = Mprocurement::where(['user_id' => $user_id, 'u_examine_state' => 1, 'u_state' => 1])->find();
// 获取返补已满但是未读状态的数量
$billion_where[] = ['user_id', '=', $user_id];
$billion_where[] = ['state', '>', 0];
$billion_where[] = ['is_read', '=', 0];
$user['unread_billions'] = Billions::where($billion_where)->count();
$user['unread_billions'] = BillionsLogic::getUnreadCount($user_id);
if($procurement != null){
$user['u_id'] = $procurement['u_id'];
$user['wholesale_state'] = $procurement['wholesale_state'];