1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- // +----------------------------------------------------------------------
- // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
- // +----------------------------------------------------------------------
- // | Author: 萤火科技 <admin@yiovo.com>
- // +----------------------------------------------------------------------
- declare (strict_types = 1);
- namespace app\api\model;
- use app\common\model\Receipt as ReceiptModel;
- /**
- * 发票记录表模型
- * Class Store
- * @package app\store\model
- */
- class Receipt extends ReceiptModel
- {
- public function add($data){
- if (!isset($data['order_no']) || !$data['headup'] || !$data['email']){
- return false;
- }
- $ftype = $data['ftype']??0;
- if (isset($data['order_no']) && $data['order_no']){
- $check = self::where('order_no',$data['order_no'])->where('ftype',$ftype)->find();
- if ($check){
- return 201;
- }
- }
- $m = new self();
- $m->receipt_type = $data['receipt_type']??10;
- $m->order_id = $data['order_id']??0;
- $m->order_no = $data['order_no']??'';
- $m->pay_money = $data['pay_money']??'';
- $m->headup_type = $data['headup_type']??10;
- $m->headup = $data['headup']??"";
- $m->email = $data['email']??'';
- $m->tax_no = $data['tax_no']??'';
- $m->account_bank = $data['account_bank']??'';
- $m->account_no = $data['account_no']??'';
- $m->ftype = $ftype;
- $m->save();
- return true;
- }
- //是否开票
- public static function ifApplyReceipt($id,$ftype=0){
- $m = self::where('order_id',$id)->where("ftype",$ftype)->find();
- return $m?$m->getAttr('status'):0;
- }
- }
|