yii2 Expression解决查询或者条件有mysql函数时

public function actionRechargeList(){
        //用户id
        $userid = self::$userid;
        $query = BtmCpsRechargeGameCoin::find()
            ->select(new Expression('if(success_time=0,create_time,success_time) as success_time,money,game_coin'))
            ->where(['uid'=>$userid,'status'=>1]);
        $data = BtmCpsUser::Pagination($query,['success_time']);
        $this->successResponse($data);
    }

 

你可能感兴趣的:(yii2)