295 lines
12 KiB
PHP
295 lines
12 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller\school;
|
|
|
|
use app\common\model\user\invoice\Apply;
|
|
use app\common\model\user\invoice\Header as HeaderModel;
|
|
|
|
/**
|
|
* 个人发票抬头库管理
|
|
*/
|
|
class Header extends Base
|
|
{
|
|
protected $noNeedLogin = [];
|
|
protected $noNeedRight = '*';
|
|
|
|
protected $model = null;
|
|
|
|
|
|
/**
|
|
* 初始化操作
|
|
* @access protected
|
|
*/
|
|
protected function _initialize()
|
|
{
|
|
// $this->transactionCheck();
|
|
|
|
$this->model = new HeaderModel;
|
|
parent::_initialize();
|
|
//敏感词过滤
|
|
// $this->checkSensitivewords([]);
|
|
|
|
// $this->setUrlLock();
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @ApiTitle( 抬头列表接口)
|
|
* @ApiSummary(抬头列表接口)
|
|
* @ApiMethod(GET)
|
|
* @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
|
|
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
|
|
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
|
|
*
|
|
* @ApiReturn({
|
|
*
|
|
*})
|
|
*/
|
|
public function header_list()
|
|
{
|
|
$user_id = 0;
|
|
$user = $this->auth->getUser();//登录用户
|
|
if($user)$user_id = $user['id'];
|
|
|
|
$params = [];
|
|
$params['user_id'] = $user_id;
|
|
$page = $this->request->get('page/d', 0); //页数
|
|
$limit = $this->request->get('limit/d', 0); //条数
|
|
$params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字
|
|
|
|
|
|
// $params["time"] = $this->request->get('time/s', ''); //时间
|
|
|
|
try{
|
|
//当前申请状态
|
|
$res = $this->model::headerList($page, $limit,$params);
|
|
// if($user_id =='670153'){
|
|
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
|
|
// }
|
|
}catch (\Exception $e){
|
|
|
|
$this->error($e->getMessage());
|
|
}
|
|
$this->success('查询成功', $res);
|
|
}
|
|
|
|
|
|
/**
|
|
* @ApiTitle( 抬头详情)
|
|
* @ApiSummary(抬头详情)
|
|
* @ApiMethod(GET)
|
|
* @ApiParams(name = "id", type = "int",required=true,description = "抬头id")
|
|
* @ApiReturn({
|
|
*
|
|
*})
|
|
*/
|
|
public function detail(){
|
|
$id = $this->request->get('id/d','');
|
|
|
|
if(empty($id)){
|
|
$this->error(__('缺少必要参数'));
|
|
}
|
|
|
|
try {
|
|
$res = $this->model->detail($id);
|
|
} catch (\Exception $e){
|
|
// Log::log($e->getMessage());
|
|
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
|
}
|
|
$this->success('获取成功', ['detail' => $res]);
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* 删除抬头
|
|
*
|
|
* @ApiMethod (POST)
|
|
* @ApiParams (name="ids", type="string", required=true, description="要删除的ids")
|
|
*/
|
|
public function del()
|
|
{
|
|
// $admin_id = $this->auth->id;
|
|
$ids = $this->request->post('ids/s');
|
|
|
|
try{
|
|
$menulist = $this->model->del($ids,true);
|
|
} catch (\Exception $e) {
|
|
$this->error($e->getMessage());
|
|
}
|
|
|
|
$this->success('删除成功', $menulist);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @ApiTitle(添加抬头)
|
|
* @ApiSummary(添加抬头)
|
|
* @ApiMethod(POST)
|
|
* @ApiParams(name = "head_type", type = "string",required=true,description = "抬头类型:personal=个人或事业单位,corporate=企业")
|
|
* @ApiParams(name = "invoice_type", type = "string",required=true,description = "发票类型:ordinary=普通发票,special=专用发票")
|
|
* @ApiParams(name = "invoice_header", type = "string",required=true,description = "发票抬头")
|
|
* @ApiParams(name = "tax_id", type = "string",required=true,description = "税号")
|
|
* @ApiParams(name = "bank_deposit", type = "string",required=true,description = "开户银行")
|
|
* @ApiParams(name = "bank_number", type = "string",required=true,description = "银行账号")
|
|
* @ApiParams(name = "enterprise_address", type = "string",required=true,description = "企业地址")
|
|
* @ApiParams(name = "enterprise_phone", type = "string",required=true,description = "企业电话")
|
|
* @ApiParams(name = "invoice_reservation_phone", type = "string",required=true,description = "发票预留电话")
|
|
* @ApiParams(name = "invoice_reservation_email", type = "string",required=true,description = "发票预留邮箱")
|
|
* @ApiParams(name = "is_default", type = "string",required=true,description = "是否默认:0=否,1=是")
|
|
* @ApiReturn({
|
|
*
|
|
*})
|
|
*/
|
|
public function add(){
|
|
|
|
//敏感词过滤
|
|
$this->checkSensitivewords(["invoice_header"]);
|
|
|
|
$user_id = 0;
|
|
$user = $this->auth->getUser();//登录用户
|
|
if($user)$user_id = $user['id'];
|
|
$params = [];
|
|
$params["user_id"] = $user_id; //老师id
|
|
$params["head_type"] = $this->request->post('head_type/s', ''); //课程标签
|
|
$params["invoice_type"] = $this->request->post('invoice_type/s', ''); //课程标签
|
|
$params["invoice_header"] = $this->request->post('invoice_header/s', ''); //课程标签
|
|
$params["tax_id"] = $this->request->post('tax_id/s', ''); //课程标签
|
|
$params["bank_deposit"] = $this->request->post('bank_deposit/s', ''); //课程标签
|
|
$params["bank_number"] = $this->request->post('bank_number/s', ''); //课程标签
|
|
$params["enterprise_address"] = $this->request->post('enterprise_address/s', ''); //课程标签
|
|
$params["enterprise_phone"] = $this->request->post('enterprise_phone/s', ''); //课程标签
|
|
$params["invoice_reservation_phone"] = $this->request->post('invoice_reservation_phone/s', ''); //课程标签
|
|
$params["invoice_reservation_email"] = $this->request->post('invoice_reservation_email/s', ''); //课程标签
|
|
$params["is_default"] = $this->request->post('is_default/d', ''); //课程标签
|
|
|
|
try{
|
|
$res = $this->model->add($params,true);
|
|
}catch (\Throwable $e){
|
|
$this->error($e->getMessage());
|
|
}
|
|
$this->success('添加成功', $res);
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* @ApiTitle(编辑成员)
|
|
* @ApiSummary(编辑成员)
|
|
* @ApiMethod(POST)
|
|
* @ApiRoute (/api/school.header/edit/ids/{ids})
|
|
* @ApiParams (name="ids", type="string", required=true, description="需要编辑的id")
|
|
* @ApiParams(name = "head_type", type = "string",required=true,description = "抬头类型:personal=个人或事业单位,corporate=企业")
|
|
* @ApiParams(name = "invoice_type", type = "string",required=true,description = "发票类型:ordinary=普通发票,special=专用发票")
|
|
* @ApiParams(name = "invoice_header", type = "string",required=true,description = "发票抬头")
|
|
* @ApiParams(name = "tax_id", type = "string",required=true,description = "税号")
|
|
* @ApiParams(name = "bank_deposit", type = "string",required=true,description = "开户银行")
|
|
* @ApiParams(name = "bank_number", type = "string",required=true,description = "银行账号")
|
|
* @ApiParams(name = "enterprise_address", type = "string",required=true,description = "企业地址")
|
|
* @ApiParams(name = "enterprise_phone", type = "string",required=true,description = "企业电话")
|
|
* @ApiParams(name = "invoice_reservation_phone", type = "string",required=true,description = "发票预留电话")
|
|
* @ApiParams(name = "invoice_reservation_email", type = "string",required=true,description = "发票预留邮箱")
|
|
* @ApiParams(name = "is_default", type = "string",required=true,description = "是否默认:0=否,1=是")
|
|
* @ApiReturn({
|
|
*
|
|
*})
|
|
*/
|
|
public function edit($ids = null){
|
|
//敏感词过滤
|
|
$this->checkSensitivewords(["name","idnum"]);
|
|
|
|
$user_id = 0;
|
|
$user = $this->auth->getUser();//登录用户
|
|
if($user)$user_id = $user['id'];
|
|
$params = [];
|
|
$params["user_id"] = $user_id; //老师id
|
|
$params["head_type"] = $this->request->post('head_type/s', ''); //课程标签
|
|
$params["invoice_type"] = $this->request->post('invoice_type/s', ''); //课程标签
|
|
$params["invoice_header"] = $this->request->post('invoice_header/s', ''); //课程标签
|
|
$params["tax_id"] = $this->request->post('tax_id/s', ''); //课程标签
|
|
$params["bank_deposit"] = $this->request->post('bank_deposit/s', ''); //课程标签
|
|
$params["bank_number"] = $this->request->post('bank_number/s', ''); //课程标签
|
|
$params["enterprise_address"] = $this->request->post('enterprise_address/s', ''); //课程标签
|
|
$params["enterprise_phone"] = $this->request->post('enterprise_phone/s', ''); //课程标签
|
|
$params["invoice_reservation_phone"] = $this->request->post('invoice_reservation_phone/s', ''); //课程标签
|
|
$params["invoice_reservation_email"] = $this->request->post('invoice_reservation_email/s', ''); //课程标签
|
|
$params["is_default"] = $this->request->post('is_default/d', ''); //课程标签
|
|
|
|
try{
|
|
$res = $this->model->edit($ids,$params,true);
|
|
}catch (\Throwable $e){
|
|
$this->error($e->getMessage());
|
|
}
|
|
$this->success('编辑成功', $res);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @ApiTitle(订单申请开票(单开|合开))
|
|
* @ApiSummary(订单申请开票)
|
|
* @ApiMethod(POST)
|
|
* @ApiParams(name = "order_nos", type = "string",required=true,description = "需要开票的订单号:多开传多个逗号隔开字符串")
|
|
* @ApiParams(name = "head_type", type = "string",required=true,description = "抬头类型:personal=个人或事业单位,corporate=企业")
|
|
* @ApiParams(name = "invoice_type", type = "string",required=true,description = "发票类型:ordinary=普通发票,special=专用发票")
|
|
* @ApiParams(name = "invoice_header", type = "string",required=true,description = "发票抬头")
|
|
* @ApiParams(name = "tax_id", type = "string",required=true,description = "税号")
|
|
* @ApiParams(name = "bank_deposit", type = "string",required=true,description = "开户银行")
|
|
* @ApiParams(name = "bank_number", type = "string",required=true,description = "银行账号")
|
|
* @ApiParams(name = "enterprise_address", type = "string",required=true,description = "企业地址")
|
|
* @ApiParams(name = "enterprise_phone", type = "string",required=true,description = "企业电话")
|
|
* @ApiParams(name = "invoice_reservation_phone", type = "string",required=true,description = "发票预留电话")
|
|
* @ApiParams(name = "invoice_reservation_email", type = "string",required=true,description = "发票预留邮箱")
|
|
* @ApiReturn({
|
|
*
|
|
*})
|
|
*/
|
|
public function apply(){
|
|
$this->model = new Apply();
|
|
//敏感词过滤
|
|
$this->checkSensitivewords(["invoice_header"]);
|
|
|
|
$user_id = 0;
|
|
$user = $this->auth->getUser();//登录用户
|
|
if($user)$user_id = $user['id'];
|
|
$params = [];
|
|
$params["user_id"] = $user_id; //老师id
|
|
$order_no = $this->request->post('order_nos/s', ''); //课程标签
|
|
|
|
$params["head_type"] = $this->request->post('head_type/s', ''); //课程标签
|
|
$params["invoice_type"] = $this->request->post('invoice_type/s', ''); //课程标签
|
|
$params["invoice_header"] = $this->request->post('invoice_header/s', ''); //课程标签
|
|
$params["tax_id"] = $this->request->post('tax_id/s', ''); //课程标签
|
|
$params["bank_deposit"] = $this->request->post('bank_deposit/s', ''); //课程标签
|
|
$params["bank_number"] = $this->request->post('bank_number/s', ''); //课程标签
|
|
$params["enterprise_address"] = $this->request->post('enterprise_address/s', ''); //课程标签
|
|
$params["enterprise_phone"] = $this->request->post('enterprise_phone/s', ''); //课程标签
|
|
$params["invoice_reservation_phone"] = $this->request->post('invoice_reservation_phone/s', ''); //课程标签
|
|
$params["invoice_reservation_email"] = $this->request->post('invoice_reservation_email/s', ''); //课程标签
|
|
// $params["is_default"] = $this->request->post('is_default/d', ''); //课程标签
|
|
|
|
try{
|
|
|
|
$res = $this->model->add($order_no,$params,$user_id,'user',true,true);
|
|
}catch (\Throwable $e){
|
|
$this->error($e->getMessage());
|
|
}
|
|
$this->success('添加成功', $res);
|
|
}
|
|
|
|
|
|
|
|
|
|
} |