...
|
...
|
@@ -179,8 +179,45 @@ class UserController extends RestBaseController |
|
|
if ($result === false) {
|
|
|
$this->error(['code'=>'40000','msg'=>'获取失败']);
|
|
|
}
|
|
|
//获取该业务员所有产品id
|
|
|
$ids = Db::name('product')
|
|
|
->alias('p')
|
|
|
->join('loans_apply l','p.id = l.product_id')
|
|
|
->where(['p.user_id' => $this->userId])
|
|
|
->column('l.id');
|
|
|
//将未读消息更新为已读
|
|
|
$condition['product_id'] = ['in',$ids];
|
|
|
$condition['is_read'] = ['=',0];
|
|
|
Db::name('loans_apply')->where($condition)->update(['is_read' => 1]);
|
|
|
$this->success('获取成功',$result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @title 产品申请列表(是否有红点)
|
|
|
* @description
|
|
|
* @url /wxapp/user/getUnread
|
|
|
* @method POST
|
|
|
*
|
|
|
* @header name:XX-Token type:string require:1 default:abc other: desc:登录标识
|
|
|
* @header name:XX-Device-Type type:string require:0 default:wxapp other: desc:设备类型
|
|
|
*
|
|
|
* @return is_unread:1未读 0已读
|
|
|
*/
|
|
|
public function getUnread() {
|
|
|
$result = Db::name('product')
|
|
|
->alias('p')
|
|
|
->join('loans_apply l','p.id = l.product_id')
|
|
|
->field('l.user_id,p.name,p.logo')
|
|
|
->where(['p.user_id' => $this->userId,'is_read' => 0])
|
|
|
->select();
|
|
|
if(count($result) > 0) {
|
|
|
$mark = 1;
|
|
|
} else {
|
|
|
$mark = 0;
|
|
|
}
|
|
|
$this->success('获取成功',$mark);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @url /wxapp/User/getWxData
|
|
|
* @method POST
|
...
|
...
|
|