You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.7 KiB
PHP
59 lines
1.7 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class UserAuth_model extends CI_Model {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
$this->HT = $this->load->database('HT', TRUE);
|
|
}
|
|
|
|
/*!
|
|
* TPA_Direction
|
|
* 1 外部调用我社系统
|
|
* 2 我社调用外部系统
|
|
*
|
|
* TPA_AccountType
|
|
* - 1* 外部调用我社系统
|
|
* - 11 地接社
|
|
* - 2* 我社调用外部系统
|
|
* - 21 所属小组
|
|
*
|
|
*/
|
|
|
|
public function get_user_key($account_id, $account_type, $direction)
|
|
{
|
|
$sql = "SELECT *
|
|
FROM [Tourmanager].[dbo].[ThirdPartyAuth]
|
|
where TPA_Direction=?
|
|
and TPA_AccountType=?
|
|
and TPA_AccountID=?
|
|
order by TPA_ExpiredTime desc ";
|
|
return $this->HT->query($sql, array($direction, $account_type, $account_id))->row();
|
|
}
|
|
|
|
/*!
|
|
* 验证openID,openKey是否有效
|
|
* @date 2018-11-29
|
|
* @param int $open_id
|
|
* @param string $open_key
|
|
* @param integer $direction 默认是1-外部调用
|
|
* @return boolean
|
|
*/
|
|
public function if_user_key($open_id, $open_key, $account_type, $direction=1)
|
|
{
|
|
$sql = "SELECT tpa_sn
|
|
FROM [Tourmanager].[dbo].[ThirdPartyAuth]
|
|
where tpa_direction=?
|
|
and TPA_AccountType=?
|
|
and tpa_openid=?
|
|
and tpa_openkey=?
|
|
";
|
|
return ($this->HT->query($sql, array($direction, $account_type, $open_id, $open_key))->num_rows() > 0);
|
|
}
|
|
|
|
}
|
|
|
|
/* End of file UserAuth_model.php */
|
|
/* Location: ./third_party/vendorPlanSync/models/UserAuth_model.php */
|