1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- /**
- * Created by PhpStorm.
- * User: sicilon_IT
- * Date: 2021/4/30
- * Time: 10:55
- */
- namespace app\index\model;
- use think\Model;
- class userlocationmodel extends Model{
- protected $table='t_userlocation';
- public function selinfobyopenid($openid){
- $where_arr['openid']=$openid;
- $uloction=$this->where($where_arr)->find();
- return $uloction;
- }
- /*
- * 20210424
- *
- */
- public function insinfo($arr){
- $this->setAttr('id',null)->isUpdate(false)->allowField(true)->save($arr);
- return $this->id;
- }
- /*
- * 20210502
- * 获取所有数据
- */
- public function sellist(){
- $list=$this->all();
- $list=collection($list)->toArray();
- return $list;
- }
- /*
- * 20210510
- */
- public function updinfobyid($id,$updarr){
- $where_arr['id']=$id;
- $rec=$upd_arr=$this->where($where_arr)->update($updarr);
- return $rec;
- }
- /*
- * 20210511
- * 获取用户的按省级的统计数据
- */
- public function selgroupby_p(){
- $strsql="select province,count(*) as workcount from t_userlocation group by province";
- $rlist=$this->query($strsql);
- $rlist=collection($rlist)->toArray();
- return $rlist;
- }
- /*
- * 20210511
- * 获取用户的按市级的统计数据
- */
- public function selgroupby_c(){
- $strsql="select city,count(*) as workcount from t_userlocation group by city";
- $rlist=$this->query($strsql);
- $rlist=collection($rlist)->toArray();
- return $rlist;
- }
- /*
- * 20210515
- * 按项目统计用户数据
- */
- public function selgroupbyprj(){
- $strsql="select prjid,count(*) as workcount from t_userlocation group by prjid";
- $rlist=$this->query($strsql);
- $rlist=collection($rlist)->toArray();
- return $rlist;
- }
- }
|