Commit d09903da authored by hujun's avatar hujun

优化判断

parent 0beb50c7
......@@ -701,15 +701,12 @@ class Shop extends Basic
$result['shop_videos'] = $s_house->getHouseVideoList($params['id']);
$result['shop_videos_length'] = $s_house->getHouseVideoLength();
$upload_video_num = $s_house->getHouseVideoNum($params['id']);
$result['is_upload_video'] = 0;
if ($upload_video_num < 3) {
$upload_id = $s_house->getHouseVideoNum($params['id']);
$result['is_upload_video'] = 0; //不能上传视频
if (count($upload_id) < 3) {
$result['is_upload_video'] = 1;
}
if ($result['is_upload_video'] == 1) {
$upload_video_num = $s_house->getHouseVideoNum($params['id'], 0, $this->agentId);
if ($upload_video_num) {
if (in_array($this->agentId, $upload_id)) {
$result['is_upload_video'] = 0;
}
}
......
......@@ -1079,11 +1079,10 @@ class HouseService
/**
* 商铺视频数量
*
*
* @param $house_id
* @param int $is_check
* @param int $agent_id
* @return int|string
* @return array
*/
public function getHouseVideoNum($house_id, $is_check = 0, $agent_id = 0) {
$m_video = new GHousesVideo();
......@@ -1099,7 +1098,7 @@ class HouseService
if ($agent_id) {
$where['upload_id'] = $agent_id;
}
$num = $m_video->getTotal($where);
return $num;
$id = $m_video->getVideoColumn('upload_id', $where);
return $id;
}
}
\ No newline at end of file
......@@ -49,6 +49,26 @@ class GHousesVideo extends BaseModel
return $this->db_->where($where)->update($data);
}
/**
* @param $field
* @param $where
* @return array
*/
public function getVideoColumn($field, $where)
{
return $this->db_->where($where)->column($field);
}
/**
* @param $pageNo
* @param $pageSize
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getHouseVideoList($pageNo,$pageSize,$field,$params)
{
$order = "a.create_time desc";
......
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