70 行
2.3 KiB
PHP
可执行文件
70 行
2.3 KiB
PHP
可执行文件
<?php
|
|
namespace Retail\Controller;
|
|
|
|
class InvoiceApplyController extends BaseController {
|
|
|
|
/**
|
|
* 添加发票申请
|
|
*/
|
|
public function add() {
|
|
if (IS_POST) {
|
|
$data = array(
|
|
'uid' => I('post.uid', 0, 'intval'),
|
|
'invoice_id' => I('post.invoice_id', 0, 'intval'),
|
|
'order_ids' => I('post.order_ids', '', 'trim'),
|
|
'status' => I('post.status', 0, 'intval'),
|
|
'apply_time' => time()
|
|
);
|
|
|
|
$model = M('retail_invoice_apply');
|
|
if ($model->add($data)) {
|
|
$this->ajaxReturn(array('status' => 1, 'msg' => '添加成功'));
|
|
} else {
|
|
$this->ajaxReturn(array('status' => 0, 'msg' => '添加失败'));
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 删除发票申请
|
|
*/
|
|
public function delete() {
|
|
$id = I('post.id', 0, 'intval');
|
|
if (empty($id)) {
|
|
$this->ajaxReturn(array('status' => 0, 'msg' => '参数错误'));
|
|
}
|
|
|
|
$model = M('retail_invoice_apply');
|
|
if ($model->where(array('id' => $id))->delete()) {
|
|
$this->ajaxReturn(array('status' => 1, 'msg' => '删除成功'));
|
|
} else {
|
|
$this->ajaxReturn(array('status' => 0, 'msg' => '删除失败'));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 修改发票申请
|
|
*/
|
|
public function edit() {
|
|
if (IS_POST) {
|
|
$id = I('post.id', 0, 'intval');
|
|
if (empty($id)) {
|
|
$this->ajaxReturn(array('status' => 0, 'msg' => '参数错误'));
|
|
}
|
|
|
|
$data = array(
|
|
'uid' => I('post.uid', 0, 'intval'),
|
|
'invoice_id' => I('post.invoice_id', 0, 'intval'),
|
|
'order_ids' => I('post.order_ids', '', 'trim'),
|
|
'status' => I('post.status', 0, 'intval')
|
|
);
|
|
|
|
$model = M('retail_invoice_apply');
|
|
if ($model->where(array('id' => $id))->save($data)) {
|
|
$this->ajaxReturn(array('status' => 1, 'msg' => '修改成功'));
|
|
} else {
|
|
$this->ajaxReturn(array('status' => 0, 'msg' => '修改失败'));
|
|
}
|
|
}
|
|
}
|
|
} |