Commit 4d65e59e by 宁成龙

Merge remote-tracking branch 'origin/master'

parents 45b622f0 6a117665
......@@ -7,6 +7,7 @@ use App\Admin\Renderable\BarChart;
use App\Admin\Renderable\InquiryDetail;
use App\Admin\Renderable\PostTable;
use App\Admin\Repositories\Inquiry;
use App\Admin\Service\InquiryService;
use App\Models\Cms\CmsUser;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
......
......@@ -15,4 +15,19 @@ class InquiryService
{
return Inquiry::batchUpdateSalesId($salesId, $userIds);
}
//根据用户id列表获取待处理和所有询价单的数量
public static function getInquiryCountByUserIds($userIds = [])
{
$result = [];
foreach ($userIds as $userId) {
$pendingCount = Inquiry::getInquiryCountByStatus($userId,Inquiry::STATUS_PENDING);
$allCount = Inquiry::where('user_id',$userId)->count();
$result[$userId] = [
'pending' => $pendingCount,
'all' => $allCount,
];
}
return $result;
}
}
......@@ -32,6 +32,11 @@ class Inquiry extends Model
return $this->hasOne(CmsUser::class, 'userId', 'sales_id');
}
public static function getInquiryCountByStatus($userId,$status)
{
return self::where('user_id',$userId)->where('status', $status)->count();
}
public static function batchUpdateSalesId($salesId, $userIds = [])
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment