2019-03-08 10:51:25 1976次浏览 2条回答 0 悬赏 10 金钱
public static function isVoteCompany($type)
{
    $return = 0;
    $userInfo = UserService::getInstance()->getUser();
    if ($userInfo) {
        $row = (new Query())->from('service_vote')
            ->where([
                'user_id' => $userInfo['user_id'],
                'type' => $type,
                'to_days(add_time)' => 'to_days(now())',
            ])
            ->one();
        if ($row) {
            $return = 1;
        }
    }
    return $return;
}

最佳答案

  • 阿江 发布于 2019-03-10 12:21 举报
    'to_days(add_time)' => 'to_days(now())'
    

    改成

    "to_days(add_time)" => "to_days(now())"
    

    你试试

  • 回答于 2019-03-08 11:19 举报

    报什么错?打印sql语句了吗?

    echo (new Query())->from('service_vote')
        ->where([
            'user_id' => $userInfo['user_id'],
            'type' => $type,
            'to_days(add_time)' => 'to_days(now())',
        ])->getRawSql(); die;
    

    看看具体报错

您需要登录后才可以回答。登录 | 立即注册
PHP学院的中学生
副总裁

PHP学院的中学生

注册时间:2018-10-23
最后登录:2024-04-07
在线时长:168小时1分
  • 粉丝29
  • 金钱4730
  • 威望30
  • 积分6710

热门问题