招标
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.
 
 
 
 
 

72 lines
2.5 KiB

<?php
namespace app\api\model;
use app\common\model\Collect;
use app\common\model\Notice;
use app\common\model\Tender;
class Member extends \app\common\model\Member
{
/**
* @param $member_id
* @return mixed
* @author Deng
* @date 2020-12-22 18:28
* 获取会员信息
*/
public static function getMember(){
$member_id = request()->middleware('token.member_id');
return self::where(['id'=>$member_id,'delete_time'=>0])->hidden(['password','update_time','create_time','delete_time'])->findOrEmpty()->toArray();
}
/**
* @param $page
* @param $limit
* @param $member_id
* @param int $type
* @return mixed
* @author Deng
* @date 2020-12-23 9:45\
* 我的项目
*/
public function getMyCollectList($page,$limit,$member_id,$type=1){
if ($type == 1) {
$data = Collect::alias('c')->leftJoin('bidding d','d.id=c.bidding_id')
->where(['c.delete_time'=>0,'c.member_id'=>$member_id])
->field('d.id,d.title,d.desc,d.contract_title,d.contractNo,d.project_title,d.projectNo,d.create_time,d.tag_ids')
->paginate($limit??5)->toArray();
}else{
$data = Tender::alias('t')->leftJoin('bidding d','d.id=t.bidding_id')
->where(['t.delete_time'=>0,'t.member_id'=>$member_id])
->field('d.id,d.title,d.contract_title,d.contractNo,d.project_title,d.projectNo,d.create_time,d.tag_ids')
->order('d.create_time desc')
->group('d.id')->paginate($limit??5)->toArray();
}
//处理分类
$tagList = \app\common\model\Tag::where('delete_time',0)->column('title','id');
if($data['data']){
foreach ($data['data'] as $key=>$value){
if($value['tag_ids']){
$tagTitle = [];
foreach (explode(',',$value['tag_ids']) as $v){
if(isset($tagList[$v]) && !empty($tagList[$v])){
$tagTitle[$v] = $tagList[$v];
}
}
$data['data'][$key]['tagTitle'] = implode(',',$tagTitle);
}else{
$data['data'][$key]['tagTitle'] = '';
}
}
}
return $data;
}
public function getMyNotice($page,$limit,$member_id){
return Notice::where(['member_id'=>$member_id,'delete_time'=>0])->paginate($limit??5)->toArray();
}
}