You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
3.6 KiB
PHTML

2 years ago
<?php
/**
* Created by PhpStorm.
* User: xmy 280564871@qq.com
* Date: 2017/4/20
* Time: 14:48
*/
namespace Open\Controller;
use Admin\Model\DevelopersModel;
use Open\Model\BankModel;
use Open\Model\ContractModel;
use Open\Model\DocumentModel;
class ApplyController extends CenterController {
public function _initialize()
{
parent::_initialize(); // TODO: Change the autogenerated stub
$this->title = "基本信息";
$this->p_title = "管理中心";
$this->p_url = U('Stats/overview');
}
/**
* 申请页面
* author: xmy 280564871@qq.com
*/
public function apply(){
$model = new DevelopersModel();
$data = $model->getUserData(UID);
if($data['nature'] == 1){
$this->assign("data",$data);
$this->display('company');
}elseif($data['nature'] == 2){
$this->assign("data",$data);
$this->display("personal");
}else{
$this->display('company');
}
}
/**
* 个人申请
* author: xmy 280564871@qq.com
*/
public function personal(){
$model = new DevelopersModel();
if(IS_POST){
$result = $model->saveBaseInfo(UID,2);
if($result !== false){
$this->success("申请成功",U("Apply/apply"));
}else{
$this->error("申请失败".$model->getError());
}
}else{
$data = $model->getUserData(UID);
if(!empty($data['nature'])){
$this->assign("data",$data);
}
$this->display();
}
}
/**
* 公司申请
* author: xmy 280564871@qq.com
*/
public function company(){
$model = new DevelopersModel();
if(IS_POST){
$result = $model->saveBaseInfo(UID,1);
if($result !== false){
$this->success("申请成功",U("Apply/apply"));
}else{
$this->error("申请失败".$model->getError());
}
}else{
$data = $model->getUserData(UID);
if(!empty($data['nature'])){
$this->assign("data",$data);
}
$this->display();
}
}
/**
* 银行信息
* author: xmy 280564871@qq.com
*/
public function bank(){
$model = new BankModel();
if(IS_POST){
$result = $model->update(UID);
if($result !== false){
$this->success("保存成功");
}else{
$this->error("保存失败 ".$model->getError());
}
}else {
$data = $model->getUserData(UID);
$this->assign("data",$data);
$this->title = "银行账号";
$this->display();
}
}
/**
* 修改密码
* author: xmy 280564871@qq.com
*/
public function password(){
$this->title = "修改密码";
$this->display();
}
/**
* 合同管理
* @param int $p
* author: xmy 280564871@qq.com
*/
public function contract($p=1){
$this->title = "合同管理";
$model = new ContractModel();
if(!empty(I('status'))){
$map['c.status'] = I("status") == 2 ? ['in',[2,3]] : I('status');
}
empty(I("game_name")) || $map['game_name'] = ['like',"%".I("game_name")."%"];
$map['c.develop_id'] = UID;
//合同列表
$data = $model->getDataLists($map,$p,'c.create_time desc');
//合同信息
$Develop = new DevelopersModel();
$develop = $Develop->getUserData(UID);
//合同内容
$Document = new DocumentModel();
$content = $Document->getDetailByName("CONTRACT_CONTENT");
$this->assign("content",$content);
$this->assign("develop",$develop);
$this->assign("data",$data['data']);
$this->showPage($data['count']);
$this->display();
}
/**
* 签署合同
* @param $id
* author: xmy 280564871@qq.com
*/
public function sign_contract($contract_id){
$model = new ContractModel();
$map['id'] = $contract_id;
$map['develop_id'] = UID;
if($model->sign_contract($map) !== false){
$this->success("签署成功");
}else{
$this->error("签署失败");
}
}
}