Commit c50506b7 authored by hujun's avatar hujun

Merge remote-tracking branch 'origin/wx0604' into wx0604

parents 40890ffb 05ebb74e
......@@ -71,7 +71,7 @@ class AppointmentTime extends Basic
return $this->response("101", "楼盘信息不能为空");
}
//todo 参数校验
if (!isset($params["phone"]) || !preg_match('/^1[345678]\d{9}$/', $params["phone"])) {
if (!isset($params["phone"]) || !preg_match('/^1[3456789]\d{9}$/', $params["phone"])) {
return $this->response("101", "手机号为空或手机号无效");
}
......
......@@ -483,16 +483,33 @@ class Member extends Basic
*/
public function getUserInfo() {
$data['status'] = 200;
$data['data'] = '';
if ($this->params['AuthToken']) {
$fields = 'id,user_pswd,user_nick,user_phone,user_pic,referrer_id,referrer_source,integral,create_time,update_time,last_login_time,last_login_ip';
$data['data'] = $this->user->selectUser($this->userId, $fields);
$data['data']['AuthToken'] = $this->params['AuthToken'];
$params = $this->params;
/* $params = array(
"user_id" => 1
);*/
$fields = "a.id,a.buyer_id,b.buyer_nick,a.user_nick,a.user_phone,a.user_pic,a.other_pic";
$result = $this->user->getUserInfoById($params, $fields);
$data = [];
if(count($result) > 0){
$jwt_data['id'] = $result[0]["id"];
$jwt_data['userNick'] = $result[0]["user_nick"];
$jwt_data['phone'] = $result[0]["user_phone"];
$jwt = new JwtUntils();
$AuthToken = $jwt->createToken($jwt_data);
$data["id"] = $result[0]["id"];
$data["buyer_id"] = $result[0]["buyer_id"];
$data["buyer_nick"] = $result[0]["buyer_nick"];
$data["user_nick"] = $result[0]["user_nick"];
$data["user_phone"] = $result[0]["user_phone"];
$data["user_pic"] = !empty($result[0]["user_pic"]) ? HEADERIMGURL . $result[0]["user_pic"] : $result[0]["other_pic"];
$data["AuthToken"] = $AuthToken;
}else{
return $this->response("101", "数据查询失败");
}
$data['msg'] = '';
return $this->response($data['status'], $data['msg'], $data['data']);
return $this->response("200","请求成功",$data);
}
/**
......
......@@ -106,7 +106,7 @@ class Sublet extends Basic
return $this->response("101", "称呼不能为空");
}
if (!isset($params["tel"]) || !preg_match('/1[345678]\d{9}/', $params["tel"])) {
if (!isset($params["tel"]) || !preg_match('/1[3456789]\d{9}/', $params["tel"])) {
return $this->response("101", "手机号检验错误");
}
$params["create_time"] = date("Y-m-d H:i:s", time());
......
......@@ -555,10 +555,10 @@ class OReportModel extends Model
(
SELECT
a.id,
a.user_id,
a.agents_id,
a.expect_time,
a.house_id,
a.user_id,
b.external_title AS house_title,
b.residue_num AS room_num_left,
b.is_show,
......@@ -568,9 +568,10 @@ class OReportModel extends Model
LEFT JOIN g_houses b ON a.house_id = b.id
WHERE
a.user_id = $user_id
and a.agents_id IS NULL
and a.status in (0,1)
) ) as aaa limit $start_index,$pageSize";
//echo $sql;
$data = $this->db->query($sql);
return $data;
......
......@@ -664,4 +664,21 @@ class Users extends Model
return $this->where($where_)->setField("buyer_id", 0);
}
public function getUserInfoById($param, $fields)
{
$where_ = [];
if (isset($param["user_id"])) {
$where_["a.id"] = $param["user_id"];
}
$data = $this
->field($fields)
->alias("a")
->join("u_wx_info b","a.buyer_id=b.id","left")
->where($where_)
->select();
return $data;
}
}
......@@ -41,8 +41,8 @@ class Response
/**
* 构造函数
* @access public
* @param mixed $data 输出数据
* @param int $code
* @param mixed $data 输出数据
* @param int $code
* @param array $header
* @param array $options 输出参数
*/
......@@ -60,11 +60,11 @@ class Response
/**
* 创建Response对象
* @access public
* @param mixed $data 输出数据
* @param string $type 输出类型
* @param int $code
* @param array $header
* @param array $options 输出参数
* @param mixed $data 输出数据
* @param string $type 输出类型
* @param int $code
* @param array $header
* @param array $options 输出参数
* @return Response|JsonResponse|ViewResponse|XmlResponse|RedirectResponse|JsonpResponse
*/
public static function create($data = '', $type = '', $code = 200, array $header = [], $options = [])
......@@ -106,7 +106,7 @@ class Response
$this->header['Cache-Control'] = 'max-age=' . $cache[1] . ',must-revalidate';
$this->header['Last-Modified'] = gmdate('D, d M Y H:i:s') . ' GMT';
$this->header['Expires'] = gmdate('D, d M Y H:i:s', $_SERVER['REQUEST_TIME'] + $cache[1]) . ' GMT';
Cache::tag($cache[2])->set($cache[0], [$data, $this->header], $cache[1]);
Cache::tag($cache[2])->set($cache[0], [ $data, $this->header ], $cache[1]);
}
}
......@@ -177,8 +177,8 @@ class Response
/**
* 设置响应头
* @access public
* @param string|array $name 参数名
* @param string $value 参数值
* @param string|array $name 参数名
* @param string $value 参数值
* @return $this
*/
public function header($name, $value = null)
......@@ -199,14 +199,14 @@ class Response
public function content($content)
{
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([
$content,
'__toString',
])
$content,
'__toString',
])
) {
throw new \InvalidArgumentException(sprintf('variable type error: %s', gettype($content)));
}
$this->content = (string) $content;
$this->content = (string)$content;
return $this;
}
......@@ -269,7 +269,7 @@ class Response
/**
* 页面输出类型
* @param string $contentType 输出类型
* @param string $charset 输出编码
* @param string $charset 输出编码
* @return $this
*/
public function contentType($contentType, $charset = 'utf-8')
......@@ -309,16 +309,16 @@ class Response
{
if (null == $this->content) {
$content = $this->output($this->data);
Log::record("response msg:" . $content);
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([
$content,
'__toString',
])
$content,
'__toString',
])
) {
throw new \InvalidArgumentException(sprintf('variable type error: %s', gettype($content)));
}
$this->content = (string) $content;
$this->content = (string)$content;
}
return $this->content;
}
......
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