|
@@ -51,15 +51,15 @@ class RecuperateController extends WebBaseController
|
|
|
$back_url = \Illuminate\Support\Facades\URL::previous();
|
|
|
return $this->showMessage('资讯不存在', $back_url, true, '上一页', '3');
|
|
|
}
|
|
|
- $uid = auth('web-member')->id();
|
|
|
- $recuperate_app=RecuperateApply::where('uid',$uid)->where('recuperate_id',$id)->first();
|
|
|
+ $uid = auth('web-member')->id();
|
|
|
+ $recuperate_app = RecuperateApply::where('uid', $uid)->where('recuperate_id', $id)->first();
|
|
|
//增加点击量
|
|
|
$this->recuperateService->incrementData(['id' => $id], 1, 'click');
|
|
|
|
|
|
- $return_data = array(
|
|
|
- 'info'=>$info,
|
|
|
- 'recuperate_app'=>$recuperate_app
|
|
|
- );
|
|
|
+ $return_data = [
|
|
|
+ 'info' => $info,
|
|
|
+ 'recuperate_app' => $recuperate_app,
|
|
|
+ ];
|
|
|
|
|
|
return view('app.recuperate.show', $return_data);
|
|
|
}
|
|
@@ -67,20 +67,20 @@ class RecuperateController extends WebBaseController
|
|
|
public function apply($id)
|
|
|
{
|
|
|
|
|
|
- // http://120.26.63.153:8080/JJRCW/api/jucaiInterface/getDevelopAllowance?idCard=350581198601242040&phone=15959581739&year=2019
|
|
|
+ // http://120.26.63.153:8080/JJRCW/api/jucaiInterface/getDevelopAllowance?idCard=350581198601242040&phone=15959581739&year=2019
|
|
|
|
|
|
-/* $data['idCard']='350581198601242040';
|
|
|
- $data['phone']='15959581739';
|
|
|
- $data['year']='2019';
|
|
|
- $result_json = https_request('http://120.26.63.153:8080/JJRCW/api/jucaiInterface/getDevelopAllowance', $data);
|
|
|
- dd(json_decode($result_json));*/
|
|
|
+ /* $data['idCard']='350581198601242040';
|
|
|
+ $data['phone']='15959581739';
|
|
|
+ $data['year']='2019';
|
|
|
+ $result_json = https_request('http://120.26.63.153:8080/JJRCW/api/jucaiInterface/getDevelopAllowance', $data);
|
|
|
+ dd(json_decode($result_json));*/
|
|
|
|
|
|
|
|
|
-/* $data['idCard']='130630199212251815';
|
|
|
- $data['phone']='17689494919';
|
|
|
- $data['year']='2019';
|
|
|
- $result_json = https_request('http://rc.jucai.gov.cn/api/jucaiInterface/getDevelopAllowance', $data);
|
|
|
- dd(json_decode($result_json)->state);*/
|
|
|
+ /* $data['idCard']='130630199212251815';
|
|
|
+ $data['phone']='17689494919';
|
|
|
+ $data['year']='2019';
|
|
|
+ $result_json = https_request('http://rc.jucai.gov.cn/api/jucaiInterface/getDevelopAllowance', $data);
|
|
|
+ dd(json_decode($result_json)->state);*/
|
|
|
|
|
|
//获取详情
|
|
|
$info = $this->recuperateService->getRecuperateInfo($id);
|
|
@@ -91,65 +91,66 @@ class RecuperateController extends WebBaseController
|
|
|
|
|
|
/*查看手机是否认证*/
|
|
|
$member = auth('web-member')->user();
|
|
|
- if($member->mobile_audit!='1'){
|
|
|
- // $back_url = \Illuminate\Support\Facades\URL::previous();;
|
|
|
+ if ($member->mobile_audit != '1') {
|
|
|
+ // $back_url = \Illuminate\Support\Facades\URL::previous();;
|
|
|
return $this->showMessage('请到个人中心先认证手机号码', route('person.memberInfo'), true, '上一页', '3');
|
|
|
}
|
|
|
- $members_info=MemberInfo::where('uid',$member->id)->select('realname','id_card','phone','card_t_cn')->first();
|
|
|
+ $members_info = MemberInfo::where('uid', $member->id)->select('realname', 'id_card', 'phone', 'card_t_cn')->first();
|
|
|
|
|
|
-/* if($members_info->card_t_cn!='306' || !$members_info->id_card){
|
|
|
- $back_url = \Illuminate\Support\Facades\URL::previous();
|
|
|
- return $this->showMessage('请到个人中心填写身份证号', $back_url, true, '上一页', '3');
|
|
|
- }*/
|
|
|
+ /* if($members_info->card_t_cn!='306' || !$members_info->id_card){
|
|
|
+ $back_url = \Illuminate\Support\Facades\URL::previous();
|
|
|
+ return $this->showMessage('请到个人中心填写身份证号', $back_url, true, '上一页', '3');
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
- /*if(date('Y',time())!='2022'){
|
|
|
- $verification=$this->verification($member->id,$info,$members_info);
|
|
|
- if(!$verification['state']){
|
|
|
- $back_url = \Illuminate\Support\Facades\URL::previous();
|
|
|
- return $this->showMessage($verification['msg'], $back_url, true, '上一页', '3');
|
|
|
- }
|
|
|
- }*/
|
|
|
+ /*if(date('Y',time())!='2022'){
|
|
|
+ $verification=$this->verification($member->id,$info,$members_info);
|
|
|
+ if(!$verification['state']){
|
|
|
+ $back_url = \Illuminate\Support\Facades\URL::previous();
|
|
|
+ return $this->showMessage($verification['msg'], $back_url, true, '上一页', '3');
|
|
|
+ }
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
$return_data = [
|
|
|
- 'info' => $info,
|
|
|
- 'members' =>array_merge($member->toArray(),$members_info->toArray(),['year'=>date('Y',strtotime("-1 year"))])
|
|
|
+ 'info' => $info,
|
|
|
+ 'members' => array_merge($member->toArray(), $members_info->toArray(), ['year' => date('Y', strtotime("-1 year"))]),
|
|
|
];
|
|
|
|
|
|
return view('app.recuperate.apply', $return_data);
|
|
|
}
|
|
|
|
|
|
- protected function verification($uid,$info,$members_info=false){
|
|
|
- $year=date('Y', strtotime("-1 year"));
|
|
|
- $recuperate_time=RecuperateTime::where('uid',$uid)->where('year',$year)->first();
|
|
|
+ protected function verification($uid, $info, $members_info = false)
|
|
|
+ {
|
|
|
+ $year = date('Y', strtotime("-1 year"));
|
|
|
+ $recuperate_time = RecuperateTime::where('uid', $uid)->where('year', $year)->first();
|
|
|
+
|
|
|
+ if ($recuperate_time) {
|
|
|
+ $old_integral = RecuperateApply::where('uid', $uid)->where('recuperate_time_id', $recuperate_time->id)->where('status', '!=', 2)->sum('price');
|
|
|
+ if ($recuperate_time->price < ($old_integral + $info['price'])) {
|
|
|
+ return ['state' => 0, 'msg' => '今年的金额额度不够'];
|
|
|
+ } else {
|
|
|
+ return ['state' => 1, 'msg' => 'ok', 'info' => $recuperate_time];
|
|
|
+ }
|
|
|
+ } else {
|
|
|
|
|
|
- if($recuperate_time){
|
|
|
- $old_integral=RecuperateApply::where('uid',$uid)->where('recuperate_time_id',$recuperate_time->id)->where('status','!=',2)->sum('price');
|
|
|
- if($recuperate_time->price<($old_integral+$info['price'])){
|
|
|
- return ['state'=>0,'msg'=>'今年的金额额度不够'];
|
|
|
- }else{
|
|
|
- return ['state'=>1,'msg'=>'ok','info'=>$recuperate_time];
|
|
|
+ $data['idCard'] = $members_info->id_card;
|
|
|
+ $data['phone'] = $members_info->phone;
|
|
|
+ $arr['year'] = $data['year'] = $year;;
|
|
|
+ $result_json = https_request('https://rc.jucai.gov.cn/api/jucaiInterface/getDevelopAllowance', $data);
|
|
|
+ // $result_json = https_request('http://120.26.63.153:8080/JJRCW/api/jucaiInterface/getDevelopAllowance', $data);
|
|
|
+ $result_json = json_decode($result_json);
|
|
|
+ if ($result_json->state == '3') {
|
|
|
+ if ($result_json->total < $info['price']) {
|
|
|
+ return ['state' => 0, 'msg' => '今年的金额额度不够'];
|
|
|
+ }
|
|
|
+ $arr['price'] = $result_json->total;
|
|
|
+ $arr['uid'] = $uid;
|
|
|
+ RecuperateTime::create($arr);
|
|
|
+ return ['state' => 1, 'msg' => $result_json->msg];
|
|
|
+ } else {
|
|
|
+ return ['state' => 0, 'msg' => $result_json->msg];
|
|
|
}
|
|
|
- }else{
|
|
|
-
|
|
|
- $data['idCard']=$members_info->id_card;
|
|
|
- $data['phone']=$members_info->phone;
|
|
|
- $arr['year']=$data['year']=$year;;
|
|
|
- $result_json = https_request('https://rc.jucai.gov.cn/api/jucaiInterface/getDevelopAllowance', $data);
|
|
|
- // $result_json = https_request('http://120.26.63.153:8080/JJRCW/api/jucaiInterface/getDevelopAllowance', $data);
|
|
|
- $result_json=json_decode($result_json);
|
|
|
- if($result_json->state=='3'){
|
|
|
- if($result_json->total<$info['price']){
|
|
|
- return ['state'=>0,'msg'=>'今年的金额额度不够'];
|
|
|
- }
|
|
|
- $arr['price']=$result_json->total;
|
|
|
- $arr['uid']=$uid;
|
|
|
- RecuperateTime::create($arr);
|
|
|
- return ['state'=>1,'msg'=>$result_json->msg];
|
|
|
- }else{
|
|
|
- return ['state'=>0,'msg'=>$result_json->msg];
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -164,44 +165,42 @@ class RecuperateController extends WebBaseController
|
|
|
return $this->sendErrorResponse('身份证号格式不正确', '', 400);
|
|
|
}*/
|
|
|
|
|
|
- $data = $request->all();
|
|
|
- $uid = auth('web-member')->id();
|
|
|
- $id_card=MemberInfo::where('uid',$uid)->value('id_card');
|
|
|
- if(empty($id_card)){
|
|
|
- $member_info = MemberInfo::where('id_card',$data['user_idcard'])->first();
|
|
|
- if(empty($member_info)){
|
|
|
- MemberInfo::where('uid',$uid)->update(['card_t_cn'=>306,'id_card'=>$data['user_idcard']]);
|
|
|
+ $data = $request->all();
|
|
|
+ $uid = auth('web-member')->id();
|
|
|
+ $id_card = MemberInfo::where('uid', $uid)->value('id_card');
|
|
|
+ if (empty($id_card)) {
|
|
|
+ $member_info = MemberInfo::where('id_card', $data['user_idcard'])->first();
|
|
|
+ if (empty($member_info)) {
|
|
|
+ MemberInfo::where('uid', $uid)->update(['card_t_cn' => 306, 'id_card' => $data['user_idcard']]);
|
|
|
}
|
|
|
}
|
|
|
//一个活动只能报名一次
|
|
|
- $recuperate_apply = RecuperateApply::where('uid',$uid)->where('recuperate_id',$data['recuperate_id'])->first();
|
|
|
+ $recuperate_apply = RecuperateApply::where('uid', $uid)->where('recuperate_id', $data['recuperate_id'])->first();
|
|
|
if ($recuperate_apply) {
|
|
|
return $this->sendErrorResponse('一个活动只能报名一次', '', 400);
|
|
|
}
|
|
|
- $recuperate=Recuperate::where('id',$data['recuperate_id'])->select('price')->first();
|
|
|
+ $recuperate = Recuperate::where('id', $data['recuperate_id'])->select('price')->first();
|
|
|
|
|
|
- if(date('Y',time())!='2021'){
|
|
|
+ /*if(date('Y',time())!='2021'){
|
|
|
$verification=$this->verification($uid,$recuperate);
|
|
|
if(!$verification['state']){
|
|
|
return $this->sendErrorResponse($verification['msg'], '', 400);
|
|
|
}
|
|
|
$data['recuperate_time_id'] = $verification['info']->id;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //一人只能报两个
|
|
|
-/* $count = RecuperateApply::where('uid',$uid)->count();
|
|
|
- if ($count >= 2) {
|
|
|
- return $this->sendErrorResponse('一人只能报两个活动', '', 400);
|
|
|
}*/
|
|
|
|
|
|
|
|
|
+ //一人只能报两个
|
|
|
+ /* $count = RecuperateApply::where('uid',$uid)->count();
|
|
|
+ if ($count >= 2) {
|
|
|
+ return $this->sendErrorResponse('一人只能报两个活动', '', 400);
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
//报名
|
|
|
- $data['uid'] = $uid;
|
|
|
+ $data['uid'] = $uid;
|
|
|
$data['price'] = $recuperate->price;
|
|
|
- $res = $this->recuperateApplyService->create($data);
|
|
|
+ $res = $this->recuperateApplyService->create($data);
|
|
|
|
|
|
if ($res) {
|
|
|
return $this->sendSuccessResponse();
|
|
@@ -211,7 +210,6 @@ class RecuperateController extends WebBaseController
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 方案
|
|
|
*/
|