本文整理汇总了PHP中CRUD::findUnique方法的典型用法代码示例。如果您正苦于以下问题:PHP CRUD::findUnique方法的具体用法?PHP CRUD::findUnique怎么用?PHP CRUD::findUnique使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRUD
的用法示例。
在下文中一共展示了CRUD::findUnique方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAccessToken
/**
* author: codeMonkey QQ:631872807
* 全局access_token获取
* @return
*/
public function getAccessToken()
{
global $_W;
$tokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $this->appid . "&secret=" . $this->secret;
$accessToken = CRUD::findUnique(CRUD::$table_sin_token, array(":weid" => $_W['weid']));
load()->func('communication');
if (!empty($accessToken)) {
$expires_in = $accessToken['expires_in'];
if (TIMESTAMP - $accessToken['createtime'] >= $expires_in - 200) {
// 过期
$content = ihttp_get($tokenUrl);
$token = @json_decode($content['content'], true);
$data = array('weid' => $_W['weid'], 'access_token' => $token['access_token'], 'expires_in' => $token['expires_in'], 'createtime' => TIMESTAMP);
CRUD::updateById(CRUD::$table_sin_token, $data, $accessToken['id']);
return $token['access_token'];
} else {
return $accessToken['access_token'];
}
} else {
$content = ihttp_get($tokenUrl);
$token = @json_decode($content['content'], true);
$data = array('weid' => $_W['weid'], 'access_token' => $token['access_token'], 'expires_in' => $token['expires_in'], 'createtime' => TIMESTAMP);
CRUD::create(CRUD::$table_sin_token, $data);
return $token['access_token'];
}
}
示例2: ruleDeleted
public function ruleDeleted($rid)
{
$sin = CRUD::findUnique(CRUD::$table_sign, array(":rid" => $rid));
pdo_delete(CRUD::$table_sign_award, array("sid" => $sin['id']));
pdo_delete(CRUD::$table_sign_user, array("sid" => $sin['id']));
pdo_delete(CRUD::$table_sign_serial, array("sid" => $sin['id']));
pdo_delete(CRUD::$table_sign_record, array("sid" => $sin['id']));
pdo_delete(CRUD::$table_sign, array('rid' => $rid));
}
示例3: findSignUser
/**
*
* @param $openid
* @param $sid
* @return bool|mixed
*/
public function findSignUser($openid, $sid)
{
return CRUD::findUnique(CRUD::$table_sign_user, array(":openid" => $openid, ":sid" => $sid));
}
示例4: ruleDeleted
public function ruleDeleted($rid)
{
$sin = CRUD::findUnique(CRUD::$table_fool, array(":rid" => $rid));
}