params['isDev']==true) { return $this->result(1, '成功',1); }else{ return $this->result(1, '成功',2); } } public function actionGetLoginCode(){ $post=axios_request(); $appId = Config::getSystemSet('merchantConfig', 0); if (!$appId['miniAppId']) { return $this->result(2, '请先配置小程序参数'); } $url = $this->shdUrl . "index.php?r=api/index/login"; $wqUrl = ""; if (Yii::$app->params['isDev'] == true) { $wqUrl = "/app/index.php"; } $data['host']=Yii::$app->request->hostInfo.$wqUrl; $res=httpRequest($url,$data); $res=json_decode($res,true); if($res['msg']=='成功' AND $res['data']){ return $this->result(1, '成功',$res['data']); }else{ return $this->result(1, '等待'); } } public function actionGetLoginStatus(){ $uniacid=0; $config = Config::getSystemSet('shdUpdateConfig', 0); $url = $this->shdUrl . "index.php?r=api/index/login-status"; $wqUrl = ""; if (Yii::$app->params['isDev'] == true) { $wqUrl = "/app/index.php"; } $config['host']=Yii::$app->request->hostInfo.$wqUrl; $config['uniacid']=0; $appId=Config::getSystemSet('merchantConfig',$uniacid); $config['appId']=$appId['miniAppId']; $config['plugin']=json_encode($config['plugin']); $res=httpRequest($url,$config); $res=json_decode($res,true); if($res['msg']=='登录成功'){ return $this->result(1, '成功',$res['data']); }else{ return $this->result(1, '等待扫码'); } } public function actionPreview(){ $post=axios_request(); $uniacid=0; $config = Config::getSystemSet('shdUpdateConfig', 0); $url = $this->shdUrl ."index.php?r=api/index/update"; $wqUrl=""; if(Yii::$app->params['isDev']==true){ $wqUrl="/app/index.php"; } $config['host']=Yii::$app->request->hostInfo.$wqUrl; $config['uniacid']=$uniacid; $appId=Config::getSystemSet('merchantConfig',$uniacid); $config['appId']=$appId['miniAppId']; $config['plugin']=json_encode($config['plugin']); $res=httpRequest($url,$config); $res=json_decode($res,true); if($res['msg']=='成功' AND !json_decode($res['data'],true)){ return $this->result(1, '成功',"data:image/jpeg;base64,".$res['data']); }else{ return $this->result(1, json_decode($res['data'],true)['message'],$res['data']); } } //设置 public function actionConfig(){ $request = Yii::$app->request; $result=axios_request(); if(!$result['ident']){ return $this->result(2,'数据异常'); } if ($request->isGet) { $res=Config::getSystemSet($result['ident'],0); echo json_encode(['code'=>1,'msg'=>'成功','data'=>$res]);die; } if(Yii::$app->params['isDev']==true){ $result['isDev']=1; }else{ $result['isDev']=2; } $re=Config::saveSystemSet($result,$result['ident'],0,$result['identName']?:''); if($re){ return $this->result(1,'成功'); }else{ return $this->result(2,'网络异常,请稍后再试'); } } }