0) $model= $model->where("uid",$where['uid']); if(isset($where['source_uid']) &&$where['source_uid']>0) $model= $model->where("source_uid",$where['source_uid']); if(isset($where['status']) &&$where['status']>-1) $model= $model->where("status",$where['status']); $count = $model->value('count(id)')?:0; $list = $model->page($where['page'],$where['limit'])->select(); if($list) $list = $list->toarray(); return compact('count','list'); } public static function card_give($id,$uid,$touid) { if(!self::be(['id'=>$id,'uid'=>$uid])) return self::setErrorInfo("参数错误"); if($uid==$touid)return self::setErrorInfo("自己不能送自己"); $to_user = User::find($touid); if(!$to_user) return self::setErrorInfo("接收用户不存在"); $info = self::find($id); if($info['source_uid']!=0) return self::setErrorInfo("卡券已转赠过一次,不能反复转"); $data['source_uid'] = $uid; $data['send_time'] = time(); $data['collection_time'] = time(); $data['uid'] = $touid; $data['is_receive'] = 1; self::edit($data,$id); return true; } }