Commit d04b7e73 by 杨树贤

最近修改人忽略审核flag

parent f90507b7
......@@ -952,7 +952,8 @@ class DataService
$logModel = new LogModel();
foreach ($suppliers as $supplier) {
$log = $logModel->where('supplier_id', $supplier['supplier_id'])
->where('type', LogModel::UPDATE_OPERATE)->orderBy('id', 'desc')->first();
->where('type', LogModel::UPDATE_OPERATE)->where('ignore_audit_check', 0)
->orderBy('id', 'desc')->first();
$supplier['last_update_name'] = $log['admin_name'] ?: '无';
if (empty($supplier['create_name'])) {
$userInfo = (new AdminUserService())->getAdminUserInfo($supplier['create_uid']);
......@@ -1224,7 +1225,7 @@ class DataService
//初始化品牌数量限制(还要跳过API对接的供应商)
public function initialMainBrandsLimit()
{
$suppliers = SupplierChannelModel::where('is_type', 0)->where('main_brands_limit',0)->get()->toArray();
$suppliers = SupplierChannelModel::where('is_type', 0)->where('main_brands_limit', 0)->get()->toArray();
foreach ($suppliers as $supplier) {
//判断是否是API对接的供应商
if (DataManageModel::where('canal', $supplier['supplier_code'])->where('is_type', 0)->exists()) {
......@@ -1251,8 +1252,8 @@ class DataService
$supplierCount = SupplierChannelModel::where('is_type', 0)->where('supplier_group', '!=', 4)->whereNotIn('supplier_name', config('field.SkipChangeSupplierTypeNames'))->where('sku_num', '>', 0)->count();
$yunxinSupplierCodes = SupplierChannelModel::where('is_type', 0)->where('stockup_type', 'like', '%5%')->where('sku_num', '>', 0)->pluck('supplier_code');
//找出哪些是云芯上传的
$yunxinUploadSupplierCodes = SkuUploadLogModel::whereIn('supplier_code',$yunxinSupplierCodes)->where('source',2)->pluck('supplier_code')->unique()->toArray();
$skuNumYunxin = SupplierChannelModel::whereIn('supplier_code',$yunxinUploadSupplierCodes)->sum('sku_num');
$yunxinUploadSupplierCodes = SkuUploadLogModel::whereIn('supplier_code', $yunxinSupplierCodes)->where('source', 2)->pluck('supplier_code')->unique()->toArray();
$skuNumYunxin = SupplierChannelModel::whereIn('supplier_code', $yunxinUploadSupplierCodes)->sum('sku_num');
dump("上架供应商数(不含代购,原厂):" . $supplierCount);
dump("上架云芯供应商数:" . count($yunxinUploadSupplierCodes));
dump("SKU 上架总条数(含API接口):" . $skuNum1);
......
......@@ -68,9 +68,7 @@ class SupplierTransformer
$lastUploadSkuTimes[$supplier['supplier_code']]) : '';
//获取最新修改人以及下级审核员
$logModel = new LogModel();
$log = $logModel->where('supplier_id', $supplier['supplier_id'])
->where('type', LogModel::UPDATE_OPERATE)->orderBy('id', 'desc')->first();
$log = LogModel::getLastLog($supplier['supplier_id']);
$supplier['last_update_name'] = $log ? $log['admin_name'] : '';
$supplier['last_update_time'] = $log ? date('Y-m-d H:i:s', $log['add_time']) : '';
//黑名单
......@@ -201,9 +199,7 @@ class SupplierTransformer
$supplier['supplier_type_name'] = array_get(config('field.SupplierType'), $supplier['supplier_type']);
}
//获取最近修改信息
$logModel = new LogModel();
$log = $logModel->where('supplier_id', $supplier['supplier_id'])
->where('type', LogModel::UPDATE_OPERATE)->orderBy('id', 'desc')->first();
$log = LogModel::getLastLog($supplier['supplier_id']);
$supplier['last_update_name'] = $log['admin_name'] ?: '无';
$supplier['last_update_time'] = empty($supplier['last_update_time']) ? ($log['add_time'] ? date('Y-m-d H:i:s',
$log['add_time']) : '无') : '无';
......
......@@ -6,11 +6,21 @@ use Illuminate\Database\Eloquent\Model;
class LogModel extends Model
{
protected $connection='web';
protected $table='log';
protected $connection = 'web';
protected $table = 'log';
public $timestamps = false;
const UPDATE_OPERATE = 1;
const ADD_OPERATE = 2;
const VIEW_OPERATE = 3;
public static function getLastLog($supplierId, $ignoreAuditCheck = true)
{
$query = self::where('supplier_id', $supplierId)
->where('type', LogModel::UPDATE_OPERATE);
if ($ignoreAuditCheck) {
$query->where('ignore_audit_check', 0);
}
return $query->where('ignore_audit_check', 0)->orderBy('id', 'desc')->first();
}
}
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