1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace app\admin\model;
- use think\Model;
- class OrderTax extends Model {
- protected $createTime = 'createTime';
- /**
- * @param $spuCode
- * @param int $open_type 1 原商品开票 2 子商品开票
- * @param int $order_type 1 进项 2 销项
- * @return array
- */
- public static function SpuCat($spuCode,$open_type=1,$order_type=2){
- $result=[];
- if($open_type==2){
- $goods= GoodCombind::where('spuCode',$spuCode)->select();
- if(!$goods->isEmpty()){
- foreach ($goods as $item){
- $temp = GoodTax::getInfobySpuCode($item->childCode,$order_type);
- if(empty($temp)) continue;
- $result[]=$temp;
- }
- }
- }
- $temp = GoodTax::getInfobySpuCode($spuCode,$order_type);
- if(empty($temp)) return $result;
- $result[]=$temp;
- return $result;
- }
- }
|