diff --git a/app/api/logic/BillionsLogic.php b/app/api/logic/BillionsLogic.php index a6f1a7cc..c57918b3 100755 --- a/app/api/logic/BillionsLogic.php +++ b/app/api/logic/BillionsLogic.php @@ -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(); + } } \ No newline at end of file diff --git a/app/api/logic/UserLogic.php b/app/api/logic/UserLogic.php index 49d07756..e6250e36 100755 --- a/app/api/logic/UserLogic.php +++ b/app/api/logic/UserLogic.php @@ -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'];