You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.3 KiB
PHP

<?php
namespace App\Services;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class SanFangCodeService
{
//核销三方code
public function HeXiaoSanFangCode($qudao_type, $code,$orderid)
{
if ($qudao_type == 1) {
$u = false;
$data = [
'status' => 2,
'pay_order_id' => $orderid,
];
$u = DB::table('transfer_code')->where(['code' => $code, 'status' => 1, 'is_del' => 0])->update($data);
$data2=[
'qudao_type' => $qudao_type,
'code' => $code,
];
DB::table('orders')->where(['id'=>$orderid])->update(['sanfang_code'=>json_encode($data2,JSON_UNESCAPED_UNICODE)]);
if ($u) {
return ['status'=>true,'msg'=>'操作成功'];
} else {
return ['status'=>false,'msg'=>'核销失败'];
}
}
}
//撤销核销
public function CancelSanFangCode($qudao_type, $code,$orderid){
if ($qudao_type == 1) {
$u = false;
$data = [
'status' => 1,
'pay_order_id' => null,
];
$u = DB::table('transfer_code')->where(['code' => $code, 'status' => 2, 'is_del' => 0])->update($data);
if ($u) {
return ['status'=>true,'msg'=>'操作成功'];
} else {
return ['status'=>false,'msg'=>'撤销失败'];
}
}
}
}