liufumingren 7b18287328 fix: 全项目清理 PHP 7.4 升级遗留(open_basedir 临时目录、implode 反序、null 取下标、嵌套三元)
一、open_basedir 不能再写 /tmp(7.4 池子把白名单收紧,Monolog/EasyWeChat 会抛异常)
- addons/shopro/library/Wechat.php:easywechat 日志改到 runtime/easywechat/
- addons/epay/library/Yansongda/Supports/Logger.php:epay 日志默认路径改到 runtime/epay/
- application/admin/library/traits/Backend.php:CSV 导入临时文件改到 runtime/temp/

二、implode 参数反序(7.4 起 E_DEPRECATED,TP5 会抛异常)
- application/api/controller/Datas.php
- application/index/controller/wms/Pda.php
- 另修正 Wms.php 中 1 处(拆分面单提示)

三、null 取下标(7.4 起 "Trying to access array offset on value of type null")
- 覆盖 71 个文件 135 行:find()/value()/json_decode()/redis get 等结果未判空即取下标处,
  统一 (\['k'] ?? null) 兜底;foreach 目标用 ?? [];in_array/count 等数组参数用 ?? []
- 涉及 api/*、admin/shopro/*、addons/shopro/*、addons/epay/*、index/wms/* 等

四、嵌套三元未加括号(7.4 弃用)
- application/index/controller/wms/Wms.php getPackingprice 2 处,补括号后与旧版本解析顺序一致

验证:74 个文件、148 行改动,逐行括号/引号配平与 HEAD 一致,未改动 vendor/ 与 thinkphp/;
剩余扫描命中均为写目标、unset、或已被 if(!\){error()} 拦截的假阳性。

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-25 09:47:48 +08:00

109 lines
4.4 KiB
PHP

<?php
namespace app\api\controller;
use app\common\controller\Api;
use think\Config;
use think\Db;
use think\db\exception\BindParamException;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
/**
* 首页接口
*/
class Warehouse extends Api
{
protected $noNeedLogin = [];
protected $noNeedRight = [];
public function index(){
$WAREHOUSEID = $this->auth->warehouseid;
$page = $this->request->get('page')?$this->request->get('page'):1;
$type = $this->request->get('type')?$this->request->get('type'):1;
$Warehouseerrmodel = new \app\common\model\Warehouseerr;
$list = $Warehouseerrmodel->where(["status"=>0,"type"=>$type,"wareHouseId"=>$WAREHOUSEID])->limit(($page-1)*20,20)->select();
$count = $Warehouseerrmodel->where(["status"=>0,"type"=>$type,"wareHouseId"=>$WAREHOUSEID])->count();
$this->success("获取成功",["list"=>$list,"count"=>$count]);
}
public function item(){
$WAREHOUSEID = $this->auth->warehouseid;
$id = $this->request->get('id')?$this->request->get('id'):0;
$Warehouseerrmodel = new \app\common\model\Warehouseerr;
$item = $Warehouseerrmodel->where(["status"=>0,"wareHouseId"=>$WAREHOUSEID,"id"=>$id])->find();
if($item){
$this->success("获取成功",$item);
}else{
$this->error("工单已处理或者不存在");
}
}
public function post(){
$WAREHOUSEID = $this->auth->warehouseid;
$userid = $this->auth->id;
$params=$this->request->post();
$id = $params['id']?$params['id']:0;
$Warehouseerrmodel = new \app\common\model\Warehouseerr;
$item = $Warehouseerrmodel->where(["status"=>0,"wareHouseId"=>$WAREHOUSEID,"id"=>$id])->find();
if($item){
$item->save(["status"=>1,"performer"=>$userid]);
$this->success("处理完成");
}else{
$this->error("工单已处理或者不存在");
}
}
public function getapplyinfos(){
$params=$this->request->post();
$WAREHOUSEID = $this->auth->warehouseid;
$sn = isset($params['sn'])?$params['sn']:0;
$StorageModel = new \app\common\model\wms\Storage;
$WarehouseModel = new \app\common\model\Warehouse;
$WAREHOUSEconfig = $WarehouseModel->where(['WAREHOUSEID'=>$WAREHOUSEID])->find();
$list = $StorageModel->with(['employees','goods'])
->where(['storage.WAREHOUSEID'=>$WAREHOUSEID,'storage.APPLYSTORAGENUM'=>$sn,'storage.SPACEID'=>($WAREHOUSEconfig['SPACEID'] ?? null)])
->select();
$this->success("入库单详情",$list);
}
public function markapply(){
$params=$this->request->post();
$WAREHOUSEID = $this->auth->warehouseid;
$sn = isset($params['sn'])?$params['sn']:0;
$StorageModel = new \app\common\model\wms\Storage;
$WarehouseModel = new \app\common\model\Warehouse;
$WAREHOUSEconfig = $WarehouseModel->where(['WAREHOUSEID'=>$WAREHOUSEID])->find();
$list = $StorageModel->where(['WAREHOUSEID'=>$WAREHOUSEID,'APPLYSTORAGENUM'=>$sn,'SPACEID'=>($WAREHOUSEconfig['SPACEID'] ?? null)])
->select();
foreach($list as $r){
$WarehouseModel = new \app\common\model\Storage;
$detail = [
'WAREHOUSEID'=>$r['WAREHOUSEID'],
'APPLYSTORAGENUM'=>$r['APPLYSTORAGENUM']
];
$details = $WarehouseModel->where($detail)->find();
if(!$details){
$WarehouseModel->save($detail);
}
}
$this->success("标记成功");
}
public function stockaking_trace_list(){
$WAREHOUSEID = $this->auth->warehouseid;
$ListsModel = new \app\common\model\stockaking\Lists;
$list = $ListsModel->where(["WAREHOUSEID"=>$WAREHOUSEID])->order('id','desc')->select();
$this->success('获取成功',$list);
}
public function create_stockaking(){
$WAREHOUSEID = $this->auth->warehouseid;
$params=$this->request->post();
$title = $params['title'];
$title = $params['type'];
$userid = $this->auth->id;
$ListsModel = new \app\common\model\stockaking\Lists;
$insert = [
"createdtime"=>time(),
"WAREHOUSEID"=>$WAREHOUSEID,
"status"=>0,
"STOREID"=>0,
"title"=>$title
];
}
}