[ 'id' =>0, // 类型名称 'name' =>'填写地址', ],'1'=>[ 'id' =>1, // 类型名称 'name' =>'进行中', ],'2'=>[ 'id' =>2, // 类型名称 'name' =>'待发货', ],'3'=>[ 'id' =>2, // 类型名称 'name' =>'已发货', ],'8'=>[ 'id' =>8, // 类型名称 'name' =>'已完成', ]]; /** * 状态列表 * */ public function getRecordStateList(){ // 返回数据 return $this->state; } /** * 获取状态值 * * @param int $id 类型ID * @param string $field 字段 * */ public function getRecordState($id,$field=''){ // 获取数据 $list = $this->getRecordStateList(); // 获取交易类型 $one = isset($list[$id]) ? $list[$id] : []; // 如果存在需要的字段 if( $field ) return isset($one[$field]) ? $one[$field] : null; // 返回结果 return $one; } }