Commit f101ae94 authored by clone's avatar clone

1

parent ff8aee8a
...@@ -74,10 +74,10 @@ class StoreFee extends Basic ...@@ -74,10 +74,10 @@ class StoreFee extends Basic
$bank = $params["bank"]; $bank = $params["bank"];
$card_no = $params["card_no"]; $card_no = $params["card_no"];
$count_time = $params["count_time"]; $count_time = $params["count_time"];
if (($type == 1 || $type == 5) && !$office_id){ if (($type == 1 || $type == 5) && !$office_id) {
return $this->response("101", "办公室必传"); return $this->response("101", "办公室必传");
} }
$img_arr = isset($params["img_arr"]) ? json_decode($params["img_arr"], true) : ""; $img_arr = isset($params["img_arr"]) ? json_decode($params["img_arr"], true) : "";
if (!$img_arr) { if (!$img_arr) {
return $this->response("101", "请上传图片"); return $this->response("101", "请上传图片");
} }
...@@ -85,6 +85,10 @@ class StoreFee extends Basic ...@@ -85,6 +85,10 @@ class StoreFee extends Basic
if (!$if_verify) { if (!$if_verify) {
return $this->response("101", "类型选择错误"); return $this->response("101", "类型选择错误");
} }
$is_commit = $this->service_->verifyTypeAndFeeItem($type, $fee_item, $store_id, $office_id, $count_time);
if (!$is_commit) {
return $this->response("101", "办公室水电费每月只能提交一次");
}
$is_ok = $this->service_->addApplyFor($type, $fee_item, $total_fee, $agent_id, $store_id, $purpose, $site_id, $card_name, $is_ok = $this->service_->addApplyFor($type, $fee_item, $total_fee, $agent_id, $store_id, $purpose, $site_id, $card_name,
$bank, $card_no, $count_time, $img_arr, 0, $office_id); $bank, $card_no, $count_time, $img_arr, 0, $office_id);
if ($is_ok > 0) { if ($is_ok > 0) {
......
...@@ -46,7 +46,8 @@ class StoreFeeService ...@@ -46,7 +46,8 @@ class StoreFeeService
* @param int $id * @param int $id
* @param int $office_id * @param int $office_id
* @return int|string * @return int|string
* @throws \app\model\Exception * @throws \think\Exception
* @throws \think\exception\PDOException
*/ */
public function addApplyFor($type, $fee_item, $total_fee, $agent_id, $store_id, $purpose, $site_id, $card_name, public function addApplyFor($type, $fee_item, $total_fee, $agent_id, $store_id, $purpose, $site_id, $card_name,
$bank, $card_no, $count_time, $img_arr, $id = 0, $office_id = 0) $bank, $card_no, $count_time, $img_arr, $id = 0, $office_id = 0)
...@@ -66,9 +67,7 @@ class StoreFeeService ...@@ -66,9 +67,7 @@ class StoreFeeService
return $feeId; return $feeId;
} }
/** /**后台提交无需总监审核
* 后台提交无需总监审核
*
* @param $type * @param $type
* @param $fee_item * @param $fee_item
* @param $total_fee * @param $total_fee
...@@ -85,7 +84,8 @@ class StoreFeeService ...@@ -85,7 +84,8 @@ class StoreFeeService
* @param int $office_id * @param int $office_id
* @param int $status * @param int $status
* @return int|string * @return int|string
* @throws \app\model\Exception * @throws \think\Exception
* @throws \think\exception\PDOException
*/ */
public function addApplyForPC($type, $fee_item, $total_fee, $agent_id, $store_id, $purpose, $site_id, $card_name, public function addApplyForPC($type, $fee_item, $total_fee, $agent_id, $store_id, $purpose, $site_id, $card_name,
$bank, $card_no, $count_time, $img_arr, $id = 0, $office_id = 0, $status = 0) $bank, $card_no, $count_time, $img_arr, $id = 0, $office_id = 0, $status = 0)
...@@ -105,10 +105,43 @@ class StoreFeeService ...@@ -105,10 +105,43 @@ class StoreFeeService
return $feeId; return $feeId;
} }
/**
* @param $type
* @param $fee_item
* @param $store_id
* @param $office_id
* @param $count_time
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function verifyTypeAndFeeItem($type, $fee_item, $store_id, $office_id, $count_time)
{
if ($type == 1 && $fee_item == 101) {
if ($office_id <= 0) {
$storeModel = new AStore();
$field = "id,office_id";
$office_info = $storeModel->findStore($field, ["id" => $store_id]);
$office_id = $office_info["office_id"];
}
$applyForArr = $this->applyForFeeModel->findByOne("id", [
"type" => $type,
"fee_item" => $fee_item,
"office_id" => $office_id,
"count_time" => $count_time
]
);
if (count($applyForArr) > 0) {
return false;
}
}
return true;
}
//费用类型 1办公室成本 2上海总部成本 3分部成本 4同联发展基金 5门店单独成本 //费用类型 1办公室成本 2上海总部成本 3分部成本 4同联发展基金 5门店单独成本
public function verifyType($type, $fee_item) public function verifyType($type, $fee_item)
{ {
switch ($type) { switch ($type) {
case 1: case 1:
if ($fee_item > 0 && $fee_item < 200) { if ($fee_item > 0 && $fee_item < 200) {
......
...@@ -494,6 +494,10 @@ class StoreFee extends Basic ...@@ -494,6 +494,10 @@ class StoreFee extends Basic
return $this->response("101", "类型选择错误"); return $this->response("101", "类型选择错误");
} }
} }
$is_commit = $service_->verifyTypeAndFeeItem($type, $fee_item,$store_id,$office_id,$count_time);
if(!$is_commit){
return $this->response("101", "办公室水电费每月只能提交一次");
}
$is_ok = $service_->addApplyForPC($type, $fee_item, $total_fee, $agent_id, $store_id, $purpose, $site_id, $card_name, $is_ok = $service_->addApplyForPC($type, $fee_item, $total_fee, $agent_id, $store_id, $purpose, $site_id, $card_name,
$bank, $card_no, $count_time, $img_arr, $id, $office_id, $status); $bank, $card_no, $count_time, $img_arr, $id, $office_id, $status);
if ($is_ok > 0) { if ($is_ok > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment