You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
2.0 KiB
64 lines
2.0 KiB
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: Administrator
|
|
* Date: 2018/3/26
|
|
* Time: 11:29
|
|
*/
|
|
|
|
namespace app\tuoguan\model;
|
|
|
|
use think\Model;
|
|
use think\Db;
|
|
|
|
class TApply extends Model
|
|
{
|
|
/**
|
|
* 申请列表
|
|
* @param array
|
|
* @param int $status 后台查询的操作用户状态
|
|
* @param int $admin_id 后台查询的操作用户ID
|
|
* @param string $order 结果排序
|
|
* @return mixed
|
|
*/
|
|
public static function getList($search_name=-1,$status=-1,$admin_id,$order='tg_id',$allstatus)
|
|
{
|
|
$where=array();
|
|
//根据状态值取出对应状态的数据
|
|
if($allstatus == -1){
|
|
$where['a.tg_status'] = array('eq',$status);
|
|
}
|
|
if($search_name != -1){
|
|
$where['m.member_list_username'] = array('like','%'.$search_name.'%');
|
|
}
|
|
//取得apply_admin_id为0或者当前用户的数据
|
|
$where['a.apply_admin_id']=array(array('eq',0),array('eq',$admin_id),'or');
|
|
return Db::name('trusteeship_apply')->alias("a")->join(config('database.prefix').'member_list m','a.tg_uid =m.member_list_id')
|
|
->join(config('database.prefix').'trusteeship_status c','a.tg_status =c.status')->where($where)->order($order)->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
|
|
}
|
|
|
|
/**
|
|
* 申请受理
|
|
* @param int $apply_id 申请id
|
|
* @param int $apply_admin_id 受理用户id
|
|
* @return int 影响行数0或1
|
|
*/
|
|
public static function applyed($apply_id,$apply_admin_id,$status)
|
|
{
|
|
$sldata=array(
|
|
'apply_admin_id'=>$apply_admin_id,
|
|
'update_time'=>time(),
|
|
'update_user_id'=>$apply_admin_id,
|
|
'update_user_type'=>1,
|
|
);
|
|
$where=array(
|
|
'tg_id'=>$apply_id,
|
|
'tg_status'=>$status,
|
|
'apply_admin_id'=>array('EQ', 0),
|
|
);
|
|
|
|
$apply=Db::name('trusteeship_apply')->where($where)->update($sldata);
|
|
|
|
return $apply;
|
|
}
|
|
}
|