You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
708 lines
27 KiB
708 lines
27 KiB
<?php
|
|
namespace app\api\controller;
|
|
use think\Request;
|
|
use think\Controller;
|
|
use think\Db;
|
|
use think\Response;
|
|
use OSS\OssClient;
|
|
use OSS\Core\OssException;
|
|
use think\exception\HttpResponseException;
|
|
use think\Validate;
|
|
use app\admin\model\Options;
|
|
|
|
class Bigdata extends Controller{
|
|
public function __construct(){
|
|
|
|
config('default_return_type','json');
|
|
return true;
|
|
|
|
$request=request();
|
|
$action=$request->action();
|
|
$post = $request->post();
|
|
$agencykey="49ba59abbe56e057";
|
|
|
|
if(empty($agencykey)){
|
|
$this->error2('缺少appid参数');
|
|
}
|
|
$timestamp =input('time');
|
|
if (empty($timestamp)) {
|
|
$this->error2('缺少time参数');
|
|
}
|
|
// 判断token
|
|
$token =input('token');
|
|
if(!$token) {
|
|
$this->error2('缺少token参数');
|
|
}
|
|
$curtime = time();
|
|
$expire = 6000; // 允许延迟秒数
|
|
if (!$timestamp || $timestamp > $curtime || ($timestamp + $expire) < $curtime) {
|
|
$this->error2('token验证超时');
|
|
}
|
|
$sign=$this->getSign($agencykey, $post);
|
|
if ($token != $sign) {
|
|
$this->error2('token验证失败');
|
|
}
|
|
}
|
|
|
|
// 获取sign
|
|
protected function getSign($secret, $data)
|
|
{
|
|
if (isset($data['token']))unset($data['token']);
|
|
if (isset($data['appid']))unset($data['appid']);
|
|
// 对数组的值按key排序
|
|
ksort($data);
|
|
// 生成url的形式
|
|
$params = http_build_query($data);
|
|
// 生成sign
|
|
$sign = md5($params.$secret);
|
|
return $sign;
|
|
}
|
|
|
|
/**
|
|
* 挂牌协议
|
|
*/
|
|
public function agreement(){
|
|
$sys=Options::get_options('agree_options6','zh-cn');
|
|
$this->success2("查询成功",['content'=>$sys['content_tpl']]);
|
|
}
|
|
/**
|
|
* 挂牌项目列表
|
|
*/
|
|
public function gplist(){
|
|
$pre=input('per_page',5,'intval');
|
|
$where=array();
|
|
$where['b.new_flag']=1;
|
|
$where['b.apply_type']=6;
|
|
|
|
$list=Db::name('cult4apply')->field("a.create_time,a.apply_id,a.user_id,a.status,a.pay_img,b.c_name,b.certificateurl,b.noticeurl,b.payurl")->alias("a")->join(config('database.prefix').'cult4baseinfo b','a.apply_id =b.apply_id')->where($where)->order('a.apply_id')->paginate($pre);
|
|
if(count($list)){
|
|
$list=$list->toArray();
|
|
$data=$list['data'];
|
|
if(count($data)){
|
|
foreach ($data as $k=>$row){
|
|
$data[$k]['pay_img']=$this->_img($row['pay_img']);
|
|
$data[$k]['payurl']=$this->_img($row['payurl']);
|
|
$data[$k]['certificateurl']=$this->_img($row['certificateurl']);
|
|
$data[$k]['noticeurl']=$this->_img($row['noticeurl']);
|
|
|
|
//$data[$k]['c_notice']=$row['c_notice']?@json_decode($row['c_notice'],true):[];
|
|
//$data[$k]['c_base']=$row['c_base']?@json_decode($row['c_base'],true):[];
|
|
//$data[$k]['c_transferor']=$row['c_transferor']?@json_decode($row['c_transferor'],true):[];
|
|
}
|
|
}
|
|
unset($list['data']);
|
|
$list['list']=$data;
|
|
}
|
|
$this->success2("查询成功",$list);
|
|
}
|
|
/**
|
|
* 挂牌项目详情
|
|
*/
|
|
public function gpdetail(){
|
|
$aid=input('apply_id','','intval');
|
|
if(empty($aid))$this->error2("缺少请求apply_id");
|
|
$where=['b.new_flag'=>1,'b.apply_type'=>6];
|
|
$where['a.apply_id']=$aid;
|
|
$list=Db::name('cult4apply')->field("a.create_time,a.apply_id,a.user_id,a.status,a.pay_img,b.c_notice,b.c_base,b.c_transferor,b.c_name,b.certificateurl,b.noticeurl,b.payurl")->alias("a")->join(config('database.prefix').'cult4baseinfo b','a.apply_id =b.apply_id')->where($where)->find();
|
|
if(count($list)){
|
|
$list['pay_img']=$this->_img($list['pay_img']);
|
|
$list['certificateurl']=$this->_img($list['certificateurl']);
|
|
$list['noticeurl']=$this->_img($list['noticeurl']);
|
|
$list['payurl']=$this->_img($list['payurl']);
|
|
|
|
$list['c_notice']=$list['c_notice']?@json_decode($list['c_notice'],true):[];
|
|
$list['c_base']=$list['c_base']?@json_decode($list['c_base'],true):[];
|
|
$list['c_transferor']=$list['c_transferor']?@json_decode($list['c_transferor'],true):[];
|
|
}else{
|
|
$list=[];
|
|
}
|
|
$this->success2("查询成功",$list);
|
|
}
|
|
/**
|
|
* 挂牌鉴证
|
|
*/
|
|
public function gpnotice(){
|
|
$aid=input('apply_id','','intval');
|
|
$list=Db::name('cult4baseinfo')->field("certificateurl,noticeurl,payurl")->where(['apply_id'=>$aid])->find();
|
|
$cert=$notice='';
|
|
if($list){
|
|
$cert=$list['certificateurl']&&!is_null($list['certificateurl'])?$list['certificateurl']:'';
|
|
$notice=$list['noticeurl']&&!is_null($list['noticeurl'])?$list['noticeurl']:'';
|
|
$payurl=$list['payurl']&&!is_null($list['payurl'])?$list['payurl']:'';
|
|
}
|
|
$this->success2("查询成功",['certificateurl'=>$cert,'noticeurl'=>$notice,'payurl'=>$payurl]);
|
|
}
|
|
/**
|
|
* 上传附件
|
|
*/
|
|
public function upload(){
|
|
$uid=$this->_check();
|
|
$file=request()->file('file');
|
|
if(empty($file))$this->error2("请上传文件");
|
|
|
|
$config=config('aliyun_oss');
|
|
$oss=new \OSS\OssClient($config['accesskey'],$config['secretkey'],$config['endpoint'],true);
|
|
|
|
try{
|
|
$fileinfo=$file->getInfo();
|
|
$filename=$fileinfo['name']?'bigdata/'.$uid.'/'.$fileinfo['name']:'';
|
|
$path=$fileinfo['tmp_name'];
|
|
|
|
$check=$file->checkExt("jpg,png,jpeg,pdf,rar,zip,xls");
|
|
if(!$check)$this->error2("文件格式不符合要求");
|
|
|
|
} catch(\Exception $e) {
|
|
$this->error2("请上传文件");//否则就是上传错误,显示错误原因
|
|
}
|
|
|
|
try{
|
|
$oss->uploadFile($config['bucket'],$filename,$path);
|
|
} catch(OssException $e) {
|
|
$this->error2($e->getMessage());//否则就是上传错误,显示错误原因
|
|
}
|
|
$file_url='';
|
|
if($filename)$file_url=$config['endpoint'].'/'.$filename;
|
|
$this->success2("上传成功",$file_url);
|
|
}
|
|
/**
|
|
* 挂牌附件列表
|
|
*/
|
|
public function files(){
|
|
$field="a.ftype_id,a.ftypedescr,a.ftype,a.ftemp_id,a.isopen,a.create_time,a.mustupload,a.forder,f.path as url";
|
|
$files=Db::name('cult4uptype')->field($field)->alias("a")->join(config('database.prefix').'cult4upfiles f','f.file_id =a.ftemp_id','left')->where(["a.apply_type"=>6,"a.isopen"=>1])->order('forder')->select();
|
|
if(count($files)){
|
|
foreach ($files as $k=>$row){
|
|
if(empty($row['url']))$files[$k]['url']='';
|
|
else $files[$k]['url']=$this->_img($row['url']);
|
|
}
|
|
}
|
|
$this->success2("查询成功",$files);
|
|
}
|
|
/**
|
|
* 挂牌审核状态
|
|
*/
|
|
public function status(){
|
|
$list=Db::name('cult4status')->select();
|
|
$keys=array_column($list,'status');
|
|
$vals=array_column($list,'descr');
|
|
$list=array_combine($keys, $vals);
|
|
$this->success2("查询成功",$list);
|
|
}
|
|
/**
|
|
* 创建挂牌项目
|
|
*/
|
|
public function gpsubmit(){
|
|
$uid=$this->_check();
|
|
$cname=input('c_name');
|
|
$files =input('files');
|
|
$cbase=input('c_base');
|
|
$cnotice=input('c_notice');
|
|
$ctran=input('c_transferor');
|
|
if(!is_array($files)){
|
|
$files=htmlspecialchars_decode($files);
|
|
$files=@json_decode($files,true);
|
|
}
|
|
if(!is_array($cbase)){
|
|
$cbase=htmlspecialchars_decode($cbase);
|
|
$cbase=@json_decode($cbase,true);
|
|
}
|
|
if(!is_array($cnotice)){
|
|
$cnotice=htmlspecialchars_decode($cnotice);
|
|
$cnotice=@json_decode($cnotice,true);
|
|
}
|
|
if(!is_array($ctran)){
|
|
$ctran=htmlspecialchars_decode($ctran);
|
|
$ctran=@json_decode($ctran,true);
|
|
}
|
|
$rule =[
|
|
['c_name','require|max:50','标的名称不能为空|标的名称不能超过50字符'],
|
|
['c_base','require','转让(或授权)标的简况不能为空'],
|
|
['c_notice','require','信息公告与交易条件不能为空'],
|
|
['c_transferor','require','转让(或授权)方简况不能为空'],
|
|
];
|
|
$checks=array(
|
|
'c_name'=>$cname,
|
|
'c_base'=>$cbase,
|
|
'c_notice'=>$cnotice,
|
|
'c_transferor'=>$ctran
|
|
);
|
|
|
|
$validate = new Validate($rule);
|
|
$rst= $validate->check($checks);
|
|
if(true!==$rst){
|
|
$error=is_array($validate->getError())?join('|',$validate->getError()):$validate->getError();
|
|
if(empty($error)){
|
|
$error="上传失败,请重新提交";
|
|
}
|
|
$this->error2($error);
|
|
}
|
|
$applyid='';
|
|
$post=input('post.');
|
|
Db::startTrans();
|
|
try {
|
|
//插入主表
|
|
$data=[
|
|
'user_id'=>$uid,
|
|
'status'=>1,
|
|
'create_user_id'=>$uid,
|
|
'create_user_type'=>1,
|
|
'create_time'=>time()
|
|
];
|
|
$applyid=Db::name('cult4apply')->insertGetId($data);
|
|
|
|
$temps=Db::name('cult4uptype')->field("ftype_id,ftype")->where(["apply_type"=>6,"isopen"=>1,"mustupload"=>1])->order('forder')->select();
|
|
if(count($temps)){
|
|
$ids=array_column($temps,'ftype_id');
|
|
$types=array_column($temps,'ftype');
|
|
$temps=array_combine($ids,$types);
|
|
}
|
|
//上传附件
|
|
if ($files&&count($files)) {
|
|
foreach ($files as $key=>$file) {
|
|
$tmpid=isset($file['ftype_id'])?$file['ftype_id']:'';
|
|
$url=isset($file['path'])?$file['path']:'';
|
|
if(empty($tmpid)||empty($url)){
|
|
Db::rollback();
|
|
$this->error2('附件格式错误,提交失败');
|
|
}
|
|
$allowtype=isset($temps[$tmpid])?explode("/",$temps[$tmpid]):'';
|
|
if($allowtype){
|
|
$ext=strtoupper(substr(strrchr($url,'.'), 1));
|
|
if(count($allowtype)&&!in_array($ext,$allowtype)){
|
|
|
|
Db::rollback();
|
|
$this->error2('附件类型错误!');
|
|
}
|
|
}
|
|
$size=$this->getsize($url);
|
|
|
|
$data=[
|
|
'apply_id'=>$applyid,
|
|
'user_id'=>$uid,
|
|
'user_type'=>1,
|
|
'status'=>0,
|
|
'upload_time'=>time(),
|
|
'ftype_id'=>$tmpid,
|
|
'ftype'=>1,
|
|
'filesize'=>$size,
|
|
'path'=>$url,
|
|
'flag'=>0
|
|
];
|
|
$res=Db::name('cult4upfiles')->insert($data);
|
|
if(!$res){
|
|
Db::rollback();
|
|
$this->error2('附件提交失败');
|
|
}
|
|
}
|
|
}
|
|
//插入缴费表
|
|
$data=['apply_id'=>$applyid,'fee_flag'=>0,'update_time'=>time()];
|
|
$query=Db::name('cult4fee')->insertGetId($data);
|
|
if(!$query){
|
|
Db::rollback();
|
|
$this->error2('提交失败');
|
|
}
|
|
$data=[
|
|
'c_name'=>$cname,
|
|
'c_base'=>is_array($cbase)?json_encode($cbase):'',
|
|
'c_notice'=>is_array($cnotice)?json_encode($cnotice):'',
|
|
'c_transferor'=>is_array($ctran)?json_encode($ctran):''
|
|
];
|
|
$data['gplevel']=input('gplevel',4,'intval');
|
|
$data['member_recmd']=0;
|
|
$data['apply_id']=$applyid;
|
|
$data['apply_type']=6;
|
|
$data['create_user_id']=$uid;
|
|
$data['create_user_type']=8;
|
|
$data['create_time']=time();
|
|
$data['k_type']=3;
|
|
$data['payment_url']='';
|
|
$data['payment_info']='';
|
|
$query=Db::name('cult4baseinfo')->insert($data);
|
|
if(!$query){
|
|
Db::rollback();
|
|
$this->error2('提交失败');
|
|
}
|
|
// 提交事务
|
|
Db::commit();
|
|
} catch (\Exception $e) {
|
|
// 回滚事务
|
|
Db::rollback();
|
|
$msg='提交失败';
|
|
$this->error2($msg);
|
|
}
|
|
|
|
$this->success2('提交成功',['apply_id'=>$applyid]);
|
|
}
|
|
/**
|
|
* 用户挂牌列表
|
|
*/
|
|
public function ugplist(){
|
|
$uid=$this->_check();
|
|
$pre=input('per_page',5,'intval');
|
|
$where=array();
|
|
$where['b.new_flag']=1;
|
|
$where['b.apply_type']=6;
|
|
$where['a.user_id']=$uid;
|
|
|
|
$list=Db::name('cult4apply')->field("a.create_time,a.apply_id,a.user_id,a.status,a.pay_img,b.c_name,b.certificateurl,b.noticeurl,b.payurl")->alias("a")->join(config('database.prefix').'cult4baseinfo b','a.apply_id =b.apply_id')->where($where)->order('a.apply_id')->paginate($pre);
|
|
if(count($list)){
|
|
$list=$list->toArray();
|
|
$data=$list['data'];
|
|
if(count($data)){
|
|
foreach ($data as $k=>$row){
|
|
$data[$k]['pay_img']=$this->_img($row['pay_img']);
|
|
$data[$k]['certificateurl']=$this->_img($row['certificateurl']);
|
|
$data[$k]['noticeurl']=$this->_img($row['noticeurl']);
|
|
$data[$k]['payurl']=$this->_img($row['payurl']);
|
|
|
|
}
|
|
}
|
|
unset($list['data']);
|
|
$list['list']=$data;
|
|
}
|
|
$this->success2("查询成功",$list);
|
|
}
|
|
/**
|
|
* 查询用户挂牌附件
|
|
*/
|
|
public function ugpfiles(){
|
|
$uid=$this->_check();
|
|
$applyid=input('apply_id','','intval');
|
|
if(empty($applyid))$this->error2("缺少apply_id");
|
|
|
|
$field="f.file_id,f.path,f.upload_time,f.flag,a.ftype_id,a.ftypedescr,a.ftype,a.ftemp_id,t.path as ftemp,a.mustupload,a.isopen,a.forder";
|
|
$files=Db::name('cult4upfiles')->field($field)->alias("f")->join(config('database.prefix').'cult4uptype a','a.ftype_id=f.ftype_id','left')->join(config('database.prefix').'cult4upfiles t','t.file_id =a.ftemp_id','left')->where(["a.apply_type"=>6,"a.isopen"=>1,"f.apply_id"=>$applyid,"f.new_flag"=>1])->order('forder')->select();
|
|
if(count($files)){
|
|
foreach ($files as $k=>$row){
|
|
$files[$k]['ftemp']=$this->_img($row['ftemp']);
|
|
$files[$k]['path']=$this->_img($row['path']);
|
|
}
|
|
}
|
|
|
|
$this->success2('查询成功',$files);
|
|
}
|
|
/**
|
|
* 用户修改附件
|
|
*/
|
|
public function ugpfilesedit(){
|
|
$uid=$this->_check();
|
|
$applyid=input('apply_id','','intval');
|
|
$files=input("files");
|
|
if(!is_array($files)){
|
|
$files=htmlspecialchars_decode($files);
|
|
try {
|
|
$files=json_decode($files,true);
|
|
} catch (\Exception $e) {
|
|
$files=[];
|
|
}
|
|
}
|
|
if(empty($applyid))$this->error2("缺少apply_id");
|
|
if(empty($files)||!count($files))$this->error2("请上传附件");
|
|
|
|
$temps=Db::name('cult4uptype')->field("ftype_id,ftype")->where(["apply_type"=>6,"isopen"=>1,"mustupload"=>1])->order('forder')->select();
|
|
if(count($temps)>count($files)){
|
|
$this->error2("请检查必须上传附件");
|
|
}
|
|
if(count($temps)){
|
|
$ids=array_column($temps,'ftype_id');
|
|
$types=array_column($temps,'ftype');
|
|
$temps=array_combine($ids,$types);
|
|
}
|
|
|
|
Db::startTrans();
|
|
try {
|
|
//上传附件
|
|
if($files&&count($files)) {
|
|
$utypeids=array_column($files,'ftype_id');
|
|
$query=Db::name('cult4upfiles')->where(['ftype_id'=>['in',$utypeids],'user_id'=>$uid,'apply_id'=>$applyid,'flag'=>0])->update(['new_flag'=>0]);
|
|
|
|
foreach($files as $key=>$file) {
|
|
$tmpid=isset($file['ftype_id'])?$file['ftype_id']:'';
|
|
$url=isset($file['path'])?$file['path']:'';
|
|
if(empty($tmpid)||empty($url)){
|
|
Db::rollback();
|
|
$this->error2('提交失败');
|
|
}
|
|
|
|
$allowtype=isset($temps[$tmpid])?explode("/",$temps[$tmpid]):[];
|
|
$ext=strtoupper(substr(strrchr($url,'.'), 1));
|
|
if(count($allowtype)&&!in_array($ext,$allowtype)){
|
|
Db::rollback();
|
|
$this->error2('上传文件类型错误!');
|
|
}
|
|
|
|
$size=$this->getsize($url);
|
|
$data=[
|
|
'apply_id'=>$applyid,
|
|
'user_id'=>$uid,
|
|
'user_type'=>1,
|
|
'status'=>0,
|
|
'upload_time'=>time(),
|
|
'ftype_id'=>$tmpid,
|
|
'ftype'=>1,
|
|
'filesize'=>$size,
|
|
'path'=>$url,
|
|
'flag'=>0
|
|
];
|
|
$query=Db::name('cult4upfiles')->insert($data);
|
|
if(!$query){
|
|
Db::rollback();
|
|
$this->error2('上传失败');
|
|
}
|
|
}
|
|
// 提交事务
|
|
Db::commit();
|
|
}
|
|
} catch (\Exception $e) {
|
|
// 回滚事务
|
|
Db::rollback();
|
|
$msg='上传失败';
|
|
$this->error2($msg);
|
|
}
|
|
|
|
$this->success2('上传成功');
|
|
}
|
|
/**
|
|
* 用户修改挂牌信息
|
|
*/
|
|
public function ugpedit(){
|
|
$uid=$this->_check();
|
|
$applyid=input('apply_id','','intval');
|
|
$cname=input('c_name');
|
|
$cbase=isset($_POST['c_base'])&&$_POST['c_base']?$_POST['c_base']:'';
|
|
$cnotice=isset($_POST['c_notice'])&&$_POST['c_notice']?$_POST['c_notice']:'';
|
|
$ctran=isset($_POST['c_transferor'])&&$_POST['c_transferor']?$_POST['c_transferor']:'';
|
|
$rule =[
|
|
['c_name','require|max:50','标的名称不能为空|标的名称不能超过50字符'],
|
|
['c_base','require','转让(或授权)标的简况不能为空'],
|
|
['c_notice','require','信息公告与交易条件不能为空'],
|
|
['c_transferor','require','转让(或授权)方简况不能为空'],
|
|
];
|
|
$checks=array(
|
|
'c_name'=>$cname,
|
|
'c_base'=>$cbase,
|
|
'c_notice'=>$cnotice,
|
|
'c_transferor'=>$ctran
|
|
);
|
|
|
|
$validate = new Validate($rule);
|
|
$rst= $validate->check($checks);
|
|
if(true!==$rst){
|
|
$error=is_array($validate->getError())?join('|',$validate->getError()):$validate->getError();
|
|
if(empty($error)){
|
|
$error="上传失败,请重新提交";
|
|
}
|
|
$this->error2($error);
|
|
}
|
|
$apply=Db::name('cult4apply')->alias('a')->join(config('database.prefix').'cult4baseinfo b','b.apply_id=a.apply_id')
|
|
->where(['a.apply_id'=>$applyid,'a.user_id'=>$uid,'b.new_flag'=>1,'status'=>['in',[32,35,37,38,41,42,43,45,50,53]]])
|
|
->order('addorder desc')->find();
|
|
if(!$apply){
|
|
$this->error2('纪录不存在,提交失败');
|
|
}
|
|
|
|
Db::startTrans();
|
|
try {
|
|
//判断是否还存在未上传资料
|
|
$lstatus=$apply['status'];
|
|
$status=1;
|
|
$statuslist=[32=>1,35=>2,37=>5,38=>6,42=>15,43=>16,45=>25,50=>29,53=>30];
|
|
if(isset($statuslist[$lstatus]))$status=$statuslist[$lstatus];
|
|
if($lstatus==41){
|
|
$fee_flag=Db::name('cult4fee')->where('apply_id',$applyid)->value('fee_flag');
|
|
$status=$fee_flag?12:9;
|
|
}
|
|
//插入主表
|
|
$data=[
|
|
'status'=>$status,
|
|
'pay_img'=>'',
|
|
'seq'=>0,
|
|
'update_user_id'=>$uid,
|
|
'update_user_type'=>1,
|
|
'update_time'=>time()
|
|
];
|
|
$query=Db::name('cult4apply')->where(['apply_id'=>$applyid,'user_id'=>$uid])->update($data);
|
|
if(!$query){
|
|
Db::rollback();
|
|
$this->error2('提交失败');
|
|
}
|
|
$post=input('post.');
|
|
$data=[
|
|
'payment_url'=>'',
|
|
'payment_info'=>'',
|
|
'c_name'=>$cname,
|
|
'c_base'=>isset($post['c_base'])&&is_array($post['c_base'])?json_encode($post['c_base']):'',
|
|
'c_notice'=>isset($post['c_notice'])&&is_array($post['c_notice'])?json_encode($post['c_notice']):'',
|
|
'c_transferor'=>isset($post['c_transferor'])&&is_array($post['c_transferor'])?json_encode($post['c_transferor']):''
|
|
];
|
|
|
|
$query=Db::name('cult4baseinfo')->where(['apply_id'=>$applyid])->update($data);
|
|
if(!$query){
|
|
Db::rollback();
|
|
$this->error2('提交失败');
|
|
}
|
|
// 提交事务
|
|
Db::commit();
|
|
} catch (\Exception $e) {
|
|
// 回滚事务
|
|
Db::rollback();
|
|
$msg='提交失败';
|
|
$this->error2($msg);
|
|
}
|
|
|
|
$this->success2('提交成功');
|
|
}
|
|
/**
|
|
* 用户上传缴费信息
|
|
*/
|
|
public function upay(){
|
|
$uid=$this->_check();
|
|
$applyid=input('apply_id','','intval');
|
|
$payimg=input('pay_img');
|
|
if(!$applyid){
|
|
$this->error2('缺少applyid');
|
|
}
|
|
if(!$payimg){
|
|
$this->error2('缺少pay_img');
|
|
}
|
|
$apply=Db::name('cult4apply')->where(['apply_id'=>$applyid,'user_id'=>$uid])->find();
|
|
if(!$apply){
|
|
$this->error2('纪录不存在,提交失败');
|
|
}
|
|
$status=$apply['status'];
|
|
$payimg=$apply['pay_img'];
|
|
if($status!=9)$this->error2('不能提交缴费证明');
|
|
if($payimg)$this->success2("已经提交过缴费证明");
|
|
|
|
$data=[
|
|
'pay_img'=>$payimg,
|
|
'update_user_id'=>$uid,
|
|
'update_user_type'=>1,
|
|
'update_time'=>time()
|
|
];
|
|
$query=Db::name('cult4apply')->where(['apply_id'=>$applyid,'user_id'=>$uid])->update($data);
|
|
if(!$query){
|
|
$this->error2('提交失败');
|
|
}
|
|
$this->success2("提交成功");
|
|
}
|
|
protected function getsize($file){
|
|
$size=0;
|
|
if($file){
|
|
$file=$this->_img($file);
|
|
$info=get_headers($file,true);
|
|
if(isset($info['Content-Length'])&&$info['Content-Length']){
|
|
$size=round($info['Content-Length'],2);
|
|
}
|
|
}
|
|
return $size;
|
|
}
|
|
protected function _check(){
|
|
$token=input('access_token');
|
|
$openId=input('openId');
|
|
if(empty($token))$this->error2("登录凭证必传");
|
|
if(empty($openId))$this->error2("普通用户的标识必传");
|
|
|
|
$check=Db::name("member_list")->where(['openid'=>$openId])->find();
|
|
$mid='';
|
|
if(!$check){
|
|
/*
|
|
$fxiyun=new \Fxiyun(['appid'=>'bd38d9bcd57b48dca7ab04a3f1e24be4','appsecret'=>'56356ccc-b9c0-4e95-9351-9903def2296d']);
|
|
$user=$fxiyun->getOauthUserinfo($token, $openId);
|
|
|
|
if(!$user){
|
|
$this->error2($fxiyun->errMsg);
|
|
}
|
|
if(!is_array($user)){
|
|
try {
|
|
$user=json_decode($user,true);
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
}
|
|
$data=$user&&isset($user['data'])?$user['data']:[];
|
|
if(count($data)){
|
|
$this->error2("用户信息获取失败");
|
|
}
|
|
$username=isset($data['username'])?$data['username']:'';
|
|
*/
|
|
$username='';
|
|
$member_list_salt=random(10);
|
|
$sl_data=array(
|
|
'openid'=>$openId,
|
|
'member_list_username'=>'',
|
|
'member_list_nickname'=>$username,
|
|
'member_list_salt' =>$member_list_salt,
|
|
'member_list_tel'=>'',
|
|
'member_list_pwd'=>'',
|
|
'member_list_email'=>'',
|
|
'member_list_headpic'=>'',
|
|
'member_list_sex'=>'',
|
|
'birthday'=>'0000-00-00',
|
|
'member_list_groupid'=>9,
|
|
'member_list_open'=>1,
|
|
'member_list_addtime'=>time(),
|
|
'user_status'=>1
|
|
);
|
|
$mid=Db::name('member_list')->insertGetId($sl_data);
|
|
}else{
|
|
$mid=$check['member_list_id'];
|
|
}
|
|
return $mid;
|
|
}
|
|
protected function _img($path){
|
|
if(!$path)return "";
|
|
|
|
if(strpos($path,'http:')==false){
|
|
return SITE_PATH.ltrim($path,'/');
|
|
}
|
|
return $path;
|
|
}
|
|
/**
|
|
* 操作成功跳转的快捷方法
|
|
* @access protected
|
|
* @param mixed $msg 提示信息
|
|
* @param string $url 跳转的URL地址
|
|
* @param mixed $data 返回的数据
|
|
* @param integer $wait 跳转等待时间
|
|
* @param array $header 发送的Header信息
|
|
* @return void
|
|
*/
|
|
protected function success2($msg = '', $data = '', $code =200){
|
|
$result = [
|
|
'code' => $code,
|
|
'msg' => $msg,
|
|
'data' => $data
|
|
];
|
|
|
|
$type = $this->getResponseType();
|
|
|
|
$response = Response::create($result, $type)->header([]);
|
|
throw new HttpResponseException($response);
|
|
}
|
|
|
|
/**
|
|
* 操作错误跳转的快捷方法
|
|
* @access protected
|
|
* @param mixed $msg 提示信息
|
|
* @param string $url 跳转的URL地址
|
|
* @param mixed $data 返回的数据
|
|
* @param integer $wait 跳转等待时间
|
|
* @param array $header 发送的Header信息
|
|
* @return void
|
|
*/
|
|
protected function error2($msg = '', $data = '',$code=204){
|
|
$result = [
|
|
'code' => $code,
|
|
'msg' => $msg,
|
|
'data' => $data
|
|
];
|
|
|
|
$type = $this->getResponseType();
|
|
|
|
$response = Response::create($result, $type)->header([]);
|
|
throw new HttpResponseException($response);
|
|
}
|
|
}
|
|
?>
|