Esempio n. 1
0
 public static function ad_refresh(\ApiParam $params)
 {
     $user = User::user_show($params);
     $ad = self::loadAndCheck($params->adId, $user, false, $params->udid);
     if ($user->id != $ad->userId) {
         return array('msg' => '您没有权限进行此操作');
     }
     //免费刷新
     if (\Business::ableToFreeRefresh($ad)) {
         \Ad::refresh($ad->id);
         return array('msg' => '免费刷新成功');
     }
     if (\Business::maintainingMessage() && \Business::stopWrite()) {
         throw new \Exception(\Business::maintainingMessage());
     }
     //余额刷新
     if ($user->money() >= f2y(\Business::refreshPrice($ad->cityEnglishName(), $ad->categoryEnglishName, $ad->userId))) {
         $oid = \Business::createOrder($ad->id, \Order::TYPE_REFRESH);
         \Business::pay($oid);
         return array('msg' => '余额刷新成功');
     }
     return array('msg' => '刷新失败', 'x' => "{$ad->posterType()}", 'time' => "{$ad->createdTime}");
 }
Esempio n. 2
0
    echo "oops! \"" . $str1 . "\" does not contain \"" . $str2 . "\". Why ?";
}
//error
echo "<br/>";
$str1 = "baixinginterns";
$str2 = "baxxing";
if (strpos($str1, $str2) >= 0) {
    echo "\"" . $str1 . "\" contains \"" . $str2 . "\"";
} else {
    echo "oops! \"" . $str1 . "\" does not contain \"" . $str2 . "\". Why ?";
}
echo "<br/>";
$money = -1.0E+46;
y2f($money);
echo "<br/>";
f2y($money);
function f2y($amount)
{
    if (is_numeric($amount)) {
        if ($amount < 0) {
            echo "输入不能为负数";
            return;
        }
        echo $amount . "分 == " . $amount / 100 . '元';
    } else {
        echo $amount . '不是可转换的数字';
    }
}
function y2f($amount)
{
    if (is_numeric($amount)) {