1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- /**
-
- *
-
- *
- * ----------------------------------------------------------------------------
- *
-
- * 数据层模型
- */
- class Invoice extends BaseModel
- {
- /**
- * 取得买家默认发票
- * @access public
- * @author csdeshang
- * @param array $condition 条件数组
- * @return array
- */
- public function getDefaultInvoiceInfo($condition = array())
- {
- return Db::name('invoice')->where($condition)->order('invoice_state asc')->find();
- }
- /**
- * 取得单条发票信息
- * @access public
- * @author csdeshang
- * @param array $condition 查询条件
- */
- public function getInvoiceInfo($condition = array())
- {
- return Db::name('invoice')->where($condition)->find();
- }
- /**
- * 取得发票列表
- * @access public
- * @author csdeshang
- * @param type $condition 条件
- * @param type $limit 限制
- * @param type $field 字段
- * @return type
- */
- public function getInvoiceList($condition, $limit = 0, $field = '*')
- {
- return Db::name('invoice')->field($field)->where($condition)->limit($limit)->select()->toArray();
- }
- /**
- * 删除发票信息
- * @access public
- * @author csdeshang
- * @param array $condition 条件
- * @return bool
- */
- public function delInvoice($condition)
- {
- return Db::name('invoice')->where($condition)->delete();
- }
- /**
- * 新增发票信息
- * @access public
- * @author csdeshang
- * @param array $data 参数内容
- * @return bool
- */
- public function addInvoice($data)
- {
- return Db::name('invoice')->insertGetId($data);
- }
- /**
- * 编辑发票
- * @param type $data
- * @param type $condition
- * @return type
- */
- public function editInvoice($data, $condition)
- {
- return Db::name('invoice')->where($condition)->update($data);
- }
- }
|