作者 郭鑫
1 个管道 的构建 通过 耗费 1 秒

付款修改

... ... @@ -57,48 +57,57 @@ class SomepayController extends HomeBaseController
$notify = new \WxPayNotify();
$notify->Handle($config, false);
$xml = file_get_contents("php://input");
$a['a'] ='333';
Db::name('Test')->insertGetId($a);
$base = new \WxPayResults();
$a['a'] ='888';
Db::name('Test')->insertGetId($a);
$data = $base->FromXml($xml);
$a['a'] ='234';
$a['f'] = json_encode($data);
Db::name('Test')->insertGetId($a);
//验签
if ($base->CheckSign($config)) {
if ($data["return_code"] == "SUCCESS") {
Db::name('Test')->insertGetId($a);
// 支付成功
Db::startTrans();
// Db::startTrans();
//// 更新主表状态
$where_orderN['order_sn'] = $data['out_trade_no'];
$where_orderN['status'] = 3;
$a['a'] ='22';
$a['f'] = json_encode($where_orderN);
Db::name('Test')->insertGetId($a);
$order = Db::name('Order')->where($where_orderN)->find();
$a['a'] ='33';
$a['f'] = json_encode($order);
Db::name('Test')->insertGetId($a);
if($order){
$up_order['status'] = 10;
$up_order['update_time'] = time();
$up_order['pay_time'] = time();
$up_order['trans_id'] = $data['transaction_id'];
$a['a'] ='44';
$a['f'] = json_encode($up_order);
Db::name('Test')->insertGetId($a);
$res_order = Db::name('Order')->where($where_orderN)->update($up_order);
$a['a'] ='55';
$a['g'] = json_encode($res_order);
Db::name('Test')->insertGetId($a);
if($res_order){
// 更新雇人表
$where_hire['id'] = $order['hire_id'];
$where_hire['status'] = 3;
$up_hire['status'] = 10;
$up_hire['update_time'] = time();
$a['a'] ='66';
$a['g'] = json_encode($where_hire);
Db::name('Test')->insertGetId($a);
$res_hire = Db::name('Order')->where($where_hire)->update($up_hire);
$a['a'] ='77';
$a['g'] = json_encode($res_hire);
Db::name('Test')->insertGetId($a);
if($res_hire){
Db::commit();
// Db::commit();
return true;
}else{
Db::rollback();
// Db::rollback();
return false;
}
}else{
Db::rollback();
// Db::rollback();
return false;
}
}
... ...