Commit 4b96fa37 authored by zw's avatar zw

pos收款记录保存

parent 9a9434fd
...@@ -138,6 +138,30 @@ class OrderLog extends Basic ...@@ -138,6 +138,30 @@ class OrderLog extends Basic
} }
} }
/**
* 保存pos机收款记录
* @return \think\Response
*/
public function savePosBillMessage(){
$params = $this->params;
/* $params = array(
"p_id" => 50,
"trade_no" =>00012,
"pay_time"=>time(),
"real_money" => 11.12
);*/
if(!isset($params["p_id"]) || !isset($params["trade_no"])
|| !isset($params["pay_time"]) || !isset($params["real_money"])){
return $this->response("101","请求参数错误");
}
$is_ok = $this->service_->updateBillInfo($params["p_id"],$params["trade_no"],$params["pay_time"],$params["real_money"]);
if($is_ok > 0){
return $this->response("200","request update success");
}else{
return $this->response("101","update faild");
}
}
/** /**
* 新增退款申请 * 新增退款申请
* @return \think\Response * @return \think\Response
......
...@@ -896,4 +896,22 @@ class OrderLogService ...@@ -896,4 +896,22 @@ class OrderLogService
return $this->payLogModel->getBeforeBillInfo($filed,["order_id"=>$order_id]); return $this->payLogModel->getBeforeBillInfo($filed,["order_id"=>$order_id]);
} }
/**
* pos机付款成功回调
* @param $id
* @param $trade_no
* @param $pay_time
* @param $real_money
* @return false|int
*/
public function updateBillInfo($id,$trade_no,$pay_time,$real_money){
$params["id"] = $id;
$params["trade_no"] = $trade_no;
$params["pay_time"] = date("Y-m-d H:i:s",$pay_time);
$params["real_money"] = $real_money;
return $this->payLogModel->updatePayLog($params);
}
} }
\ No newline at end of file
...@@ -45,6 +45,21 @@ class OPayLogModel extends Model ...@@ -45,6 +45,21 @@ class OPayLogModel extends Model
return 0; return 0;
} }
} }
public function updatePayLog($params){
$id = $params["id"];
unset($params["id"]);
Db::startTrans();
try {
$id = $this->where(["id"=>$id])->update($params);
Db::commit();
return $id;
} catch (\Exception $e) {
echo $this->getLastSql();
dump("error:".$e);
Db::rollback();
return 0;
}
}
/** /**
* 查询付款记录 * 查询付款记录
...@@ -96,6 +111,7 @@ class OPayLogModel extends Model ...@@ -96,6 +111,7 @@ class OPayLogModel extends Model
return $this->db_ return $this->db_
->field($filed) ->field($filed)
->where($where_) ->where($where_)
->order("id desc")
->limit(1) ->limit(1)
->select(); ->select();
} }
......
...@@ -334,6 +334,7 @@ Route::group('broker', [ ...@@ -334,6 +334,7 @@ Route::group('broker', [
'getFollowUpList' => [ 'api_broker/Report/getFollowUpList', [ 'method' => 'get|post' ] ], 'getFollowUpList' => [ 'api_broker/Report/getFollowUpList', [ 'method' => 'get|post' ] ],
'marchIn' => [ 'api_broker/OrderLog/marchIn', [ 'method' => 'get|post' ] ], 'marchIn' => [ 'api_broker/OrderLog/marchIn', [ 'method' => 'get|post' ] ],
'getBeforeBillInfo' => [ 'api_broker/OrderLog/getBeforeBillInfo', [ 'method' => 'get|post' ] ], 'getBeforeBillInfo' => [ 'api_broker/OrderLog/getBeforeBillInfo', [ 'method' => 'get|post' ] ],
'savePosBillMessage' => [ 'api_broker/OrderLog/savePosBillMessage', [ 'method' => 'get|post' ] ],
'collectingBill' => [ 'api_broker/OrderLog/collectingBill', [ 'method' => 'get|post' ] ], 'collectingBill' => [ 'api_broker/OrderLog/collectingBill', [ 'method' => 'get|post' ] ],
'refund' => [ 'api_broker/OrderLog/refund', [ 'method' => 'get|post' ] ], 'refund' => [ 'api_broker/OrderLog/refund', [ 'method' => 'get|post' ] ],
'bargain' => [ 'api_broker/OrderLog/bargain', [ 'method' => 'get|post' ] ], 'bargain' => [ 'api_broker/OrderLog/bargain', [ 'method' => 'get|post' ] ],
......
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