inventory_302

This commit is contained in:
dengbw
2022-03-02 17:36:23 +08:00
committed by lccsw
parent 454e9e031c
commit e98d26a05f
11 changed files with 1419 additions and 7 deletions
+61
View File
@@ -18,6 +18,67 @@ class Licheb extends HD_Controller
$this->load->model('receiver/receiver_customers_visit_model', 'mdCustomersVisit');
}
/**
* Notes:更新车辆调拨状态
* Created on: 2022/2/28 17:15
* Created by: dengbw
* https://liche-api-dev.xiaoyu.com/plan/licheb/inventory_log
* https://api.liche.cn/plan/licheb/inventory_log
*/
public function inventory_log()
{
$params = $this->input->get();
$size = 100;//每次最多处理多少条
$rds = intval($this->input->get('rds'));
$redis = &load_cache('redis');
$redisKey = 'inventory_log_id';
$id = $redis->get($redisKey);
!$id && $id = 0;
if ($rds) {//手动清除缓存
$id = 0;
$redis->delete($redisKey);
}
$log = array();
$this->load->model('items/Items_inventory_log_model', 'mdInventoryLog');
$this->load->model('items/items_model', 'mdItems');
$where = array('id >' => $id, 'status' => 0);
$res_log = $this->mdInventoryLog->select($where, 'id asc', 1, $size, 'id,item_id,biz_id,addr_id');
if (!$res_log) {
echo '执行到当前id' . $id . '暂无数据';
$redis->delete($redisKey);
return;
}
foreach ($res_log as $key => $value) {
$id = $value['id'];
$res_item = $this->mdItems->get(['id' => $value['item_id']]);
if ($res_item) {
$status = '';
if ($res_item['bill_time'] != '0000-00-00 00:00:00') {//已售
$status = -2;
} else if ($res_item['biz_id'] != $value['biz_id'] || $res_item['addr_id'] != $value['addr_id']) {//已调拨
$status = -1;
}
if ($status) {
$ret = $this->mdInventoryLog->update(['status' => $status], ['id' => $id]);
if ($ret) {
$log[] = array('id' => $id, 'status' => $status);
}
}
}
}
$redis->save($redisKey, $id);//保存最后id
if ($params['sd']) {
echo '<br>执行到当前id' . $id;
echo '<br>成功更新:<br>';
if ($log) {
echo json_encode($log, JSON_UNESCAPED_UNICODE);
echo '<br>';
}
echo '数据库获取:<br>';
echo json_encode($res_log, JSON_UNESCAPED_UNICODE);
}
}
/**
* Notes:更新车辆调拨异常
* Created on: 2022/1/4 13:53
+1
View File
@@ -33,6 +33,7 @@ class Plan extends CI_Controller
$plan[] = array('url' => base_url(array('plan', 'licheb', 'customer_level')), 'interval' => 1);//更新客户等级
$plan[] = array('url' => base_url(array('plan', 'licheb', 'visit_sales_sms')), 'interval' => 1);//给销售发送待回访短信
$plan[] = array('url' => base_url(array('plan', 'licheb', 'customer_manager_sms')), 'interval' => 1);//给店长发送待分配短信
$plan[] = array('url' => base_url(array('plan', 'licheb', 'inventory_log')), 'interval' => 5);//更新车辆调拨状态
$this->plan = $plan;
}
+148
View File
@@ -0,0 +1,148 @@
<?php
defined('WXAPP_APP') OR exit('No direct script access allowed');
/**
* Notes:商品操作
* Created on: 2022/3/01 16:43
* Created by: dengbw
*/
require_once APPPATH . 'controllers/wxapp/Wxapp.php';
class Goods extends Wxapp
{
private $biz_id;//门店id
function __construct($inputs, $app_key)
{
parent::__construct($inputs, $app_key);
$this->login_white = array();//登录白名单
$this->check_status = array();//用户状态校验
$this->check_mobile = array();//需要手机号
$this->check_headimg = array();//授权微信信息
$this->load->model('items/items_model', 'mdItems');
$this->load->model('items/items_oplogs_model', 'mdItemsOplogs');
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
$this->load->model('auto/auto_attr_model', 'mdAutoAttr');
$this->biz_id = $this->session['new_biz_id'] ? $this->session['new_biz_id'] : intval($this->session['biz_id']);
}
/**
* Notes:库存车辆提醒
* Created on: 2022/3/01 17:03
* Created by: dengbw
* @return array
*/
protected function get_remind()
{
$where = ['status<>' => 0, 'biz_id' => $this->biz_id, 'bill_time' => '0000-00-00 00:00:00'];
$res = $this->mdItems->select($where, 'id DESC', 0, 0, 'id,in_time,biz_id');
$total = count($res);
$warning = '';
if ($total) {
$list = [];
foreach ($res as $key => $val) {
$re_logs = $this->mdItemsOplogs->max('com_time', ["item_id" => $val['id'], 'type' => 2, 'biz_id_to' => $val['biz_id']]);
if ($re_logs['com_time'] || $val['in_time']) {
$in_time = $re_logs['com_time'] ? $re_logs['com_time'] : $val['in_time'];
$days = round((time() - strtotime($in_time)) / 3600 / 24);
if ($days > 20) {
$item_info = $this->item_info($val['id']);
$list[] = ['title' => $item_info['title'], 'vin' => $item_info['vin']
, 'days' => "已库存:{$days}", 'img' => $item_info['cor_img']];
}
}
}
$list && $warning = ['title' => '库存超期预警', 'note' => '库存天数已超过20天,请尽快销售,以免造成损失!', 'list' => $list];
}
if ($warning) {//库存预警
$date = ['total' =>2,'inventory' => ['title' => "库存车辆({$total})", 'value' => '库存超期'
, 'color1' => '#fe606c', 'color2' => '#ff9026'], 'warning' => $warning];
} else {
$date = ['inventory' => ['title' => "库存车辆({$total})", 'value' => '库存良好'
, 'color1' => '#30cfbd', 'color2' => '#2cbf8b'], 'warning' => $warning];
}
return $date;
}
protected function get_lists()
{
$page = $this->input_param('page');
$size = $this->input_param('size');
!$page && $page = 1;
!$size && $size = 5;
$where = ['status<>' => 0, 'biz_id' => $this->biz_id, 'bill_time' => '0000-00-00 00:00:00'];
$count = $this->mdItems->count($where);
$lists = [];
if ($count) {
$res = $this->mdItems->select($where, 'id DESC', $page, $size, 'id,brand_id,s_id,v_id,cor_id,vin,in_time,biz_id');
foreach ($res as $key => $val) {
$setValue = $other_data = [];
$item_info = $this->item_info($val['id'], $val);
$setValue['title'] = $item_info['title'];
$other_data = $item_info['other_data'];
$setValue['other_data'] = $other_data;
$setValue['car_cor_img'] = $item_info['cor_img'];
$lists[] = $setValue;
}
}
$data = [
'list' => $lists,
'total' => $count
];
return $data;
}
/**
* Notes:获取商品信息
* Created on: 2022/3/2 15:20
* Created by: dengbw
* @param $item_id
* @param string $re
* @return array
*/
private function item_info($item_id, $re = '')
{
$type = 0;
if ($re) {
$type = 1;
} else {
$re = $this->mdItems->get(array('id' => $item_id));
if (!$re || empty($re)) {
return [];
}
}
$re_b = $this->mdAutoBrand->get(array('id' => $re['brand_id']), 'name');
$re_s = $this->mdAutoSeries->get(array('id' => $re['s_id']), 'name');
$re_cor = $this->mdAutoAttr->get(array('id' => $re['cor_id']), 'title,jsondata');
$title = $cor_img = '';
$other_data = [];
$re_b['name'] && $title = $re_b['name'];
$re_s['name'] && $title = $title ? $title . '-' . $re_s['name'] : $re_s['name'];
if ($re_cor['jsondata']) {
$jsondata = json_decode($re_cor['jsondata'], true);
$jsondata['img'] && $cor_img = build_qiniu_image_url($jsondata['img']);
}
if ($type == 0) {
$info['vin'] = $re['vin'];
} else {
$re_v = $this->mdAutoAttr->get(array('id' => $re['v_id']), 'title');
$re_v['title'] && $other_data[] = ['title' => '版本', 'value' => $re_v['title']];
$re_cor['title'] && $other_data[] = ['title' => '颜色', 'value' => $re_cor['title']];
$re['vin'] && $other_data[] = ['title' => '车架号', 'value' => $re['vin']];
$in_time = $re['in_time'] != '0000-00-00 00:00:00' ? $re['in_time'] : '';
$re_logs = $this->mdItemsOplogs->max('com_time', ["item_id" => $item_id, 'type' => 2, 'biz_id_to' => $re['biz_id']]);
$re_logs['com_time'] && $in_time = $re_logs['com_time'];
if ($in_time) {
$other_data[] = ['title' => '入库时间', 'value' => $in_time];
$days = round((time() - strtotime($in_time)) / 3600 / 24);
$other_data[] = ['title' => '库存天数', 'value' => $days, 'color' => '#f9394d'];
}
$info['other_data'] = $other_data;
}
$info['title'] = $title;
$info['cor_img'] = $cor_img;//车辆颜色
return $info;
}
}
+235
View File
@@ -0,0 +1,235 @@
<?php
defined('WXAPP_APP') OR exit('No direct script access allowed');
/**
* Notes:车辆盘点
* Created on: 2022/2/24 16:43
* Created by: dengbw
*/
require_once APPPATH . 'controllers/wxapp/Wxapp.php';
class Inventory extends Wxapp
{
private $biz_id;//门店id
private $addrManage = [491 => '129', 492 => '130'];//信息员管理地址
function __construct($inputs, $app_key)
{
parent::__construct($inputs, $app_key);
$this->login_white = array();//登录白名单
$this->check_status = array();//用户状态校验
$this->check_mobile = array();//需要手机号
$this->check_headimg = array();//授权微信信息
$this->load->model('items/Items_inventory_model', 'mdInventory');
$this->load->model('items/Items_inventory_log_model', 'mdInventoryLog');
$this->load->model('items/items_oplogs_model', 'mdItemsOplogs');
$this->load->model('items/items_model', 'mdItems');
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
$this->load->model('auto/auto_attr_model', 'mdAutoAttr');
$this->load->model("biz/biz_model", 'mdBiz');
$this->load->model("sys/sys_addr_model", 'mdAddr');
$this->biz_id = $this->session['new_biz_id'] ? $this->session['new_biz_id'] : intval($this->session['biz_id']);
}
protected function get_tabs()
{
return [['id' => 1, 'name' => '进行中'], ['id' => 2, 'name' => '已完成']];
}
/**
* Notes:盘点提醒
* Created on: 2021/12/10 17:03
* Created by: dengbw
* @return array
*/
protected function get_remind()
{
$total = 0;
if ($this->addrManage[$this->myuid]) {//信息员管理
$where = ['biz_id' => -1, "addr_id in({$this->addrManage[$this->myuid]})" => null, 'status' => 0];
$total = $this->mdInventoryLog->count($where);
} else if ($this->biz_id) {//门店
$where = ['biz_id' => $this->biz_id, 'status' => 0];
$total = $this->mdInventoryLog->count($where);
}
return ['total' => $total];
}
protected function get_lists()
{
$page = $this->input_param('page');
$size = $this->input_param('size');
$s_date = $this->input_param('s_date');
$e_date = $this->input_param('e_date');
!$page && $page = 1;
!$size && $size = 5;
$where = ['id' => 0];
$tabs_id = intval($this->input_param('tabs_id'));
if ($this->addrManage[$this->myuid]) {//信息员管理
$where = ['biz_id' => -1, "addr_id in({$this->addrManage[$this->myuid]})" => null];
$where['status'] = $tabs_id == 2 ? 1 : 0;
} elseif ($this->biz_id) {//门店
$where = ['biz_id' => $this->biz_id];
$where['status'] = $tabs_id == 2 ? 1 : 0;
} else if ($this->session['group_id'] == 4) {//渠道经理
$where = ['status(0,1)' => null, "biz_id in({$this->biz_id})" => null];
}
$s_date && $where['c_time >='] = strtotime($s_date . ' 00:00:00');
$e_date && $where['c_time <='] = strtotime($e_date . ' 23:59:59');
$count = $this->mdInventoryLog->count($where);
$lists = [];
if ($count) {
$res = $this->mdInventoryLog->select($where, 'id DESC', $page, $size, 'id,item_id,status,c_time,jsondata,biz_id,addr_id');
// $bizs = $this->mdBiz->get_map_by_ids(array_unique(array_column($res, 'biz_id')), 'id,biz_name');//门店
// $addrs = $this->mdAddr->get_map_by_ids(array_unique(array_column($res, 'addr_id')), 'id,title');//地址
foreach ($res as $key => $val) {
$setValue = $other_data = [];
$setValue['id'] = $val['id'];
// if ($val['biz_id'] == -1) {
// $biz_name = $addrs[$val['addr_id']][0]['title'];
// } else {
// $biz_name = $bizs[$val['biz_id']][0]['biz_name'];
// }
// $setValue['biz_name'] = $biz_name ? $biz_name : '';
$item_info = $this->item_info($val['item_id']);
$setValue['biz_name'] = $item_info['title'];
$other_data = $item_info['other_data'];
if ($val['status'] == 1) {
$jsondata = $val['jsondata'] ? json_decode($val['jsondata'], true) : [];
$jsondata['completion_time'] && $other_data[] = ['title' => '完成时间', 'value' => $jsondata['completion_time']];
}
$setValue['other_data'] = $other_data;
$setValue['car_cor_img'] = $item_info['cor_img'];
$lists[] = $setValue;
}
}
$data = [
'list' => $lists,
'total' => $count
];
return $data;
}
protected function get()
{
$id = intval($this->input_param('id'));
if (!$id) {
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
$re = $this->mdInventoryLog->get(['id' => $id]);
if (!$re) {
throw new Exception('盘点不存在', ERR_PARAMS_ERROR);
}
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : [];
$mileage = $jsondata['mileage'] ? $jsondata['mileage'] : '';
$note = $jsondata['note'] ? $jsondata['note'] : '';
$car_img = [];
foreach ($this->mdInventoryLog->carImgAry() as $key => $value) {
$img_value = $img_src = '';
if ($jsondata['car_img'] && $jsondata['car_img'][$key]) {
$img_value = $jsondata['car_img'][$key];
$img_src = build_qiniu_image_url($img_value);
}
$car_img[] = ['title' => $value, 'key' => $key, 'value' => $img_value, 'src' => $img_src];
}
$item_info = $this->item_info($re['item_id']);
$other_data = $item_info['other_data'];
$other_data[] = ['title' => '盘点任务', 'value' => date('Y-m-d', $re['c_time'])];
$jsondata['completion_time'] && $other_data[] = ['title' => '完成时间', 'value' => $jsondata['completion_time']];
$data['id'] = $id;
$data['car_img'] = $car_img;
$data['car_cor_img'] = $item_info['cor_img'];
$data['mileage'] = $mileage;
$data['note'] = $note;
$data['other_data'] = $other_data;
$data['biz_name'] = $item_info['title'];
// $biz_name = '';
// if ($re['biz_id'] == -1) {//地址
// $re_addr = $this->mdAddr->get(['id' => $re['addr_id']]);
// $re_addr && $biz_name = $re_addr['title'];
// } else {//门店
// $re_biz = $this->mdBiz->get(['id' => $re['biz_id']]);
// $re_biz && $biz_name = $re_biz['biz_name'];
// }
return $data;
}
/**
* Notes:提交盘点
* Created on: 2022/2/25 16:07
* Created by: dengbw
* @throws Exception
*/
protected function post()
{
$id = intval($this->input_param('id'));
if (!$id) {
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
$mileage = $this->input_param('mileage');
$car_img = $this->input_param('car_img');
$note = $this->input_param('note');
if (!$mileage) {
throw new Exception('里程数不能为空', ERR_PARAMS_ERROR);
}
if (!$car_img) {
throw new Exception('请上传图片', ERR_PARAMS_ERROR);
}
$jsonData['completion_time'] = date('Y-m-d H:i:s');
$jsonData['mileage'] = $mileage;
$jsonData['note'] = $note ? $note : '';
$jsonData['car_img'] = [];
foreach ($car_img as $key => $value) {
if (!$value['value']) {
throw new Exception('请上传' . $value['title'] . '图片', ERR_PARAMS_ERROR);
}
$jsonData['car_img'][$value['key']] = $value['value'];
}
$ret = $this->mdInventoryLog->update(['status' => 1, 'jsondata' => json_encode($jsonData, JSON_UNESCAPED_UNICODE)], ['id' => $id]);
if ($ret) {
throw new Exception('操作成功', API_CODE_SUCCESS);
} else {
throw new Exception('操作失败', ERR_PARAMS_ERROR);
}
}
/**
* Notes:获取商品信息
* Created on: 2021/12/9 10:47
* Created by: dengbw
* @param $item_id
* @param int $type
* @return array
*/
private function item_info($item_id)
{
$re = $this->mdItems->get(array('id' => $item_id));
if (!$re || empty($re)) {
return [];
}
$re_b = $this->mdAutoBrand->get(array('id' => $re['brand_id']), 'name');
$re_s = $this->mdAutoSeries->get(array('id' => $re['s_id']), 'name');
$re_v = $this->mdAutoAttr->get(array('id' => $re['v_id']), 'title');
$re_cor = $this->mdAutoAttr->get(array('id' => $re['cor_id']), 'title,jsondata');
$title = $cor_img = '';
$other_data = [];
$re_b['name'] && $title = $re_b['name'];
$re_s['name'] && $title = $title ? $title . '-' . $re_s['name'] : $re_s['name'];
$re_v['title'] && $other_data[] = ['title' => '版本', 'value' => $re_v['title']];
$re_cor['title'] && $other_data[] = ['title' => '颜色', 'value' => $re_cor['title']];
$re['vin'] && $other_data[] = ['title' => '车架号', 'value' => $re['vin']];
$in_time = $re['in_time'] != '0000-00-00 00:00:00' ? $re['in_time'] : '';
$re_logs = $this->mdItemsOplogs->max('com_time', ["item_id" => $item_id, 'type' => 2, 'biz_id_to' => $re['biz_id']]);
$re_logs['com_time'] && $in_time = $re_logs['com_time'];
$in_time && $other_data[] = ['title' => '入库时间', 'value' => $in_time];
if ($re_cor['jsondata']) {
$jsondata = json_decode($re_cor['jsondata'], true);
$jsondata['img'] && $cor_img = build_qiniu_image_url($jsondata['img']);
}
$info['title'] = $title;
$info['other_data'] = $other_data;
$info['cor_img'] = $cor_img;//车辆颜色
return $info;
}
}
+98 -6
View File
@@ -25,6 +25,7 @@ class User extends Wxapp
$this->load->model("biz/biz_model");
$this->load->model('auto/auto_brand_model');
$this->load->model('items/items_model', 'mdItems');
$this->load->model('items/items_oplogs_model', 'mdItemsOplogs');
}
/**
@@ -123,6 +124,7 @@ class User extends Wxapp
'uid' => $uid,
'uname' => $user['uname'],
'mobile' => $user['mobile'],
'headimg' => $user['headimg'],
'tel' => $tel,
'group_id' => $user['group_id'],
'group_name' => $group_name,
@@ -134,6 +136,81 @@ class User extends Wxapp
return $data;
}
/**
* 更新用户信息
* @return array
* @throws Exception
*/
protected function put()
{
$encrypted = $this->input_param('encryptedData');
$iv = $this->input_param('iv');
$intro = $this->input_param('intro');
//获取用户信息
$uid = $this->session['uid'];
$user = $this->app_user_model->get(array('id' => $uid));
$upd = array();
$mobile = '';
//授权
if (!is_null($encrypted)) {
if (!$encrypted || !$iv) {
throw new Exception('授权失败', API_CODE_INVILD_PARAM);
}
$wxdata = $this->wx_data($encrypted, $iv);
if (!$wxdata) {
throw new Exception('授权失败', API_CODE_FAIL);
}
$openid = $wxdata['openId'];
$nickname = $wxdata['nickName'];
$sex = $wxdata['gender'];
$headimg = $wxdata['avatarUrl'];
$unionid = $wxdata['unionId'];
$mobile = $wxdata['phoneNumber'];
if (!$mobile && isset($wxdata['phoneNumber'])) {
throw new Exception('微信未绑定手机号', API_CODE_FAIL);
}
$mobile && !$user['mobile'] && $upd['mobile'] = $mobile;
$nickname && $upd['nickname'] = $nickname;
$headimg && $upd['headimg'] = $headimg;
if ($mobile) {//判断手机号是否重复
if (!mobile_valid($mobile)) {
throw new Exception("请输入正确的手机号", API_CODE_FAIL);
}
$where = array('mobile' => $mobile, 'id <>' => $uid, "status<>" => -1);
$count = $this->app_user_model->count($where);
if ($count > 0) {
throw new Exception("{$mobile}已被绑", API_CODE_FAIL);
}
}
} else {//编辑其他信息
$userInfo = $this->input_param('userInfo');
$userInfo['nickName'] && $upd['nickname'] = $userInfo['nickName'];
$userInfo['avatarUrl'] && $upd['headimg'] = $userInfo['avatarUrl'];
if ($intro) {
if (mb_strlen($intro, 'utf8') > 20) {
throw new Exception('介绍自己20个字够啦', API_CODE_FAIL);
}
$upd['signature'] = $intro;
}
}
if ($upd) {
$ret = $this->app_user_model->update($upd, array('id' => $uid));
if (!$ret) {
debug_log("[error]# " . $this->app_user_model->db->last_query(), __FUNCTION__, $this->log_dir);
throw new Exception('请求失败', API_CODE_FAIL);
}
}
$data = array(
'mobile' => $mobile,
'nickname' => $upd['nickname'] ? $upd['nickname'] : $user['nickname'],
'headimg' => $upd['headimg'] ? $upd['headimg'] : $user['headimg'],
);
return $data;
}
/**
* 统计数据
*/
@@ -296,10 +373,10 @@ class User extends Wxapp
$biz_id_arr = explode(',', $this->session['biz_id']);
$fileds = 'id,biz_name,jsondata';
if ($this->session['biz_id'] && $biz_id_arr) {
$city_id && $o_where = ['city_id' => $city_id,'type<>'=>4];
$city_id && $o_where = ['city_id' => $city_id, 'type<>' => 4];
$bizs = $this->biz_model->get_by_id_arr($biz_id_arr, $o_where, $fileds);
} else {
$bizs = $this->biz_model->select(['status' => 1, 'city_id' => $city_id,'type<>'=>4], 'id desc', '', '', $fileds);
$bizs = $this->biz_model->select(['status' => 1, 'city_id' => $city_id, 'type<>' => 4], 'id desc', '', '', $fileds);
}
if ($bizs) {
foreach ($bizs as $key => $val) {
@@ -314,10 +391,25 @@ class User extends Wxapp
];
$brands = $this->auto_brand_model->select($where, '', 0, 0, 'id,name');
foreach ($brands as $key2 => $val2) {
$count_items = $this->mdItems->count(['brand_id' => $val2['id'], 'status<>' => 0, 'biz_id' => $val['id']
, 'bill_time' => '0000-00-00 00:00:00']);
$bg_color = $count_items ? '#fff' : '#999';
$auto_brands[] = ['name' => $val2['name'], 'bg_color' => $bg_color];
// $count_items = $this->mdItems->count(['brand_id' => $val2['id'], 'status<>' => 0, 'biz_id' => $val['id']
// , 'bill_time' => '0000-00-00 00:00:00']);
$res_items = $this->mdItems->select(['brand_id' => $val2['id'], 'status<>' => 0, 'biz_id' => $val['id']
, 'bill_time' => '0000-00-00 00:00:00'], 'in_time asc', 0, 0, 'id,in_time,c_time');
$str_ids = $res_items ? implode(',', array_column($res_items, 'id')) : '';
$bg_color = '#999';
$name = $val2['name'];
if ($str_ids) {
$bg_color = '#fff';
$in_time = $res_items[0]['in_time'] != '0000-00-00 00:00:00' ? strtotime($res_items[0]['in_time']) : $res_items[0]['c_time'];
$re_logs = $this->mdItemsOplogs->select(["item_id in({$str_ids})" => null, 'type' => 2, 'biz_id_to' => $val['id']
], 'c_time asc', 1, 1, 'com_time');//找出调拨最早
$re_logs && $in_time = strtotime($re_logs[0]['com_time']);
if ($in_time) {//计算库存天数
$days = round((time() - $in_time) / 3600 / 24);
$days > 0 && $name = $val2['name'] . '(' . $days . '天)';
}
}
$auto_brands[] = ['name' => $name, 'bg_color' => $bg_color];
}
}
$lists[] = [