Commit 7dca7a31 7dca7a317ecaa4397dd4fcb2634ea4faa14cc6c9 by lemon

*

1 parent 95a3bd49
...@@ -48,7 +48,7 @@ class AuthIdentifier ...@@ -48,7 +48,7 @@ class AuthIdentifier
48 if (empty($identifier)) return Response::error(ErrorCode::IDENTIFIER_FAIL); 48 if (empty($identifier)) return Response::error(ErrorCode::IDENTIFIER_FAIL);
49 49
50 $identifier = json_decode($identifier); 50 $identifier = json_decode($identifier);
51 51
52 //通过身份证查询id 52 //通过身份证查询id
53 $stakeholder_ids = Stakeholder::stakeholderIds($identifier); 53 $stakeholder_ids = Stakeholder::stakeholderIds($identifier);
54 if (empty($stakeholder_ids)) return Response::error(ErrorCode::MATCH_IDENTIFIER_FAIL); 54 if (empty($stakeholder_ids)) return Response::error(ErrorCode::MATCH_IDENTIFIER_FAIL);
......
...@@ -28,25 +28,28 @@ class Stakeholder extends BaseModel ...@@ -28,25 +28,28 @@ class Stakeholder extends BaseModel
28 */ 28 */
29 public static function stakeholderIds(object $identifier) 29 public static function stakeholderIds(object $identifier)
30 { 30 {
31 $stakeholders_model = Stakeholder::query();
32
33 switch (intval($identifier->type)) { 31 switch (intval($identifier->type)) {
34 case 1: 32 case 1:
35 //个人 33 //个人
36 $s_table = Stakeholder::table(); 34 $s_table = Stakeholder::table();
37 $sbd_table = StakeholderBankDetail::table(); 35 $sbd_table = StakeholderBankDetail::table();
38 $stakeholder = $stakeholders_model->where(['type' => 1, "{$sbd_table}.card_no"=>$identifier->identifier]) 36 $stakeholder = Stakeholder::query()->where(['type' => 1, "{$sbd_table}.card_no"=>$identifier->identifier])
39 ->join($sbd_table, "{$s_table}.id", '=', "{$sbd_table}.stakeholder_id") 37 ->join($sbd_table, "{$s_table}.id", '=', "{$sbd_table}.stakeholder_id")
40 ->pluck("{$s_table}.id"); 38 ->pluck("{$s_table}.id")->toArray();
39
40 $stakeholder_ids = Stakeholder::query()->where(['type'=>1 , 'card_no'=>$identifier->identifier])
41 ->pluck('id')->toArray();
42
43 $stakeholder = array_merge($stakeholder, $stakeholder_ids);
41 break; 44 break;
42 case 2: 45 case 2:
43 $stakeholder = $stakeholders_model->where(['type' => 2, 'company_no' => $identifier->identifier])->pluck('id'); 46 $stakeholder = Stakeholder::query()->where(['type' => 2, 'company_no' => $identifier->identifier])->pluck('id')->toArray();
44 break; 47 break;
45 default: 48 default:
46 return []; 49 return [];
47 break; 50 break;
48 } 51 }
49 52
50 return array_unique($stakeholder->toArray()); 53 return array_unique($stakeholder);
51 } 54 }
52 } 55 }
......