cmbYouku_Api/app/front/Agreement.php

122 lines
3.3 KiB
PHP
Raw Normal View History

2024-07-01 15:57:07 +08:00
<?php
namespace app\front;
use app\service\AgreementService;
use app\service\util\CmbLifeUtils;
use think\Request;
use think\Response;
class Agreement
{
/**
* 签约协议
* @param Request $request
* @return Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function agreeApproval(Request $request)
{
$userId = $request->user_id;
$callback = $request->post('callback', '');
$account = $request->post('account', '');
$approval = AgreementService::agreeApproval($userId, $callback, $account);
return response_json($approval);
}
/**
* 后台签约通知
* @param Request $request
* @return Response
*/
public function agreeNotify(Request $request)
{
$posts = $request->post();
$res = AgreementService::agreeNotify($posts);
$res['sign'] = CmbLifeUtils::signForResponse($res);
return Response::create($res, 'json');
}
/**
* 取消订阅
* @param Request $request
* @return Response
*/
public function unsubscribe(Request $request)
{
$params = $request->post();
$params['user_id'] = $request->user_id;
AgreementService::unsubscribe($params);
return response_json();
}
/**
* 解约通知接口
* @param Request $request
* @return Response
*/
public function releaseNotify(Request $request)
{
$posts = $request->post();
$res = AgreementService::releaseNotify($posts);
$res['sign'] = CmbLifeUtils::signForResponse($res);
return Response::create($res, 'json');
}
/**
* 协议扣款通知
* @param Request $request
* @return Response
*/
public function payNotify(Request $request)
{
$posts = $request->post();
$res = AgreementService::payNotify($posts);
$res['sign'] = CmbLifeUtils::signForResponse($res);
return Response::create($res, 'json');
}
/**
* 发送验证码
* @param Request $request
* @return Response
* @throws \app\exception\BusinessException
*/
public function releaseSendSms(Request $request)
{
$params = $request->post();
AgreementService::releaseSendSms($params);
return response_json();
}
/**
* 获取绑定手机号
* @param Request $request
* @return Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getBindMobile(Request $request)
{
$userId = $request->user_id;
$res = AgreementService::getBindMobile($userId);
return response_json($res);
}
/**
* 判断是否可兑换
* @param Request $request
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getExchangeStatus(Request $request)
{
$params = $request->post();
$params['user_id'] = $request->user_id;
$res = AgreementService::getExchangeStatus($params);
return response_json($res);
}
}