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.
57 lines
1.6 KiB
PHP
57 lines
1.6 KiB
PHP
<?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("操作失败");
|
|
}
|
|
}
|
|
}
|
|
}
|