Commit 55b86b85 authored by clone's avatar clone

1

parent 0e5511bc
...@@ -124,7 +124,7 @@ class OfficeOrderLogService ...@@ -124,7 +124,7 @@ class OfficeOrderLogService
if ($pay_id > 0) { if ($pay_id > 0) {
$payLogService = new OfficePayLogService(); $payLogService = new OfficePayLogService();
$payLogService->addAdjustment($father_id, $pay_id, $money, $type, $agent_id); $payLogService->addAdjustment($father_id, $pay_id, $money, $type, $agent_id, $store_id);
} }
/*$pushMarchIn = new PushMessageService(); /*$pushMarchIn = new PushMessageService();
......
...@@ -43,7 +43,7 @@ class OfficePayLogService ...@@ -43,7 +43,7 @@ class OfficePayLogService
* @param $type * @param $type
* @return int * @return int
*/ */
public function adjustment($pay_id,$type = 1) public function adjustment($pay_id, $type = 1)
{ {
//todo 1.计算剩余金额 查询调整表 2.减去退款 3.减去转账 //todo 1.计算剩余金额 查询调整表 2.减去退款 3.减去转账
$filed = "id,money"; $filed = "id,money";
...@@ -59,7 +59,7 @@ class OfficePayLogService ...@@ -59,7 +59,7 @@ class OfficePayLogService
$adjustment_sum = $this->payLogAdjustmentModel->getAdjustmentSum("money", $where_); $adjustment_sum = $this->payLogAdjustmentModel->getAdjustmentSum("money", $where_);
//减去退款 //减去退款
$refund_params["pay_log_id"] = $pay_id; $refund_params["pay_log_id"] = $pay_id;
if($type == 2){ if ($type == 2) {
//驳回退款 不会改变入账的状态,驳回退款是为了让店长重新编辑上传的东西。 //驳回退款 不会改变入账的状态,驳回退款是为了让店长重新编辑上传的东西。
$refund_params["status"] = array("neq", 4); $refund_params["status"] = array("neq", 4);
} }
...@@ -79,14 +79,14 @@ class OfficePayLogService ...@@ -79,14 +79,14 @@ class OfficePayLogService
* @param $agent_id * @param $agent_id
* @return int * @return int
*/ */
public function addAdjustment($new_pay_id, $pay_id, $money, $type, $agent_id) public function addAdjustment($new_pay_id, $pay_id, $money, $type, $agent_id, $store_id)
{ {
$filed = "id,type"; $filed = "id,type";
$pay_log_arr = $this->payLogModel->getBeforeBillInfo($filed, ["id" => $pay_id]); $pay_log_arr = $this->payLogModel->getBeforeBillInfo($filed, ["id" => $pay_id]);
if (count($pay_log_arr) < 0) { if (count($pay_log_arr) < 0) {
return -1; return -1;
} }
$where_ = $this->adjustmentBin($new_pay_id, $pay_id, $money, $type, $agent_id, $pay_log_arr[0]["type"]); $where_ = $this->adjustmentBin($new_pay_id, $pay_id, $money, $type, $agent_id, $pay_log_arr[0]["type"], $store_id);
$this->payLogAdjustmentModel->addAdjustment($where_); $this->payLogAdjustmentModel->addAdjustment($where_);
} }
...@@ -99,7 +99,7 @@ class OfficePayLogService ...@@ -99,7 +99,7 @@ class OfficePayLogService
* @param $old_type * @param $old_type
* @return mixed * @return mixed
*/ */
private function adjustmentBin($new_pay_id, $pay_id, $money, $type, $agent_id, $old_type) private function adjustmentBin($new_pay_id, $pay_id, $money, $type, $agent_id, $old_type, $store_id)
{ {
$arr["paylog_id"] = $pay_id; $arr["paylog_id"] = $pay_id;
...@@ -140,6 +140,7 @@ class OfficePayLogService ...@@ -140,6 +140,7 @@ class OfficePayLogService
$arr["type"] = $val; $arr["type"] = $val;
$arr["operation_id"] = $agent_id; $arr["operation_id"] = $agent_id;
$arr["reckon_in_store"] = $store_id;
$arr["create_time"] = date("Y-m-d H:i:s", time()); $arr["create_time"] = date("Y-m-d H:i:s", time());
$arr["update_time"] = date("Y-m-d H:i:s", time()); $arr["update_time"] = date("Y-m-d H:i:s", time());
return $arr; return $arr;
...@@ -185,14 +186,14 @@ class OfficePayLogService ...@@ -185,14 +186,14 @@ class OfficePayLogService
//验证金额是否合法 //验证金额是否合法
$payLogService = new OfficePayLogService(); $payLogService = new OfficePayLogService();
$residue_money = $payLogService->adjustment($pay_log_id,2); $residue_money = $payLogService->adjustment($pay_log_id, 2);
if ($residue_money < $refund_money) { if ($residue_money < $refund_money) {
return -2; return -2;
} }
$insert_id = 0; $insert_id = 0;
$arr = $this->refundBin($agent_id, $agent_name, $report_id, $order_id, $order_no, $refund_money, $name, $arr = $this->refundBin($agent_id, $agent_name, $report_id, $order_id, $order_no, $refund_money, $name,
$phone, $bank, $card_no, $receipt_number, $type, $refund_cause, $pay_log_id,$refund_way, $remark,$refund_id); $phone, $bank, $card_no, $receipt_number, $type, $refund_cause, $pay_log_id, $refund_way, $remark, $refund_id);
if ($refund_id <= 0) { if ($refund_id <= 0) {
$insert_id = $this->oRefundModel->addRefund($arr); $insert_id = $this->oRefundModel->addRefund($arr);
} else { } else {
...@@ -203,8 +204,8 @@ class OfficePayLogService ...@@ -203,8 +204,8 @@ class OfficePayLogService
if ($insert_id > 0 && $remark_img) { if ($insert_id > 0 && $remark_img) {
$this->addOImg($insert_id, 3, $remark_img); $this->addOImg($insert_id, 3, $remark_img);
} }
if($del_img){ if ($del_img) {
$this->delOImg(3,$del_img); $this->delOImg(3, $del_img);
} }
/*$service_push = new PushMessageService(); /*$service_push = new PushMessageService();
...@@ -233,11 +234,11 @@ class OfficePayLogService ...@@ -233,11 +234,11 @@ class OfficePayLogService
*/ */
private function refundBin($agent_id, $agent_name, $report_id, $order_id, $order_no, $refund_money, $name, private function refundBin($agent_id, $agent_name, $report_id, $order_id, $order_no, $refund_money, $name,
$phone, $bank, $card_no, $receipt_number, $type, $refund_cause, $pay_log_id, $phone, $bank, $card_no, $receipt_number, $type, $refund_cause, $pay_log_id,
$refund_way, $remark,$refund_id) $refund_way, $remark, $refund_id)
{ {
if($refund_id > 0){ //修改 if ($refund_id > 0) { //修改
$arr["id"] = $refund_id; $arr["id"] = $refund_id;
}else{ } else {
$arr["create_time"] = date("Y-m-d H:i:s", time()); $arr["create_time"] = date("Y-m-d H:i:s", time());
} }
$arr["report_id"] = $report_id; $arr["report_id"] = $report_id;
...@@ -294,10 +295,11 @@ class OfficePayLogService ...@@ -294,10 +295,11 @@ class OfficePayLogService
* @param $type * @param $type
* @param $del_img * @param $del_img
*/ */
private function delOImg($type, $del_img){ private function delOImg($type, $del_img)
{
$oImgModel = new OfficeOImg(); $oImgModel = new OfficeOImg();
$ids = rtrim($del_img, ","); $ids = rtrim($del_img, ",");
$where_["id"] = array("in",$ids); $where_["id"] = array("in", $ids);
$where_["img_type"] = $type; $where_["img_type"] = $type;
$params["img_status"] = 1; $params["img_status"] = 1;
...@@ -336,19 +338,20 @@ class OfficePayLogService ...@@ -336,19 +338,20 @@ class OfficePayLogService
* @param $bargain_id * @param $bargain_id
* @return bool|float|int * @return bool|float|int
*/ */
public function getPayLogRefundSurplusMoney($bargain_id) { public function getPayLogRefundSurplusMoney($bargain_id)
{
if (empty($bargain_id)) { if (empty($bargain_id)) {
return false; return false;
} }
$pay_id = $this->payLogModel->getFieldColumn('id', ['bargain_id'=>$bargain_id]); $pay_id = $this->payLogModel->getFieldColumn('id', ['bargain_id' => $bargain_id]);
if (empty($pay_id)) { if (empty($pay_id)) {
return false; return false;
} }
$money = $this->payLogModel->getSum('money', ['id'=> ['in', $pay_id]]); $money = $this->payLogModel->getSum('money', ['id' => ['in', $pay_id]]);
if ($money > 0) { if ($money > 0) {
$refund_money = $this->oRefundModel->getRefundSum('refund_money', ['pay_log_id'=>['in', $pay_id]]); $refund_money = $this->oRefundModel->getRefundSum('refund_money', ['pay_log_id' => ['in', $pay_id]]);
$result = $money - $refund_money; $result = $money - $refund_money;
} else { } else {
$result = 0; $result = 0;
...@@ -360,13 +363,14 @@ class OfficePayLogService ...@@ -360,13 +363,14 @@ class OfficePayLogService
* @param $bargain_id * @param $bargain_id
* @return bool * @return bool
*/ */
public function checkPayLogAdjustment($bargain_id) { public function checkPayLogAdjustment($bargain_id)
{
if (empty($bargain_id)) { if (empty($bargain_id)) {
return false; return false;
} }
$result = false; $result = false;
$pay_id = $this->payLogModel->getFieldColumn('id', ['bargain_id'=>$bargain_id]); $pay_id = $this->payLogModel->getFieldColumn('id', ['bargain_id' => $bargain_id]);
$id = $this->payLogAdjustmentModel->getFieldValue('id', ['paylog_id'=> ['in', $pay_id]]); $id = $this->payLogAdjustmentModel->getFieldValue('id', ['paylog_id' => ['in', $pay_id]]);
if ($id > 0) { if ($id > 0) {
$result = true; $result = true;
} }
......
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