Commit b5ae3b18 authored by clone's avatar clone

1

parent e1262186
......@@ -40,21 +40,21 @@ class StoreFee extends Basic
*/
public function addApplyFor()
{
$params = $this->params;
/* $params = array(
'type' => 1,//费用类型
'fee_item' => 100,//费用项目
'total_fee' => 123.43,//总费用
'agent_id' => 11,//经纪人id
'store_id' => 12,//门店id
'assume_fee' => 111, //费用承担金额
'site_id' => 10001, //站点id
'card_name' => "123123",//收款卡户名 非必填
'bank' => "123123",//开户行 非必填
'card_no' => "123123",//银行卡号 非必填
'count_time' => "2019-07-01",//计入日期, pc后台的字段 非必填
'img_arr' => [],//数组模式 同收款一样
);*/
$params = $this->params;
/* $params = array(
'type' => 1,//费用类型
'fee_item' => 100,//费用项目
'total_fee' => 123.43,//总费用
'purpose' => 111, //详细用途
'agent_id' => 11,//经纪人id
'store_id' => 12,//门店id
'site_id' => 10001, //站点id
'card_name' => "123123",//收款卡户名 非必填
'bank' => "123123",//开户行 非必填
'card_no' => "123123",//银行卡号 非必填
'count_time' => "2019-07-01",//计入日期, pc后台的字段 非必填
'img_arr' => [],//数组模式 同收款一样
);*/
$checkResult = $this->validate($params, "StoreFeeValidate.addApplyFor");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
......@@ -64,18 +64,22 @@ class StoreFee extends Basic
$total_fee = $params["total_fee"];
$agent_id = $params["agent_id"];
$store_id = $params["store_id"];
$assume_fee = $params["assume_fee"];
$site_id = $params["assume_fee"];
$purpose = $params["purpose"];
$site_id = $params["site_id"];
$card_name = $params["card_name"];
$bank = $params["bank"];
$card_no = $params["card_no"];
$count_time = $params["count_time"];
$img_arr = isset($params["img_arr"]) ? json_decode($params["img_arr"], true) : "";
if(!$img_arr){
$img_arr = isset($params["img_arr"]) ? json_decode($params["img_arr"], true) : "";
if (!$img_arr) {
return $this->response("101", "请上传图片");
}
$is_ok = $this->service_->addApplyFor($type, $fee_item, $total_fee, $agent_id, $store_id, $assume_fee, $site_id, $card_name,
$bank, $card_no, $count_time,$img_arr);
$if_verify = $this->service_->verifyType($type, $fee_item);
if(!$if_verify){
return $this->response("101", "类型选择错误");
}
$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);
if ($is_ok > 0) {
return $this->response("200", "request success", []);
} else {
......
......@@ -28,7 +28,7 @@ class StoreFeeService
* @param $total_fee
* @param $agent_id
* @param $store_id
* @param $assume_fee
* @param $purpose
* @param $site_id
* @param $card_name
* @param $bank
......@@ -39,18 +39,43 @@ class StoreFeeService
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function addApplyFor($type, $fee_item, $total_fee, $agent_id, $store_id, $assume_fee, $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)
{
$arr = $this->applyForFeeBin(0, $type, $fee_item, $total_fee, $agent_id, $store_id, $assume_fee, $site_id, $card_name,
$arr = $this->applyForFeeBin(0, $type, $fee_item, $total_fee, $agent_id, $store_id, $purpose, $site_id, $card_name,
$bank, $card_no, $count_time);
$feeId = $this->applyForFeeModel->saveData($arr);
if ($feeId > 0) {
$this->imgModel->addImgAll($feeId,1,$img_arr);
$this->imgModel->addImgAll($feeId, 1, $img_arr);
}
return $feeId;
}
public function verifyType($type, $fee_item)
{
switch ($type) {
case 1:
if ($fee_item > 0 && $fee_item < 200) {
return true;
}
break;
case 2:
if ($fee_item > 200 && $fee_item < 300) {
return true;
}
break;
case 3:
if ($fee_item == 301) {
return true;
}
break;
case 4:
if ($fee_item > 500 && $fee_item < 600) {
return true;
}
break;
}
return false;
}
/**
......@@ -60,7 +85,7 @@ class StoreFeeService
* @param $total_fee
* @param $agent_id
* @param $store_id
* @param $assume_fee
* @param $purpose
* @param $site_id
* @param $card_name
* @param $bank
......@@ -68,7 +93,7 @@ class StoreFeeService
* @param $count_time
* @return array
*/
private function applyForFeeBin($id, $type, $fee_item, $total_fee, $agent_id, $store_id, $assume_fee, $site_id, $card_name,
private function applyForFeeBin($id, $type, $fee_item, $total_fee, $agent_id, $store_id, $purpose, $site_id, $card_name,
$bank, $card_no, $count_time)
{
......@@ -91,8 +116,8 @@ class StoreFeeService
if ($site_id) {
$arr["site_id"] = $site_id;
}
if ($assume_fee) {
$arr["assume_fee"] = $assume_fee;
if ($purpose) {
$arr["purpose"] = $purpose;
}
if ($card_name) {
$arr["card_name"] = $card_name;
......
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