本文整理汇总了PHP中freelancer::clearCacheFromProfIdNow方法的典型用法代码示例。如果您正苦于以下问题:PHP freelancer::clearCacheFromProfIdNow方法的具体用法?PHP freelancer::clearCacheFromProfIdNow怎么用?PHP freelancer::clearCacheFromProfIdNow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类freelancer
的用法示例。
在下文中一共展示了freelancer::clearCacheFromProfIdNow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DelByOpid
/** Удаление закрепления по id в account_operations
* @see account::DelByOpid()
*
* @param intr $uid uid пользователя
* @param int $opid id операции в биллинге
* @return int 0
*/
public function DelByOpid($uid, $opid)
{
//Получаем информацию об удаляемом платеже
$sql = "SELECT bq.id, bq.op_count, bq.src_id, ao.op_code\n FROM account_operations ao\n INNER JOIN bill_reserve br ON br.uid = ?i\n AND br.ammount = -(ao.ammount) \n AND br.complete_time::timestamp = ao.op_date::timestamp\n INNER JOIN bill_queue bq ON bq.reserve_id = br.id AND bq.op_code = ao.op_code\n WHERE ao.id = ?i\n AND ao.billing_id = (SELECT id FROM account WHERE uid = ?i);";
$operation = $this->db->row($sql, $uid, $opid, $uid);
if (!$operation) {
return 0;
}
$operation['op_code'] = billing::getOpCodeByDiscount($operation['op_code']);
$is_spec = false;
$ok = false;
switch ($operation['op_code']) {
case self::OP_CODE_PROF:
$is_spec = true;
case self::OP_CODE_CATALOG:
case self::OP_CODE_PROFGROUP:
//Убираем запись о закреплении из базы
$ok = $this->db->query("DELETE FROM {$this->TABLE} WHERE user_id = ?i AND prof_id = ?i AND is_spec = ?b", $uid, $operation['src_id'], $is_spec);
break;
case self::OP_CODE_PROLONG_PROF:
case self::OP_CODE_UP_PROF:
$is_spec = true;
case self::OP_CODE_PROLONG_CATALOG:
case self::OP_CODE_PROLONG_PROFGROUP:
case self::OP_CODE_UP_CATALOG:
case self::OP_CODE_UP_PROFGROUP:
//пересчитать сроки начала срока действия закрепления с учетом
//удаления покупки - чтобы закрепление вернулось
//на то место в каталоге, с которого был подъем
$bind_id = $this->isUserBinded($uid, $operation['src_id'], $is_spec);
if ($bind_id) {
$dates = $this->recalcBindDates($operation, $uid);
$this->db->update($this->TABLE, array('date_start' => $dates['start'], 'date_stop' => $dates['stop']), 'id = ?i', $bind_id);
}
break;
}
if ($ok) {
freelancer::clearCacheFromProfIdNow($operation['src_id'], $is_spec);
}
return 0;
}
示例2: UpdateProfsAddSpec
/**
* Обновление дополнительных специальностей фрилансера
*
* @param integer $user_id ИД Пользователя
* @param array $specs ИД Специализаций
* @return boolean
*/
function UpdateProfsAddSpec($user_id, $oldprof_id, $prof_id, $paid_id)
{
global $DB;
$nprof_id = 'NULL';
$prof_orig = 'NULL';
if ($prof_id) {
$nprof_id = self::GetProfessionOrigin($prof_id);
if ($nprof_id != $prof_id) {
$prof_orig = $prof_id;
}
}
if ($paid_id) {
$sql = "UPDATE spec_paid_choise SET prof_id = {$nprof_id}, prof_origin = {$prof_orig} WHERE user_id = {$user_id} AND id = {$paid_id}";
} else {
if ($oldprof_id) {
if (!$prof_id) {
freelancer::clearCacheFromProfIdNow($oldprof_id);
return !!$DB->query("DELETE FROM spec_add_choise WHERE user_id = ? AND prof_id = ?", $user_id, $oldprof_id);
}
$res = $DB->query("UPDATE spec_add_choise SET prof_id = ?, prof_origin = ? WHERE user_id = ? AND prof_id = ?", $nprof_id, $prof_orig == 'NULL' ? NULL : $prof_orig, $user_id, $oldprof_id);
freelancer::clearCacheFromProfIdNow($oldprof_id);
freelancer::clearCacheFromProfIdNow($prof_orig);
if (pg_affected_rows($res)) {
return true;
}
}
$sql = "\n INSERT INTO spec_add_choise (user_id, prof_id, prof_origin) \n SELECT {$user_id}, {$nprof_id}, {$prof_orig}\n WHERE (SELECT COUNT(1) FROM spec_add_choise WHERE user_id = {$user_id}) < " . PROF_SPEC_ADD . "\n ";
freelancer::clearCacheFromProfIdNow($prof_orig);
}
return $DB->query($sql);
}