...
|
...
|
@@ -974,14 +974,22 @@ class UserController extends CommonController |
|
|
}
|
|
|
$where_need['id'] = $data['need_id'];
|
|
|
$where_need['user_id'] = $member['id'];
|
|
|
$where_need['status'] = 5;
|
|
|
$userNeed = Db::name('UserNeed')->where($where_need)->field("id as need_id,city,quarters,room,pay_money,create_time,choose_time,status")->find();
|
|
|
$where_need['status'] = array('in','5,7');
|
|
|
$userNeed = Db::name('UserNeed')->where($where_need)->field("id as need_id,city,quarters,room,pay_money,pay_time,choose_time,status")->find();
|
|
|
$final['need'] = $userNeed;
|
|
|
$final['user'] = $member;
|
|
|
if($userNeed){
|
|
|
// 已选择中介
|
|
|
if($userNeed['status'] == 7){
|
|
|
$where_agency['a.need_id'] = $data['need_id'];
|
|
|
$where_agency['a.status'] = 5;
|
|
|
}else{
|
|
|
// 待选择中介
|
|
|
$where_agency['a.need_id'] = $data['need_id'];
|
|
|
$where_agency['a.status'] = 4;
|
|
|
}
|
|
|
// 查询报价
|
|
|
$where_agency['a.need_id'] = $data['need_id'];
|
|
|
$where_agency['a.status'] = 4;
|
|
|
|
|
|
$agency = Db::name('Agency')->alias('a')
|
|
|
->where($where_agency)
|
|
|
->join("hp_Member m", 'm.id = a.agency_id')
|
...
|
...
|
@@ -989,6 +997,15 @@ class UserController extends CommonController |
|
|
m.id as user_id,m.name,m.company,m.store,m.tel,m.reputation,m.start')
|
|
|
->select()->toArray();
|
|
|
if($agency){
|
|
|
foreach ($agency as $agek=>$agev){
|
|
|
$agency[$agek]['service_charge'] = $this->getStr($agev['service_charge']);
|
|
|
$agency[$agek]['assessment_tax'] = $this->getStr($agev['assessment_tax']);
|
|
|
$agency[$agek]['security_tax'] = $this->getStr($agev['security_tax']);
|
|
|
$agency[$agek]['value_added_tax'] = $this->getStr($agev['value_added_tax']);
|
|
|
$agency[$agek]['deed_tax'] = $this->getStr($agev['deed_tax']);
|
|
|
$agency[$agek]['personal_income_tax'] = $this->getStr($agev['personal_income_tax']);
|
|
|
$agency[$agek]['else_tax'] = $this->getStr($agev['else_tax']);
|
|
|
}
|
|
|
$final['agency'] = $agency;
|
|
|
$this->apiResponse('1','成功',$final);
|
|
|
}else{
|
...
|
...
|
@@ -1043,13 +1060,25 @@ class UserController extends CommonController |
|
|
* @param name:token type:int require:1 default: other: desc:token
|
|
|
* @param name:need_id type:int require:1 default: other: desc:需求id
|
|
|
* @param name:intermediary_id type:int require:1 default: other: desc:中介报价id
|
|
|
* @return data:''@
|
|
|
* @return data:''
|
|
|
*/
|
|
|
public function sureAgency(Request $request){
|
|
|
$data = $request->param();
|
|
|
if(!$data['need_id'] || !$data['intermediary_id'] ){
|
|
|
$this->apiResponse('0','参数错误');
|
|
|
}
|
|
|
$where_need['id'] = $data['need_id'];
|
|
|
$where_need['status'] = 5;
|
|
|
$user_need = Db::name('UserNeed')->where($where_need)->find();
|
|
|
if(!$user_need){
|
|
|
$this->apiResponse('0','状态错误');
|
|
|
}
|
|
|
$need_update['status'] = 7;
|
|
|
$need_update['choose_time'] = time();
|
|
|
$need_res = Db::name('UserNeed')->where($where_need)->update($need_update);
|
|
|
if(!$need_res){
|
|
|
$this->apiResponse('0','成交失败');
|
|
|
}
|
|
|
$where_bid['need_id'] = $data['need_id'];
|
|
|
$where_bid['id'] = $data['intermediary_id'];
|
|
|
$where_bid['status'] = 4;
|
...
|
...
|
@@ -1146,7 +1175,7 @@ class UserController extends CommonController |
|
|
$change_status['status'] = 11;
|
|
|
$change_com = Db::name('UserNeed')->where($where_need)->update($change_status);
|
|
|
if($change_com){
|
|
|
$this->apiResponse('1','评价成功');
|
|
|
$this->apiResponse('1','评价成功',$add_result);
|
|
|
}else{
|
|
|
$this->apiResponse('0','评价失败');
|
|
|
}
|
...
|
...
|
@@ -1168,75 +1197,40 @@ class UserController extends CommonController |
|
|
* @url /api/portal/User/changeUserComment
|
|
|
* @method POST
|
|
|
* @param name:token type:int require:1 default: other: desc:token
|
|
|
* @param name:comment_id type:int require:1 default: other: desc:评论id
|
|
|
* @param name:need_id type:int require:1 default: other: desc:需求id
|
|
|
* @param name:content type:int require:1 default: other: desc:评论内容
|
|
|
*/
|
|
|
public function changeUserComment(Request $request){
|
|
|
$data = $request->param();
|
|
|
if(empty($data['comment_id'])){
|
|
|
$this->apiResponse('0','评论id不能为空');
|
|
|
if(empty($data['need_id'])){
|
|
|
$this->apiResponse('0','需求id不能为空');
|
|
|
}
|
|
|
$where_member['token'] = $data['token'];
|
|
|
$member_id = Db::name('Member')->where($where_member)->field('id')->find();
|
|
|
if(empty($data['content'])){
|
|
|
$where_change['id'] = $data['comment_id'];
|
|
|
$where_change['need_id'] = $data['need_id'];
|
|
|
$where_change['user_id'] = $member_id['id'];
|
|
|
$where_change['status'] = 1;
|
|
|
$where_change['is_comment'] = 0;
|
|
|
$find_comment = Db::name('Comment')->where($where_change)->find();
|
|
|
if($find_comment){
|
|
|
$this->apiResponse('1','成功',$find_comment);
|
|
|
$this->apiResponse('1','成功',$find_comment['id']);
|
|
|
}else{
|
|
|
$this->apiResponse('0','该评价不可修改');
|
|
|
}
|
|
|
}else{
|
|
|
$where_update['id'] = $data['comment_id'];
|
|
|
$where_update['need_id'] = $data['need_id'];
|
|
|
$where_update['user_id'] = $member_id['id'];
|
|
|
$where_update['is_comment'] = 0;
|
|
|
$where_update['status'] = 1;
|
|
|
$update['content'] = $data['content'];
|
|
|
$update['is_comment'] = 1;
|
|
|
$update_result = Db::name('Comment')->where($where_update)->update($update);
|
|
|
if($update_result){
|
|
|
$this->apiResponse('1','修改成功');
|
|
|
$this->apiResponse('1','修改成功',$data['need_id']);
|
|
|
}else{
|
|
|
$this->apiResponse('0','修改失败');
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if(empty($data['content'])){
|
|
|
$this->apiResponse('0','评论内容不能为空');
|
|
|
}
|
|
|
$where_need['status'] = 10;
|
|
|
$where_need['id'] = $data['need_id'];
|
|
|
$need = Db::name('UserNeed')->where($where_need)->find();
|
|
|
if($need){
|
|
|
$where_agency['status'] = 11;
|
|
|
$where_agency['need_id'] = $need['id'];
|
|
|
$agency = Db::name('Agency')->where($where_agency)->find();
|
|
|
if($agency){
|
|
|
$add['need_id'] = $need['id'];
|
|
|
$add['agency_id'] = $agency['id'];
|
|
|
$add['intermediary_id'] = $agency['agency_id'];
|
|
|
$add['user_id'] = $need['user_id'];
|
|
|
$add['content'] = $data['content'];
|
|
|
$add['create_time'] = time();
|
|
|
$add['update_time'] = time();
|
|
|
$add_result = Db::name('Comment')->insertGetId($add);
|
|
|
if($add_result){
|
|
|
$change_status['status'] = 11;
|
|
|
$change_com = Db::name('UserNeed')->where($where_need)->update($change_status);
|
|
|
if($change_com){
|
|
|
$this->apiResponse('1','评价成功');
|
|
|
}else{
|
|
|
$this->apiResponse('0','评价失败');
|
|
|
}
|
|
|
}else{
|
|
|
$this->apiResponse('0','评价失败');
|
|
|
}
|
|
|
}else{
|
|
|
$this->apiResponse('0','评价失败');
|
|
|
}
|
|
|
}else{
|
|
|
$this->apiResponse('0','评价失败');
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -1322,7 +1316,10 @@ class UserController extends CommonController |
|
|
Db::startTrans();
|
|
|
$data = $request->param();
|
|
|
$where_member['token'] = $data['token'];
|
|
|
$member = Db::name('Member')->where($where_member)->field('id,money')->find();
|
|
|
$member = Db::name('Member')->where($where_member)->field('id,money,type')->find();
|
|
|
if($member['money'] <= 0){
|
|
|
$this->apiResponse('0','用户余额不足');
|
|
|
}
|
|
|
if($member){
|
|
|
$final['user'] = $member;
|
|
|
}else{
|
...
|
...
|
@@ -1338,13 +1335,21 @@ class UserController extends CommonController |
|
|
$final['card'] = $card;
|
|
|
}
|
|
|
$where_umoney['user_id'] = $member['id'];
|
|
|
$where_umoney['card_id'] = $card['id'];
|
|
|
$where_umoney['title'] = '用户提现';
|
|
|
$where_umoney['user_type'] = $member['type'];
|
|
|
// if($member['type'] == 1){
|
|
|
// $where_umoney['title'] = '用户提现';
|
|
|
// }else{
|
|
|
// $where_umoney['title'] = '中介提现';
|
|
|
// }
|
|
|
$where_umoney['title'] = '余额提现';
|
|
|
$where_umoney['money'] = $member['money'];
|
|
|
$where_umoney['order_type'] = 6;
|
|
|
$where_umoney['type'] = 3;
|
|
|
$where_umoney['pay_type'] = 3;
|
|
|
$where_umoney['status'] = 5;
|
|
|
$where_umoney['create_time'] = time();
|
|
|
$where_umoney['update_time'] = time();
|
|
|
$add = Db::name('UmoenyDetail')->insertGetId($where_umoney);
|
|
|
$add = Db::name('MoneyDetail')->insertGetId($where_umoney);
|
|
|
if($add){
|
|
|
$del = Db::name('Member')->where($where_member)->setDec('money',$member['money']);
|
|
|
$inc = Db::name('Member')->where($where_member)->setInc('get_money',$member['money']);
|
...
|
...
|
@@ -1368,15 +1373,19 @@ class UserController extends CommonController |
|
|
* @url /api/portal/User/orderDetail
|
|
|
* @method POST
|
|
|
* @param name:token type:int require:1 default: other: desc:token
|
|
|
* @return data:'type.1增加,2减少,3提现'
|
|
|
*/
|
|
|
public function orderDetail(Request $request){
|
|
|
$data = $request->param();
|
|
|
$user = $this->myleft($data['token']);
|
|
|
$where_umoney['user_id'] = $user['id'];
|
|
|
$where_umoney['status'] = 1;
|
|
|
$order_list = Db::name('UmoenyDetail')->where($where_umoney)->select()->toArray();
|
|
|
$where_umoney['status'] = array('neq',9);
|
|
|
$order_list = Db::name('MoneyDetail')->where($where_umoney)->field('id,title,money,update_time,type')->select()->toArray();
|
|
|
$final['user'] = $user;
|
|
|
if($order_list){
|
|
|
foreach ($order_list as $ordk=>$ordv){
|
|
|
$order_list[$ordk]['update_time'] = date('Y-m-d H:i:s',$ordv['update_time']);
|
|
|
}
|
|
|
$final['detail'] = $order_list;
|
|
|
}else{
|
|
|
$final['detail'] = array();
|
...
|
...
|
|