Commit b75885cd5df2cf601a3c2a24e2401209558d71c0

Authored by Deepseath
1 parent f3c6b1a8

完善

Showing 2 changed files with 30 additions and 13 deletions
src/Api/User.php
@@ -11,7 +11,7 @@ class User @@ -11,7 +11,7 @@ class User
11 { 11 {
12 /** 12 /**
13 * 基类服务对象 13 * 基类服务对象
14 - * @var Object 14 + * @var \deepseath\hris\Hris
15 */ 15 */
16 protected $service = null; 16 protected $service = null;
17 17
@@ -25,6 +25,15 @@ class User @@ -25,6 +25,15 @@ class User
25 * @desc 查询 HRIS 中的员工基础信息 25 * @desc 查询 HRIS 中的员工基础信息
26 * @param array $params 26 * @param array $params
27 * @return array 27 * @return array
  28 + * <pre>
  29 + * list
  30 + * employeeId
  31 + * nameZH
  32 + * nameEN
  33 + * email
  34 + * wxUserId
  35 + * positionId
  36 + * </pre>
28 */ 37 */
29 public function baseList(array $params) : array 38 public function baseList(array $params) : array
30 { 39 {
@@ -127,12 +136,20 @@ class User @@ -127,12 +136,20 @@ class User
127 } 136 }
128 137
129 /** 138 /**
  139 + * 在职状态:在职
  140 + */
  141 + const STATUS_ON = '1';
  142 + /**
  143 + * 在职状态:离职
  144 + */
  145 + const STATUS_OFFLINE = '3';
  146 + /**
130 * 在职状态描述映射关系 147 * 在职状态描述映射关系
131 * @var array 148 * @var array
132 */ 149 */
133 const MAP_STATUS = [ 150 const MAP_STATUS = [
134 - '1' => '在职',  
135 - '3' => '离职' 151 + self::STATUS_ON => '在职',
  152 + self::STATUS_OFFLINE => '离职'
136 ]; 153 ];
137 154
138 /** 155 /**
@@ -229,14 +246,14 @@ class User @@ -229,14 +246,14 @@ class User
229 '99' => ['Bachelor', '本科'], 246 '99' => ['Bachelor', '本科'],
230 '103' => ['Senior High', '高中'], 247 '103' => ['Senior High', '高中'],
231 '105' => ['Junior High', '初中'], 248 '105' => ['Junior High', '初中'],
232 - '107' => ['Diploma', '大学毕业'],  
233 - '109' => ['Associate Degree', ''],  
234 - '111' => ['Advanced Diploma', ''],  
235 - '113' => ['Higher Diploma', ''],  
236 - '115' => ['Juris Doctor', ''],  
237 - '117' => ['Certificate', ''],  
238 - '119' => ['Secondary ', ''],  
239 - '121' => ['F.5', ''], 249 + '107' => ['Diploma', '大专'],
  250 + '109' => ['Associate Degree', '大学肆业'],
  251 + '111' => ['Advanced Diploma', '高级文凭'],
  252 + '113' => ['Higher Diploma', '高级文凭'],
  253 + '115' => ['Juris Doctor', '法学博士'],
  254 + '117' => ['Certificate', '证书'],
  255 + '119' => ['Secondary ', '中专'],
  256 + '121' => ['F.5', 'F.5'],
240 ]; 257 ];
241 258
242 /** 259 /**
src/Hris.php
@@ -96,7 +96,7 @@ class Hris @@ -96,7 +96,7 @@ class Hris
96 $this->_debug = $options['debug']; 96 $this->_debug = $options['debug'];
97 } 97 }
98 98
99 - $this->_origin= $options['originToken']; 99 + $this->_originToken= $options['originToken'];
100 $this->_http = \Yurun\Util\HttpRequest::newSession(); 100 $this->_http = \Yurun\Util\HttpRequest::newSession();
101 } 101 }
102 102
@@ -134,7 +134,7 @@ class Hris @@ -134,7 +134,7 @@ class Hris
134 $newTokenInfo = $response->json(true); 134 $newTokenInfo = $response->json(true);
135 135
136 if (empty($newTokenInfo) || !isset($newTokenInfo['code'])) { 136 if (empty($newTokenInfo) || !isset($newTokenInfo['code'])) {
137 - throw new \Exception('request hris token error', 9001); 137 + throw new \Exception('request hris token error' . var_export($newTokenInfo, true) . '|' . $url . var_export($params, true), 9001);
138 } 138 }
139 if ($newTokenInfo['code'] != 200) { 139 if ($newTokenInfo['code'] != 200) {
140 throw new \Exception('HRIS TOKEN GET ERROR:' . $newTokenInfo['msg'] . ':' . $newTokenInfo['code']); 140 throw new \Exception('HRIS TOKEN GET ERROR:' . $newTokenInfo['msg'] . ':' . $newTokenInfo['code']);