Files
SRCMS/Application/User/Controller/InfoController.class.php

46 lines
1.1 KiB
PHP
Raw Normal View History

2015-10-06 20:25:13 +08:00
<?php
namespace User\Controller;
use Think\Controller;
/**
* @Author: Zhou Yuyang <1009465756@qq.com> 10:28 2017/02/02
* @Copyright 2015-2020 SISMO
* @Project homepage https://github.com/CNSISMO
* @Version 2.0
2015-10-06 20:25:13 +08:00
*/
class InfoController extends BaseController{
2015-10-06 20:25:13 +08:00
/**
* 更新联系方式
*/
public function index()
2015-10-06 20:25:13 +08:00
{
$id = session('userId');
2015-10-06 20:25:13 +08:00
if (!IS_POST) {
$info = M('member')->where(array('id'=>$id))->select();
$this->assign('info',$info);
2015-10-06 20:25:13 +08:00
$this->display();
}
if (IS_POST) {
$model = M("member");
$data = I();
$token = $data['token'];
$user = $model->where(array('id'=>$id))->find();
if($token != $user['token']){
$this->error("非法请求");
}
if ($model->where(array('id'=>$id))->field('realname,zipcode,address,tel,alipay,bankcode,idcode,qqnumber,website,description,qqnumber,idcode,team')->save($data)) {
$this->success("联系方式更新成功", U('info/index'));
2015-10-06 20:25:13 +08:00
} else {
$this->error("联系方式更新失败", U('info/index'));
2015-10-06 20:25:13 +08:00
}
}
}
}