Files
OMS/app/invoice/lib/extracolumn/abstract.php
2025-12-28 23:13:25 +08:00

70 lines
1.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Copyright © ShopeX http://www.shopex.cn. All rights reserved.
* See LICENSE file for license details.
*/
/**
* 插件接口类
* 20160712
* @author wangjianjun@shopex.cn
* @version 1.0
*/
abstract class invoice_extracolumn_abstract {
/**
* 传入的关联主键id数组
*/
private $__Ids = array();
/**
* 传入的列表页数据数组
*/
private $__params = array();
/**
* 关联数据数组
*/
private $__formatData = array();
/**
* 初始化相关参数
* @param Array $params 要处理的列表数组数据
*/
public function init($params){
if(is_null($this->__Ids) || count($this->__Ids) <=0){
foreach($params as $k => $param){
$this->__Ids[] = $param[$this->__pkey];
}
}
$this->__params = $params;
}
/**
* 转化关联的实际数据输出
*/
public function outPut(){
foreach($this->__params as $k =>$_param){
if(isset($this->__formatData[$_param[$this->__pkey]])){
$this->__params[$k][$this->__extra_column] = $this->__formatData[$_param[$this->__pkey]];
}else{
$this->__params[$k][$this->__extra_column] ='';
}
}
return $this->__params;
}
/**
* 处理列表数组里的扩展字段
* @param Array $params 要处理的列表数组数据
* @return Array 转换扩展字段后的列表数据
*/
public function process($params){
$this->init($params);
$this->__formatData = $this->associatedData($this->__Ids);
return $this->outPut();
}
}