CustomtaskContentModel.class.php 1.1 KB
<?php
/**
 * Created by PhpStorm.
 * User: liyifei2012it
 * Date: 17/5/18
 * Time: 11:34
 */
namespace Common\Model;

class CustomtaskContentModel extends AbstractModel
{

    // 构造方法
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * 根据应用获取应用数据ID数组
     * @author zhonglei
     * @param string $app 应用
     * @return array
     */
    public function getAppDataIds($app)
    {
        if (empty($app)) {
            return [];
        }

        $wheres = [];
        $params = [];
        $this->_parse_where($wheres, $params, ['app' => strtolower($app)]);

        // 企业标记
        $wheres[] = "`{$this->prefield}domain`=?";
        $params[] = QY_DOMAIN;
        // 状态条件
        $wheres[] = "`{$this->prefield}status`<?";
        $params[] = $this->get_st_delete();

        $wheres_sql = implode(' AND ', $wheres);
        $sql = "SELECT DISTINCT `app_data_id` FROM __TABLE__ WHERE {$wheres_sql}";
        $list = $this->_m->fetch_array($sql, $params);

        return empty($list) ? [] : array_column($list, 'app_data_id');
    }
}