Commit cec78295 authored by zhuwei's avatar zhuwei

客户看了哪些铺记录

parent b1691c9d
...@@ -201,7 +201,7 @@ class LookShop extends Basic ...@@ -201,7 +201,7 @@ class LookShop extends Basic
} }
/** /**
* 我的看铺记录 * 客户看了哪些铺记录
* @return \think\Response * @return \think\Response
*/ */
public function getShopLookList() public function getShopLookList()
......
...@@ -274,7 +274,7 @@ class LookShopService ...@@ -274,7 +274,7 @@ class LookShopService
} }
/** /**
* 我的看铺记录 * 客户看了哪些铺记录
* @param $user_id * @param $user_id
* @param $pageNo * @param $pageNo
* @param $pageSize * @param $pageSize
...@@ -297,6 +297,33 @@ class LookShopService ...@@ -297,6 +297,33 @@ class LookShopService
return $list; return $list;
} }
/**
* 客户看了哪些铺记录 pc后台
* @param $user_id
* @param $pageNo
* @param $pageSize
* @return false|\PDOStatement|string|\think\Collection
*/
public function getShopLookListPc($user_id,$pageNo,$pageSize)
{
$m_user = new Users();
$fields = "b.id,b.buyer_nick";
$result = $m_user->getUserInfoById(['user_id'=>$user_id], $fields);
if (isset($result[0]["id"]) && $result[0]["id"] > 0) {
$conditions[] = ['EXP', "(a.user_id = {$result[0]["id"]} and a.source = 1) or (a.user_id = {$user_id} and a.source = 0)"];
}else{
$conditions['a.user_id'] = $user_id;
}
$field = 'a.type,a.create_time,a.house_id,b.internal_title';
$m_look_shop = new TLookShopUser();
$list = $m_look_shop->getLookShopListPc($conditions, $field, $pageNo, $pageSize);
$total = $m_look_shop->getLookShopListCountPc($conditions, $field);
$list["list"] = $list;
$list["total"] = $total;
return $list;
}
......
...@@ -10,6 +10,7 @@ namespace app\index\controller; ...@@ -10,6 +10,7 @@ namespace app\index\controller;
* Intro: * Intro:
*/ */
use app\api_broker\service\LookShopService;
use app\api_broker\service\VerifyService; use app\api_broker\service\VerifyService;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\model\TLookShopModel; use app\model\TLookShopModel;
...@@ -131,4 +132,22 @@ class LookShop extends Basic ...@@ -131,4 +132,22 @@ class LookShop extends Basic
return $this->response("200", "success", $list); return $this->response("200", "success", $list);
} }
/**
* 客户看了哪些铺记录
* @return \think\Response
*/
public function getShopLookList()
{
$params = $this->params;
if(empty($params["user_id"])){
return $this->response("101","请求参数错误");
}
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
$s_look_Shop = new LookShopService();
$result = $s_look_Shop->getShopLookListPc($params['user_id'],$pageNo,$pageSize);
return $this->response("200", "success", $result);
}
} }
\ No newline at end of file
...@@ -66,6 +66,14 @@ class TLookShopUser extends Model ...@@ -66,6 +66,14 @@ class TLookShopUser extends Model
->select(); ->select();
} }
/**
* 客户看了哪些铺记录
* @param $condition
* @param $field
* @param $pageNo
* @param $pageSize
* @return false|\PDOStatement|string|\think\Collection
*/
public function getLookShopList($condition, $field, $pageNo, $pageSize) public function getLookShopList($condition, $field, $pageNo, $pageSize)
{ {
$data = $this->db_ $data = $this->db_
...@@ -80,13 +88,42 @@ class TLookShopUser extends Model ...@@ -80,13 +88,42 @@ class TLookShopUser extends Model
->select(); ->select();
return $data; return $data;
} }
public function getLookShopListCount($condition, $field)
/**
* 客户看了哪些铺记录 pc后台
* @param $condition
* @param $field
* @param $pageNo
* @param $pageSize
* @return false|\PDOStatement|string|\think\Collection
*/
public function getLookShopListPc($condition, $field, $pageNo, $pageSize)
{
$data = $this->db_
->field($field)
->alias("a")
->join("g_houses b","a.house_id=b.id","left")
->where($condition)
->page($pageNo)
->limit($pageSize)
->order("a.id desc")
->select();
return $data;
}
/**
* 客户看了哪些铺记录 pc后台
* @param $condition
* @param $field
* @return int|string
*/
public function getLookShopListCountPc($condition, $field)
{ {
return $this->db_ return $this->db_
->field($field) ->field($field)
->alias("a") ->alias("a")
// ->join("u_wx_info b","a.user_id=b.id","left") ->join("g_houses b","a.house_id=b.id","left")
// ->join("u_users c", "c.buyer_id=b.id", "left")
->where($condition) ->where($condition)
->count(); ->count();
} }
......
...@@ -592,6 +592,8 @@ Route::group('index', [ ...@@ -592,6 +592,8 @@ Route::group('index', [
'editAmercement' => [ 'index/Amercement/editAmercement', [ 'method' => 'GET|POST' ] ], 'editAmercement' => [ 'index/Amercement/editAmercement', [ 'method' => 'GET|POST' ] ],
'delAmercementImage' => [ 'index/Amercement/delAmercementImage', [ 'method' => 'GET|POST' ] ], 'delAmercementImage' => [ 'index/Amercement/delAmercementImage', [ 'method' => 'GET|POST' ] ],
'getShopLookList' => ['index/LookShop/getShopLookList', ['method' => 'POST|GET']],//客户看了哪些铺记录
]); ]);
......
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