Commit bf7855b4 authored by zhuwei's avatar zhuwei

客户站点表模型

parent 1be57fc9
<?php
namespace app\model;
use think\Db;
use think\Model;
class UserSiteModel extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'u_user_site';
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
/**
* 新增数据
* @param $data
* @return int|string
*/
public function saveUserSite($data) {
$time = date("Y-m-d H:i:s", time());
$data['create_time'] = $time;
$data['update_time'] = $time;
$data['is_del'] = 0;
return $this->db_ ->insert($data);
}
// /**
// * 查询数据
// */
// public function getUserAgent($field,$params)
// {
// $params["a.is_del"] = 0;
// $result = $this->db_
// ->field($field)
// ->alias('a')
// ->join('u_users b', 'a.user_id = b.id', 'left')
// ->join('a_agents c', 'a.agent_id = c.id', 'left')
// ->where($params)
// ->find();
// //echo $this->getLastSql();
// return $result;
// }
//
// public function selectUserAgent($field,$params)
// {
// $params["a.is_del"] = 0;
// $result = $this->db_
// ->field($field)
// ->alias('a')
// ->join('u_users b', 'a.user_id = b.id', 'left')
// ->join('a_agents c', 'a.agent_id = c.id', 'left')
// ->join('a_site d', 'a.site_id = d.id', 'left')
// ->where($params)
// ->select();
// //echo $this->getLastSql();
// return $result;
// }
// /**
// * 更新数据
// */
// public function updateUserAgent($where,$params)
// {
// $result = $this->db_ ->where($where)->update($params);
// //dump($this->getLastSql());
// return $result;
//
// }
//
// /**
// * @param $field
// * @param $params
// * @return array
// */
// public function getUserAgentColumn($field, $params) {
// $params['is_del'] = 0;
// return $this->db_->where($params)
// ->column($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 getAddUserNumGroupTimeNew($params)
// {
// $field = "count(1) as num";
// $where_['is_del'] = 0;
// if (isset($params["agent_id"])) {
// $where_["agent_id"] = $params["agent_id"];
// }
// if (isset($params["create_time"])) {
// $where_["create_time"] = $params["create_time"];
// }
// return $this->db_
// ->field($field)
// ->where($where_)
// ->select();
// }
//
// public function moveHouseInsertAll($data)
// {
// $result = Db::table($this->table)
// ->insertAll($data);
// return $result;
// }
//
// /**
// * @param $field
// * @param $where
// * @return false|\PDOStatement|string|\think\Collection
// */
// public function getAllData($field, $where)
// {
// $where['is_del'] = 0;
// return $this->db_->field($field)
// ->where($where)
// ->select();
// }
}
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