mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-23 02:45:33 +08:00
93 lines
2.5 KiB
PHP
93 lines
2.5 KiB
PHP
<?php
|
|
/**
|
|
* Copyright 2026 ShopeX (https://www.shopex.cn)
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
class openapi_mdl_sales extends ome_mdl_sales{
|
|
|
|
var $has_many = array(
|
|
'sales_items' => 'sales_items',
|
|
);
|
|
|
|
function __construct($app){
|
|
parent::__construct(app::get('ome'));
|
|
}
|
|
|
|
/**
|
|
* table_name
|
|
* @param mixed $real real
|
|
* @return mixed 返回值
|
|
*/
|
|
public function table_name($real=false){
|
|
$table_name = "sales";
|
|
if($real){
|
|
return kernel::database()->prefix.$this->app->app_id.'_'.$table_name;
|
|
}else{
|
|
return $table_name;
|
|
}
|
|
}
|
|
|
|
function getList($cols='*', $filter=array(), $offset=0, $limit=-1, $orderby=null){
|
|
|
|
return parent::getList($cols, $filter, $offset, $limit, $orderby);
|
|
|
|
}
|
|
|
|
/**
|
|
* modifier_shop_id
|
|
* @param mixed $shop_id ID
|
|
* @param mixed $list list
|
|
* @param mixed $row row
|
|
* @return mixed 返回值
|
|
*/
|
|
public function modifier_shop_id($shop_id,$list,$row){
|
|
static $shopList;
|
|
|
|
if (isset($shopList)) {
|
|
return $shopList[$shop_id];
|
|
}
|
|
|
|
$shopIds = array_unique(array_column($list, 'shop_id'));
|
|
$shopList = app::get('ome')->model('shop')->getList('shop_id,name', ['shop_id'=>$shopIds]);
|
|
$shopList = array_column($shopList, 'name', 'shop_id');
|
|
|
|
return $shopList[$shop_id];
|
|
}
|
|
|
|
/**
|
|
* modifier_org_id
|
|
* @param mixed $org_id ID
|
|
* @param mixed $list list
|
|
* @param mixed $row row
|
|
* @return mixed 返回值
|
|
*/
|
|
public function modifier_org_id($org_id,$list,$row){
|
|
static $orgList;
|
|
|
|
if (isset($orgList)) {
|
|
return $orgList[$org_id];
|
|
}
|
|
|
|
$orgIds = array_unique(array_column($list, 'org_id'));
|
|
$orgList = app::get('ome')->model('operation_organization')->getList('org_id,name', ['org_id'=>$orgIds]);
|
|
$orgList = array_column($orgList, 'name', 'org_id');
|
|
|
|
return $orgList[$org_id];
|
|
}
|
|
|
|
|
|
}
|
|
|
|
?>
|