Commit a39186e1 authored by clone's avatar clone

token 状态码

parent 85a6abd0
...@@ -10,6 +10,7 @@ namespace app\api\controller; ...@@ -10,6 +10,7 @@ namespace app\api\controller;
* Intro: 获取商铺list * Intro: 获取商铺list
*/ */
use app\api\extend\Basic; use app\api\extend\Basic;
use app\model\AttentionModel;
use app\model\HouseImgs; use app\model\HouseImgs;
use app\model\HouseInfos; use app\model\HouseInfos;
use app\model\Labels; use app\model\Labels;
...@@ -19,6 +20,7 @@ class Shop extends Basic ...@@ -19,6 +20,7 @@ class Shop extends Basic
protected $db; protected $db;
protected $dbImg; protected $dbImg;
protected $labels; protected $labels;
protected $attentionModel;
function __construct($request = null) function __construct($request = null)
{ {
...@@ -26,6 +28,7 @@ class Shop extends Basic ...@@ -26,6 +28,7 @@ class Shop extends Basic
$this->db = new HouseInfos(); $this->db = new HouseInfos();
$this->dbImg = new HouseImgs(); $this->dbImg = new HouseImgs();
$this->labels = new Labels(); $this->labels = new Labels();
$this->attentionModel = new AttentionModel();
} }
/** /**
...@@ -167,8 +170,14 @@ class Shop extends Basic ...@@ -167,8 +170,14 @@ class Shop extends Basic
return $this->response("101", '此楼盘已下架'); return $this->response("101", '此楼盘已下架');
} }
//todo 查询关注门店 //todo 查询关注门店
/* $attention["user_id"] = if (isset($this->userId)) {
getAttentionByUserIdAndHouseId($attention);*/ $attention["user_id"] = $this->userId;
$attention["house_id"] = $params["id"];
$attention["is_del"] = 0;
$attResult = $this->attentionModel->getAttentionByUserIdAndHouseId($attention);
if (count($attResult) > 0)
$result ["attention"] = $attResult["id"];
}
return $this->response("200", 'request success', $result); return $this->response("200", 'request success', $result);
......
...@@ -65,7 +65,7 @@ class Basic extends Controller ...@@ -65,7 +65,7 @@ class Basic extends Controller
} elseif (strtoupper($this->request->method()) === "POST") { } elseif (strtoupper($this->request->method()) === "POST") {
$this->params = $this->request->param() != null ? $this->request->param() : null; $this->params = $this->request->param() != null ? $this->request->param() : null;
} }
if (isset($this->params['AuthToken'])) { if (isset($this->params['AuthToken'])) {
$jwt = new \Firebase\JWT\JWT(); $jwt = new \Firebase\JWT\JWT();
$this->authToken = $this->params['AuthToken']; $this->authToken = $this->params['AuthToken'];
...@@ -89,7 +89,7 @@ class Basic extends Controller ...@@ -89,7 +89,7 @@ class Basic extends Controller
*/ */
public function tokenVerify(){ public function tokenVerify(){
if (!isset($this->params['AuthToken'])) { if (!isset($this->params['AuthToken'])) {
echo json_encode(array( "code" => "101", "msg" => "AuthToken不能为空!", "data" => [], "type" => "json" )); echo json_encode(array( "code" => "300", "msg" => "AuthToken不能为空!", "data" => [], "type" => "json" ));
exit; exit;
} }
$this->verifyUserInfo(); $this->verifyUserInfo();
...@@ -101,7 +101,7 @@ class Basic extends Controller ...@@ -101,7 +101,7 @@ class Basic extends Controller
{ {
//authToken有效期为30天 //authToken有效期为30天
if ((time() - $this->timeStamp_) > 2592000) { if ((time() - $this->timeStamp_) > 2592000) {
echo json_encode(array( "code" => "101", "msg" => "AuthToken失效,请重新登录!", "data" => [], "type" => "json" )); echo json_encode(array( "code" => "300", "msg" => "AuthToken失效,请重新登录!", "data" => [], "type" => "json" ));
exit; exit;
} }
} }
...@@ -111,7 +111,7 @@ class Basic extends Controller ...@@ -111,7 +111,7 @@ class Basic extends Controller
$userModel = new Users(); $userModel = new Users();
$userArr = $userModel->selectUser($this->userId); $userArr = $userModel->selectUser($this->userId);
if (count($userArr) > 0 && ($userArr["id"] != $this->userId || $userArr["user_phone"] != $this->phone)) { if (count($userArr) > 0 && ($userArr["id"] != $this->userId || $userArr["user_phone"] != $this->phone)) {
echo json_encode(array( "code" => "101", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json" )); echo json_encode(array( "code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json" ));
exit; exit;
} }
return true; return true;
......
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