Commit 3ec525fb authored by clone's avatar clone

验证token

parent 0191fac1
......@@ -7,7 +7,7 @@ namespace app\api\controller;
* User : zw
* Date : 2017/12/8
* Time : 11:07
* Intro:
* Intro:banner增删改查
*/
use app\api\extend\Basic;
......@@ -57,6 +57,10 @@ class Banner extends Basic
}
}
/**
* 修改是否显示
* @return \think\Response
*/
public function upIsShow()
{
$params = array(
......
......@@ -4,7 +4,7 @@
* User : zw
* Date : 2017/12/7
* Time : 15:16
* Intro: c端首页资源 banner 月均价 上周成交量
* Intro: c端首页资源 月均价 上周成交量
*/
namespace app\api\controller;
......
<?php
namespace app\api\controller;
/**
* Created by PhpStorm.
* User : zw
* Date : 2017/12/12
* Time : 10:39
* Intro:
*/
use app\api\extend\Basic;
use app\model\SubletModel;
use think\Request;
class Sublet extends Basic
{
protected $subletMode;
public function __construct($request = null)
{
parent::__construct($request);
$this->subletMode = new SubletModel();
}
public function addSublet(){
//$params = $this->params;
/**
* `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '我的转租记录表',
`user_id` int(10) DEFAULT NULL COMMENT '用户id',
`manage_status` tinyint(3) DEFAULT '0' COMMENT '经营状态 0:餐饮美食 1:零售 2:休闲娱乐 3:其他',
`address_detail` varchar(255) DEFAULT '' COMMENT '详细地址',
`province` varchar(125) DEFAULT NULL COMMENT '省',
`province_code` int(10) DEFAULT NULL COMMENT '省code 对应regions表code',
`city` varchar(125) DEFAULT '' COMMENT '市',
`city_id` int(10) DEFAULT NULL COMMENT '市id',
`district` varchar(125) DEFAULT '' COMMENT '区',
`district_id` int(10) DEFAULT NULL COMMENT '区id',
`expected_rent` int(11) DEFAULT '0' COMMENT '期望租金 存分',
`appellation` varchar(125) DEFAULT '' COMMENT '称呼',
`tel` varchar(20) DEFAULT '' COMMENT '联系方式',
`status` tinyint(3) DEFAULT '0' COMMENT '状态 0:已发布 1:电话核实 2:商铺上架',
`agents_id` int(10) DEFAULT NULL COMMENT '经纪人 对应agents表(对接经纪人)',
`create_time` timestamp NULL DEFAULT NULL,
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
*/
$params = array(
);
}
}
......@@ -14,6 +14,7 @@ use think\helper\Time;
use think\Request;
use think\Response;
use Qiniu;
use think\Session;
class Basic extends Controller
{
......@@ -62,9 +63,9 @@ class Basic extends Controller
}
$jwt = new \Firebase\JWT\JWT();
/* $jwt = new \Firebase\JWT\JWT();
/* $this->authToken = $this->params['AuthToken'];
$this->authToken = $this->params['AuthToken'];
$result = $jwt->decode($this->authToken, config('jwt_key'), array( 'HS256' )); //解码token
$this->userId = $result['data']["userId"];
$this->phone = $result['data']["phone"];
......@@ -84,6 +85,11 @@ class Basic extends Controller
}
public function verifyUserInfo(){
//todo 待完成
$userArr = Session::get("u_user");
if(count($userArr) > 0 && ($userArr["status"] != 0 || $userArr["id"] != $this->userId || $userArr["user_phone"] != $this->phone) ){
$this->response("101", "用户验证失败,重新登录!");
}
return true;
}
......
......@@ -4,8 +4,23 @@ namespace app\model;
use think\Model;
class Sublet extends Model
class SubletModel extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'u_sublet';
protected $db;
function __construct()
{
$this->db = Db($this->table);
}
public function addSublet($params)
{
//todo 新增
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment