Commit 8bde05b0 authored by hujun's avatar hujun

house_video

parent 10a588ba
......@@ -1091,4 +1091,27 @@ class Shop extends Basic
return $this->response($code, $msg);
}
/**
* 添加商铺视频
*
* @return \think\Response
*/
public function addHouseVideo()
{
if (empty($this->params['house_id']) || empty($this->params['video_name'])) {
return $this->response(101, '参数错误');
}
$code = 200;
$msg = '';
$service = new HouseService();
$result = $service->addVideo($this->params['house_id'], $this->params['video_name'], $this->agentId, $this->agentName);
if ($result['status'] == 'fail') {
$code = 101;
$msg = $result['msg'];
}
return $this->response($code, $msg, []);
}
}
......@@ -100,6 +100,10 @@ class UploadFileService
$path .= 'static/check/';
$internet_path = 'static/check/';
break;
case 'house_video':
$path .= 'resource/lib/Attachments/video/';
$internet_path = '';
break;
default :
$data['code'] = 101;
$data['msg'] = "上传图片类型错误";
......
......@@ -20,6 +20,7 @@ use app\model\GHouses;
use app\model\GHousesExt;
use app\model\GHousesImgs;
use app\model\GHousesToAgents;
use app\model\GHousesVideo;
use app\model\GLandlordPhone;
use app\model\GOperatingRecords;
use app\task\controller\ResultsSummaryNewTask;
......@@ -970,4 +971,48 @@ class HouseService
}
return $is_ok;
}
/**
* @param $house_id
* @param $video_name
* @param $upload_id
* @param $upload_name
* @return mixed
*/
public function addVideo($house_id, $video_name, $upload_id, $upload_name)
{
$result['status'] = 'fail';
$house_where['status'] = ['<>', 3];
$house_where['id'] = $house_id;
$id = $this->m_house->getHouseValue('id', ['status' => ['<>', 3],]);
if (empty($id)) {
$result['msg'] = '没有该商铺';
return $result;
}
$m_video = new GHousesVideo();
$video_where['house_id'] = $house_id;
$video_where['upload_id'] = $upload_id;
$video_where['is_del'] = 0;
$num = $m_video->getTotal($video_where);
if ($num > 0) {
$result['msg'] = '你已上传过该视频';
return $result;
}
$data['video_name'] = $video_name;
$data['upload_id'] = $upload_id;
$data['upload_name'] = $upload_name;
$data['house_id'] = $house_id;
$num = $m_video->insertData($data);
if ($num > 0) {
$result['status'] = 'successful';
} else {
$result['msg'] = '提交失败';
}
return $result;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: 43897
* Date: 2019/3/22
* Time: 14:23
*/
namespace app\model;
use think\Db;
class GHousesVideo extends BaseModel
{
// 设置当前模型对应的完整数据表名称
protected $table = 'g_houses_video';
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
/**
* @param $data
* @return int|string
*/
public function insertData($data)
{
if (is_array($data[0])) {
$num = $this->db_->insertAll($data);
} else {
$num = $this->db_->insert($data);
}
return $num;
}
}
\ No newline at end of file
......@@ -668,6 +668,7 @@ Route::group('broker', [
'getCityInfoByMap' => ['api_broker/MapFindHouse/getCityInfoByMap', ['method' => 'get|post']],
'getShopDetail' => ['api_broker/Shop/getShopDetail', ['method' => 'get']],
'addShopFollowUp' => ['api_broker/Shop/addShopFollowUp', ['method' => 'post']], //新增商铺跟进记录
'addHouseVideo' => ['api_broker/Shop/addHouseVideo', ['method' => 'post']], //新增商铺视频
'reportList' => ['api_broker/Report/reportList', ['method' => '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