各种更新
parent
e992574e16
commit
d5aaf868ae
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\API\H5;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class SanFangController extends Controller
|
||||||
|
{
|
||||||
|
public function GetSanFangList(Request $request)
|
||||||
|
{
|
||||||
|
$list = DB::table('sanfang')->where(['status' => 1])->get();
|
||||||
|
return \Yz::Return(true, "查询完成", ['list' => $list]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询三方码
|
||||||
|
public function GetSanFangCode(Request $request)
|
||||||
|
{
|
||||||
|
$code = request('code');
|
||||||
|
$qudao_type = request('qudao_type');//1H5转赠码2有赞
|
||||||
|
if ($qudao_type == 1) {
|
||||||
|
|
||||||
|
$code = DB::table('transfer_code')->where(['code' => $code, 'status' => 1, 'is_del' => 0])->first();
|
||||||
|
if (!$code) return \Yz::echoError1("此转赠码不可用");
|
||||||
|
$data = [
|
||||||
|
'code_num' => $code->code,
|
||||||
|
'status' => $code->status,
|
||||||
|
'price' => $code->price,
|
||||||
|
'combo_id' => $code->combo_id,
|
||||||
|
'qudao_type' => $qudao_type,
|
||||||
|
];
|
||||||
|
return \Yz::Return(true, "查询成功", $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//操作三方码
|
||||||
|
public function HeXiaoSanFangCode(Request $request)
|
||||||
|
{
|
||||||
|
$qudao_type = request('qudao_type');//1H5转赠码2有赞
|
||||||
|
$code = request('code');
|
||||||
|
if ($qudao_type == 1) {
|
||||||
|
$u = false;
|
||||||
|
$data = [
|
||||||
|
'status' => 2,
|
||||||
|
'tj_num' => isset($tj_num) ? $tj_num : null,
|
||||||
|
];
|
||||||
|
$u = DB::table('transfer_code')->where(['code' => $code, 'status' => 1, 'is_del' => 0])->update($data);
|
||||||
|
if ($u) {
|
||||||
|
return \Yz::Return(true, "操作成功", ['code_num' => $code]);
|
||||||
|
} else {
|
||||||
|
return \Yz::echoError1("操作失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
<?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'=>'撤销失败'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Loading…
Reference in New Issue