|
|
|
@ -18,7 +18,6 @@ class User extends ApiController
|
|
|
|
|
|
|
|
|
|
|
|
public function add()
|
|
|
|
public function add()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// //參數檢查
|
|
|
|
// //參數檢查
|
|
|
|
// try {
|
|
|
|
// try {
|
|
|
|
// validate(UserValidate::class)->check(input());
|
|
|
|
// validate(UserValidate::class)->check(input());
|
|
|
|
@ -28,12 +27,17 @@ class User extends ApiController
|
|
|
|
// // dump($e->getError());
|
|
|
|
// // dump($e->getError());
|
|
|
|
// return $this->Error($e->getError(),501,'參數錯誤');
|
|
|
|
// return $this->Error($e->getError(),501,'參數錯誤');
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
$params = input();
|
|
|
|
$params = input();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(empty($params['user_id'])){
|
|
|
|
|
|
|
|
return $this->error('user_id參數錯誤!!!');
|
|
|
|
|
|
|
|
}
|
|
|
|
//檢查user_id是否存在
|
|
|
|
//檢查user_id是否存在
|
|
|
|
$user = Db::name('user')
|
|
|
|
$user = Db::name('user')
|
|
|
|
->where('user_id', $params['user_id'])
|
|
|
|
->where('user_id', $params['user_id'])
|
|
|
|
->find();
|
|
|
|
->find();
|
|
|
|
|
|
|
|
|
|
|
|
if (!$user) {
|
|
|
|
if (!$user) {
|
|
|
|
// 用戶不存在處理
|
|
|
|
// 用戶不存在處理
|
|
|
|
//使用user_id至sso server取得用戶資料
|
|
|
|
//使用user_id至sso server取得用戶資料
|
|
|
|
@ -136,7 +140,7 @@ class User extends ApiController
|
|
|
|
|
|
|
|
|
|
|
|
//判斷order_sn是否執行過,沒有的話就不處理
|
|
|
|
//判斷order_sn是否執行過,沒有的話就不處理
|
|
|
|
if (trim($user_info['note']) != trim(input('order_sn'))) {
|
|
|
|
if (trim($user_info['note']) != trim(input('order_sn'))) {
|
|
|
|
return $this->Error('未自動新增過', 501);
|
|
|
|
return $this->Success('未自動新增過', 201);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$overdue_time = intval($user_info['overdue_time']) - (365 * 24 * 60 * 60);
|
|
|
|
$overdue_time = intval($user_info['overdue_time']) - (365 * 24 * 60 * 60);
|
|
|
|
@ -159,11 +163,15 @@ class User extends ApiController
|
|
|
|
->where('user_id', $params['user_id'])
|
|
|
|
->where('user_id', $params['user_id'])
|
|
|
|
->update($update_data);
|
|
|
|
->update($update_data);
|
|
|
|
|
|
|
|
|
|
|
|
echo Db::getLastSql();
|
|
|
|
|
|
|
|
}catch(\Exception $e){
|
|
|
|
}catch(\Exception $e){
|
|
|
|
return $this->Error($e->getMessage(), 500, '新增失敗');
|
|
|
|
return $this->Error($e->getMessage(), 500, '新增失敗');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->Success('更新成功');
|
|
|
|
//取得到期時間
|
|
|
|
|
|
|
|
$overdue_time = Db::name('user')
|
|
|
|
|
|
|
|
->where('user_id', $params['user_id'])
|
|
|
|
|
|
|
|
->value('overdue_time');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $this->Success($overdue_time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|