1.首先头部引入
use yii\db\Expression;
2.使用函数new Expression()此示例中mysql处理时间戳函数from_unixtime
public static function getCashlog($data){
$log = MemberCashLog::find()->select(new Expression("from_unixtime(addtime,'%Y-%m-%d %H:%i') as add_time"))->where(['app_id'=>$data['app_id'],'memberid'=>$data['mid']])->asArray()->all();
return $log;
}