小程序用户改用门店登录
This commit is contained in:
@@ -9,7 +9,6 @@ use App\Models\CustomerLevelModel;
|
||||
use App\Models\NoticeModel;
|
||||
use App\Models\ProductModel;
|
||||
use App\Models\StoreModel;
|
||||
use App\Models\UserModel;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@@ -188,19 +187,14 @@ class ProductController extends BaseController
|
||||
->implode('、');
|
||||
$content = mb_substr('以下商品价格已调整:' . $productNames . ',下次登录小程序后按新价格显示', 0, 500);
|
||||
|
||||
// 成本价变更影响所有等级的售价:通知全部正常门店绑定的正常用户
|
||||
$userIds = UserModel::query()
|
||||
->where('status', UserModel::STATUS_NORMAL)
|
||||
->whereIn('store_id', function ($q) {
|
||||
$q->select('id')
|
||||
->from('store')
|
||||
->where('status', StoreModel::STATUS_NORMAL);
|
||||
})
|
||||
// 成本价变更影响所有等级的售价:通知全部正常门店
|
||||
$storeIds = StoreModel::query()
|
||||
->where('status', StoreModel::STATUS_NORMAL)
|
||||
->pluck('id');
|
||||
|
||||
foreach ($userIds as $userId) {
|
||||
foreach ($storeIds as $storeId) {
|
||||
NoticeModel::create([
|
||||
'user_id' => $userId,
|
||||
'store_id' => $storeId,
|
||||
'type' => NoticeModel::TYPE_PRICE,
|
||||
'title' => '商品价格变更',
|
||||
'content' => $content,
|
||||
|
||||
Reference in New Issue
Block a user