Files
OMS/app/finance/lib/rpc/request/bill.php
2026-01-04 19:08:31 +08:00

79 lines
2.1 KiB
PHP

<?php
/**
* Copyright 2012-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.
*/
/**
* 财务费用
*
* @category finance
* @package finance/lib/rpc/request
* @author chenping<chenping@shopex.cn>
* @version $Id: bill.php 2013-3-12 17:23Z
*/
class finance_rpc_request_bill{
const _APP_NAME = 'ome';
private $shop_id = NULL;
/**
* 店铺ID初始
*
* @param String $shop_id 店铺ID
* @return void
* @author
**/
public function setShopId($shop_id)
{
$this->shop_id = $shop_id;
return $this;
}
public function __call($method,$args)
{
$rs = array('rsp'=>'fail','msg'=>'no method','msg_code'=>'','msg_id'=>'','data'=>'');
if (!$this->shop_id) {
$rs['msg'] = 'set shop id first';
return $rs;
}
$shop = app::get(self::_APP_NAME)->model('shop')->dump($this->shop_id);
if (!$shop['node_type']) {
$rs['msg'] = 'no shop type';
return $rs;
}
try {
$class_name = sprintf('finance_rpc_request_bill_%s',$shop['node_type']);
if (class_exists($class_name)) {
$platform = kernel::single($class_name);
if ($platform instanceof finance_rpc_request_bill_abstract && method_exists($platform,$method)) {
$platform->setShop($shop);
return call_user_func_array(array($platform,$method), $args);
}
}
} catch (Exception $e) {
$rs['msg'] = 'no file';
return $rs;
}
return $rs;
}
}