Merge branch 'feat_agree' into dev

This commit is contained in:
yaooo 2023-09-23 14:21:42 +08:00
commit 7f95bb1044
2 changed files with 28 additions and 1 deletions

View File

@ -275,6 +275,31 @@ class Auth extends BaseController
return app('json')->success('退出登录');
}
public function doMargin()
{
$user = $this->request->userInfo();
$merchant = Db::name('merchant')->where('uid', $user['uid'])->where('status', 1)->find();
if (!$merchant) {
return app('json')->fail('用户店铺异常');
}
$repository = app()->make(StoreOrderRepository::class);
$param = [
"status" => 0,
"is_del" => 0,
"mer_id" => $merchant['mer_id'],
"pay_type" => 1,
"attach" => "meal",
"order_info" => '{"is_margin":1,"margin":"' . $merchant['margin'] . '"}',
"pay_price" => $merchant['margin'],
"order_sn" => "bzj" . date('YmdHis') . uniqid(),
"body" => $merchant['mer_name'] . ' - ' . $merchant['margin'],
];
$payType = 'weixinApp';
$service = new PayService($payType, $param);
$payInfo = $service->pay(User::where(['uid'=>$user['uid']])->find());
return app('json')->success($payInfo);
}
/**
* @return mixed
* @throws DataNotFoundException

View File

@ -67,7 +67,9 @@ Route::group('api/', function () {
//绑定推荐人
Route::post('user/spread', 'api.Auth/spread');
//用户缴纳保证金
Route::post('user/margin', 'api.Auth/doMargin');
//优惠券
Route::group('coupon', function () {
Route::post('receive/:id', 'api.store.product.StoreCoupon/receiveCoupon');