Commit 6bc1d846 authored by clone's avatar clone

金额处理

parent 4f0edd6c
...@@ -16,7 +16,6 @@ use app\model\Regions; ...@@ -16,7 +16,6 @@ use app\model\Regions;
* Time : 10:36 * Time : 10:36
* Intro: * Intro:
*/ */
class Shop extends Basic class Shop extends Basic
{ {
private $gHousesModel; private $gHousesModel;
...@@ -84,7 +83,7 @@ class Shop extends Basic ...@@ -84,7 +83,7 @@ class Shop extends Basic
} else if (isset($params['title'])) { } else if (isset($params['title'])) {
$conditions['internal_title'] = array( "like", "%" . trim($params['title']) . "%" ); $conditions['internal_title'] = array( "like", "%" . trim($params['title']) . "%" );
} }
if(isset($params['house_id'])){ if (isset($params['house_id'])) {
$conditions['id'] = array( "eq", $params['house_id'] ); $conditions['id'] = array( "eq", $params['house_id'] );
} }
$order_ = ""; $order_ = "";
...@@ -112,11 +111,11 @@ class Shop extends Basic ...@@ -112,11 +111,11 @@ class Shop extends Basic
} }
//我的商铺 代表我是盘方的商铺 //我的商铺 代表我是盘方的商铺
if(isset($params['agent_id'])){ if (isset($params['agent_id'])) {
$verifyService = new VerifyService(); $verifyService = new VerifyService();
$ids = $verifyService->getPanpartyByAgentId($params['agent_id']); $ids = $verifyService->getPanpartyByAgentId($params['agent_id']);
//$conditions['upload_id'] = array( "eq", $params['agent_id'] ); //$conditions['upload_id'] = array( "eq", $params['agent_id'] );
$conditions['id'] = array("in",$ids); $conditions['id'] = array( "in", $ids );
} }
$area_start = isset($params['shop_area_start']) ? $params['shop_area_start'] : -1; $area_start = isset($params['shop_area_start']) ? $params['shop_area_start'] : -1;
...@@ -152,14 +151,14 @@ class Shop extends Basic ...@@ -152,14 +151,14 @@ class Shop extends Basic
default: default:
return $this->response("101", "请求数据异常"); return $this->response("101", "请求数据异常");
} }
if (!empty($conditions) ) { if (!empty($conditions)) {
$conditions['status'] = array( 'eq', 1 ); //只显示上架 $conditions['status'] = array( 'eq', 1 ); //只显示上架
if ($params['site_area'] == 1 || $params['site_area'] == 2) if ($params['site_area'] == 1 || $params['site_area'] == 2)
$conditions['is_show'] = array( 'eq', 0 ); //c端只显示可显示的楼盘 $conditions['is_show'] = array( 'eq', 0 ); //c端只显示可显示的楼盘
} }
//如果有传经纪人id则代表我的商铺不区分状态 //如果有传经纪人id则代表我的商铺不区分状态
if( isset($params['agent_id'])){ if (isset($params['agent_id'])) {
unset($conditions['status']); unset($conditions['status']);
} }
$result = $this->gHousesModel->getHousesList($pageNo, $pageSize, $order_, $field, $conditions, $spTagArr); $result = $this->gHousesModel->getHousesList($pageNo, $pageSize, $order_, $field, $conditions, $spTagArr);
...@@ -228,7 +227,7 @@ class Shop extends Basic ...@@ -228,7 +227,7 @@ class Shop extends Basic
$result = $this->gHousesModel->getHouseDetailById($field, $conditions); $result = $this->gHousesModel->getHouseDetailById($field, $conditions);
$result["rent_price"] = $result["rent_price"] * 0.01;
$result["api_path"] = IMG_PATH; $result["api_path"] = IMG_PATH;
$param["house_id"] = $params['id']; $param["house_id"] = $params['id'];
//todo 这里的是否要更改成b端后台上传的类型 //todo 这里的是否要更改成b端后台上传的类型
...@@ -266,7 +265,8 @@ class Shop extends Basic ...@@ -266,7 +265,8 @@ class Shop extends Basic
* @throws \think\exception\DbException * @throws \think\exception\DbException
* @throws \think\exception\PDOException * @throws \think\exception\PDOException
*/ */
public function edit() { public function edit()
{
$result['code'] = 200; $result['code'] = 200;
$result['msg'] = ''; $result['msg'] = '';
$result['data'] = []; $result['data'] = [];
...@@ -302,28 +302,29 @@ class Shop extends Basic ...@@ -302,28 +302,29 @@ class Shop extends Basic
* *
* @return \think\Response * @return \think\Response
*/ */
public function uploadHouseFile() { public function uploadHouseFile()
{
$data['status'] = 101; $data['status'] = 101;
$data['msg'] = ''; $data['msg'] = '';
$data['data'] = ''; $data['data'] = '';
$file = request()->file('file'); $file = request()->file('file');
if($file){ if ($file) {
$path = ROOT_PATH . 'public' . DS . 'resource'. DS . 'lib'. DS .'Attachments'. DS .'images'; $path = ROOT_PATH . 'public' . DS . 'resource' . DS . 'lib' . DS . 'Attachments' . DS . 'images';
$info = $file->validate(['size'=>1024000,'ext'=>'jpg,png'])->move($path); $info = $file->validate([ 'size' => 1024000, 'ext' => 'jpg,png' ])->move($path);
if($info){ if ($info) {
$img_path = $info->getSaveName(); //生成的图片路径 $img_path = $info->getSaveName(); //生成的图片路径
$data['img_type'] = $this->params['img_type']; $data['img_type'] = $this->params['img_type'];
$data['img_name'] = $img_path; $data['img_name'] = $img_path;
$img = new GHousesImgs(); $img = new GHousesImgs();
$img->addHouseImg($data,$this->params['house_id']); $img->addHouseImg($data, $this->params['house_id']);
$data['status'] = 200; $data['status'] = 200;
$data['msg'] = '上传成功'; $data['msg'] = '上传成功';
$data['data'] = [ $data['data'] = [
'file_name' => CK_IMG_URL .'images'. DS . $img_path, 'file_name' => CK_IMG_URL . 'images' . DS . $img_path,
'save_path' => $img_path 'save_path' => $img_path
]; ];
}else{ } else {
// 上传失败获取错误信息 // 上传失败获取错误信息
$data['msg'] = $file->getError(); $data['msg'] = $file->getError();
} }
...@@ -342,17 +343,18 @@ class Shop extends Basic ...@@ -342,17 +343,18 @@ class Shop extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function delHouseFile() { public function delHouseFile()
{
$data['status'] = 101; $data['status'] = 101;
$data['msg'] = ''; $data['msg'] = '';
$data['data'] = ''; $data['data'] = '';
if(empty($this->params['save_path']) || empty($this->params['house_id'])){ if (empty($this->params['save_path']) || empty($this->params['house_id'])) {
return $this->response($data['status'], 'Save_path or id house_id is null', $data['data']); return $this->response($data['status'], 'Save_path or id house_id is null', $data['data']);
} }
$img = new GHousesImgs(); $img = new GHousesImgs();
$id = $img->getHouseImagesInfo('id',[ $id = $img->getHouseImagesInfo('id', [
'house_id' => $this->params['house_id'], 'house_id' => $this->params['house_id'],
'img_name' => $this->params['save_path'], 'img_name' => $this->params['save_path'],
'img_status' => 0 'img_status' => 0
...@@ -361,9 +363,9 @@ class Shop extends Basic ...@@ -361,9 +363,9 @@ class Shop extends Basic
if (empty($id['id'])) { if (empty($id['id'])) {
$data['msg'] = '没有该文件'; $data['msg'] = '没有该文件';
} else { } else {
$path = ROOT_PATH . 'public' . DS . 'resource'. DS . 'lib'. DS .'Attachments'. DS .'Images/'; $path = ROOT_PATH . 'public' . DS . 'resource' . DS . 'lib' . DS . 'Attachments' . DS . 'Images/';
@unlink($path.$this->params['save_path']); @unlink($path . $this->params['save_path']);
$img->editData(['img_status'=>1],$id['id'], 'id'); $img->editData([ 'img_status' => 1 ], $id['id'], 'id');
$data['status'] = 200; $data['status'] = 200;
} }
...@@ -378,7 +380,8 @@ class Shop extends Basic ...@@ -378,7 +380,8 @@ class Shop extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getAddress() { public function getAddress()
{
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$regions = new Regions(); $regions = new Regions();
$data = $regions->getRegionsCity(); $data = $regions->getRegionsCity();
...@@ -393,7 +396,8 @@ class Shop extends Basic ...@@ -393,7 +396,8 @@ class Shop extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getRegions() { public function getRegions()
{
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$regions = new Regions(); $regions = new Regions();
$data = $regions->getRegions($this->params['code'], $this->params['parent_code']); $data = $regions->getRegions($this->params['code'], $this->params['parent_code']);
......
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